optimized-react-component-library-xyz123 0.0.6 → 0.0.7
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.css +22 -12
- package/dist/index.js +196 -115
- package/dist/index.mjs +204 -123
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -612,7 +612,7 @@ textarea:focus-visible,
|
|
|
612
612
|
sans-serif;
|
|
613
613
|
}
|
|
614
614
|
.files-drop-zone {
|
|
615
|
-
border: 2px dashed #
|
|
615
|
+
border: 2px dashed #6e3282;
|
|
616
616
|
border-radius: 12px;
|
|
617
617
|
padding: 3rem 2rem;
|
|
618
618
|
text-align: center;
|
|
@@ -623,17 +623,27 @@ textarea:focus-visible,
|
|
|
623
623
|
overflow: hidden;
|
|
624
624
|
}
|
|
625
625
|
.files-drop-zone:hover {
|
|
626
|
-
border-color: #
|
|
627
|
-
background-color: #
|
|
626
|
+
border-color: #6e3282;
|
|
627
|
+
background-color: #f5ebf8;
|
|
628
628
|
transform: translateY(-2px);
|
|
629
|
-
box-shadow: 0 4px 12px rgba(
|
|
629
|
+
box-shadow: 0 4px 12px rgba(220, 148, 253, 0.15);
|
|
630
630
|
}
|
|
631
631
|
.files-drop-zone.drag-active {
|
|
632
|
-
border-color: #
|
|
633
|
-
background-color: #
|
|
632
|
+
border-color: #6e3282;
|
|
633
|
+
background-color: #f5ebf8;
|
|
634
634
|
transform: scale(1.02);
|
|
635
635
|
box-shadow: 0 8px 25px rgba(30, 167, 253, 0.2);
|
|
636
636
|
}
|
|
637
|
+
.files-drop-zone:focus {
|
|
638
|
+
border: 0.2rem solid #6e3282;
|
|
639
|
+
}
|
|
640
|
+
.files-drop-zone:focus-visible {
|
|
641
|
+
outline-offset: 0 !important;
|
|
642
|
+
outline-style: solid !important;
|
|
643
|
+
outline-color: #fff !important;
|
|
644
|
+
outline-width: 2px !important;
|
|
645
|
+
box-shadow: 0 0 0 4px #000 !important;
|
|
646
|
+
}
|
|
637
647
|
.files-drop-content {
|
|
638
648
|
pointer-events: none;
|
|
639
649
|
}
|
|
@@ -667,12 +677,12 @@ textarea:focus-visible,
|
|
|
667
677
|
color: #555;
|
|
668
678
|
margin: 0.75rem 0 0 0;
|
|
669
679
|
padding: 0.5rem;
|
|
670
|
-
background-color: rgba(
|
|
680
|
+
background-color: rgba(146, 64, 252, 0.1);
|
|
671
681
|
border-radius: 6px;
|
|
672
|
-
border-left: 3px solid #
|
|
682
|
+
border-left: 3px solid #ce95e0;
|
|
673
683
|
}
|
|
674
684
|
.files-allowed-types strong {
|
|
675
|
-
color: #
|
|
685
|
+
color: #6e3282;
|
|
676
686
|
}
|
|
677
687
|
.files-input-hidden {
|
|
678
688
|
display: none;
|
|
@@ -868,11 +878,11 @@ textarea:focus-visible,
|
|
|
868
878
|
color: white;
|
|
869
879
|
}
|
|
870
880
|
.action-btn.remove {
|
|
871
|
-
color: #
|
|
872
|
-
border-color: #
|
|
881
|
+
color: #6e3282;
|
|
882
|
+
border-color: #6e3282;
|
|
873
883
|
}
|
|
874
884
|
.action-btn.remove:hover {
|
|
875
|
-
background-color: #
|
|
885
|
+
background-color: #6e3282;
|
|
876
886
|
color: white;
|
|
877
887
|
}
|
|
878
888
|
@media (max-width: 768px) {
|
package/dist/index.js
CHANGED
|
@@ -400,17 +400,34 @@ var PreviewTextField = ({
|
|
|
400
400
|
// src/NewInputComponentStandard/FilesUploadStandard/FilesUploadStandard.tsx
|
|
401
401
|
var import_react2 = require("react");
|
|
402
402
|
var import_clsx = __toESM(require("clsx"));
|
|
403
|
+
var import_dompurify3 = __toESM(require("dompurify"));
|
|
403
404
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
404
405
|
var FilesUpload = ({
|
|
405
406
|
question,
|
|
406
|
-
isTouched
|
|
407
|
+
isTouched,
|
|
407
408
|
visible: _visible = true,
|
|
408
|
-
showPreview
|
|
409
|
+
showPreview = false,
|
|
409
410
|
activatedLanguage: _activatedLanguage = "sv",
|
|
410
411
|
onFilesAdded,
|
|
411
412
|
onFileRemoved,
|
|
412
413
|
allowedNumberOfFiles = 5,
|
|
413
|
-
allowedFileTypes = [
|
|
414
|
+
allowedFileTypes = [
|
|
415
|
+
".pdf",
|
|
416
|
+
".doc",
|
|
417
|
+
".docx",
|
|
418
|
+
".xls",
|
|
419
|
+
".xlsx",
|
|
420
|
+
".txt",
|
|
421
|
+
".rtf",
|
|
422
|
+
".ppt",
|
|
423
|
+
".pptx",
|
|
424
|
+
".jpg",
|
|
425
|
+
".jpeg",
|
|
426
|
+
".png",
|
|
427
|
+
".tif",
|
|
428
|
+
".tiff",
|
|
429
|
+
".csv"
|
|
430
|
+
],
|
|
414
431
|
maxFileSize = 50 * 1024 * 1024,
|
|
415
432
|
// 50MB default
|
|
416
433
|
allowedTotalFileSize = 20 * 1024 * 1024,
|
|
@@ -418,6 +435,11 @@ var FilesUpload = ({
|
|
|
418
435
|
allowDuplicates = false,
|
|
419
436
|
multiple = true
|
|
420
437
|
}) => {
|
|
438
|
+
var _a;
|
|
439
|
+
const questionId = `question-${question.id}`;
|
|
440
|
+
const inputId = `file-${question.id}`;
|
|
441
|
+
const aboutId = `about-${question.id}`;
|
|
442
|
+
const errorId = `error-${question.id}`;
|
|
421
443
|
const [selectedFiles, setSelectedFiles] = (0, import_react2.useState)([]);
|
|
422
444
|
const [dragActive, setDragActive] = (0, import_react2.useState)(false);
|
|
423
445
|
const fileInputRef = (0, import_react2.useRef)(null);
|
|
@@ -434,28 +456,35 @@ var FilesUpload = ({
|
|
|
434
456
|
};
|
|
435
457
|
(0, import_react2.useEffect)(() => {
|
|
436
458
|
if (question.files && question.files.length > 0) {
|
|
437
|
-
const existingFiles = question.files.map(
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
459
|
+
const existingFiles = question.files.map(
|
|
460
|
+
(item) => {
|
|
461
|
+
if (item instanceof File) {
|
|
462
|
+
return {
|
|
463
|
+
id: generateFileId(item),
|
|
464
|
+
file: item
|
|
465
|
+
};
|
|
466
|
+
} else {
|
|
467
|
+
return {
|
|
468
|
+
id: item.id || generateFileId(item.file),
|
|
469
|
+
file: item.file,
|
|
470
|
+
dataURL: item.dataURL
|
|
471
|
+
};
|
|
472
|
+
}
|
|
449
473
|
}
|
|
450
|
-
|
|
474
|
+
);
|
|
451
475
|
setSelectedFiles(existingFiles);
|
|
452
476
|
}
|
|
453
477
|
}, [question.files]);
|
|
478
|
+
(0, import_react2.useEffect)(() => {
|
|
479
|
+
alert("Selected files changed");
|
|
480
|
+
const e = {};
|
|
481
|
+
isTouched(e, question);
|
|
482
|
+
}, [selectedFiles]);
|
|
454
483
|
const getTotalFileSize = () => {
|
|
455
484
|
return selectedFiles.reduce((total, selectedFile) => total + selectedFile.file.size, 0);
|
|
456
485
|
};
|
|
457
486
|
const validateFile = (file, additionalFiles = []) => {
|
|
458
|
-
var
|
|
487
|
+
var _a2;
|
|
459
488
|
if (file.size > maxFileSize) {
|
|
460
489
|
return `Filen \xE4r f\xF6r stor. Max storlek: ${formatFileSize(maxFileSize)}`;
|
|
461
490
|
}
|
|
@@ -464,10 +493,12 @@ var FilesUpload = ({
|
|
|
464
493
|
const newTotalSize = currentTotalSize + additionalSize + file.size;
|
|
465
494
|
if (newTotalSize > allowedTotalFileSize) {
|
|
466
495
|
const remainingSize = allowedTotalFileSize - currentTotalSize - additionalSize;
|
|
467
|
-
return `Total filstorlek \xF6verskrider gr\xE4nsen p\xE5 ${formatFileSize(
|
|
496
|
+
return `Total filstorlek \xF6verskrider gr\xE4nsen p\xE5 ${formatFileSize(
|
|
497
|
+
allowedTotalFileSize
|
|
498
|
+
)}. \xC5terst\xE5ende: ${formatFileSize(Math.max(0, remainingSize))}`;
|
|
468
499
|
}
|
|
469
500
|
if (allowedFileTypes.length > 0 && !allowedFileTypes.includes("*")) {
|
|
470
|
-
const fileExtension = (
|
|
501
|
+
const fileExtension = (_a2 = file.name.split(".").pop()) == null ? void 0 : _a2.toLowerCase();
|
|
471
502
|
if (!fileExtension) {
|
|
472
503
|
return `Fil saknar fil\xE4ndelse`;
|
|
473
504
|
}
|
|
@@ -542,13 +573,15 @@ var FilesUpload = ({
|
|
|
542
573
|
const updatedFiles = selectedFiles.filter((f) => f.id !== fileId);
|
|
543
574
|
setSelectedFiles(updatedFiles);
|
|
544
575
|
if (fileToRemove && question.files) {
|
|
545
|
-
const fileIndex = question.files.findIndex(
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
576
|
+
const fileIndex = question.files.findIndex(
|
|
577
|
+
(f) => {
|
|
578
|
+
if (f instanceof File) {
|
|
579
|
+
return f.name === fileToRemove.file.name && f.size === fileToRemove.file.size;
|
|
580
|
+
} else {
|
|
581
|
+
return f.file.name === fileToRemove.file.name && f.file.size === fileToRemove.file.size;
|
|
582
|
+
}
|
|
550
583
|
}
|
|
551
|
-
|
|
584
|
+
);
|
|
552
585
|
if (fileIndex !== -1) {
|
|
553
586
|
question.files.splice(fileIndex, 1);
|
|
554
587
|
}
|
|
@@ -580,8 +613,8 @@ var FilesUpload = ({
|
|
|
580
613
|
}
|
|
581
614
|
};
|
|
582
615
|
const openFileDialog = () => {
|
|
583
|
-
var
|
|
584
|
-
(
|
|
616
|
+
var _a2;
|
|
617
|
+
(_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
585
618
|
};
|
|
586
619
|
const formatFileSize = (bytes) => {
|
|
587
620
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -590,91 +623,139 @@ var FilesUpload = ({
|
|
|
590
623
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
591
624
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
592
625
|
};
|
|
593
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
"
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
onClick: openFileDialog,
|
|
604
|
-
children: [
|
|
605
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "files-drop-content", children: [
|
|
606
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "files-icon", children: "\u{1F4C2}" }),
|
|
607
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "files-drop-text", children: "Dra och sl\xE4pp filer h\xE4r eller klicka f\xF6r att v\xE4lja" }),
|
|
608
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "files-drop-info" }),
|
|
609
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "files-drop-info", children: [
|
|
610
|
-
"Max ",
|
|
611
|
-
allowedNumberOfFiles,
|
|
612
|
-
" filer, ",
|
|
613
|
-
formatFileSize(maxFileSize),
|
|
614
|
-
" per fil, ",
|
|
615
|
-
formatFileSize(allowedTotalFileSize),
|
|
616
|
-
" totalt"
|
|
617
|
-
] }),
|
|
618
|
-
allowedFileTypes.length > 0 && !allowedFileTypes.includes("*") && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "files-allowed-types", children: [
|
|
619
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Till\xE5tna filtyper:" }),
|
|
620
|
-
" ",
|
|
621
|
-
allowedFileTypes.map(
|
|
622
|
-
(type) => type.startsWith(".") ? type : `.${type}`
|
|
623
|
-
).join(", ")
|
|
624
|
-
] })
|
|
625
|
-
] }),
|
|
626
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
627
|
-
"input",
|
|
628
|
-
{
|
|
629
|
-
ref: fileInputRef,
|
|
630
|
-
type: "file",
|
|
631
|
-
multiple,
|
|
632
|
-
accept: allowedFileTypes.join(","),
|
|
633
|
-
onChange: handleFileInput,
|
|
634
|
-
className: "files-input-hidden"
|
|
635
|
-
}
|
|
636
|
-
)
|
|
637
|
-
]
|
|
638
|
-
}
|
|
639
|
-
),
|
|
640
|
-
selectedFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "files-summary", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "files-summary-stats", children: [
|
|
641
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "stat", children: [
|
|
642
|
-
"\u{1F4C1} ",
|
|
643
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: selectedFiles.length }),
|
|
644
|
-
" filer totalt"
|
|
645
|
-
] }),
|
|
646
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "stat", children: [
|
|
647
|
-
"\u{1F4BE} ",
|
|
648
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: formatFileSize(getTotalFileSize()) }),
|
|
649
|
-
" / ",
|
|
650
|
-
formatFileSize(allowedTotalFileSize)
|
|
651
|
-
] })
|
|
652
|
-
] }) }),
|
|
653
|
-
selectedFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "files-list", children: [
|
|
654
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h4", { children: [
|
|
655
|
-
"Filer (",
|
|
656
|
-
selectedFiles.length,
|
|
657
|
-
")"
|
|
658
|
-
] }),
|
|
659
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "files-items", children: selectedFiles.map((selectedFile) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { className: "file-item", children: [
|
|
660
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "file-icon-status", children: "\u{1F4C1}" }),
|
|
661
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "file-info", children: [
|
|
662
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "file-name", children: selectedFile.file.name }),
|
|
663
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "file-details", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "file-size", children: formatFileSize(selectedFile.file.size) }) })
|
|
626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: !showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
627
|
+
"div",
|
|
628
|
+
{
|
|
629
|
+
id: questionId,
|
|
630
|
+
className: `pts-root-question pts-textArea-container${question.aboutText ? " pts-question-hasAbout" : ""}`,
|
|
631
|
+
children: [
|
|
632
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { htmlFor: inputId, children: [
|
|
633
|
+
question.questionLabel,
|
|
634
|
+
" ",
|
|
635
|
+
question.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "pts-root-mandatoryAsterisk", "aria-hidden": "true", children: "*" })
|
|
664
636
|
] }),
|
|
665
|
-
|
|
666
|
-
"
|
|
637
|
+
question.aboutText && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
638
|
+
"div",
|
|
667
639
|
{
|
|
668
|
-
className: "
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
children: "\u2715"
|
|
640
|
+
className: "pts-about",
|
|
641
|
+
dangerouslySetInnerHTML: {
|
|
642
|
+
__html: import_dompurify3.default.sanitize(question.aboutText)
|
|
643
|
+
}
|
|
673
644
|
}
|
|
674
|
-
)
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
645
|
+
),
|
|
646
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
647
|
+
"div",
|
|
648
|
+
{
|
|
649
|
+
className: (0, import_clsx.default)("files-drop-zone", { "drag-active": dragActive }),
|
|
650
|
+
onDrop: handleDrop,
|
|
651
|
+
onDragOver: handleDragOver,
|
|
652
|
+
onDragLeave: handleDragLeave,
|
|
653
|
+
onClick: openFileDialog,
|
|
654
|
+
onKeyDown: (e) => {
|
|
655
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
656
|
+
e.preventDefault();
|
|
657
|
+
openFileDialog();
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
tabIndex: 0,
|
|
661
|
+
role: "button",
|
|
662
|
+
"aria-label": "V\xE4lj filer att ladda upp",
|
|
663
|
+
children: [
|
|
664
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "files-drop-content", children: [
|
|
665
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "files-icon", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
666
|
+
"svg",
|
|
667
|
+
{
|
|
668
|
+
"aria-hidden": "true",
|
|
669
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
670
|
+
width: "72",
|
|
671
|
+
height: "48",
|
|
672
|
+
viewBox: "0 0 72 48",
|
|
673
|
+
fill: "none",
|
|
674
|
+
children: [
|
|
675
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { clipPath: "url(#clip0_247_596)", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
676
|
+
"path",
|
|
677
|
+
{
|
|
678
|
+
d: "M66.6084 23.0844C64.6397 21.6247 62.2209 20.5531 59.6672 19.9752C59.2479 19.8808 58.8641 19.6692 58.5605 19.3649C58.257 19.0606 58.0463 18.6763 57.953 18.2567C56.8561 13.37 54.495 9.1794 51.0244 6.00409C46.9898 2.30706 41.6545 0.273621 36 0.273621C31.0289 0.273621 26.4375 1.83174 22.7292 4.78065C20.216 6.78238 18.193 9.33154 16.8145 12.2338C16.6651 12.5513 16.4434 12.8295 16.1672 13.0461C15.8911 13.2627 15.5681 13.4117 15.2241 13.4811C11.4623 14.2405 8.06625 15.8535 5.47312 18.1386C1.89281 21.3027 0 25.5088 0 30.3111C0 35.1655 2.03766 39.5924 5.73609 42.793C9.26859 45.8431 14.0245 47.5236 19.125 47.5236H33.75V25.956L28.5905 31.1155C28.3751 31.3309 28.1182 31.5003 27.8354 31.6134C27.5525 31.7266 27.2497 31.7811 26.9452 31.7738C26.6406 31.7664 26.3408 31.6973 26.0638 31.5706C25.7867 31.4439 25.5383 31.2623 25.3336 31.0367C24.518 30.141 24.5967 28.7446 25.4531 27.8881L34.4095 18.9331C34.8314 18.5115 35.4035 18.2747 36 18.2747C36.5965 18.2747 37.1686 18.5115 37.5905 18.9331L46.5469 27.8853C47.43 28.7699 47.4806 30.2197 46.6017 31.107C46.3932 31.3176 46.1451 31.485 45.8718 31.5994C45.5984 31.7139 45.3051 31.7732 45.0088 31.774C44.7124 31.7748 44.4188 31.717 44.1449 31.604C43.8709 31.491 43.622 31.325 43.4123 31.1155L38.25 25.956V47.5236H55.6875C60.0947 47.5236 64.1124 46.2861 67.0008 44.0403C70.2717 41.495 72 37.8528 72 33.5174C72 29.3071 70.1353 25.6972 66.6084 23.0844Z",
|
|
679
|
+
fill: "#6E3282"
|
|
680
|
+
}
|
|
681
|
+
) }),
|
|
682
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("clipPath", { id: "clip0_247_596", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
683
|
+
"rect",
|
|
684
|
+
{
|
|
685
|
+
width: "72",
|
|
686
|
+
height: "47.1064",
|
|
687
|
+
fill: "white",
|
|
688
|
+
transform: "translate(0 0.446777)"
|
|
689
|
+
}
|
|
690
|
+
) }) })
|
|
691
|
+
]
|
|
692
|
+
}
|
|
693
|
+
) }),
|
|
694
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "files-drop-text", children: "Dra och sl\xE4pp filer h\xE4r eller klicka f\xF6r att v\xE4lja" }),
|
|
695
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "files-drop-info" }),
|
|
696
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "files-drop-info", children: [
|
|
697
|
+
"Max ",
|
|
698
|
+
allowedNumberOfFiles,
|
|
699
|
+
" filer, ",
|
|
700
|
+
formatFileSize(maxFileSize),
|
|
701
|
+
" per fil,",
|
|
702
|
+
" ",
|
|
703
|
+
formatFileSize(allowedTotalFileSize),
|
|
704
|
+
" totalt"
|
|
705
|
+
] }),
|
|
706
|
+
allowedFileTypes.length > 0 && !allowedFileTypes.includes("*") && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "files-allowed-types", children: [
|
|
707
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Till\xE5tna filtyper:" }),
|
|
708
|
+
" ",
|
|
709
|
+
allowedFileTypes.map((type) => type.startsWith(".") ? type : `.${type}`).join(", ")
|
|
710
|
+
] })
|
|
711
|
+
] }),
|
|
712
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
713
|
+
"input",
|
|
714
|
+
{
|
|
715
|
+
ref: fileInputRef,
|
|
716
|
+
type: "file",
|
|
717
|
+
multiple,
|
|
718
|
+
accept: allowedFileTypes.join(","),
|
|
719
|
+
onChange: handleFileInput,
|
|
720
|
+
className: "files-input-hidden",
|
|
721
|
+
name: `question-name-${question.id}`,
|
|
722
|
+
disabled: (_a = question.questionExtraAttribute) == null ? void 0 : _a.disabled,
|
|
723
|
+
required: question.isQuestionMandatory,
|
|
724
|
+
"aria-required": question.isQuestionMandatory,
|
|
725
|
+
"aria-describedby": `${question.aboutText ? aboutId : ""} ${question.hasValidationError ? errorId : ""}`.trim(),
|
|
726
|
+
"aria-invalid": question.hasValidationError,
|
|
727
|
+
"aria-errormessage": question.hasValidationError ? errorId : void 0
|
|
728
|
+
}
|
|
729
|
+
)
|
|
730
|
+
]
|
|
731
|
+
}
|
|
732
|
+
),
|
|
733
|
+
selectedFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "files-list", children: [
|
|
734
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h4", { children: [
|
|
735
|
+
"Filer (",
|
|
736
|
+
selectedFiles.length,
|
|
737
|
+
")"
|
|
738
|
+
] }),
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "files-items", children: selectedFiles.map((selectedFile) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { className: "file-item", children: [
|
|
740
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "file-info", children: [
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "file-name", children: selectedFile.file.name }),
|
|
742
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "file-details", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "file-size", children: formatFileSize(selectedFile.file.size) }) })
|
|
743
|
+
] }),
|
|
744
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "file-actions", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
745
|
+
"button",
|
|
746
|
+
{
|
|
747
|
+
className: "action-btn remove",
|
|
748
|
+
onClick: () => removeFile(selectedFile.id),
|
|
749
|
+
type: "button",
|
|
750
|
+
title: "Ta bort fil",
|
|
751
|
+
children: "Radera"
|
|
752
|
+
}
|
|
753
|
+
) })
|
|
754
|
+
] }, selectedFile.id)) })
|
|
755
|
+
] })
|
|
756
|
+
]
|
|
757
|
+
}
|
|
758
|
+
) });
|
|
678
759
|
};
|
|
679
760
|
var FilesUploadStandard_default = FilesUpload;
|
|
680
761
|
|
|
@@ -1611,9 +1692,9 @@ var HeaderStandard_default = Header;
|
|
|
1611
1692
|
|
|
1612
1693
|
// src/NewTextComponentStandard/InfoOnlyStandard/InfoOnlyStandard.tsx
|
|
1613
1694
|
var import_react4 = require("react");
|
|
1614
|
-
var
|
|
1695
|
+
var import_dompurify4 = __toESM(require("dompurify"));
|
|
1615
1696
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1616
|
-
var cleanText = (text) =>
|
|
1697
|
+
var cleanText = (text) => import_dompurify4.default.sanitize(text, { ADD_ATTR: ["target", "class"] });
|
|
1617
1698
|
var InfoOnly = ({
|
|
1618
1699
|
questionObject,
|
|
1619
1700
|
isTouched,
|
|
@@ -1680,13 +1761,13 @@ var Modal = ({ showModal: isOpen, activatedLanguage = "" }) => {
|
|
|
1680
1761
|
var ModalStandard_default = Modal;
|
|
1681
1762
|
|
|
1682
1763
|
// src/NewTextComponentStandard/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
|
|
1683
|
-
var
|
|
1764
|
+
var import_dompurify5 = __toESM(require("dompurify"));
|
|
1684
1765
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1685
1766
|
var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
1686
1767
|
const HeadlineTag = headlineType;
|
|
1687
1768
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "pts-textHeadlineAndBody-container", children: [
|
|
1688
1769
|
data.headline && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(HeadlineTag, { children: data.headline }),
|
|
1689
|
-
data.body && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { dangerouslySetInnerHTML: { __html:
|
|
1770
|
+
data.body && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify5.default.sanitize(data.body) } }),
|
|
1690
1771
|
data.linksForMoreInfo && data.linksForMoreInfo.length > 0 && /* @__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)("a", { href: link.url, target: "_blank", rel: "noopener noreferrer", "aria-label": link.ariaLabel, children: [
|
|
1691
1772
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "MoreInfoIcon", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1692
1773
|
"svg",
|
|
@@ -1767,12 +1848,12 @@ var PrincipleOfPublicity = ({ activatedLanguage = "" }) => {
|
|
|
1767
1848
|
var PrincipleOfPublicityStandard_default = PrincipleOfPublicity;
|
|
1768
1849
|
|
|
1769
1850
|
// src/NewTextComponentStandard/ServiceHeadlineAndBodyStandard/ServiceHeadlineAndBodyStandard.tsx
|
|
1770
|
-
var
|
|
1851
|
+
var import_dompurify6 = __toESM(require("dompurify"));
|
|
1771
1852
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1772
1853
|
var ServiceHeadlineAndBody = ({ data, activeStep = 1 }) => {
|
|
1773
1854
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "pts-serviceHeadlineAndBody-container", children: [
|
|
1774
1855
|
data.mainHeadline && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h1", { id: "pts-main-service-headline", children: data.mainHeadline }),
|
|
1775
|
-
activeStep === 1 && data.ingressBody && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { dangerouslySetInnerHTML: { __html:
|
|
1856
|
+
activeStep === 1 && data.ingressBody && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify6.default.sanitize(data.ingressBody) } }),
|
|
1776
1857
|
activeStep === 1 && data.linksForMoreInfo && data.linksForMoreInfo.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((moreInfo, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("a", { href: moreInfo.url, target: "_blank", rel: "noopener noreferrer", children: [
|
|
1777
1858
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1778
1859
|
"svg",
|
package/dist/index.mjs
CHANGED
|
@@ -338,17 +338,34 @@ var PreviewTextField = ({
|
|
|
338
338
|
// src/NewInputComponentStandard/FilesUploadStandard/FilesUploadStandard.tsx
|
|
339
339
|
import { useState as useState2, useRef, useEffect as useEffect2 } from "react";
|
|
340
340
|
import clsx from "clsx";
|
|
341
|
-
import
|
|
341
|
+
import DOMPurify3 from "dompurify";
|
|
342
|
+
import { Fragment as Fragment5, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
342
343
|
var FilesUpload = ({
|
|
343
344
|
question,
|
|
344
|
-
isTouched
|
|
345
|
+
isTouched,
|
|
345
346
|
visible: _visible = true,
|
|
346
|
-
showPreview
|
|
347
|
+
showPreview = false,
|
|
347
348
|
activatedLanguage: _activatedLanguage = "sv",
|
|
348
349
|
onFilesAdded,
|
|
349
350
|
onFileRemoved,
|
|
350
351
|
allowedNumberOfFiles = 5,
|
|
351
|
-
allowedFileTypes = [
|
|
352
|
+
allowedFileTypes = [
|
|
353
|
+
".pdf",
|
|
354
|
+
".doc",
|
|
355
|
+
".docx",
|
|
356
|
+
".xls",
|
|
357
|
+
".xlsx",
|
|
358
|
+
".txt",
|
|
359
|
+
".rtf",
|
|
360
|
+
".ppt",
|
|
361
|
+
".pptx",
|
|
362
|
+
".jpg",
|
|
363
|
+
".jpeg",
|
|
364
|
+
".png",
|
|
365
|
+
".tif",
|
|
366
|
+
".tiff",
|
|
367
|
+
".csv"
|
|
368
|
+
],
|
|
352
369
|
maxFileSize = 50 * 1024 * 1024,
|
|
353
370
|
// 50MB default
|
|
354
371
|
allowedTotalFileSize = 20 * 1024 * 1024,
|
|
@@ -356,6 +373,11 @@ var FilesUpload = ({
|
|
|
356
373
|
allowDuplicates = false,
|
|
357
374
|
multiple = true
|
|
358
375
|
}) => {
|
|
376
|
+
var _a;
|
|
377
|
+
const questionId = `question-${question.id}`;
|
|
378
|
+
const inputId = `file-${question.id}`;
|
|
379
|
+
const aboutId = `about-${question.id}`;
|
|
380
|
+
const errorId = `error-${question.id}`;
|
|
359
381
|
const [selectedFiles, setSelectedFiles] = useState2([]);
|
|
360
382
|
const [dragActive, setDragActive] = useState2(false);
|
|
361
383
|
const fileInputRef = useRef(null);
|
|
@@ -372,28 +394,35 @@ var FilesUpload = ({
|
|
|
372
394
|
};
|
|
373
395
|
useEffect2(() => {
|
|
374
396
|
if (question.files && question.files.length > 0) {
|
|
375
|
-
const existingFiles = question.files.map(
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
397
|
+
const existingFiles = question.files.map(
|
|
398
|
+
(item) => {
|
|
399
|
+
if (item instanceof File) {
|
|
400
|
+
return {
|
|
401
|
+
id: generateFileId(item),
|
|
402
|
+
file: item
|
|
403
|
+
};
|
|
404
|
+
} else {
|
|
405
|
+
return {
|
|
406
|
+
id: item.id || generateFileId(item.file),
|
|
407
|
+
file: item.file,
|
|
408
|
+
dataURL: item.dataURL
|
|
409
|
+
};
|
|
410
|
+
}
|
|
387
411
|
}
|
|
388
|
-
|
|
412
|
+
);
|
|
389
413
|
setSelectedFiles(existingFiles);
|
|
390
414
|
}
|
|
391
415
|
}, [question.files]);
|
|
416
|
+
useEffect2(() => {
|
|
417
|
+
alert("Selected files changed");
|
|
418
|
+
const e = {};
|
|
419
|
+
isTouched(e, question);
|
|
420
|
+
}, [selectedFiles]);
|
|
392
421
|
const getTotalFileSize = () => {
|
|
393
422
|
return selectedFiles.reduce((total, selectedFile) => total + selectedFile.file.size, 0);
|
|
394
423
|
};
|
|
395
424
|
const validateFile = (file, additionalFiles = []) => {
|
|
396
|
-
var
|
|
425
|
+
var _a2;
|
|
397
426
|
if (file.size > maxFileSize) {
|
|
398
427
|
return `Filen \xE4r f\xF6r stor. Max storlek: ${formatFileSize(maxFileSize)}`;
|
|
399
428
|
}
|
|
@@ -402,10 +431,12 @@ var FilesUpload = ({
|
|
|
402
431
|
const newTotalSize = currentTotalSize + additionalSize + file.size;
|
|
403
432
|
if (newTotalSize > allowedTotalFileSize) {
|
|
404
433
|
const remainingSize = allowedTotalFileSize - currentTotalSize - additionalSize;
|
|
405
|
-
return `Total filstorlek \xF6verskrider gr\xE4nsen p\xE5 ${formatFileSize(
|
|
434
|
+
return `Total filstorlek \xF6verskrider gr\xE4nsen p\xE5 ${formatFileSize(
|
|
435
|
+
allowedTotalFileSize
|
|
436
|
+
)}. \xC5terst\xE5ende: ${formatFileSize(Math.max(0, remainingSize))}`;
|
|
406
437
|
}
|
|
407
438
|
if (allowedFileTypes.length > 0 && !allowedFileTypes.includes("*")) {
|
|
408
|
-
const fileExtension = (
|
|
439
|
+
const fileExtension = (_a2 = file.name.split(".").pop()) == null ? void 0 : _a2.toLowerCase();
|
|
409
440
|
if (!fileExtension) {
|
|
410
441
|
return `Fil saknar fil\xE4ndelse`;
|
|
411
442
|
}
|
|
@@ -480,13 +511,15 @@ var FilesUpload = ({
|
|
|
480
511
|
const updatedFiles = selectedFiles.filter((f) => f.id !== fileId);
|
|
481
512
|
setSelectedFiles(updatedFiles);
|
|
482
513
|
if (fileToRemove && question.files) {
|
|
483
|
-
const fileIndex = question.files.findIndex(
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
514
|
+
const fileIndex = question.files.findIndex(
|
|
515
|
+
(f) => {
|
|
516
|
+
if (f instanceof File) {
|
|
517
|
+
return f.name === fileToRemove.file.name && f.size === fileToRemove.file.size;
|
|
518
|
+
} else {
|
|
519
|
+
return f.file.name === fileToRemove.file.name && f.file.size === fileToRemove.file.size;
|
|
520
|
+
}
|
|
488
521
|
}
|
|
489
|
-
|
|
522
|
+
);
|
|
490
523
|
if (fileIndex !== -1) {
|
|
491
524
|
question.files.splice(fileIndex, 1);
|
|
492
525
|
}
|
|
@@ -518,8 +551,8 @@ var FilesUpload = ({
|
|
|
518
551
|
}
|
|
519
552
|
};
|
|
520
553
|
const openFileDialog = () => {
|
|
521
|
-
var
|
|
522
|
-
(
|
|
554
|
+
var _a2;
|
|
555
|
+
(_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
523
556
|
};
|
|
524
557
|
const formatFileSize = (bytes) => {
|
|
525
558
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -528,91 +561,139 @@ var FilesUpload = ({
|
|
|
528
561
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
529
562
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
530
563
|
};
|
|
531
|
-
return /* @__PURE__ */
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
"
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
onClick: openFileDialog,
|
|
542
|
-
children: [
|
|
543
|
-
/* @__PURE__ */ jsxs5("div", { className: "files-drop-content", children: [
|
|
544
|
-
/* @__PURE__ */ jsx5("div", { className: "files-icon", children: "\u{1F4C2}" }),
|
|
545
|
-
/* @__PURE__ */ jsx5("p", { className: "files-drop-text", children: "Dra och sl\xE4pp filer h\xE4r eller klicka f\xF6r att v\xE4lja" }),
|
|
546
|
-
/* @__PURE__ */ jsx5("p", { className: "files-drop-info" }),
|
|
547
|
-
/* @__PURE__ */ jsxs5("p", { className: "files-drop-info", children: [
|
|
548
|
-
"Max ",
|
|
549
|
-
allowedNumberOfFiles,
|
|
550
|
-
" filer, ",
|
|
551
|
-
formatFileSize(maxFileSize),
|
|
552
|
-
" per fil, ",
|
|
553
|
-
formatFileSize(allowedTotalFileSize),
|
|
554
|
-
" totalt"
|
|
555
|
-
] }),
|
|
556
|
-
allowedFileTypes.length > 0 && !allowedFileTypes.includes("*") && /* @__PURE__ */ jsxs5("p", { className: "files-allowed-types", children: [
|
|
557
|
-
/* @__PURE__ */ jsx5("strong", { children: "Till\xE5tna filtyper:" }),
|
|
558
|
-
" ",
|
|
559
|
-
allowedFileTypes.map(
|
|
560
|
-
(type) => type.startsWith(".") ? type : `.${type}`
|
|
561
|
-
).join(", ")
|
|
562
|
-
] })
|
|
563
|
-
] }),
|
|
564
|
-
/* @__PURE__ */ jsx5(
|
|
565
|
-
"input",
|
|
566
|
-
{
|
|
567
|
-
ref: fileInputRef,
|
|
568
|
-
type: "file",
|
|
569
|
-
multiple,
|
|
570
|
-
accept: allowedFileTypes.join(","),
|
|
571
|
-
onChange: handleFileInput,
|
|
572
|
-
className: "files-input-hidden"
|
|
573
|
-
}
|
|
574
|
-
)
|
|
575
|
-
]
|
|
576
|
-
}
|
|
577
|
-
),
|
|
578
|
-
selectedFiles.length > 0 && /* @__PURE__ */ jsx5("div", { className: "files-summary", children: /* @__PURE__ */ jsxs5("div", { className: "files-summary-stats", children: [
|
|
579
|
-
/* @__PURE__ */ jsxs5("span", { className: "stat", children: [
|
|
580
|
-
"\u{1F4C1} ",
|
|
581
|
-
/* @__PURE__ */ jsx5("strong", { children: selectedFiles.length }),
|
|
582
|
-
" filer totalt"
|
|
583
|
-
] }),
|
|
584
|
-
/* @__PURE__ */ jsxs5("span", { className: "stat", children: [
|
|
585
|
-
"\u{1F4BE} ",
|
|
586
|
-
/* @__PURE__ */ jsx5("strong", { children: formatFileSize(getTotalFileSize()) }),
|
|
587
|
-
" / ",
|
|
588
|
-
formatFileSize(allowedTotalFileSize)
|
|
589
|
-
] })
|
|
590
|
-
] }) }),
|
|
591
|
-
selectedFiles.length > 0 && /* @__PURE__ */ jsxs5("div", { className: "files-list", children: [
|
|
592
|
-
/* @__PURE__ */ jsxs5("h4", { children: [
|
|
593
|
-
"Filer (",
|
|
594
|
-
selectedFiles.length,
|
|
595
|
-
")"
|
|
596
|
-
] }),
|
|
597
|
-
/* @__PURE__ */ jsx5("ul", { className: "files-items", children: selectedFiles.map((selectedFile) => /* @__PURE__ */ jsxs5("li", { className: "file-item", children: [
|
|
598
|
-
/* @__PURE__ */ jsx5("div", { className: "file-icon-status", children: "\u{1F4C1}" }),
|
|
599
|
-
/* @__PURE__ */ jsxs5("div", { className: "file-info", children: [
|
|
600
|
-
/* @__PURE__ */ jsx5("div", { className: "file-name", children: selectedFile.file.name }),
|
|
601
|
-
/* @__PURE__ */ jsx5("div", { className: "file-details", children: /* @__PURE__ */ jsx5("span", { className: "file-size", children: formatFileSize(selectedFile.file.size) }) })
|
|
564
|
+
return /* @__PURE__ */ jsx5(Fragment5, { children: !showPreview && question.visible && /* @__PURE__ */ jsxs5(
|
|
565
|
+
"div",
|
|
566
|
+
{
|
|
567
|
+
id: questionId,
|
|
568
|
+
className: `pts-root-question pts-textArea-container${question.aboutText ? " pts-question-hasAbout" : ""}`,
|
|
569
|
+
children: [
|
|
570
|
+
/* @__PURE__ */ jsxs5("label", { htmlFor: inputId, children: [
|
|
571
|
+
question.questionLabel,
|
|
572
|
+
" ",
|
|
573
|
+
question.isQuestionMandatory && /* @__PURE__ */ jsx5("span", { className: "pts-root-mandatoryAsterisk", "aria-hidden": "true", children: "*" })
|
|
602
574
|
] }),
|
|
603
|
-
|
|
604
|
-
"
|
|
575
|
+
question.aboutText && /* @__PURE__ */ jsx5(
|
|
576
|
+
"div",
|
|
605
577
|
{
|
|
606
|
-
className: "
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
children: "\u2715"
|
|
578
|
+
className: "pts-about",
|
|
579
|
+
dangerouslySetInnerHTML: {
|
|
580
|
+
__html: DOMPurify3.sanitize(question.aboutText)
|
|
581
|
+
}
|
|
611
582
|
}
|
|
612
|
-
)
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
583
|
+
),
|
|
584
|
+
/* @__PURE__ */ jsxs5(
|
|
585
|
+
"div",
|
|
586
|
+
{
|
|
587
|
+
className: clsx("files-drop-zone", { "drag-active": dragActive }),
|
|
588
|
+
onDrop: handleDrop,
|
|
589
|
+
onDragOver: handleDragOver,
|
|
590
|
+
onDragLeave: handleDragLeave,
|
|
591
|
+
onClick: openFileDialog,
|
|
592
|
+
onKeyDown: (e) => {
|
|
593
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
594
|
+
e.preventDefault();
|
|
595
|
+
openFileDialog();
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
tabIndex: 0,
|
|
599
|
+
role: "button",
|
|
600
|
+
"aria-label": "V\xE4lj filer att ladda upp",
|
|
601
|
+
children: [
|
|
602
|
+
/* @__PURE__ */ jsxs5("div", { className: "files-drop-content", children: [
|
|
603
|
+
/* @__PURE__ */ jsx5("div", { className: "files-icon", children: /* @__PURE__ */ jsxs5(
|
|
604
|
+
"svg",
|
|
605
|
+
{
|
|
606
|
+
"aria-hidden": "true",
|
|
607
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
608
|
+
width: "72",
|
|
609
|
+
height: "48",
|
|
610
|
+
viewBox: "0 0 72 48",
|
|
611
|
+
fill: "none",
|
|
612
|
+
children: [
|
|
613
|
+
/* @__PURE__ */ jsx5("g", { clipPath: "url(#clip0_247_596)", children: /* @__PURE__ */ jsx5(
|
|
614
|
+
"path",
|
|
615
|
+
{
|
|
616
|
+
d: "M66.6084 23.0844C64.6397 21.6247 62.2209 20.5531 59.6672 19.9752C59.2479 19.8808 58.8641 19.6692 58.5605 19.3649C58.257 19.0606 58.0463 18.6763 57.953 18.2567C56.8561 13.37 54.495 9.1794 51.0244 6.00409C46.9898 2.30706 41.6545 0.273621 36 0.273621C31.0289 0.273621 26.4375 1.83174 22.7292 4.78065C20.216 6.78238 18.193 9.33154 16.8145 12.2338C16.6651 12.5513 16.4434 12.8295 16.1672 13.0461C15.8911 13.2627 15.5681 13.4117 15.2241 13.4811C11.4623 14.2405 8.06625 15.8535 5.47312 18.1386C1.89281 21.3027 0 25.5088 0 30.3111C0 35.1655 2.03766 39.5924 5.73609 42.793C9.26859 45.8431 14.0245 47.5236 19.125 47.5236H33.75V25.956L28.5905 31.1155C28.3751 31.3309 28.1182 31.5003 27.8354 31.6134C27.5525 31.7266 27.2497 31.7811 26.9452 31.7738C26.6406 31.7664 26.3408 31.6973 26.0638 31.5706C25.7867 31.4439 25.5383 31.2623 25.3336 31.0367C24.518 30.141 24.5967 28.7446 25.4531 27.8881L34.4095 18.9331C34.8314 18.5115 35.4035 18.2747 36 18.2747C36.5965 18.2747 37.1686 18.5115 37.5905 18.9331L46.5469 27.8853C47.43 28.7699 47.4806 30.2197 46.6017 31.107C46.3932 31.3176 46.1451 31.485 45.8718 31.5994C45.5984 31.7139 45.3051 31.7732 45.0088 31.774C44.7124 31.7748 44.4188 31.717 44.1449 31.604C43.8709 31.491 43.622 31.325 43.4123 31.1155L38.25 25.956V47.5236H55.6875C60.0947 47.5236 64.1124 46.2861 67.0008 44.0403C70.2717 41.495 72 37.8528 72 33.5174C72 29.3071 70.1353 25.6972 66.6084 23.0844Z",
|
|
617
|
+
fill: "#6E3282"
|
|
618
|
+
}
|
|
619
|
+
) }),
|
|
620
|
+
/* @__PURE__ */ jsx5("defs", { children: /* @__PURE__ */ jsx5("clipPath", { id: "clip0_247_596", children: /* @__PURE__ */ jsx5(
|
|
621
|
+
"rect",
|
|
622
|
+
{
|
|
623
|
+
width: "72",
|
|
624
|
+
height: "47.1064",
|
|
625
|
+
fill: "white",
|
|
626
|
+
transform: "translate(0 0.446777)"
|
|
627
|
+
}
|
|
628
|
+
) }) })
|
|
629
|
+
]
|
|
630
|
+
}
|
|
631
|
+
) }),
|
|
632
|
+
/* @__PURE__ */ jsx5("p", { className: "files-drop-text", children: "Dra och sl\xE4pp filer h\xE4r eller klicka f\xF6r att v\xE4lja" }),
|
|
633
|
+
/* @__PURE__ */ jsx5("p", { className: "files-drop-info" }),
|
|
634
|
+
/* @__PURE__ */ jsxs5("p", { className: "files-drop-info", children: [
|
|
635
|
+
"Max ",
|
|
636
|
+
allowedNumberOfFiles,
|
|
637
|
+
" filer, ",
|
|
638
|
+
formatFileSize(maxFileSize),
|
|
639
|
+
" per fil,",
|
|
640
|
+
" ",
|
|
641
|
+
formatFileSize(allowedTotalFileSize),
|
|
642
|
+
" totalt"
|
|
643
|
+
] }),
|
|
644
|
+
allowedFileTypes.length > 0 && !allowedFileTypes.includes("*") && /* @__PURE__ */ jsxs5("p", { className: "files-allowed-types", children: [
|
|
645
|
+
/* @__PURE__ */ jsx5("strong", { children: "Till\xE5tna filtyper:" }),
|
|
646
|
+
" ",
|
|
647
|
+
allowedFileTypes.map((type) => type.startsWith(".") ? type : `.${type}`).join(", ")
|
|
648
|
+
] })
|
|
649
|
+
] }),
|
|
650
|
+
/* @__PURE__ */ jsx5(
|
|
651
|
+
"input",
|
|
652
|
+
{
|
|
653
|
+
ref: fileInputRef,
|
|
654
|
+
type: "file",
|
|
655
|
+
multiple,
|
|
656
|
+
accept: allowedFileTypes.join(","),
|
|
657
|
+
onChange: handleFileInput,
|
|
658
|
+
className: "files-input-hidden",
|
|
659
|
+
name: `question-name-${question.id}`,
|
|
660
|
+
disabled: (_a = question.questionExtraAttribute) == null ? void 0 : _a.disabled,
|
|
661
|
+
required: question.isQuestionMandatory,
|
|
662
|
+
"aria-required": question.isQuestionMandatory,
|
|
663
|
+
"aria-describedby": `${question.aboutText ? aboutId : ""} ${question.hasValidationError ? errorId : ""}`.trim(),
|
|
664
|
+
"aria-invalid": question.hasValidationError,
|
|
665
|
+
"aria-errormessage": question.hasValidationError ? errorId : void 0
|
|
666
|
+
}
|
|
667
|
+
)
|
|
668
|
+
]
|
|
669
|
+
}
|
|
670
|
+
),
|
|
671
|
+
selectedFiles.length > 0 && /* @__PURE__ */ jsxs5("div", { className: "files-list", children: [
|
|
672
|
+
/* @__PURE__ */ jsxs5("h4", { children: [
|
|
673
|
+
"Filer (",
|
|
674
|
+
selectedFiles.length,
|
|
675
|
+
")"
|
|
676
|
+
] }),
|
|
677
|
+
/* @__PURE__ */ jsx5("ul", { className: "files-items", children: selectedFiles.map((selectedFile) => /* @__PURE__ */ jsxs5("li", { className: "file-item", children: [
|
|
678
|
+
/* @__PURE__ */ jsxs5("div", { className: "file-info", children: [
|
|
679
|
+
/* @__PURE__ */ jsx5("div", { className: "file-name", children: selectedFile.file.name }),
|
|
680
|
+
/* @__PURE__ */ jsx5("div", { className: "file-details", children: /* @__PURE__ */ jsx5("span", { className: "file-size", children: formatFileSize(selectedFile.file.size) }) })
|
|
681
|
+
] }),
|
|
682
|
+
/* @__PURE__ */ jsx5("div", { className: "file-actions", children: /* @__PURE__ */ jsx5(
|
|
683
|
+
"button",
|
|
684
|
+
{
|
|
685
|
+
className: "action-btn remove",
|
|
686
|
+
onClick: () => removeFile(selectedFile.id),
|
|
687
|
+
type: "button",
|
|
688
|
+
title: "Ta bort fil",
|
|
689
|
+
children: "Radera"
|
|
690
|
+
}
|
|
691
|
+
) })
|
|
692
|
+
] }, selectedFile.id)) })
|
|
693
|
+
] })
|
|
694
|
+
]
|
|
695
|
+
}
|
|
696
|
+
) });
|
|
616
697
|
};
|
|
617
698
|
var FilesUploadStandard_default = FilesUpload;
|
|
618
699
|
|
|
@@ -829,7 +910,7 @@ function groupQuestionsByStepCategoryGroup(questions, steps, validationErrorsLis
|
|
|
829
910
|
var GroupQuestionsByStepCategoryGroup_default = groupQuestionsByStepCategoryGroup;
|
|
830
911
|
|
|
831
912
|
// src/NewRenderFormComponentStandard/RenderQuestion/RenderQuestion.tsx
|
|
832
|
-
import { Fragment as
|
|
913
|
+
import { Fragment as Fragment6, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
833
914
|
var RenderQuestion = ({
|
|
834
915
|
question,
|
|
835
916
|
isTouched,
|
|
@@ -837,7 +918,7 @@ var RenderQuestion = ({
|
|
|
837
918
|
showPreview = false,
|
|
838
919
|
hideValidationMessage
|
|
839
920
|
}) => {
|
|
840
|
-
return /* @__PURE__ */ jsxs6(
|
|
921
|
+
return /* @__PURE__ */ jsxs6(Fragment6, { children: [
|
|
841
922
|
question.questionType === "Radio" && /* @__PURE__ */ jsx6(
|
|
842
923
|
RadioMultipleStandard_default,
|
|
843
924
|
{
|
|
@@ -881,7 +962,7 @@ var RenderQuestion_default = RenderQuestion;
|
|
|
881
962
|
|
|
882
963
|
// src/NewRenderFormComponentStandard/RenderQuestionGroup/RenderQuestionGroup.tsx
|
|
883
964
|
import React2 from "react";
|
|
884
|
-
import { Fragment as
|
|
965
|
+
import { Fragment as Fragment7, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
885
966
|
var RenderQuestionGroup = ({
|
|
886
967
|
questionArray,
|
|
887
968
|
wrapper,
|
|
@@ -899,7 +980,7 @@ var RenderQuestionGroup = ({
|
|
|
899
980
|
}
|
|
900
981
|
});
|
|
901
982
|
}, [questionArray]);
|
|
902
|
-
const questions = /* @__PURE__ */ jsx7(
|
|
983
|
+
const questions = /* @__PURE__ */ jsx7(Fragment7, { children: questionArray.map((question, index) => {
|
|
903
984
|
return /* @__PURE__ */ jsx7(React2.Fragment, { children: /* @__PURE__ */ jsx7(
|
|
904
985
|
RenderQuestion_default,
|
|
905
986
|
{
|
|
@@ -1549,9 +1630,9 @@ var HeaderStandard_default = Header;
|
|
|
1549
1630
|
|
|
1550
1631
|
// src/NewTextComponentStandard/InfoOnlyStandard/InfoOnlyStandard.tsx
|
|
1551
1632
|
import { useEffect as useEffect3 } from "react";
|
|
1552
|
-
import
|
|
1553
|
-
import { Fragment as
|
|
1554
|
-
var cleanText = (text) =>
|
|
1633
|
+
import DOMPurify4 from "dompurify";
|
|
1634
|
+
import { Fragment as Fragment8, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1635
|
+
var cleanText = (text) => DOMPurify4.sanitize(text, { ADD_ATTR: ["target", "class"] });
|
|
1555
1636
|
var InfoOnly = ({
|
|
1556
1637
|
questionObject,
|
|
1557
1638
|
isTouched,
|
|
@@ -1570,7 +1651,7 @@ var InfoOnly = ({
|
|
|
1570
1651
|
const e = { target: { value: questionObject2.questionLabel + avoidBugInRedux } };
|
|
1571
1652
|
isTouched(e, questionObject2);
|
|
1572
1653
|
};
|
|
1573
|
-
return /* @__PURE__ */ jsxs12(
|
|
1654
|
+
return /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
1574
1655
|
showConfigure && visible && /* @__PURE__ */ jsx12("div", { className: "pts-infoOnly-container", children: /* @__PURE__ */ jsx12("div", { className: "InfoOnlyText", tabIndex, children: questionObject.questionLabel && /* @__PURE__ */ jsx12(
|
|
1575
1656
|
"p",
|
|
1576
1657
|
{
|
|
@@ -1584,7 +1665,7 @@ var InfoOnly = ({
|
|
|
1584
1665
|
};
|
|
1585
1666
|
var InfoOnlyStandard_default = InfoOnly;
|
|
1586
1667
|
var PreviewInfoOnly = ({ questionObject }) => {
|
|
1587
|
-
return /* @__PURE__ */ jsx12(
|
|
1668
|
+
return /* @__PURE__ */ jsx12(Fragment8, { children: questionObject.answer && /* @__PURE__ */ jsx12("div", { className: "pts-infoOnly-preview", children: /* @__PURE__ */ jsx12("div", { className: "InfoOnlyText", children: /* @__PURE__ */ jsx12(
|
|
1588
1669
|
"p",
|
|
1589
1670
|
{
|
|
1590
1671
|
dangerouslySetInnerHTML: {
|
|
@@ -1618,13 +1699,13 @@ var Modal = ({ showModal: isOpen, activatedLanguage = "" }) => {
|
|
|
1618
1699
|
var ModalStandard_default = Modal;
|
|
1619
1700
|
|
|
1620
1701
|
// src/NewTextComponentStandard/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
|
|
1621
|
-
import
|
|
1702
|
+
import DOMPurify5 from "dompurify";
|
|
1622
1703
|
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1623
1704
|
var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
1624
1705
|
const HeadlineTag = headlineType;
|
|
1625
1706
|
return /* @__PURE__ */ jsxs14("section", { className: "pts-textHeadlineAndBody-container", children: [
|
|
1626
1707
|
data.headline && /* @__PURE__ */ jsx14(HeadlineTag, { children: data.headline }),
|
|
1627
|
-
data.body && /* @__PURE__ */ jsx14("div", { dangerouslySetInnerHTML: { __html:
|
|
1708
|
+
data.body && /* @__PURE__ */ jsx14("div", { dangerouslySetInnerHTML: { __html: DOMPurify5.sanitize(data.body) } }),
|
|
1628
1709
|
data.linksForMoreInfo && data.linksForMoreInfo.length > 0 && /* @__PURE__ */ jsx14("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ jsx14("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ jsxs14("a", { href: link.url, target: "_blank", rel: "noopener noreferrer", "aria-label": link.ariaLabel, children: [
|
|
1629
1710
|
/* @__PURE__ */ jsx14("span", { className: "MoreInfoIcon", children: /* @__PURE__ */ jsx14(
|
|
1630
1711
|
"svg",
|
|
@@ -1705,12 +1786,12 @@ var PrincipleOfPublicity = ({ activatedLanguage = "" }) => {
|
|
|
1705
1786
|
var PrincipleOfPublicityStandard_default = PrincipleOfPublicity;
|
|
1706
1787
|
|
|
1707
1788
|
// src/NewTextComponentStandard/ServiceHeadlineAndBodyStandard/ServiceHeadlineAndBodyStandard.tsx
|
|
1708
|
-
import
|
|
1789
|
+
import DOMPurify6 from "dompurify";
|
|
1709
1790
|
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1710
1791
|
var ServiceHeadlineAndBody = ({ data, activeStep = 1 }) => {
|
|
1711
1792
|
return /* @__PURE__ */ jsxs15("div", { className: "pts-serviceHeadlineAndBody-container", children: [
|
|
1712
1793
|
data.mainHeadline && /* @__PURE__ */ jsx16("h1", { id: "pts-main-service-headline", children: data.mainHeadline }),
|
|
1713
|
-
activeStep === 1 && data.ingressBody && /* @__PURE__ */ jsx16("div", { dangerouslySetInnerHTML: { __html:
|
|
1794
|
+
activeStep === 1 && data.ingressBody && /* @__PURE__ */ jsx16("div", { dangerouslySetInnerHTML: { __html: DOMPurify6.sanitize(data.ingressBody) } }),
|
|
1714
1795
|
activeStep === 1 && data.linksForMoreInfo && data.linksForMoreInfo.length > 0 && /* @__PURE__ */ jsx16("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((moreInfo, index) => /* @__PURE__ */ jsx16("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ jsxs15("a", { href: moreInfo.url, target: "_blank", rel: "noopener noreferrer", children: [
|
|
1715
1796
|
/* @__PURE__ */ jsx16(
|
|
1716
1797
|
"svg",
|