optimized-react-component-library-xyz123 3.3.2 → 3.4.0
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 +92 -120
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -109
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -289,7 +289,6 @@ var PreviewCheckboxGroup = ({
|
|
|
289
289
|
};
|
|
290
290
|
|
|
291
291
|
// src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
|
|
292
|
-
import { useEffect as useEffect3, useRef, useState as useState3 } from "react";
|
|
293
292
|
import DOMPurify from "dompurify";
|
|
294
293
|
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
295
294
|
var InputTextarea = ({
|
|
@@ -298,31 +297,18 @@ var InputTextarea = ({
|
|
|
298
297
|
showPreview = false,
|
|
299
298
|
activatedLanguage
|
|
300
299
|
}) => {
|
|
301
|
-
var _a, _b, _c, _d, _e, _f
|
|
300
|
+
var _a, _b, _c, _d, _e, _f;
|
|
302
301
|
const questionId = `question-${question.id}`;
|
|
303
302
|
const inputId = `textarea-${question.id}`;
|
|
304
303
|
const aboutId = `about-${question.id}`;
|
|
305
304
|
const errorId = `error-${question.id}`;
|
|
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]);
|
|
316
305
|
const defaultMaxLength = 1e3;
|
|
317
|
-
const answerLength = (
|
|
318
|
-
const maxLength = (
|
|
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;
|
|
319
308
|
const isTooLong = answerLength > maxLength;
|
|
320
309
|
const counterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
|
|
321
310
|
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
|
|
322
|
-
const
|
|
323
|
-
const value = e.target.value;
|
|
324
|
-
setLocalAnswer(value);
|
|
325
|
-
lastSyncedAnswer.current = value;
|
|
311
|
+
const onChange = (e) => {
|
|
326
312
|
handleQuestionInputChange(e, question);
|
|
327
313
|
};
|
|
328
314
|
return /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
@@ -351,8 +337,8 @@ var InputTextarea = ({
|
|
|
351
337
|
"textarea",
|
|
352
338
|
{
|
|
353
339
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
354
|
-
onChange:
|
|
355
|
-
value:
|
|
340
|
+
onChange: (e) => onChange(e),
|
|
341
|
+
value: question.answer,
|
|
356
342
|
required: question.isQuestionMandatory,
|
|
357
343
|
"aria-required": question.isQuestionMandatory,
|
|
358
344
|
"aria-invalid": question.hasValidationError,
|
|
@@ -361,13 +347,13 @@ var InputTextarea = ({
|
|
|
361
347
|
}
|
|
362
348
|
),
|
|
363
349
|
/* @__PURE__ */ jsxs5("div", { className: "pts-textarea-counter-error-container", children: [
|
|
364
|
-
!((
|
|
350
|
+
!((_e = question.questionExtraAttribute) == null ? void 0 : _e.hideTextCounter) && /* @__PURE__ */ jsx5("div", { "aria-live": "polite", className: `pts-character-counter`, children: counterText }),
|
|
365
351
|
!isTooLong && question.hasValidationError && /* @__PURE__ */ jsx5(
|
|
366
352
|
ValidationMessage_default,
|
|
367
353
|
{
|
|
368
354
|
showValidationMessage: true,
|
|
369
355
|
validationId: errorId,
|
|
370
|
-
validationMessesege: (
|
|
356
|
+
validationMessesege: (_f = question.validationDefaultMessesege) != null ? _f : "",
|
|
371
357
|
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
372
358
|
}
|
|
373
359
|
),
|
|
@@ -408,7 +394,6 @@ var PreviewTextarea = ({
|
|
|
408
394
|
};
|
|
409
395
|
|
|
410
396
|
// src/components/input-components/TextFieldStandard/TextFieldStandard.tsx
|
|
411
|
-
import { useState as useState4, useRef as useRef2, useEffect as useEffect4 } from "react";
|
|
412
397
|
import DOMPurify2 from "dompurify";
|
|
413
398
|
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
414
399
|
var TextFieldStandard = ({
|
|
@@ -417,29 +402,16 @@ var TextFieldStandard = ({
|
|
|
417
402
|
showPreview = false,
|
|
418
403
|
activatedLanguage
|
|
419
404
|
}) => {
|
|
420
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o
|
|
405
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
421
406
|
const questionId = `question-${question.id}`;
|
|
422
407
|
const inputId = `textField-${question.id}`;
|
|
423
408
|
const aboutId = `about-${question.id}`;
|
|
424
409
|
const errorId = `error-${question.id}`;
|
|
425
|
-
const
|
|
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;
|
|
433
|
-
}
|
|
434
|
-
}, [question.answer]);
|
|
435
|
-
const answerLength = (_c = localAnswer == null ? void 0 : localAnswer.length) != null ? _c : 0;
|
|
410
|
+
const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
436
411
|
const maxLength = 100;
|
|
437
412
|
const isTooLong = answerLength > maxLength;
|
|
438
413
|
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r inte vara l\xE4ngre \xE4n ${maxLength} tecken`;
|
|
439
414
|
const handleOnChange = (e) => {
|
|
440
|
-
const value = e.target.value;
|
|
441
|
-
setLocalAnswer(value);
|
|
442
|
-
lastSyncedAnswer.current = value;
|
|
443
415
|
handleQuestionInputChange(e, question);
|
|
444
416
|
};
|
|
445
417
|
return /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
@@ -447,7 +419,7 @@ var TextFieldStandard = ({
|
|
|
447
419
|
"div",
|
|
448
420
|
{
|
|
449
421
|
id: questionId,
|
|
450
|
-
className: `pts-root-question pts-textField-container ${((
|
|
422
|
+
className: `pts-root-question pts-textField-container ${((_c = question.questionExtraAttribute) == null ? void 0 : _c.disabled) ? " pts-textField-disabled" : ""}${question.aboutText ? " pts-question-hasAbout" : ""}`.trim(),
|
|
451
423
|
children: [
|
|
452
424
|
/* @__PURE__ */ jsxs6("label", { htmlFor: inputId, children: [
|
|
453
425
|
question.questionLabel,
|
|
@@ -467,21 +439,21 @@ var TextFieldStandard = ({
|
|
|
467
439
|
/* @__PURE__ */ jsx6(
|
|
468
440
|
"input",
|
|
469
441
|
{
|
|
470
|
-
type: (
|
|
471
|
-
autoComplete: (
|
|
472
|
-
inputMode: (
|
|
442
|
+
type: (_e = (_d = question.questionExtraAttribute) == null ? void 0 : _d.inputType) != null ? _e : "text",
|
|
443
|
+
autoComplete: (_g = (_f = question.questionExtraAttribute) == null ? void 0 : _f.autoComplete) != null ? _g : void 0,
|
|
444
|
+
inputMode: (_i = (_h = question.questionExtraAttribute) == null ? void 0 : _h.inputMode) != null ? _i : void 0,
|
|
473
445
|
name: `question-name-${question.id}`,
|
|
474
446
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
475
447
|
onChange: handleOnChange,
|
|
476
|
-
value:
|
|
448
|
+
value: question.answer,
|
|
477
449
|
id: inputId,
|
|
478
|
-
disabled: (
|
|
450
|
+
disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
|
|
479
451
|
required: question.isQuestionMandatory,
|
|
480
452
|
"aria-required": question.isQuestionMandatory,
|
|
481
453
|
"aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
|
|
482
454
|
"aria-invalid": question.hasValidationError,
|
|
483
|
-
spellCheck: (
|
|
484
|
-
autoCapitalize: (
|
|
455
|
+
spellCheck: (_l = (_k = question.questionExtraAttribute) == null ? void 0 : _k.spellCheck) != null ? _l : void 0,
|
|
456
|
+
autoCapitalize: (_n = (_m = question.questionExtraAttribute) == null ? void 0 : _m.autoCapitalize) != null ? _n : void 0
|
|
485
457
|
}
|
|
486
458
|
),
|
|
487
459
|
!isTooLong && question.hasValidationError && /* @__PURE__ */ jsx6(
|
|
@@ -489,7 +461,7 @@ var TextFieldStandard = ({
|
|
|
489
461
|
{
|
|
490
462
|
showValidationMessage: true,
|
|
491
463
|
validationId: errorId,
|
|
492
|
-
validationMessesege: (
|
|
464
|
+
validationMessesege: (_o = question.validationDefaultMessesege) != null ? _o : "",
|
|
493
465
|
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
494
466
|
}
|
|
495
467
|
),
|
|
@@ -529,7 +501,7 @@ var PreviewTextField = ({
|
|
|
529
501
|
};
|
|
530
502
|
|
|
531
503
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
532
|
-
import { useCallback, useEffect as
|
|
504
|
+
import { useCallback, useEffect as useEffect5, useState as useState5 } from "react";
|
|
533
505
|
import clsx3 from "clsx";
|
|
534
506
|
|
|
535
507
|
// src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
|
|
@@ -581,19 +553,19 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
581
553
|
var DropFilesStandard_default = DropFiles;
|
|
582
554
|
|
|
583
555
|
// src/components/input-components/AddFilesStandard/ExploreFilesStandard.tsx
|
|
584
|
-
import { useRef
|
|
556
|
+
import { useRef } from "react";
|
|
585
557
|
import clsx from "clsx";
|
|
586
558
|
|
|
587
559
|
// src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
|
|
588
|
-
import
|
|
560
|
+
import React from "react";
|
|
589
561
|
import { Fragment as Fragment7, jsx as jsx8 } from "react/jsx-runtime";
|
|
590
562
|
var ScreenReaderErrors = ({
|
|
591
563
|
errorMessageAddingFile,
|
|
592
564
|
activatedLanguage
|
|
593
565
|
}) => {
|
|
594
|
-
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] =
|
|
595
|
-
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] =
|
|
596
|
-
|
|
566
|
+
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = React.useState(false);
|
|
567
|
+
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = React.useState("");
|
|
568
|
+
React.useEffect(() => {
|
|
597
569
|
if (errorMessageAddingFile.length > 0) {
|
|
598
570
|
let errorMessages = "";
|
|
599
571
|
errorMessages += errorMessageAddingFile.length;
|
|
@@ -624,8 +596,8 @@ var ExploreFiles = ({
|
|
|
624
596
|
showErrors,
|
|
625
597
|
errorMessageAddingFile
|
|
626
598
|
}) => {
|
|
627
|
-
const fileInputRef =
|
|
628
|
-
const buttonInputRef =
|
|
599
|
+
const fileInputRef = useRef(null);
|
|
600
|
+
const buttonInputRef = useRef(null);
|
|
629
601
|
const handleFiles = (event) => {
|
|
630
602
|
const files = Array.from(event.target.files || []);
|
|
631
603
|
FilesSelected(files);
|
|
@@ -693,16 +665,16 @@ var ExploreFiles = ({
|
|
|
693
665
|
var ExploreFilesStandard_default = ExploreFiles;
|
|
694
666
|
|
|
695
667
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
696
|
-
import
|
|
668
|
+
import React4, { useEffect as useEffect4, useState as useState4, useRef as useRef2 } from "react";
|
|
697
669
|
import { Col, Row } from "react-bootstrap";
|
|
698
670
|
|
|
699
671
|
// src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
|
|
700
|
-
import { useState as
|
|
672
|
+
import { useState as useState3 } from "react";
|
|
701
673
|
import clsx2 from "clsx";
|
|
702
674
|
import { Fragment as Fragment9, jsx as jsx10 } from "react/jsx-runtime";
|
|
703
675
|
var Indicator = (filename) => {
|
|
704
|
-
const [uploadPercentage, setUploadPercentage] =
|
|
705
|
-
const [uploadDone, setUploadDone] =
|
|
676
|
+
const [uploadPercentage, setUploadPercentage] = useState3(0);
|
|
677
|
+
const [uploadDone, setUploadDone] = useState3(false);
|
|
706
678
|
return /* @__PURE__ */ jsx10(Fragment9, { children: /* @__PURE__ */ jsx10("div", { className: clsx2("uploadIndicator", "uploadDone") }) });
|
|
707
679
|
};
|
|
708
680
|
var IndicatorStandard_default = Indicator;
|
|
@@ -721,7 +693,7 @@ var SelectedFiles = ({
|
|
|
721
693
|
setNumberOfFiles,
|
|
722
694
|
removeUploadErrors
|
|
723
695
|
}) => {
|
|
724
|
-
const theDiv =
|
|
696
|
+
const theDiv = useRef2(null);
|
|
725
697
|
const remove = (file) => {
|
|
726
698
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
727
699
|
const newCountOfFiles = newFiles.length;
|
|
@@ -733,8 +705,8 @@ var SelectedFiles = ({
|
|
|
733
705
|
removeFile(newCountOfFiles);
|
|
734
706
|
};
|
|
735
707
|
const useWindowWidth = () => {
|
|
736
|
-
const [windowWidth2, setWindowWidth] =
|
|
737
|
-
|
|
708
|
+
const [windowWidth2, setWindowWidth] = useState4(window.innerWidth);
|
|
709
|
+
useEffect4(() => {
|
|
738
710
|
const handleResize = () => {
|
|
739
711
|
setWindowWidth(window.innerWidth);
|
|
740
712
|
};
|
|
@@ -757,7 +729,7 @@ var SelectedFiles = ({
|
|
|
757
729
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
758
730
|
const fileType = errorObj.FileName.split(".").pop();
|
|
759
731
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
760
|
-
return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(
|
|
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: [
|
|
761
733
|
/* @__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 }) }) }),
|
|
762
734
|
/* @__PURE__ */ jsx11(Row, { children: /* @__PURE__ */ jsx11(
|
|
763
735
|
Col,
|
|
@@ -810,7 +782,7 @@ var SelectedFiles = ({
|
|
|
810
782
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
811
783
|
const fileType = file.FileName.split(".").pop();
|
|
812
784
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
813
|
-
return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(
|
|
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: [
|
|
814
786
|
/* @__PURE__ */ jsxs9("div", { className: "fileItem", children: [
|
|
815
787
|
/* @__PURE__ */ jsx11(Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: "uploadedDot", children: /* @__PURE__ */ jsx11(
|
|
816
788
|
"svg",
|
|
@@ -903,19 +875,19 @@ var AddFiles = ({
|
|
|
903
875
|
const errorId = `error-${questionObject.id}`;
|
|
904
876
|
const labelId = `label-${questionObject.id}`;
|
|
905
877
|
const maxSizeMB = Math.round(allowedTotalFileSize / 1048576);
|
|
906
|
-
const [numberOfFiles, setNumberOfFiles] =
|
|
907
|
-
const [totalFileSize, setTotalFileSize] =
|
|
908
|
-
const [errorMessageAddingFile, setErrorMessageAddingFile] =
|
|
909
|
-
const [newFiles, setNewFiles] =
|
|
910
|
-
const [dropFilesText, setDropFilesText] =
|
|
911
|
-
|
|
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(() => {
|
|
912
884
|
if (activatedLanguage === "sv") {
|
|
913
885
|
setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
|
|
914
886
|
} else {
|
|
915
887
|
setDropFilesText("Drag and drop your files here");
|
|
916
888
|
}
|
|
917
889
|
}, [activatedLanguage]);
|
|
918
|
-
|
|
890
|
+
useEffect5(() => {
|
|
919
891
|
if (questionObject.files && questionObject.files.length > 0) {
|
|
920
892
|
setNumberOfFiles(questionObject.files.length);
|
|
921
893
|
}
|
|
@@ -1010,7 +982,7 @@ var AddFiles = ({
|
|
|
1010
982
|
reader.readAsDataURL(file);
|
|
1011
983
|
});
|
|
1012
984
|
};
|
|
1013
|
-
|
|
985
|
+
useEffect5(() => {
|
|
1014
986
|
if (newFiles.length > 0) {
|
|
1015
987
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
1016
988
|
const e = {
|
|
@@ -1130,7 +1102,7 @@ var PreviewAddFiles = ({
|
|
|
1130
1102
|
};
|
|
1131
1103
|
|
|
1132
1104
|
// src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
|
|
1133
|
-
import { useEffect as
|
|
1105
|
+
import { useEffect as useEffect6, useState as useState6 } from "react";
|
|
1134
1106
|
import DOMPurify3 from "dompurify";
|
|
1135
1107
|
import { Fragment as Fragment12, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1136
1108
|
var SingleCheckbox = ({
|
|
@@ -1144,8 +1116,8 @@ var SingleCheckbox = ({
|
|
|
1144
1116
|
const inputId = `checkbox-${question.id}`;
|
|
1145
1117
|
const aboutId = `about-${question.id}`;
|
|
1146
1118
|
const errorId = `error-${question.id}`;
|
|
1147
|
-
const [checked, setChecked] =
|
|
1148
|
-
|
|
1119
|
+
const [checked, setChecked] = useState6(false);
|
|
1120
|
+
useEffect6(() => {
|
|
1149
1121
|
if (question.answer && question.answer === "true") {
|
|
1150
1122
|
setChecked(true);
|
|
1151
1123
|
} else {
|
|
@@ -2073,10 +2045,10 @@ var InputInfoOnly = ({
|
|
|
2073
2045
|
var InfoOnlyStandard_default = InputInfoOnly;
|
|
2074
2046
|
|
|
2075
2047
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioMultipleWithInfoStandard.tsx
|
|
2076
|
-
import
|
|
2048
|
+
import React7 from "react";
|
|
2077
2049
|
|
|
2078
2050
|
// src/components/input-components/RadioMultipleWithInfoStandard/RadioCollapseItem.tsx
|
|
2079
|
-
import { useEffect as
|
|
2051
|
+
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
2080
2052
|
import DOMPurify7 from "dompurify";
|
|
2081
2053
|
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2082
2054
|
var RadioCollapseItem = ({
|
|
@@ -2092,13 +2064,13 @@ var RadioCollapseItem = ({
|
|
|
2092
2064
|
activatedLanguage = "sv",
|
|
2093
2065
|
initialOpen = false
|
|
2094
2066
|
}) => {
|
|
2095
|
-
const [isOpen, setIsOpen] =
|
|
2067
|
+
const [isOpen, setIsOpen] = useState7(initialOpen);
|
|
2096
2068
|
const contentId = `${questionId}-content-${index}`;
|
|
2097
2069
|
const buttonId = `${questionId}-button-${index}`;
|
|
2098
2070
|
const openLabel = activatedLanguage === "sv" ? "Visa mer information om" : "Show more information about";
|
|
2099
2071
|
const closeLabel = activatedLanguage === "sv" ? "D\xF6lj mer information om" : "Hide more information about";
|
|
2100
2072
|
const buttonLabel = `${isOpen ? closeLabel : openLabel} "${label}"`;
|
|
2101
|
-
|
|
2073
|
+
useEffect7(() => {
|
|
2102
2074
|
if (questionAnswer === value) {
|
|
2103
2075
|
setIsOpen(true);
|
|
2104
2076
|
} else {
|
|
@@ -2208,7 +2180,7 @@ var RadioWithInfo = ({
|
|
|
2208
2180
|
groupedOptionArray.map((group, g_index) => {
|
|
2209
2181
|
var _a2;
|
|
2210
2182
|
let subId = "subheading-" + g_index;
|
|
2211
|
-
return /* @__PURE__ */ jsxs17(
|
|
2183
|
+
return /* @__PURE__ */ jsxs17(React7.Fragment, { children: [
|
|
2212
2184
|
/* @__PURE__ */ jsx21("legend", { className: "pts-radioWithInfo-sub-headline", id: subId, children: group.category }),
|
|
2213
2185
|
/* @__PURE__ */ jsx21("div", { role: "group", "aria-labelledby": subId, children: (_a2 = group.items) == null ? void 0 : _a2.map((option, o_index) => {
|
|
2214
2186
|
var _a3, _b2, _c2, _d, _e;
|
|
@@ -3034,9 +3006,9 @@ var getGroupCheckIds = (validationType) => {
|
|
|
3034
3006
|
var getGroupCheckIds_default = getGroupCheckIds;
|
|
3035
3007
|
|
|
3036
3008
|
// src/hooks/useFormStatusModal/useFormStatusModal.ts
|
|
3037
|
-
import * as
|
|
3009
|
+
import * as React8 from "react";
|
|
3038
3010
|
var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSelector = "#main-content") => {
|
|
3039
|
-
|
|
3011
|
+
React8.useEffect(() => {
|
|
3040
3012
|
if (formStatus === "loading") {
|
|
3041
3013
|
handleModalOpen();
|
|
3042
3014
|
}
|
|
@@ -3051,7 +3023,7 @@ var useFormStatusModal = (formStatus, handleModalOpen, handleModalClose, mainSel
|
|
|
3051
3023
|
};
|
|
3052
3024
|
|
|
3053
3025
|
// src/hooks/usePTSPageTitle/usePTSPageTitle.ts
|
|
3054
|
-
import { useMemo, useEffect as
|
|
3026
|
+
import { useMemo, useEffect as useEffect9 } from "react";
|
|
3055
3027
|
var usePTSPageTitle = ({
|
|
3056
3028
|
formStatus,
|
|
3057
3029
|
activeStep,
|
|
@@ -3069,19 +3041,19 @@ var usePTSPageTitle = ({
|
|
|
3069
3041
|
if (activeStep === 0 && baseTitle) return baseTitle;
|
|
3070
3042
|
return stepTitle || baseTitle || fallbackTitle;
|
|
3071
3043
|
}, [formStatus, activeStep, applicationContent, thankYouBlock, steps, fallbackTitle]);
|
|
3072
|
-
|
|
3044
|
+
useEffect9(() => {
|
|
3073
3045
|
document.title = computedTitle;
|
|
3074
3046
|
}, [computedTitle]);
|
|
3075
3047
|
return computedTitle;
|
|
3076
3048
|
};
|
|
3077
3049
|
|
|
3078
3050
|
// src/hooks/useInputMethodDetection/useInputMethodDetection.ts
|
|
3079
|
-
import { useEffect as
|
|
3051
|
+
import { useEffect as useEffect10 } from "react";
|
|
3080
3052
|
var useInputMethodDetection = ({
|
|
3081
3053
|
mouseClassName = "using-mouse",
|
|
3082
3054
|
keyboardToggleKey = "Tab"
|
|
3083
3055
|
} = {}) => {
|
|
3084
|
-
|
|
3056
|
+
useEffect10(() => {
|
|
3085
3057
|
const handleMouseDown = () => {
|
|
3086
3058
|
document.body.classList.add(mouseClassName);
|
|
3087
3059
|
};
|
|
@@ -3100,7 +3072,7 @@ var useInputMethodDetection = ({
|
|
|
3100
3072
|
};
|
|
3101
3073
|
|
|
3102
3074
|
// src/hooks/useCookieConsent/useCookieConsent.ts
|
|
3103
|
-
import { useCallback as useCallback2, useEffect as
|
|
3075
|
+
import { useCallback as useCallback2, useEffect as useEffect11, useMemo as useMemo2, useState as useState8 } from "react";
|
|
3104
3076
|
var useCookieConsent = ({
|
|
3105
3077
|
cookieName,
|
|
3106
3078
|
choiceKey,
|
|
@@ -3121,7 +3093,7 @@ var useCookieConsent = ({
|
|
|
3121
3093
|
}),
|
|
3122
3094
|
[cookieName, choiceKey, expiryYears]
|
|
3123
3095
|
);
|
|
3124
|
-
const [showBanner, setShowBanner] =
|
|
3096
|
+
const [showBanner, setShowBanner] = useState8(false);
|
|
3125
3097
|
const handleCookieStateChange = useCallback2(() => {
|
|
3126
3098
|
const cookiesNowAccepted = areCookiesAccepted();
|
|
3127
3099
|
if (onConsentChange) {
|
|
@@ -3129,7 +3101,7 @@ var useCookieConsent = ({
|
|
|
3129
3101
|
}
|
|
3130
3102
|
setShowBanner(false);
|
|
3131
3103
|
}, [areCookiesAccepted, onConsentChange]);
|
|
3132
|
-
|
|
3104
|
+
useEffect11(() => {
|
|
3133
3105
|
const cookiesAccepted = areCookiesAccepted();
|
|
3134
3106
|
const choiceMade = hasChoiceBeenMade();
|
|
3135
3107
|
setShowBanner(!cookiesAccepted && !choiceMade);
|
|
@@ -3258,7 +3230,7 @@ var QuestionRenderer = ({
|
|
|
3258
3230
|
var QuestionRenderer_default = QuestionRenderer;
|
|
3259
3231
|
|
|
3260
3232
|
// src/components/question-rendering/QuestionGroup/QuestionGroup.tsx
|
|
3261
|
-
import { useEffect as
|
|
3233
|
+
import { useEffect as useEffect12, Fragment as Fragment18 } from "react";
|
|
3262
3234
|
import { Fragment as Fragment19, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3263
3235
|
var QuestionGroup = ({
|
|
3264
3236
|
questions,
|
|
@@ -3278,7 +3250,7 @@ var QuestionGroup = ({
|
|
|
3278
3250
|
const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
|
|
3279
3251
|
(e) => e.startsWith("groupCheck-")
|
|
3280
3252
|
);
|
|
3281
|
-
|
|
3253
|
+
useEffect12(() => {
|
|
3282
3254
|
questions.forEach((question) => {
|
|
3283
3255
|
if (question.visible && !question.isDisplayed) {
|
|
3284
3256
|
markQuestionAsDisplayed(question);
|
|
@@ -3958,10 +3930,10 @@ var Header = ({
|
|
|
3958
3930
|
var HeaderStandard_default = Header;
|
|
3959
3931
|
|
|
3960
3932
|
// src/components/layout/NavigationHeaderStandard/NavigationHeaderStandard.tsx
|
|
3961
|
-
import { useRef as
|
|
3933
|
+
import { useRef as useRef4, useState as useState11 } from "react";
|
|
3962
3934
|
|
|
3963
3935
|
// src/components/layout/NavigationStandard/NavigationStandard.tsx
|
|
3964
|
-
import { useEffect as
|
|
3936
|
+
import { useEffect as useEffect13, useState as useState9, useRef as useRef3 } from "react";
|
|
3965
3937
|
import { Fragment as Fragment20, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3966
3938
|
var Navigation = ({
|
|
3967
3939
|
setIsMenyOpen,
|
|
@@ -3974,9 +3946,9 @@ var Navigation = ({
|
|
|
3974
3946
|
activePath = null
|
|
3975
3947
|
}) => {
|
|
3976
3948
|
const closeMenuText = activatedLanguage === "sv" ? "St\xE4ng meny" : "Close menu";
|
|
3977
|
-
const navRef =
|
|
3978
|
-
const firstVisitRef =
|
|
3979
|
-
const [openSubMenu, setOpenSubMenu] =
|
|
3949
|
+
const navRef = useRef3(null);
|
|
3950
|
+
const firstVisitRef = useRef3(true);
|
|
3951
|
+
const [openSubMenu, setOpenSubMenu] = useState9(null);
|
|
3980
3952
|
const handleSubMenu = (label) => {
|
|
3981
3953
|
setOpenSubMenu(openSubMenu === label ? null : label);
|
|
3982
3954
|
};
|
|
@@ -3985,7 +3957,7 @@ var Navigation = ({
|
|
|
3985
3957
|
setIsMenyOpen == null ? void 0 : setIsMenyOpen(false);
|
|
3986
3958
|
typeOfInteraction === "close" ? (_a = openButtonRef == null ? void 0 : openButtonRef.current) == null ? void 0 : _a.focus() : navigationCloseFocusId && ((_b = document.getElementById(navigationCloseFocusId)) == null ? void 0 : _b.focus());
|
|
3987
3959
|
};
|
|
3988
|
-
|
|
3960
|
+
useEffect13(() => {
|
|
3989
3961
|
var _a, _b;
|
|
3990
3962
|
if (!isOpen) {
|
|
3991
3963
|
setOpenSubMenu(null);
|
|
@@ -3997,7 +3969,7 @@ var Navigation = ({
|
|
|
3997
3969
|
})) == null ? void 0 : _a.label[activatedLanguage]) != null ? _b : null;
|
|
3998
3970
|
setOpenSubMenu(defaultOpenSubMenu);
|
|
3999
3971
|
}, [isOpen, activePath, menuLinks, activatedLanguage]);
|
|
4000
|
-
|
|
3972
|
+
useEffect13(() => {
|
|
4001
3973
|
if (!isOpen || !navRef.current) {
|
|
4002
3974
|
return;
|
|
4003
3975
|
}
|
|
@@ -4047,8 +4019,8 @@ var Navigation = ({
|
|
|
4047
4019
|
}
|
|
4048
4020
|
return "\xD6ppna undermeny f\xF6r " + label["sv"];
|
|
4049
4021
|
};
|
|
4050
|
-
const [instruction, setInstruction] =
|
|
4051
|
-
|
|
4022
|
+
const [instruction, setInstruction] = useState9("");
|
|
4023
|
+
useEffect13(() => {
|
|
4052
4024
|
if (firstVisitRef.current) {
|
|
4053
4025
|
firstVisitRef.current = false;
|
|
4054
4026
|
return;
|
|
@@ -4137,7 +4109,7 @@ var Navigation = ({
|
|
|
4137
4109
|
var NavigationStandard_default = Navigation;
|
|
4138
4110
|
|
|
4139
4111
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4140
|
-
import { useState as
|
|
4112
|
+
import { useState as useState10 } from "react";
|
|
4141
4113
|
|
|
4142
4114
|
// src/components/layout/SearchBarStandard/Icons.tsx
|
|
4143
4115
|
import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
@@ -4161,7 +4133,7 @@ var SearchIcon2 = ({ width = 15, height = 15, color = "#6E3282" }) => /* @__PURE
|
|
|
4161
4133
|
// src/components/layout/SearchBarStandard/SearchBarStandard.tsx
|
|
4162
4134
|
import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
4163
4135
|
var SearchBar = ({ activatedLanguage = "sv" }) => {
|
|
4164
|
-
const [searchTerm, setSearchTerm] =
|
|
4136
|
+
const [searchTerm, setSearchTerm] = useState10("");
|
|
4165
4137
|
const handleSearch = () => {
|
|
4166
4138
|
console.log("S\xF6kt efter:", searchTerm);
|
|
4167
4139
|
};
|
|
@@ -4215,8 +4187,8 @@ var NavigationHeader = ({
|
|
|
4215
4187
|
if (activatedLanguage === "sv") return "English";
|
|
4216
4188
|
else return "Svenska";
|
|
4217
4189
|
};
|
|
4218
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
4219
|
-
const menuButtonFocusRef =
|
|
4190
|
+
const [isMenuOpen, setIsMenuOpen] = useState11(false);
|
|
4191
|
+
const menuButtonFocusRef = useRef4(null);
|
|
4220
4192
|
const handleMenuClick = () => {
|
|
4221
4193
|
setIsMenuOpen((prev) => !prev);
|
|
4222
4194
|
};
|
|
@@ -4230,7 +4202,7 @@ var NavigationHeader = ({
|
|
|
4230
4202
|
const getMenuIcon = () => {
|
|
4231
4203
|
return isMenuOpen ? /* @__PURE__ */ jsx33(CloseIcon, {}) : /* @__PURE__ */ jsx33(MenuIcon, {});
|
|
4232
4204
|
};
|
|
4233
|
-
const [isSearchOpen, setIsSearchOpen] =
|
|
4205
|
+
const [isSearchOpen, setIsSearchOpen] = useState11(false);
|
|
4234
4206
|
const handleSearchClick = () => {
|
|
4235
4207
|
if (!isSearchOpen) {
|
|
4236
4208
|
setIsSearchOpen(true);
|
|
@@ -4471,7 +4443,7 @@ var LinkList = ({
|
|
|
4471
4443
|
var LinkListStandard_default = LinkList;
|
|
4472
4444
|
|
|
4473
4445
|
// src/components/layout/CollapseStandard/CollapseStandard.tsx
|
|
4474
|
-
import { useState as
|
|
4446
|
+
import { useState as useState12, useId as useId2 } from "react";
|
|
4475
4447
|
import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
4476
4448
|
var Collapse = ({
|
|
4477
4449
|
title,
|
|
@@ -4481,7 +4453,7 @@ var Collapse = ({
|
|
|
4481
4453
|
activatedLanguage = "sv",
|
|
4482
4454
|
customClass = ""
|
|
4483
4455
|
}) => {
|
|
4484
|
-
const [isOpen, setIsOpen] =
|
|
4456
|
+
const [isOpen, setIsOpen] = useState12(defaultOpen);
|
|
4485
4457
|
const uniqueId = id != null ? id : useId2();
|
|
4486
4458
|
const contentId = `${uniqueId}-content`;
|
|
4487
4459
|
const openLabel = activatedLanguage === "sv" ? "Visa" : "Show";
|
|
@@ -4596,14 +4568,14 @@ var StepperButtons = ({
|
|
|
4596
4568
|
var StepperButtonsStandard_default = StepperButtons;
|
|
4597
4569
|
|
|
4598
4570
|
// src/components/stepper/StepperStandard/StepperStandard.tsx
|
|
4599
|
-
import
|
|
4571
|
+
import React11 from "react";
|
|
4600
4572
|
import { jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4601
4573
|
var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
|
|
4602
4574
|
return /* @__PURE__ */ jsx42("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
|
|
4603
4575
|
const isActive = step.step === activeStep;
|
|
4604
4576
|
const lastElement = arraySteps.length;
|
|
4605
4577
|
const isDone = step.step < activeStep;
|
|
4606
|
-
return /* @__PURE__ */ jsxs34(
|
|
4578
|
+
return /* @__PURE__ */ jsxs34(React11.Fragment, { children: [
|
|
4607
4579
|
/* @__PURE__ */ jsxs34("div", { className: "pts-stepper-step", children: [
|
|
4608
4580
|
/* @__PURE__ */ jsx42(
|
|
4609
4581
|
"div",
|