optimized-react-component-library-xyz123 0.22.1 → 0.22.3
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 +164 -163
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +164 -163
- 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
|
@@ -5,50 +5,70 @@ var InputRadio = ({
|
|
|
5
5
|
handleQuestionInputChange,
|
|
6
6
|
showPreview = false
|
|
7
7
|
}) => {
|
|
8
|
-
var _a;
|
|
8
|
+
var _a, _b;
|
|
9
9
|
const questionId = `question-${question.id}`;
|
|
10
10
|
const groupId = `radio-group-${question.id}`;
|
|
11
11
|
const errorId = `error-${question.id}`;
|
|
12
|
+
const languageObj = question.languageSupport[0];
|
|
13
|
+
let optionsInfoText = [];
|
|
14
|
+
if ("optionsInfoText" in languageObj) {
|
|
15
|
+
optionsInfoText.push(languageObj.optionsInfoText);
|
|
16
|
+
console.log(languageObj.optionsInfoText, question);
|
|
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
|
+
optionsInfoText.length && /* @__PURE__ */ jsx(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
id: "textinfo-option3",
|
|
64
|
+
"aria-live": "polite",
|
|
65
|
+
"aria-atomic": "true",
|
|
66
|
+
children: (_b = optionsInfoText.find(
|
|
67
|
+
(op) => op.value === question.answer
|
|
68
|
+
)) == null ? void 0 : _b.text
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] }),
|
|
52
72
|
showPreview && /* @__PURE__ */ jsx(PreviewRadio, { question })
|
|
53
73
|
] });
|
|
54
74
|
};
|
|
@@ -251,11 +271,6 @@ var InputTextarea = ({
|
|
|
251
271
|
const aboutId = `about-${question.id}`;
|
|
252
272
|
const errorId = `error-${question.id}`;
|
|
253
273
|
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
274
|
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
260
275
|
!showPreview && question.visible && /* @__PURE__ */ jsxs4(
|
|
261
276
|
"div",
|
|
@@ -287,20 +302,29 @@ var InputTextarea = ({
|
|
|
287
302
|
required: question.isQuestionMandatory,
|
|
288
303
|
"aria-required": question.isQuestionMandatory,
|
|
289
304
|
"aria-invalid": question.hasValidationError,
|
|
305
|
+
maxLength: ((_a = question.questionExtraAttribute) == null ? void 0 : _a.answerMaxLength) || defaultMaxLength,
|
|
290
306
|
"aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
|
|
291
307
|
id: inputId
|
|
292
308
|
}
|
|
293
309
|
),
|
|
294
310
|
/* @__PURE__ */ jsxs4("div", { className: "pts-textarea-counter-error-container", children: [
|
|
295
|
-
|
|
311
|
+
question.hasValidationError && /* @__PURE__ */ jsxs4("div", { className: "pts-root-error", id: errorId, children: [
|
|
296
312
|
/* @__PURE__ */ jsx4("span", { "aria-label": "Felmeddelande.", className: "errorDot", children: "!" }),
|
|
297
313
|
/* @__PURE__ */ jsx4("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
298
314
|
] }),
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
315
|
+
!((_b = question.questionExtraAttribute) == null ? void 0 : _b.hideTextCounter) && /* @__PURE__ */ jsxs4(
|
|
316
|
+
"div",
|
|
317
|
+
{
|
|
318
|
+
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" : ""}`,
|
|
319
|
+
children: [
|
|
320
|
+
question.answer ? question.answer.length : 0,
|
|
321
|
+
" av",
|
|
322
|
+
" ",
|
|
323
|
+
((_e = question.questionExtraAttribute) == null ? void 0 : _e.answerMaxLength) || defaultMaxLength,
|
|
324
|
+
" tecken"
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
)
|
|
304
328
|
] })
|
|
305
329
|
]
|
|
306
330
|
}
|
|
@@ -337,21 +361,18 @@ var TextFieldStandard = ({
|
|
|
337
361
|
showPreview = false,
|
|
338
362
|
activatedLanguage
|
|
339
363
|
}) => {
|
|
340
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m
|
|
364
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
341
365
|
const questionId = `question-${question.id}`;
|
|
342
366
|
const inputId = `textField-${question.id}`;
|
|
343
367
|
const aboutId = `about-${question.id}`;
|
|
344
368
|
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`;
|
|
369
|
+
const defaultMaxLength = 1e3;
|
|
349
370
|
return /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
350
371
|
!showPreview && question.visible && /* @__PURE__ */ jsxs5(
|
|
351
372
|
"div",
|
|
352
373
|
{
|
|
353
374
|
id: questionId,
|
|
354
|
-
className: `pts-root-question pts-textField-container${((
|
|
375
|
+
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
376
|
children: [
|
|
356
377
|
/* @__PURE__ */ jsxs5("label", { htmlFor: inputId, children: [
|
|
357
378
|
question.questionLabel,
|
|
@@ -371,33 +392,29 @@ var TextFieldStandard = ({
|
|
|
371
392
|
/* @__PURE__ */ jsx5(
|
|
372
393
|
"input",
|
|
373
394
|
{
|
|
374
|
-
type: (
|
|
375
|
-
autoComplete: (
|
|
376
|
-
inputMode: (
|
|
395
|
+
type: (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.inputType) != null ? _c : "text",
|
|
396
|
+
autoComplete: (_e = (_d = question.questionExtraAttribute) == null ? void 0 : _d.autoComplete) != null ? _e : void 0,
|
|
397
|
+
inputMode: (_g = (_f = question.questionExtraAttribute) == null ? void 0 : _f.inputMode) != null ? _g : void 0,
|
|
377
398
|
name: `question-name-${question.id}`,
|
|
378
399
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
379
400
|
onChange: (e) => handleQuestionInputChange(e, question),
|
|
380
401
|
value: question.answer,
|
|
402
|
+
maxLength: ((_h = question.questionExtraAttribute) == null ? void 0 : _h.answerMaxLength) || defaultMaxLength,
|
|
381
403
|
id: inputId,
|
|
382
|
-
disabled: (
|
|
404
|
+
disabled: (_i = question.questionExtraAttribute) == null ? void 0 : _i.disabled,
|
|
383
405
|
required: question.isQuestionMandatory,
|
|
384
406
|
"aria-required": question.isQuestionMandatory,
|
|
385
407
|
"aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
|
|
386
408
|
"aria-invalid": question.hasValidationError,
|
|
387
409
|
"aria-errormessage": question.hasValidationError ? errorId : void 0,
|
|
388
|
-
spellCheck: (
|
|
389
|
-
autoCapitalize: (
|
|
410
|
+
spellCheck: (_k = (_j = question.questionExtraAttribute) == null ? void 0 : _j.spellCheck) != null ? _k : void 0,
|
|
411
|
+
autoCapitalize: (_m = (_l = question.questionExtraAttribute) == null ? void 0 : _l.autoCapitalize) != null ? _m : void 0
|
|
390
412
|
}
|
|
391
413
|
),
|
|
392
|
-
|
|
414
|
+
question.hasValidationError && /* @__PURE__ */ jsxs5("div", { className: "pts-root-error", id: errorId, children: [
|
|
393
415
|
/* @__PURE__ */ jsx5("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
394
416
|
/* @__PURE__ */ jsx5("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
395
417
|
/* @__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
418
|
] })
|
|
402
419
|
]
|
|
403
420
|
}
|
|
@@ -623,12 +640,14 @@ var SelectedFiles = ({
|
|
|
623
640
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
624
641
|
const newCountOfFiles = newFiles.length;
|
|
625
642
|
setNumberOfFiles(newCountOfFiles);
|
|
626
|
-
|
|
627
|
-
const targetValue = e.target.value === "0 files" ? "" : e.target.value;
|
|
628
|
-
e = { ...e, target: { ...e.target, value: targetValue } };
|
|
643
|
+
const e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
|
|
629
644
|
isTouched(e, questionObject);
|
|
630
645
|
removeFile(newCountOfFiles);
|
|
631
646
|
};
|
|
647
|
+
useEffect4(() => {
|
|
648
|
+
var _a;
|
|
649
|
+
numberOfFiles > 0 && ((_a = theDiv.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "end" }));
|
|
650
|
+
}, [numberOfFiles]);
|
|
632
651
|
const useWindowWidth = () => {
|
|
633
652
|
const [windowWidth2, setWindowWidth] = useState4(window.innerWidth);
|
|
634
653
|
useEffect4(() => {
|
|
@@ -911,7 +930,7 @@ var AddFiles = ({
|
|
|
911
930
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
912
931
|
const e = {
|
|
913
932
|
target: {
|
|
914
|
-
value:
|
|
933
|
+
value: `${currentFiles.length + newFiles.length} files`,
|
|
915
934
|
files: [...currentFiles, ...newFiles]
|
|
916
935
|
}
|
|
917
936
|
};
|
|
@@ -934,75 +953,68 @@ var AddFiles = ({
|
|
|
934
953
|
setErrorMessageAddingFile([]);
|
|
935
954
|
};
|
|
936
955
|
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
|
-
}
|
|
956
|
+
!showPreview && visible && /* @__PURE__ */ jsx11("div", { className: "root-question addFile-question-container", id: `question-${questionObject.id}`, children: /* @__PURE__ */ jsxs9("div", { role: "group", children: [
|
|
957
|
+
questionObject.aboutText && /* @__PURE__ */ jsxs9(
|
|
958
|
+
"p",
|
|
959
|
+
{
|
|
960
|
+
id: aboutId,
|
|
961
|
+
className: clsx3(
|
|
962
|
+
"addFilesMandatory",
|
|
963
|
+
questionObject.hasValidationError ? " error" : ""
|
|
988
964
|
),
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
{
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
965
|
+
children: [
|
|
966
|
+
questionObject.aboutText,
|
|
967
|
+
questionObject.isQuestionMandatory && /* @__PURE__ */ jsxs9("span", { className: "pts-root-mandatoryAsterisk", "aria-label": "Obligatorisk fr\xE5ga", children: [
|
|
968
|
+
" ",
|
|
969
|
+
"*"
|
|
970
|
+
] })
|
|
971
|
+
]
|
|
972
|
+
}
|
|
973
|
+
),
|
|
974
|
+
questionObject.hasValidationError && /* @__PURE__ */ jsxs9("div", { className: "pts-root-error error addfileserror", id: errorId, children: [
|
|
975
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
976
|
+
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
977
|
+
/* @__PURE__ */ jsx11("span", { className: "errorText", children: questionObject.validationDefaultMessesege })
|
|
978
|
+
] }),
|
|
979
|
+
/* @__PURE__ */ jsx11(
|
|
980
|
+
ExploreFilesStandard_default,
|
|
981
|
+
{
|
|
982
|
+
FilesSelected: onDrop,
|
|
983
|
+
numberOfFiles,
|
|
984
|
+
allowedNumberOfFiles,
|
|
985
|
+
activatedLanguage,
|
|
986
|
+
inputId,
|
|
987
|
+
labelId,
|
|
988
|
+
aboutId,
|
|
989
|
+
errorId,
|
|
990
|
+
questionObject,
|
|
991
|
+
errorMessageAddingFile,
|
|
992
|
+
removeUploadErrors: handleRemoveErrors
|
|
993
|
+
}
|
|
994
|
+
),
|
|
995
|
+
/* @__PURE__ */ jsx11(
|
|
996
|
+
DropFilesStandard_default,
|
|
997
|
+
{
|
|
998
|
+
FilesSelected: onDrop,
|
|
999
|
+
DropFilesText: dropFilesText,
|
|
1000
|
+
language: activatedLanguage
|
|
1001
|
+
}
|
|
1002
|
+
),
|
|
1003
|
+
/* @__PURE__ */ jsx11(
|
|
1004
|
+
SelectedFilesStandard_default,
|
|
1005
|
+
{
|
|
1006
|
+
questionObject,
|
|
1007
|
+
isTouched: handleQuestionInputChange,
|
|
1008
|
+
removeFile: removeFileFromNumberOfFiles,
|
|
1009
|
+
removeError,
|
|
1010
|
+
errorMessageAddingFile,
|
|
1011
|
+
activatedLanguage,
|
|
1012
|
+
numberOfFiles,
|
|
1013
|
+
setNumberOfFiles,
|
|
1014
|
+
removeUploadErrors: handleRemoveErrors
|
|
1015
|
+
}
|
|
1016
|
+
)
|
|
1017
|
+
] }) }),
|
|
1006
1018
|
showPreview && /* @__PURE__ */ jsx11(PreviewAddFiles, { activatedLanguage, questionObject })
|
|
1007
1019
|
] });
|
|
1008
1020
|
};
|
|
@@ -1116,7 +1128,7 @@ var PreviewSingleCheckbox = ({
|
|
|
1116
1128
|
// src/helpers/hasQuestionValidationError/hasQuestionValidationError.tsx
|
|
1117
1129
|
import { isValid, parseISO } from "date-fns";
|
|
1118
1130
|
var hasQuestionValidationError = (question, questions) => {
|
|
1119
|
-
var _a, _b, _c, _d, _e
|
|
1131
|
+
var _a, _b, _c, _d, _e;
|
|
1120
1132
|
let error = false;
|
|
1121
1133
|
if (question.isQuestionMandatory) {
|
|
1122
1134
|
if (question.isTouched === false) {
|
|
@@ -1129,28 +1141,19 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1129
1141
|
error = true;
|
|
1130
1142
|
}
|
|
1131
1143
|
}
|
|
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 !== "")) {
|
|
1144
|
+
if (((_b = question.validationType) == null ? void 0 : _b.find((e) => e === "email")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1142
1145
|
const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
1143
1146
|
if (!emailRegex.test(question.answer)) {
|
|
1144
1147
|
error = true;
|
|
1145
1148
|
}
|
|
1146
1149
|
}
|
|
1147
|
-
if (((
|
|
1150
|
+
if (((_c = question.validationType) == null ? void 0 : _c.find((e) => e === "fourNumbers")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1148
1151
|
const fourNumbersRegex = /^\d{4}$/.test(question.answer);
|
|
1149
1152
|
if (!fourNumbersRegex) {
|
|
1150
1153
|
error = true;
|
|
1151
1154
|
}
|
|
1152
1155
|
}
|
|
1153
|
-
if (((
|
|
1156
|
+
if (((_d = question.validationType) == null ? void 0 : _d.find((e) => e === "isDateFormatValid")) && question.answer !== "") {
|
|
1154
1157
|
const regex = /^\d{4}-\d{2}-\d{2}$/;
|
|
1155
1158
|
if (!regex.test(question.answer)) {
|
|
1156
1159
|
error = true;
|
|
@@ -1164,18 +1167,16 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1164
1167
|
error = true;
|
|
1165
1168
|
}
|
|
1166
1169
|
}
|
|
1167
|
-
const groupCheckError = (
|
|
1170
|
+
const groupCheckError = (_e = question.validationType) == null ? void 0 : _e.find((e) => e.startsWith("groupCheck-"));
|
|
1168
1171
|
if (groupCheckError) {
|
|
1169
1172
|
const ids = groupCheckError.replace("groupCheck-", "").split("-");
|
|
1170
|
-
const relatedAnswers = ids.map(
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
}
|
|
1178
|
-
);
|
|
1173
|
+
const relatedAnswers = ids.map((id) => {
|
|
1174
|
+
var _a2;
|
|
1175
|
+
return (_a2 = questions.find((q) => {
|
|
1176
|
+
var _a3;
|
|
1177
|
+
return ((_a3 = q.id) == null ? void 0 : _a3.toString()) === id;
|
|
1178
|
+
})) == null ? void 0 : _a2.answer;
|
|
1179
|
+
});
|
|
1179
1180
|
const currentAnswer = question.answer;
|
|
1180
1181
|
const allAnswers = [...relatedAnswers, currentAnswer];
|
|
1181
1182
|
if (allAnswers.every((ans) => ans === "")) {
|
|
@@ -2047,7 +2048,7 @@ var CookieBanner = ({
|
|
|
2047
2048
|
href: "https://pts.se/om-oss/om-pts.se/kakor-pa-webbplatsen/kakor-pa-pts-e-tjanster/",
|
|
2048
2049
|
target: "_blank",
|
|
2049
2050
|
rel: "noopener noreferrer",
|
|
2050
|
-
children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i
|
|
2051
|
+
children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i nytt f\xF6nster)"
|
|
2051
2052
|
}
|
|
2052
2053
|
)
|
|
2053
2054
|
] }),
|
|
@@ -2159,7 +2160,7 @@ var LanguageIcon = () => /* @__PURE__ */ jsx17("svg", { width: "15", height: "15
|
|
|
2159
2160
|
fill: "#6E3282"
|
|
2160
2161
|
}
|
|
2161
2162
|
) });
|
|
2162
|
-
var Logo_sv = () => /* @__PURE__ */ jsxs15("svg", { width: "168.8", height: "
|
|
2163
|
+
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
2164
|
/* @__PURE__ */ jsx17(
|
|
2164
2165
|
"path",
|
|
2165
2166
|
{
|
|
@@ -2305,7 +2306,7 @@ var Logo_sv = () => /* @__PURE__ */ jsxs15("svg", { width: "168.8", height: "40"
|
|
|
2305
2306
|
),
|
|
2306
2307
|
/* @__PURE__ */ jsx17("path", { d: "M82.2223 18.3335V37.2224", stroke: "currentColor", strokeWidth: "0.8", strokeMiterlimit: "10" })
|
|
2307
2308
|
] });
|
|
2308
|
-
var Logo_en = () => /* @__PURE__ */ jsxs15("svg", { width: "189.0", height: "
|
|
2309
|
+
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
2310
|
/* @__PURE__ */ jsx17(
|
|
2310
2311
|
"path",
|
|
2311
2312
|
{
|