optimized-react-component-library-xyz123 0.22.1 → 0.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +160 -162
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +160 -162
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/css/darkMode.css +0 -5
- package/src/css/questions.css +1 -0
package/dist/index.mjs
CHANGED
|
@@ -9,46 +9,63 @@ var InputRadio = ({
|
|
|
9
9
|
const questionId = `question-${question.id}`;
|
|
10
10
|
const groupId = `radio-group-${question.id}`;
|
|
11
11
|
const errorId = `error-${question.id}`;
|
|
12
|
+
let optionsInfoText = [];
|
|
13
|
+
const languageObj = question.languageSupport[0];
|
|
14
|
+
if ("optionsInfoText" in languageObj) {
|
|
15
|
+
optionsInfoText.push(languageObj.optionsInfoText);
|
|
16
|
+
console.log(languageObj.optionsInfoText);
|
|
17
|
+
}
|
|
12
18
|
const handleInputChange = (event) => {
|
|
13
19
|
const e = { target: { value: event.target.value } };
|
|
14
20
|
handleQuestionInputChange(e, question);
|
|
15
21
|
};
|
|
16
22
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17
|
-
!showPreview && question.visible && /* @__PURE__ */
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
23
|
+
!showPreview && question.visible && /* @__PURE__ */ jsxs("div", { className: "pts-root-question pts-radioMultiple-container", id: questionId, children: [
|
|
24
|
+
/* @__PURE__ */ jsxs(
|
|
25
|
+
"fieldset",
|
|
26
|
+
{
|
|
27
|
+
"aria-required": question.isQuestionMandatory,
|
|
28
|
+
"aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
|
|
29
|
+
"aria-errormessage": question.hasValidationError ? errorId : void 0,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("legend", { id: `label-${groupId}`, children: [
|
|
32
|
+
question.questionLabel,
|
|
33
|
+
" ",
|
|
34
|
+
question.isQuestionMandatory && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" })
|
|
35
|
+
] }),
|
|
36
|
+
(_a = question.options) == null ? void 0 : _a.map((option, index) => /* @__PURE__ */ jsxs("div", { className: "pts-radio-option", children: [
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
38
|
+
"input",
|
|
39
|
+
{
|
|
40
|
+
type: "radio",
|
|
41
|
+
name: `name-${question.id}`,
|
|
42
|
+
id: `${groupId}-option-${index}`,
|
|
43
|
+
value: option.value,
|
|
44
|
+
checked: question.answer === option.value,
|
|
45
|
+
onChange: handleInputChange,
|
|
46
|
+
"aria-describedby": "about_" + option.value
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ jsx("label", { htmlFor: `${groupId}-option-${index}`, children: option.label }),
|
|
50
|
+
" "
|
|
51
|
+
] }, index)),
|
|
52
|
+
question.hasValidationError && /* @__PURE__ */ jsxs("div", { className: "pts-root-error", id: errorId, children: [
|
|
53
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
54
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
55
|
+
/* @__PURE__ */ jsx("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
56
|
+
] })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
id: "textinfo-option3",
|
|
64
|
+
"aria-live": "polite",
|
|
65
|
+
"aria-atomic": "true"
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
] }),
|
|
52
69
|
showPreview && /* @__PURE__ */ jsx(PreviewRadio, { question })
|
|
53
70
|
] });
|
|
54
71
|
};
|
|
@@ -251,11 +268,6 @@ var InputTextarea = ({
|
|
|
251
268
|
const aboutId = `about-${question.id}`;
|
|
252
269
|
const errorId = `error-${question.id}`;
|
|
253
270
|
const defaultMaxLength = 1e3;
|
|
254
|
-
const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
255
|
-
const maxLength = (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.answerMaxLength) != null ? _d : defaultMaxLength;
|
|
256
|
-
const isTooLong = answerLength > maxLength;
|
|
257
|
-
const counterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
|
|
258
|
-
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r max vara ${maxLength} tecken`;
|
|
259
271
|
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
260
272
|
!showPreview && question.visible && /* @__PURE__ */ jsxs4(
|
|
261
273
|
"div",
|
|
@@ -287,20 +299,29 @@ var InputTextarea = ({
|
|
|
287
299
|
required: question.isQuestionMandatory,
|
|
288
300
|
"aria-required": question.isQuestionMandatory,
|
|
289
301
|
"aria-invalid": question.hasValidationError,
|
|
302
|
+
maxLength: ((_a = question.questionExtraAttribute) == null ? void 0 : _a.answerMaxLength) || defaultMaxLength,
|
|
290
303
|
"aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
|
|
291
304
|
id: inputId
|
|
292
305
|
}
|
|
293
306
|
),
|
|
294
307
|
/* @__PURE__ */ jsxs4("div", { className: "pts-textarea-counter-error-container", children: [
|
|
295
|
-
|
|
308
|
+
question.hasValidationError && /* @__PURE__ */ jsxs4("div", { className: "pts-root-error", id: errorId, children: [
|
|
296
309
|
/* @__PURE__ */ jsx4("span", { "aria-label": "Felmeddelande.", className: "errorDot", children: "!" }),
|
|
297
310
|
/* @__PURE__ */ jsx4("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
298
311
|
] }),
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
312
|
+
!((_b = question.questionExtraAttribute) == null ? void 0 : _b.hideTextCounter) && /* @__PURE__ */ jsxs4(
|
|
313
|
+
"div",
|
|
314
|
+
{
|
|
315
|
+
className: `pts-character-counter ${question.answer && (((_c = question.questionExtraAttribute) == null ? void 0 : _c.answerMaxLength) || defaultMaxLength) && question.answer.length > (((_d = question.questionExtraAttribute) == null ? void 0 : _d.answerMaxLength) || defaultMaxLength) ? "error" : ""}`,
|
|
316
|
+
children: [
|
|
317
|
+
question.answer ? question.answer.length : 0,
|
|
318
|
+
" av",
|
|
319
|
+
" ",
|
|
320
|
+
((_e = question.questionExtraAttribute) == null ? void 0 : _e.answerMaxLength) || defaultMaxLength,
|
|
321
|
+
" tecken"
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
)
|
|
304
325
|
] })
|
|
305
326
|
]
|
|
306
327
|
}
|
|
@@ -337,21 +358,18 @@ var TextFieldStandard = ({
|
|
|
337
358
|
showPreview = false,
|
|
338
359
|
activatedLanguage
|
|
339
360
|
}) => {
|
|
340
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m
|
|
361
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
341
362
|
const questionId = `question-${question.id}`;
|
|
342
363
|
const inputId = `textField-${question.id}`;
|
|
343
364
|
const aboutId = `about-${question.id}`;
|
|
344
365
|
const errorId = `error-${question.id}`;
|
|
345
|
-
const
|
|
346
|
-
const maxLength = 100;
|
|
347
|
-
const isTooLong = answerLength > maxLength;
|
|
348
|
-
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r max vara ${maxLength} tecken`;
|
|
366
|
+
const defaultMaxLength = 1e3;
|
|
349
367
|
return /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
350
368
|
!showPreview && question.visible && /* @__PURE__ */ jsxs5(
|
|
351
369
|
"div",
|
|
352
370
|
{
|
|
353
371
|
id: questionId,
|
|
354
|
-
className: `pts-root-question pts-textField-container${((
|
|
372
|
+
className: `pts-root-question pts-textField-container${((_a = question.questionExtraAttribute) == null ? void 0 : _a.disabled) ? " pts-textField-disabled" : ""}${question.aboutText ? " pts-question-hasAbout" : ""}`.trim(),
|
|
355
373
|
children: [
|
|
356
374
|
/* @__PURE__ */ jsxs5("label", { htmlFor: inputId, children: [
|
|
357
375
|
question.questionLabel,
|
|
@@ -371,33 +389,29 @@ var TextFieldStandard = ({
|
|
|
371
389
|
/* @__PURE__ */ jsx5(
|
|
372
390
|
"input",
|
|
373
391
|
{
|
|
374
|
-
type: (
|
|
375
|
-
autoComplete: (
|
|
376
|
-
inputMode: (
|
|
392
|
+
type: (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.inputType) != null ? _c : "text",
|
|
393
|
+
autoComplete: (_e = (_d = question.questionExtraAttribute) == null ? void 0 : _d.autoComplete) != null ? _e : void 0,
|
|
394
|
+
inputMode: (_g = (_f = question.questionExtraAttribute) == null ? void 0 : _f.inputMode) != null ? _g : void 0,
|
|
377
395
|
name: `question-name-${question.id}`,
|
|
378
396
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
379
397
|
onChange: (e) => handleQuestionInputChange(e, question),
|
|
380
398
|
value: question.answer,
|
|
399
|
+
maxLength: ((_h = question.questionExtraAttribute) == null ? void 0 : _h.answerMaxLength) || defaultMaxLength,
|
|
381
400
|
id: inputId,
|
|
382
|
-
disabled: (
|
|
401
|
+
disabled: (_i = question.questionExtraAttribute) == null ? void 0 : _i.disabled,
|
|
383
402
|
required: question.isQuestionMandatory,
|
|
384
403
|
"aria-required": question.isQuestionMandatory,
|
|
385
404
|
"aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
|
|
386
405
|
"aria-invalid": question.hasValidationError,
|
|
387
406
|
"aria-errormessage": question.hasValidationError ? errorId : void 0,
|
|
388
|
-
spellCheck: (
|
|
389
|
-
autoCapitalize: (
|
|
407
|
+
spellCheck: (_k = (_j = question.questionExtraAttribute) == null ? void 0 : _j.spellCheck) != null ? _k : void 0,
|
|
408
|
+
autoCapitalize: (_m = (_l = question.questionExtraAttribute) == null ? void 0 : _l.autoCapitalize) != null ? _m : void 0
|
|
390
409
|
}
|
|
391
410
|
),
|
|
392
|
-
|
|
411
|
+
question.hasValidationError && /* @__PURE__ */ jsxs5("div", { className: "pts-root-error", id: errorId, children: [
|
|
393
412
|
/* @__PURE__ */ jsx5("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
394
413
|
/* @__PURE__ */ jsx5("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
395
414
|
/* @__PURE__ */ jsx5("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
396
|
-
] }),
|
|
397
|
-
isTooLong && question.hasValidationError && /* @__PURE__ */ jsxs5("div", { className: "pts-root-error", id: errorId, children: [
|
|
398
|
-
/* @__PURE__ */ jsx5("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
399
|
-
/* @__PURE__ */ jsx5("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
400
|
-
/* @__PURE__ */ jsx5("span", { className: "errorText", children: maxLengthErrorText })
|
|
401
415
|
] })
|
|
402
416
|
]
|
|
403
417
|
}
|
|
@@ -623,12 +637,14 @@ var SelectedFiles = ({
|
|
|
623
637
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
624
638
|
const newCountOfFiles = newFiles.length;
|
|
625
639
|
setNumberOfFiles(newCountOfFiles);
|
|
626
|
-
|
|
627
|
-
const targetValue = e.target.value === "0 files" ? "" : e.target.value;
|
|
628
|
-
e = { ...e, target: { ...e.target, value: targetValue } };
|
|
640
|
+
const e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
|
|
629
641
|
isTouched(e, questionObject);
|
|
630
642
|
removeFile(newCountOfFiles);
|
|
631
643
|
};
|
|
644
|
+
useEffect4(() => {
|
|
645
|
+
var _a;
|
|
646
|
+
numberOfFiles > 0 && ((_a = theDiv.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "end" }));
|
|
647
|
+
}, [numberOfFiles]);
|
|
632
648
|
const useWindowWidth = () => {
|
|
633
649
|
const [windowWidth2, setWindowWidth] = useState4(window.innerWidth);
|
|
634
650
|
useEffect4(() => {
|
|
@@ -911,7 +927,7 @@ var AddFiles = ({
|
|
|
911
927
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
912
928
|
const e = {
|
|
913
929
|
target: {
|
|
914
|
-
value:
|
|
930
|
+
value: `${currentFiles.length + newFiles.length} files`,
|
|
915
931
|
files: [...currentFiles, ...newFiles]
|
|
916
932
|
}
|
|
917
933
|
};
|
|
@@ -934,75 +950,68 @@ var AddFiles = ({
|
|
|
934
950
|
setErrorMessageAddingFile([]);
|
|
935
951
|
};
|
|
936
952
|
return /* @__PURE__ */ jsxs9(Fragment11, { children: [
|
|
937
|
-
!showPreview && visible && /* @__PURE__ */ jsx11(
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
"
|
|
945
|
-
{
|
|
946
|
-
id: aboutId,
|
|
947
|
-
className: clsx3(
|
|
948
|
-
"addFilesMandatory",
|
|
949
|
-
questionObject.hasValidationError ? " error" : ""
|
|
950
|
-
),
|
|
951
|
-
children: [
|
|
952
|
-
questionObject.aboutText,
|
|
953
|
-
questionObject.isQuestionMandatory && /* @__PURE__ */ jsxs9("span", { className: "pts-root-mandatoryAsterisk", "aria-label": "Obligatorisk fr\xE5ga", children: [
|
|
954
|
-
" ",
|
|
955
|
-
"*"
|
|
956
|
-
] })
|
|
957
|
-
]
|
|
958
|
-
}
|
|
959
|
-
),
|
|
960
|
-
questionObject.hasValidationError && /* @__PURE__ */ jsxs9("div", { className: "pts-root-error error addfileserror", id: errorId, children: [
|
|
961
|
-
/* @__PURE__ */ jsx11("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
962
|
-
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
963
|
-
/* @__PURE__ */ jsx11("span", { className: "errorText", children: questionObject.validationDefaultMessesege })
|
|
964
|
-
] }),
|
|
965
|
-
/* @__PURE__ */ jsx11(
|
|
966
|
-
ExploreFilesStandard_default,
|
|
967
|
-
{
|
|
968
|
-
FilesSelected: onDrop,
|
|
969
|
-
numberOfFiles,
|
|
970
|
-
allowedNumberOfFiles,
|
|
971
|
-
activatedLanguage,
|
|
972
|
-
inputId,
|
|
973
|
-
labelId,
|
|
974
|
-
aboutId,
|
|
975
|
-
errorId,
|
|
976
|
-
questionObject,
|
|
977
|
-
errorMessageAddingFile,
|
|
978
|
-
removeUploadErrors: handleRemoveErrors
|
|
979
|
-
}
|
|
980
|
-
),
|
|
981
|
-
/* @__PURE__ */ jsx11(
|
|
982
|
-
DropFilesStandard_default,
|
|
983
|
-
{
|
|
984
|
-
FilesSelected: onDrop,
|
|
985
|
-
DropFilesText: dropFilesText,
|
|
986
|
-
language: activatedLanguage
|
|
987
|
-
}
|
|
953
|
+
!showPreview && visible && /* @__PURE__ */ jsx11("div", { className: "root-question addFile-question-container", id: `question-${questionObject.id}`, children: /* @__PURE__ */ jsxs9("div", { role: "group", children: [
|
|
954
|
+
questionObject.aboutText && /* @__PURE__ */ jsxs9(
|
|
955
|
+
"p",
|
|
956
|
+
{
|
|
957
|
+
id: aboutId,
|
|
958
|
+
className: clsx3(
|
|
959
|
+
"addFilesMandatory",
|
|
960
|
+
questionObject.hasValidationError ? " error" : ""
|
|
988
961
|
),
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
{
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
962
|
+
children: [
|
|
963
|
+
questionObject.aboutText,
|
|
964
|
+
questionObject.isQuestionMandatory && /* @__PURE__ */ jsxs9("span", { className: "pts-root-mandatoryAsterisk", "aria-label": "Obligatorisk fr\xE5ga", children: [
|
|
965
|
+
" ",
|
|
966
|
+
"*"
|
|
967
|
+
] })
|
|
968
|
+
]
|
|
969
|
+
}
|
|
970
|
+
),
|
|
971
|
+
questionObject.hasValidationError && /* @__PURE__ */ jsxs9("div", { className: "pts-root-error error addfileserror", id: errorId, children: [
|
|
972
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
973
|
+
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
974
|
+
/* @__PURE__ */ jsx11("span", { className: "errorText", children: questionObject.validationDefaultMessesege })
|
|
975
|
+
] }),
|
|
976
|
+
/* @__PURE__ */ jsx11(
|
|
977
|
+
ExploreFilesStandard_default,
|
|
978
|
+
{
|
|
979
|
+
FilesSelected: onDrop,
|
|
980
|
+
numberOfFiles,
|
|
981
|
+
allowedNumberOfFiles,
|
|
982
|
+
activatedLanguage,
|
|
983
|
+
inputId,
|
|
984
|
+
labelId,
|
|
985
|
+
aboutId,
|
|
986
|
+
errorId,
|
|
987
|
+
questionObject,
|
|
988
|
+
errorMessageAddingFile,
|
|
989
|
+
removeUploadErrors: handleRemoveErrors
|
|
990
|
+
}
|
|
991
|
+
),
|
|
992
|
+
/* @__PURE__ */ jsx11(
|
|
993
|
+
DropFilesStandard_default,
|
|
994
|
+
{
|
|
995
|
+
FilesSelected: onDrop,
|
|
996
|
+
DropFilesText: dropFilesText,
|
|
997
|
+
language: activatedLanguage
|
|
998
|
+
}
|
|
999
|
+
),
|
|
1000
|
+
/* @__PURE__ */ jsx11(
|
|
1001
|
+
SelectedFilesStandard_default,
|
|
1002
|
+
{
|
|
1003
|
+
questionObject,
|
|
1004
|
+
isTouched: handleQuestionInputChange,
|
|
1005
|
+
removeFile: removeFileFromNumberOfFiles,
|
|
1006
|
+
removeError,
|
|
1007
|
+
errorMessageAddingFile,
|
|
1008
|
+
activatedLanguage,
|
|
1009
|
+
numberOfFiles,
|
|
1010
|
+
setNumberOfFiles,
|
|
1011
|
+
removeUploadErrors: handleRemoveErrors
|
|
1012
|
+
}
|
|
1013
|
+
)
|
|
1014
|
+
] }) }),
|
|
1006
1015
|
showPreview && /* @__PURE__ */ jsx11(PreviewAddFiles, { activatedLanguage, questionObject })
|
|
1007
1016
|
] });
|
|
1008
1017
|
};
|
|
@@ -1116,7 +1125,7 @@ var PreviewSingleCheckbox = ({
|
|
|
1116
1125
|
// src/helpers/hasQuestionValidationError/hasQuestionValidationError.tsx
|
|
1117
1126
|
import { isValid, parseISO } from "date-fns";
|
|
1118
1127
|
var hasQuestionValidationError = (question, questions) => {
|
|
1119
|
-
var _a, _b, _c, _d, _e
|
|
1128
|
+
var _a, _b, _c, _d, _e;
|
|
1120
1129
|
let error = false;
|
|
1121
1130
|
if (question.isQuestionMandatory) {
|
|
1122
1131
|
if (question.isTouched === false) {
|
|
@@ -1129,28 +1138,19 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1129
1138
|
error = true;
|
|
1130
1139
|
}
|
|
1131
1140
|
}
|
|
1132
|
-
|
|
1133
|
-
if (((_d = question.validationType) == null ? void 0 : _d.includes("maxLength")) && question.answer.length > maxLength) {
|
|
1134
|
-
error = true;
|
|
1135
|
-
}
|
|
1136
|
-
if (question.questionType === "TextField") {
|
|
1137
|
-
if (question.answer.length > 100) {
|
|
1138
|
-
error = true;
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
if (((_e = question.validationType) == null ? void 0 : _e.find((e) => e === "email")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1141
|
+
if (((_b = question.validationType) == null ? void 0 : _b.find((e) => e === "email")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1142
1142
|
const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
1143
1143
|
if (!emailRegex.test(question.answer)) {
|
|
1144
1144
|
error = true;
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
|
-
if (((
|
|
1147
|
+
if (((_c = question.validationType) == null ? void 0 : _c.find((e) => e === "fourNumbers")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1148
1148
|
const fourNumbersRegex = /^\d{4}$/.test(question.answer);
|
|
1149
1149
|
if (!fourNumbersRegex) {
|
|
1150
1150
|
error = true;
|
|
1151
1151
|
}
|
|
1152
1152
|
}
|
|
1153
|
-
if (((
|
|
1153
|
+
if (((_d = question.validationType) == null ? void 0 : _d.find((e) => e === "isDateFormatValid")) && question.answer !== "") {
|
|
1154
1154
|
const regex = /^\d{4}-\d{2}-\d{2}$/;
|
|
1155
1155
|
if (!regex.test(question.answer)) {
|
|
1156
1156
|
error = true;
|
|
@@ -1164,18 +1164,16 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1164
1164
|
error = true;
|
|
1165
1165
|
}
|
|
1166
1166
|
}
|
|
1167
|
-
const groupCheckError = (
|
|
1167
|
+
const groupCheckError = (_e = question.validationType) == null ? void 0 : _e.find((e) => e.startsWith("groupCheck-"));
|
|
1168
1168
|
if (groupCheckError) {
|
|
1169
1169
|
const ids = groupCheckError.replace("groupCheck-", "").split("-");
|
|
1170
|
-
const relatedAnswers = ids.map(
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
}
|
|
1178
|
-
);
|
|
1170
|
+
const relatedAnswers = ids.map((id) => {
|
|
1171
|
+
var _a2;
|
|
1172
|
+
return (_a2 = questions.find((q) => {
|
|
1173
|
+
var _a3;
|
|
1174
|
+
return ((_a3 = q.id) == null ? void 0 : _a3.toString()) === id;
|
|
1175
|
+
})) == null ? void 0 : _a2.answer;
|
|
1176
|
+
});
|
|
1179
1177
|
const currentAnswer = question.answer;
|
|
1180
1178
|
const allAnswers = [...relatedAnswers, currentAnswer];
|
|
1181
1179
|
if (allAnswers.every((ans) => ans === "")) {
|
|
@@ -2047,7 +2045,7 @@ var CookieBanner = ({
|
|
|
2047
2045
|
href: "https://pts.se/om-oss/om-pts.se/kakor-pa-webbplatsen/kakor-pa-pts-e-tjanster/",
|
|
2048
2046
|
target: "_blank",
|
|
2049
2047
|
rel: "noopener noreferrer",
|
|
2050
|
-
children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i
|
|
2048
|
+
children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i nytt f\xF6nster)"
|
|
2051
2049
|
}
|
|
2052
2050
|
)
|
|
2053
2051
|
] }),
|
|
@@ -2159,7 +2157,7 @@ var LanguageIcon = () => /* @__PURE__ */ jsx17("svg", { width: "15", height: "15
|
|
|
2159
2157
|
fill: "#6E3282"
|
|
2160
2158
|
}
|
|
2161
2159
|
) });
|
|
2162
|
-
var Logo_sv = () => /* @__PURE__ */ jsxs15("svg", { width: "168.8", height: "
|
|
2160
|
+
var Logo_sv = () => /* @__PURE__ */ jsxs15("svg", { width: "168.8", height: "46.67", viewBox: "0 0 168.8 46.67", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2163
2161
|
/* @__PURE__ */ jsx17(
|
|
2164
2162
|
"path",
|
|
2165
2163
|
{
|
|
@@ -2305,7 +2303,7 @@ var Logo_sv = () => /* @__PURE__ */ jsxs15("svg", { width: "168.8", height: "40"
|
|
|
2305
2303
|
),
|
|
2306
2304
|
/* @__PURE__ */ jsx17("path", { d: "M82.2223 18.3335V37.2224", stroke: "currentColor", strokeWidth: "0.8", strokeMiterlimit: "10" })
|
|
2307
2305
|
] });
|
|
2308
|
-
var Logo_en = () => /* @__PURE__ */ jsxs15("svg", { width: "189.0", height: "
|
|
2306
|
+
var Logo_en = () => /* @__PURE__ */ jsxs15("svg", { width: "189.0", height: "46.67", viewBox: "0 0 189 46.67", fill: "none", xmlns: "http://www.w3.org/2000/svg", role: "img", children: [
|
|
2309
2307
|
/* @__PURE__ */ jsx17(
|
|
2310
2308
|
"path",
|
|
2311
2309
|
{
|