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.mjs CHANGED
@@ -288,6 +288,188 @@ var PreviewCheckboxGroup = ({
288
288
  ] });
289
289
  };
290
290
 
291
+ // src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
292
+ import { useEffect as useEffect8, useState as useState5 } from "react";
293
+
294
+ // src/hooks/useCookieConsent/useCookieConsent.ts
295
+ import { useCallback, useEffect as useEffect3, useMemo, useState as useState3 } from "react";
296
+
297
+ // src/helpers/cookieHandler/cookieHandler.ts
298
+ var getCookie = (name) => {
299
+ const match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)"));
300
+ return match ? match[2] : null;
301
+ };
302
+ var setCookie = (name, value, expirationDate) => {
303
+ let cookieString = `${name}=${value}; path=/; SameSite=Strict`;
304
+ if (expirationDate) {
305
+ cookieString += `; expires=${expirationDate.toUTCString()}`;
306
+ }
307
+ if (window.location.protocol === "https:") {
308
+ cookieString += "; Secure";
309
+ }
310
+ document.cookie = cookieString;
311
+ };
312
+ var removeCookie = (name) => {
313
+ const pastDate = /* @__PURE__ */ new Date(0);
314
+ setCookie(name, "", pastDate);
315
+ };
316
+ var createCookieConsent = (config) => {
317
+ const { cookieName, choiceKey, expiryYears = 1 } = config;
318
+ const acceptCookies = () => {
319
+ const expires = /* @__PURE__ */ new Date();
320
+ expires.setFullYear(expires.getFullYear() + expiryYears);
321
+ setCookie(cookieName, "true", expires);
322
+ localStorage.setItem(cookieName, "true");
323
+ };
324
+ const rejectCookies = () => {
325
+ removeCookie(cookieName);
326
+ localStorage.removeItem(cookieName);
327
+ sessionStorage.setItem(choiceKey, "true");
328
+ };
329
+ const areCookiesAccepted = () => getCookie(cookieName) === "true";
330
+ const hasChoiceBeenMade = () => sessionStorage.getItem(choiceKey) === "true";
331
+ const clearChoiceFromSession = () => sessionStorage.removeItem(choiceKey);
332
+ return {
333
+ acceptCookies,
334
+ rejectCookies,
335
+ areCookiesAccepted,
336
+ hasChoiceBeenMade,
337
+ clearChoiceFromSession
338
+ };
339
+ };
340
+
341
+ // src/hooks/useCookieConsent/useCookieConsent.ts
342
+ var useCookieConsent = ({
343
+ cookieName,
344
+ choiceKey,
345
+ expiryYears = 1,
346
+ onConsentChange
347
+ }) => {
348
+ const {
349
+ acceptCookies,
350
+ rejectCookies,
351
+ areCookiesAccepted,
352
+ hasChoiceBeenMade,
353
+ clearChoiceFromSession
354
+ } = useMemo(
355
+ () => createCookieConsent({
356
+ cookieName,
357
+ choiceKey,
358
+ expiryYears
359
+ }),
360
+ [cookieName, choiceKey, expiryYears]
361
+ );
362
+ const [showBanner, setShowBanner] = useState3(false);
363
+ const handleCookieStateChange = useCallback(() => {
364
+ const cookiesNowAccepted = areCookiesAccepted();
365
+ if (onConsentChange) {
366
+ onConsentChange(cookiesNowAccepted);
367
+ }
368
+ setShowBanner(false);
369
+ }, [areCookiesAccepted, onConsentChange]);
370
+ useEffect3(() => {
371
+ const cookiesAccepted = areCookiesAccepted();
372
+ const choiceMade = hasChoiceBeenMade();
373
+ setShowBanner(!cookiesAccepted && !choiceMade);
374
+ if (cookiesAccepted && onConsentChange) {
375
+ onConsentChange(true);
376
+ }
377
+ const handleShowBannerEvent = () => {
378
+ clearChoiceFromSession();
379
+ setShowBanner(true);
380
+ };
381
+ window.addEventListener("showCookieBanner", handleShowBannerEvent);
382
+ return () => {
383
+ window.removeEventListener("showCookieBanner", handleShowBannerEvent);
384
+ };
385
+ }, [areCookiesAccepted, hasChoiceBeenMade, clearChoiceFromSession, onConsentChange]);
386
+ return {
387
+ showBanner,
388
+ handleCookieStateChange,
389
+ acceptCookies,
390
+ rejectCookies
391
+ };
392
+ };
393
+
394
+ // src/hooks/useDebouncedValue/useDebouncedValue.ts
395
+ import { useEffect as useEffect4, useState as useState4 } from "react";
396
+ var useDebouncedValue = (value, delay) => {
397
+ const [debouncedValue, setDebouncedValue] = useState4(value);
398
+ useEffect4(() => {
399
+ const timeoutId = window.setTimeout(() => {
400
+ setDebouncedValue(value);
401
+ }, delay);
402
+ return () => window.clearTimeout(timeoutId);
403
+ }, [value, delay]);
404
+ return debouncedValue;
405
+ };
406
+
407
+ // src/hooks/useFormStatusModal/useFormStatusModal.ts
408
+ import * as React from "react";
409
+ var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
410
+ React.useEffect(() => {
411
+ if (formStatus === "loading") {
412
+ handleModalOpen();
413
+ }
414
+ if (formStatus === "success" || formStatus === "failed") {
415
+ setTimeout(() => {
416
+ handleModalClose();
417
+ }, 1050);
418
+ const main = document.querySelector(mainSelector);
419
+ if (main) main.focus();
420
+ }
421
+ }, [formStatus, handleModalOpen, handleModalClose, mainSelector]);
422
+ };
423
+
424
+ // src/hooks/useInputMethodDetection/useInputMethodDetection.ts
425
+ import { useEffect as useEffect6 } from "react";
426
+ var useInputMethodDetection = ({
427
+ mouseClassName = "using-mouse",
428
+ keyboardToggleKey = "Tab"
429
+ } = {}) => {
430
+ useEffect6(() => {
431
+ const handleMouseDown = () => {
432
+ document.body.classList.add(mouseClassName);
433
+ };
434
+ const handleKeyDown = (event) => {
435
+ if (event.key === keyboardToggleKey) {
436
+ document.body.classList.remove(mouseClassName);
437
+ }
438
+ };
439
+ document.addEventListener("mousedown", handleMouseDown);
440
+ document.addEventListener("keydown", handleKeyDown);
441
+ return () => {
442
+ document.removeEventListener("mousedown", handleMouseDown);
443
+ document.removeEventListener("keydown", handleKeyDown);
444
+ };
445
+ }, [mouseClassName, keyboardToggleKey]);
446
+ };
447
+
448
+ // src/hooks/usePTSPageTitle/usePTSPageTitle.ts
449
+ import { useMemo as useMemo2, useEffect as useEffect7 } from "react";
450
+ var usePTSPageTitle = ({
451
+ formStatus,
452
+ activeStep,
453
+ applicationContent,
454
+ thankYouBlock,
455
+ steps,
456
+ fallbackTitle = "PTS e-tj\xE4nst"
457
+ }) => {
458
+ const computedTitle = useMemo2(() => {
459
+ var _a, _b, _c, _d;
460
+ const baseTitle = (_a = applicationContent == null ? void 0 : applicationContent.pageTitle) != null ? _a : "";
461
+ const thankYouPageTitle = (_b = thankYouBlock == null ? void 0 : thankYouBlock.pageTitle) != null ? _b : "";
462
+ const stepTitle = (_d = (_c = steps == null ? void 0 : steps[Math.max(0, activeStep - 1)]) == null ? void 0 : _c.pageTitle) != null ? _d : "";
463
+ if (formStatus === "success" && thankYouPageTitle) return thankYouPageTitle;
464
+ if (activeStep === 0 && baseTitle) return baseTitle;
465
+ return stepTitle || baseTitle || fallbackTitle;
466
+ }, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
467
+ useEffect7(() => {
468
+ document.title = computedTitle;
469
+ }, [computedTitle]);
470
+ return computedTitle;
471
+ };
472
+
291
473
  // src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
292
474
  import DOMPurify from "dompurify";
293
475
  import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
@@ -297,16 +479,25 @@ var InputTextarea = ({
297
479
  showPreview = false,
298
480
  activatedLanguage
299
481
  }) => {
300
- var _a, _b, _c, _d, _e, _f;
482
+ var _a, _b, _c, _d, _e;
301
483
  const questionId = `question-${question.id}`;
302
484
  const inputId = `textarea-${question.id}`;
303
485
  const aboutId = `about-${question.id}`;
304
486
  const errorId = `error-${question.id}`;
487
+ const counterLiveRegionId = `counter-live-${question.id}`;
488
+ const [localAnswer, setLocalAnswer] = useState5((_a = question.answer) != null ? _a : "");
489
+ useEffect8(() => {
490
+ var _a2;
491
+ setLocalAnswer((_a2 = question.answer) != null ? _a2 : "");
492
+ }, [question.answer]);
493
+ const debouncedAnswer = useDebouncedValue(localAnswer, 1e3);
305
494
  const defaultMaxLength = 1e3;
306
- const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
307
- const maxLength = (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.answerMaxLength) != null ? _d : defaultMaxLength;
495
+ const answerLength = localAnswer.length;
496
+ const debouncedAnswerLength = debouncedAnswer.length;
497
+ const maxLength = (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.answerMaxLength) != null ? _c : defaultMaxLength;
308
498
  const isTooLong = answerLength > maxLength;
309
- const counterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
499
+ const visibleCounterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
500
+ const screenReaderCounterText = activatedLanguage === "en" ? `${debouncedAnswerLength} of ${maxLength} characters` : `${debouncedAnswerLength} av ${maxLength} tecken`;
310
501
  const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
311
502
  const onChange = (e) => {
312
503
  handleQuestionInputChange(e, question);
@@ -347,13 +538,16 @@ var InputTextarea = ({
347
538
  }
348
539
  ),
349
540
  /* @__PURE__ */ jsxs5("div", { className: "pts-textarea-counter-error-container", children: [
350
- !((_e = question.questionExtraAttribute) == null ? void 0 : _e.hideTextCounter) && /* @__PURE__ */ jsx5("div", { "aria-live": "polite", className: `pts-character-counter`, children: counterText }),
541
+ !((_d = question.questionExtraAttribute) == null ? void 0 : _d.hideTextCounter) && /* @__PURE__ */ jsxs5(Fragment4, { children: [
542
+ /* @__PURE__ */ jsx5("div", { "aria-hidden": "true", className: `pts-character-counter`, children: visibleCounterText }),
543
+ /* @__PURE__ */ jsx5("div", { id: counterLiveRegionId, "aria-live": "polite", className: "sr-only", children: screenReaderCounterText })
544
+ ] }),
351
545
  !isTooLong && question.hasValidationError && /* @__PURE__ */ jsx5(
352
546
  ValidationMessage_default,
353
547
  {
354
548
  showValidationMessage: true,
355
549
  validationId: errorId,
356
- validationMessesege: (_f = question.validationDefaultMessesege) != null ? _f : "",
550
+ validationMessesege: (_e = question.validationDefaultMessesege) != null ? _e : "",
357
551
  activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
358
552
  }
359
553
  ),
@@ -501,7 +695,7 @@ var PreviewTextField = ({
501
695
  };
502
696
 
503
697
  // src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
504
- import { useCallback, useEffect as useEffect5, useState as useState5 } from "react";
698
+ import { useCallback as useCallback2, useEffect as useEffect11, useState as useState8 } from "react";
505
699
  import clsx3 from "clsx";
506
700
 
507
701
  // src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
@@ -557,15 +751,15 @@ import { useRef } from "react";
557
751
  import clsx from "clsx";
558
752
 
559
753
  // src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
560
- import React from "react";
754
+ import React3 from "react";
561
755
  import { Fragment as Fragment7, jsx as jsx8 } from "react/jsx-runtime";
562
756
  var ScreenReaderErrors = ({
563
757
  errorMessageAddingFile,
564
758
  activatedLanguage
565
759
  }) => {
566
- const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = React.useState(false);
567
- const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = React.useState("");
568
- React.useEffect(() => {
760
+ const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = React3.useState(false);
761
+ const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = React3.useState("");
762
+ React3.useEffect(() => {
569
763
  if (errorMessageAddingFile.length > 0) {
570
764
  let errorMessages = "";
571
765
  errorMessages += errorMessageAddingFile.length;
@@ -665,16 +859,16 @@ var ExploreFiles = ({
665
859
  var ExploreFilesStandard_default = ExploreFiles;
666
860
 
667
861
  // src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
668
- import React4, { useEffect as useEffect4, useState as useState4, useRef as useRef2 } from "react";
862
+ import React6, { useEffect as useEffect10, useState as useState7, useRef as useRef2 } from "react";
669
863
  import { Col, Row } from "react-bootstrap";
670
864
 
671
865
  // src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
672
- import { useState as useState3 } from "react";
866
+ import { useState as useState6 } from "react";
673
867
  import clsx2 from "clsx";
674
868
  import { Fragment as Fragment9, jsx as jsx10 } from "react/jsx-runtime";
675
869
  var Indicator = (filename) => {
676
- const [uploadPercentage, setUploadPercentage] = useState3(0);
677
- const [uploadDone, setUploadDone] = useState3(false);
870
+ const [uploadPercentage, setUploadPercentage] = useState6(0);
871
+ const [uploadDone, setUploadDone] = useState6(false);
678
872
  return /* @__PURE__ */ jsx10(Fragment9, { children: /* @__PURE__ */ jsx10("div", { className: clsx2("uploadIndicator", "uploadDone") }) });
679
873
  };
680
874
  var IndicatorStandard_default = Indicator;
@@ -705,8 +899,8 @@ var SelectedFiles = ({
705
899
  removeFile(newCountOfFiles);
706
900
  };
707
901
  const useWindowWidth = () => {
708
- const [windowWidth2, setWindowWidth] = useState4(window.innerWidth);
709
- useEffect4(() => {
902
+ const [windowWidth2, setWindowWidth] = useState7(window.innerWidth);
903
+ useEffect10(() => {
710
904
  const handleResize = () => {
711
905
  setWindowWidth(window.innerWidth);
712
906
  };
@@ -729,7 +923,7 @@ var SelectedFiles = ({
729
923
  mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
730
924
  const fileType = errorObj.FileName.split(".").pop();
731
925
  mobileFirstFileName = mobileFirstFileName + "." + fileType;
732
- return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(React4.Fragment, { children: /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs9("div", { className: "fileInList", children: [
926
+ 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
927
  /* @__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
928
  /* @__PURE__ */ jsx11(Row, { children: /* @__PURE__ */ jsx11(
735
929
  Col,
@@ -782,7 +976,7 @@ var SelectedFiles = ({
782
976
  mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
783
977
  const fileType = file.FileName.split(".").pop();
784
978
  mobileFirstFileName = mobileFirstFileName + "." + fileType;
785
- return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(React4.Fragment, { children: /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs9("div", { className: "fileInList", children: [
979
+ 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
980
  /* @__PURE__ */ jsxs9("div", { className: "fileItem", children: [
787
981
  /* @__PURE__ */ jsx11(Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: "uploadedDot", children: /* @__PURE__ */ jsx11(
788
982
  "svg",
@@ -875,24 +1069,24 @@ var AddFiles = ({
875
1069
  const errorId = `error-${questionObject.id}`;
876
1070
  const labelId = `label-${questionObject.id}`;
877
1071
  const maxSizeMB = Math.round(allowedTotalFileSize / 1048576);
878
- const [numberOfFiles, setNumberOfFiles] = useState5(0);
879
- const [totalFileSize, setTotalFileSize] = useState5(0);
880
- const [errorMessageAddingFile, setErrorMessageAddingFile] = useState5([]);
881
- const [newFiles, setNewFiles] = useState5([]);
882
- const [dropFilesText, setDropFilesText] = useState5("Dra och sl\xE4pp dina filer h\xE4r");
883
- useEffect5(() => {
1072
+ const [numberOfFiles, setNumberOfFiles] = useState8(0);
1073
+ const [totalFileSize, setTotalFileSize] = useState8(0);
1074
+ const [errorMessageAddingFile, setErrorMessageAddingFile] = useState8([]);
1075
+ const [newFiles, setNewFiles] = useState8([]);
1076
+ const [dropFilesText, setDropFilesText] = useState8("Dra och sl\xE4pp dina filer h\xE4r");
1077
+ useEffect11(() => {
884
1078
  if (activatedLanguage === "sv") {
885
1079
  setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
886
1080
  } else {
887
1081
  setDropFilesText("Drag and drop your files here");
888
1082
  }
889
1083
  }, [activatedLanguage]);
890
- useEffect5(() => {
1084
+ useEffect11(() => {
891
1085
  if (questionObject.files && questionObject.files.length > 0) {
892
1086
  setNumberOfFiles(questionObject.files.length);
893
1087
  }
894
1088
  }, []);
895
- const onDrop = useCallback(
1089
+ const onDrop = useCallback2(
896
1090
  (acceptedFiles) => {
897
1091
  var _a2, _b2, _c;
898
1092
  const validationErrors = [];
@@ -982,7 +1176,7 @@ var AddFiles = ({
982
1176
  reader.readAsDataURL(file);
983
1177
  });
984
1178
  };
985
- useEffect5(() => {
1179
+ useEffect11(() => {
986
1180
  if (newFiles.length > 0) {
987
1181
  const currentFiles = questionObject.files ? questionObject.files : [];
988
1182
  const e = {
@@ -1102,7 +1296,7 @@ var PreviewAddFiles = ({
1102
1296
  };
1103
1297
 
1104
1298
  // src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
1105
- import { useEffect as useEffect6, useState as useState6 } from "react";
1299
+ import { useEffect as useEffect12, useState as useState9 } from "react";
1106
1300
  import DOMPurify3 from "dompurify";
1107
1301
  import { Fragment as Fragment12, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
1108
1302
  var SingleCheckbox = ({
@@ -1116,8 +1310,8 @@ var SingleCheckbox = ({
1116
1310
  const inputId = `checkbox-${question.id}`;
1117
1311
  const aboutId = `about-${question.id}`;
1118
1312
  const errorId = `error-${question.id}`;
1119
- const [checked, setChecked] = useState6(false);
1120
- useEffect6(() => {
1313
+ const [checked, setChecked] = useState9(false);
1314
+ useEffect12(() => {
1121
1315
  if (question.answer && question.answer === "true") {
1122
1316
  setChecked(true);
1123
1317
  } else {
@@ -2045,10 +2239,10 @@ var InputInfoOnly = ({
2045
2239
  var InfoOnlyStandard_default = InputInfoOnly;
2046
2240
 
2047
2241
  // src/components/input-components/RadioMultipleWithInfoStandard/RadioMultipleWithInfoStandard.tsx
2048
- import React7 from "react";
2242
+ import React9 from "react";
2049
2243
 
2050
2244
  // src/components/input-components/RadioMultipleWithInfoStandard/RadioCollapseItem.tsx
2051
- import { useEffect as useEffect7, useState as useState7 } from "react";
2245
+ import { useEffect as useEffect13, useState as useState10 } from "react";
2052
2246
  import DOMPurify7 from "dompurify";
2053
2247
  import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
2054
2248
  var RadioCollapseItem = ({
@@ -2064,13 +2258,13 @@ var RadioCollapseItem = ({
2064
2258
  activatedLanguage = "sv",
2065
2259
  initialOpen = false
2066
2260
  }) => {
2067
- const [isOpen, setIsOpen] = useState7(initialOpen);
2261
+ const [isOpen, setIsOpen] = useState10(initialOpen);
2068
2262
  const contentId = `${questionId}-content-${index}`;
2069
2263
  const buttonId = `${questionId}-button-${index}`;
2070
2264
  const openLabel = activatedLanguage === "sv" ? "Visa mer information om" : "Show more information about";
2071
2265
  const closeLabel = activatedLanguage === "sv" ? "D\xF6lj mer information om" : "Hide more information about";
2072
2266
  const buttonLabel = `${isOpen ? closeLabel : openLabel} "${label}"`;
2073
- useEffect7(() => {
2267
+ useEffect13(() => {
2074
2268
  if (questionAnswer === value) {
2075
2269
  setIsOpen(true);
2076
2270
  } else {
@@ -2180,7 +2374,7 @@ var RadioWithInfo = ({
2180
2374
  groupedOptionArray.map((group, g_index) => {
2181
2375
  var _a2;
2182
2376
  let subId = "subheading-" + g_index;
2183
- return /* @__PURE__ */ jsxs17(React7.Fragment, { children: [
2377
+ return /* @__PURE__ */ jsxs17(React9.Fragment, { children: [
2184
2378
  /* @__PURE__ */ jsx21("legend", { className: "pts-radioWithInfo-sub-headline", id: subId, children: group.category }),
2185
2379
  /* @__PURE__ */ jsx21("div", { role: "group", "aria-labelledby": subId, children: (_a2 = group.items) == null ? void 0 : _a2.map((option, o_index) => {
2186
2380
  var _a3, _b2, _c2, _d, _e;
@@ -2909,50 +3103,6 @@ var makeFormSelectors = (selectSlice) => {
2909
3103
  };
2910
3104
  };
2911
3105
 
2912
- // src/helpers/cookieHandler/cookieHandler.ts
2913
- var getCookie = (name) => {
2914
- const match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)"));
2915
- return match ? match[2] : null;
2916
- };
2917
- var setCookie = (name, value, expirationDate) => {
2918
- let cookieString = `${name}=${value}; path=/; SameSite=Strict`;
2919
- if (expirationDate) {
2920
- cookieString += `; expires=${expirationDate.toUTCString()}`;
2921
- }
2922
- if (window.location.protocol === "https:") {
2923
- cookieString += "; Secure";
2924
- }
2925
- document.cookie = cookieString;
2926
- };
2927
- var removeCookie = (name) => {
2928
- const pastDate = /* @__PURE__ */ new Date(0);
2929
- setCookie(name, "", pastDate);
2930
- };
2931
- var createCookieConsent = (config) => {
2932
- const { cookieName, choiceKey, expiryYears = 1 } = config;
2933
- const acceptCookies = () => {
2934
- const expires = /* @__PURE__ */ new Date();
2935
- expires.setFullYear(expires.getFullYear() + expiryYears);
2936
- setCookie(cookieName, "true", expires);
2937
- localStorage.setItem(cookieName, "true");
2938
- };
2939
- const rejectCookies = () => {
2940
- removeCookie(cookieName);
2941
- localStorage.removeItem(cookieName);
2942
- sessionStorage.setItem(choiceKey, "true");
2943
- };
2944
- const areCookiesAccepted = () => getCookie(cookieName) === "true";
2945
- const hasChoiceBeenMade = () => sessionStorage.getItem(choiceKey) === "true";
2946
- const clearChoiceFromSession = () => sessionStorage.removeItem(choiceKey);
2947
- return {
2948
- acceptCookies,
2949
- rejectCookies,
2950
- areCookiesAccepted,
2951
- hasChoiceBeenMade,
2952
- clearChoiceFromSession
2953
- };
2954
- };
2955
-
2956
3106
  // src/helpers/scriptHandler/scriptHandler.ts
2957
3107
  var toggleScriptByConsent = (consent, options) => {
2958
3108
  if (typeof document === "undefined") return;
@@ -3005,126 +3155,6 @@ var getGroupCheckIds = (validationType) => {
3005
3155
  };
3006
3156
  var getGroupCheckIds_default = getGroupCheckIds;
3007
3157
 
3008
- // src/hooks/useFormStatusModal/useFormStatusModal.ts
3009
- import * as React8 from "react";
3010
- var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
3011
- React8.useEffect(() => {
3012
- if (formStatus === "loading") {
3013
- handleModalOpen();
3014
- }
3015
- if (formStatus === "success" || formStatus === "failed") {
3016
- setTimeout(() => {
3017
- handleModalClose();
3018
- }, 1050);
3019
- const main = document.querySelector(mainSelector);
3020
- if (main) main.focus();
3021
- }
3022
- }, [formStatus, handleModalOpen, handleModalClose, mainSelector]);
3023
- };
3024
-
3025
- // src/hooks/usePTSPageTitle/usePTSPageTitle.ts
3026
- import { useMemo, useEffect as useEffect9 } from "react";
3027
- var usePTSPageTitle = ({
3028
- formStatus,
3029
- activeStep,
3030
- applicationContent,
3031
- thankYouBlock,
3032
- steps,
3033
- fallbackTitle = "PTS e-tj\xE4nst"
3034
- }) => {
3035
- const computedTitle = useMemo(() => {
3036
- var _a, _b, _c, _d;
3037
- const baseTitle = (_a = applicationContent == null ? void 0 : applicationContent.pageTitle) != null ? _a : "";
3038
- const thankYouPageTitle = (_b = thankYouBlock == null ? void 0 : thankYouBlock.pageTitle) != null ? _b : "";
3039
- const stepTitle = (_d = (_c = steps == null ? void 0 : steps[Math.max(0, activeStep - 1)]) == null ? void 0 : _c.pageTitle) != null ? _d : "";
3040
- if (formStatus === "success" && thankYouPageTitle) return thankYouPageTitle;
3041
- if (activeStep === 0 && baseTitle) return baseTitle;
3042
- return stepTitle || baseTitle || fallbackTitle;
3043
- }, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
3044
- useEffect9(() => {
3045
- document.title = computedTitle;
3046
- }, [computedTitle]);
3047
- return computedTitle;
3048
- };
3049
-
3050
- // src/hooks/useInputMethodDetection/useInputMethodDetection.ts
3051
- import { useEffect as useEffect10 } from "react";
3052
- var useInputMethodDetection = ({
3053
- mouseClassName = "using-mouse",
3054
- keyboardToggleKey = "Tab"
3055
- } = {}) => {
3056
- useEffect10(() => {
3057
- const handleMouseDown = () => {
3058
- document.body.classList.add(mouseClassName);
3059
- };
3060
- const handleKeyDown = (event) => {
3061
- if (event.key === keyboardToggleKey) {
3062
- document.body.classList.remove(mouseClassName);
3063
- }
3064
- };
3065
- document.addEventListener("mousedown", handleMouseDown);
3066
- document.addEventListener("keydown", handleKeyDown);
3067
- return () => {
3068
- document.removeEventListener("mousedown", handleMouseDown);
3069
- document.removeEventListener("keydown", handleKeyDown);
3070
- };
3071
- }, [mouseClassName, keyboardToggleKey]);
3072
- };
3073
-
3074
- // src/hooks/useCookieConsent/useCookieConsent.ts
3075
- import { useCallback as useCallback2, useEffect as useEffect11, useMemo as useMemo2, useState as useState8 } from "react";
3076
- var useCookieConsent = ({
3077
- cookieName,
3078
- choiceKey,
3079
- expiryYears = 1,
3080
- onConsentChange
3081
- }) => {
3082
- const {
3083
- acceptCookies,
3084
- rejectCookies,
3085
- areCookiesAccepted,
3086
- hasChoiceBeenMade,
3087
- clearChoiceFromSession
3088
- } = useMemo2(
3089
- () => createCookieConsent({
3090
- cookieName,
3091
- choiceKey,
3092
- expiryYears
3093
- }),
3094
- [cookieName, choiceKey, expiryYears]
3095
- );
3096
- const [showBanner, setShowBanner] = useState8(false);
3097
- const handleCookieStateChange = useCallback2(() => {
3098
- const cookiesNowAccepted = areCookiesAccepted();
3099
- if (onConsentChange) {
3100
- onConsentChange(cookiesNowAccepted);
3101
- }
3102
- setShowBanner(false);
3103
- }, [areCookiesAccepted, onConsentChange]);
3104
- useEffect11(() => {
3105
- const cookiesAccepted = areCookiesAccepted();
3106
- const choiceMade = hasChoiceBeenMade();
3107
- setShowBanner(!cookiesAccepted && !choiceMade);
3108
- if (cookiesAccepted && onConsentChange) {
3109
- onConsentChange(true);
3110
- }
3111
- const handleShowBannerEvent = () => {
3112
- clearChoiceFromSession();
3113
- setShowBanner(true);
3114
- };
3115
- window.addEventListener("showCookieBanner", handleShowBannerEvent);
3116
- return () => {
3117
- window.removeEventListener("showCookieBanner", handleShowBannerEvent);
3118
- };
3119
- }, [areCookiesAccepted, hasChoiceBeenMade, clearChoiceFromSession, onConsentChange]);
3120
- return {
3121
- showBanner,
3122
- handleCookieStateChange,
3123
- acceptCookies,
3124
- rejectCookies
3125
- };
3126
- };
3127
-
3128
3158
  // src/components/question-rendering/QuestionRenderer/QuestionRenderer.tsx
3129
3159
  import { Fragment as Fragment17, jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
3130
3160
  var QuestionRenderer = ({
@@ -3230,7 +3260,7 @@ var QuestionRenderer = ({
3230
3260
  var QuestionRenderer_default = QuestionRenderer;
3231
3261
 
3232
3262
  // src/components/question-rendering/QuestionGroup/QuestionGroup.tsx
3233
- import { useEffect as useEffect12, Fragment as Fragment18 } from "react";
3263
+ import { useEffect as useEffect14, Fragment as Fragment18 } from "react";
3234
3264
  import { Fragment as Fragment19, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
3235
3265
  var QuestionGroup = ({
3236
3266
  questions,
@@ -3250,7 +3280,7 @@ var QuestionGroup = ({
3250
3280
  const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
3251
3281
  (e) => e.startsWith("groupCheck-")
3252
3282
  );
3253
- useEffect12(() => {
3283
+ useEffect14(() => {
3254
3284
  questions.forEach((question) => {
3255
3285
  if (question.visible && !question.isDisplayed) {
3256
3286
  markQuestionAsDisplayed(question);
@@ -3930,10 +3960,10 @@ var Header = ({
3930
3960
  var HeaderStandard_default = Header;
3931
3961
 
3932
3962
  // src/components/layout/NavigationHeaderStandard/NavigationHeaderStandard.tsx
3933
- import { useRef as useRef4, useState as useState11 } from "react";
3963
+ import { useRef as useRef4, useState as useState13 } from "react";
3934
3964
 
3935
3965
  // src/components/layout/NavigationStandard/NavigationStandard.tsx
3936
- import { useEffect as useEffect13, useState as useState9, useRef as useRef3 } from "react";
3966
+ import { useEffect as useEffect15, useState as useState11, useRef as useRef3 } from "react";
3937
3967
  import { Fragment as Fragment20, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
3938
3968
  var Navigation = ({
3939
3969
  setIsMenyOpen,
@@ -3948,7 +3978,7 @@ var Navigation = ({
3948
3978
  const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
3949
3979
  const navRef = useRef3(null);
3950
3980
  const firstVisitRef = useRef3(true);
3951
- const [openSubMenu, setOpenSubMenu] = useState9(null);
3981
+ const [openSubMenu, setOpenSubMenu] = useState11(null);
3952
3982
  const handleSubMenu = (label) => {
3953
3983
  setOpenSubMenu(openSubMenu === label ? null : label);
3954
3984
  };
@@ -3957,7 +3987,7 @@ var Navigation = ({
3957
3987
  setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
3958
3988
  typeOfInteraction === "close" ? (_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus() : navigationCloseFocusId && ((_b = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _b.focus());
3959
3989
  };
3960
- useEffect13(() => {
3990
+ useEffect15(() => {
3961
3991
  var _a, _b;
3962
3992
  if (!isOpen) {
3963
3993
  setOpenSubMenu(null);
@@ -3969,7 +3999,7 @@ var Navigation = ({
3969
3999
  })) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
3970
4000
  setOpenSubMenu(defaultOpenSubMenu);
3971
4001
  }, [isOpen, activePath, menuLinks, activatedLanguage]);
3972
- useEffect13(() => {
4002
+ useEffect15(() => {
3973
4003
  if (!isOpen || !navRef.current) {
3974
4004
  return;
3975
4005
  }
@@ -4019,8 +4049,8 @@ var Navigation = ({
4019
4049
  }
4020
4050
  return "\xD6ppna undermeny f\xF6r " + label["sv"];
4021
4051
  };
4022
- const [instruction, setInstruction] = useState9("");
4023
- useEffect13(() => {
4052
+ const [instruction, setInstruction] = useState11("");
4053
+ useEffect15(() => {
4024
4054
  if (firstVisitRef.current) {
4025
4055
  firstVisitRef.current = false;
4026
4056
  return;
@@ -4109,7 +4139,7 @@ var Navigation = ({
4109
4139
  var NavigationStandard_default = Navigation;
4110
4140
 
4111
4141
  // src/components/layout/SearchBarStandard/SearchBarStandard.tsx
4112
- import { useState as useState10 } from "react";
4142
+ import { useState as useState12 } from "react";
4113
4143
 
4114
4144
  // src/components/layout/SearchBarStandard/Icons.tsx
4115
4145
  import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
@@ -4133,7 +4163,7 @@ var SearchIcon2 = ({ width = 15, height = 15, color = "#6E3282" }) => /* @__PURE
4133
4163
  // src/components/layout/SearchBarStandard/SearchBarStandard.tsx
4134
4164
  import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
4135
4165
  var SearchBar = ({ activatedLanguage = "sv" }) => {
4136
- const [searchTerm, setSearchTerm] = useState10("");
4166
+ const [searchTerm, setSearchTerm] = useState12("");
4137
4167
  const handleSearch = () => {
4138
4168
  console.log("S\xF6kt efter:", searchTerm);
4139
4169
  };
@@ -4187,7 +4217,7 @@ var NavigationHeader = ({
4187
4217
  if (activatedLanguage === "sv") return "English";
4188
4218
  else return "Svenska";
4189
4219
  };
4190
- const [isMenuOpen, setIsMenuOpen] = useState11(false);
4220
+ const [isMenuOpen, setIsMenuOpen] = useState13(false);
4191
4221
  const menuButtonFocusRef = useRef4(null);
4192
4222
  const handleMenuClick = () => {
4193
4223
  setIsMenuOpen((prev) => !prev);
@@ -4202,7 +4232,7 @@ var NavigationHeader = ({
4202
4232
  const getMenuIcon = () => {
4203
4233
  return isMenuOpen ? /* @__PURE__ */ jsx33(CloseIcon, {}) : /* @__PURE__ */ jsx33(MenuIcon, {});
4204
4234
  };
4205
- const [isSearchOpen, setIsSearchOpen] = useState11(false);
4235
+ const [isSearchOpen, setIsSearchOpen] = useState13(false);
4206
4236
  const handleSearchClick = () => {
4207
4237
  if (!isSearchOpen) {
4208
4238
  setIsSearchOpen(true);
@@ -4443,7 +4473,7 @@ var LinkList = ({
4443
4473
  var LinkListStandard_default = LinkList;
4444
4474
 
4445
4475
  // src/components/layout/CollapseStandard/CollapseStandard.tsx
4446
- import { useState as useState12, useId as useId2 } from "react";
4476
+ import { useState as useState14, useId as useId2 } from "react";
4447
4477
  import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
4448
4478
  var Collapse = ({
4449
4479
  title,
@@ -4453,7 +4483,7 @@ var Collapse = ({
4453
4483
  activatedLanguage = "sv",
4454
4484
  customClass = ""
4455
4485
  }) => {
4456
- const [isOpen, setIsOpen] = useState12(defaultOpen);
4486
+ const [isOpen, setIsOpen] = useState14(defaultOpen);
4457
4487
  const uniqueId = id != null ? id : useId2();
4458
4488
  const contentId = `${uniqueId}-content`;
4459
4489
  const openLabel = activatedLanguage === "sv" ? "Visa" : "Show";
@@ -4568,14 +4598,14 @@ var StepperButtons = ({
4568
4598
  var StepperButtonsStandard_default = StepperButtons;
4569
4599
 
4570
4600
  // src/components/stepper/StepperStandard/StepperStandard.tsx
4571
- import React11 from "react";
4601
+ import React12 from "react";
4572
4602
  import { jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
4573
4603
  var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
4574
4604
  return /* @__PURE__ */ jsx42("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
4575
4605
  const isActive = step.step === activeStep;
4576
4606
  const lastElement = arraySteps.length;
4577
4607
  const isDone = step.step < activeStep;
4578
- return /* @__PURE__ */ jsxs34(React11.Fragment, { children: [
4608
+ return /* @__PURE__ */ jsxs34(React12.Fragment, { children: [
4579
4609
  /* @__PURE__ */ jsxs34("div", { className: "pts-stepper-step", children: [
4580
4610
  /* @__PURE__ */ jsx42(
4581
4611
  "div",