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 CHANGED
@@ -87,50 +87,70 @@ var InputRadio = ({
87
87
  handleQuestionInputChange,
88
88
  showPreview = false
89
89
  }) => {
90
- var _a;
90
+ var _a, _b;
91
91
  const questionId = `question-${question.id}`;
92
92
  const groupId = `radio-group-${question.id}`;
93
93
  const errorId = `error-${question.id}`;
94
+ const languageObj = question.languageSupport[0];
95
+ let optionsInfoText = [];
96
+ if ("optionsInfoText" in languageObj) {
97
+ optionsInfoText.push(languageObj.optionsInfoText);
98
+ console.log(languageObj.optionsInfoText, question);
99
+ }
94
100
  const handleInputChange = (event) => {
95
101
  const e = { target: { value: event.target.value } };
96
102
  handleQuestionInputChange(e, question);
97
103
  };
98
104
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
99
- !showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "pts-root-question pts-radioMultiple-container", id: questionId, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
100
- "fieldset",
101
- {
102
- "aria-required": question.isQuestionMandatory,
103
- "aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
104
- "aria-errormessage": question.hasValidationError ? errorId : void 0,
105
- children: [
106
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("legend", { id: `label-${groupId}`, children: [
107
- question.questionLabel,
108
- " ",
109
- question.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" })
110
- ] }),
111
- (_a = question.options) == null ? void 0 : _a.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pts-radio-option", children: [
112
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
113
- "input",
114
- {
115
- type: "radio",
116
- name: `name-${question.id}`,
117
- id: `${groupId}-option-${index}`,
118
- value: option.value,
119
- checked: question.answer === option.value,
120
- onChange: handleInputChange
121
- }
122
- ),
123
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { htmlFor: `${groupId}-option-${index}`, children: option.label }),
124
- " "
125
- ] }, index)),
126
- question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
127
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
128
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
129
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
130
- ] })
131
- ]
132
- }
133
- ) }),
105
+ !showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pts-root-question pts-radioMultiple-container", id: questionId, children: [
106
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
107
+ "fieldset",
108
+ {
109
+ "aria-required": question.isQuestionMandatory,
110
+ "aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
111
+ "aria-errormessage": question.hasValidationError ? errorId : void 0,
112
+ children: [
113
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("legend", { id: `label-${groupId}`, children: [
114
+ question.questionLabel,
115
+ " ",
116
+ question.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" })
117
+ ] }),
118
+ (_a = question.options) == null ? void 0 : _a.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pts-radio-option", children: [
119
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
120
+ "input",
121
+ {
122
+ type: "radio",
123
+ name: `name-${question.id}`,
124
+ id: `${groupId}-option-${index}`,
125
+ value: option.value,
126
+ checked: question.answer === option.value,
127
+ onChange: handleInputChange,
128
+ "aria-describedby": "about_" + option.value
129
+ }
130
+ ),
131
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { htmlFor: `${groupId}-option-${index}`, children: option.label }),
132
+ " "
133
+ ] }, index)),
134
+ question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
135
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
136
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
137
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
138
+ ] })
139
+ ]
140
+ }
141
+ ),
142
+ optionsInfoText.length && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
143
+ "div",
144
+ {
145
+ id: "textinfo-option3",
146
+ "aria-live": "polite",
147
+ "aria-atomic": "true",
148
+ children: (_b = optionsInfoText.find(
149
+ (op) => op.value === question.answer
150
+ )) == null ? void 0 : _b.text
151
+ }
152
+ )
153
+ ] }),
134
154
  showPreview && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PreviewRadio, { question })
135
155
  ] });
136
156
  };
@@ -333,11 +353,6 @@ var InputTextarea = ({
333
353
  const aboutId = `about-${question.id}`;
334
354
  const errorId = `error-${question.id}`;
335
355
  const defaultMaxLength = 1e3;
336
- const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
337
- const maxLength = (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.answerMaxLength) != null ? _d : defaultMaxLength;
338
- const isTooLong = answerLength > maxLength;
339
- const counterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
340
- const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r max vara ${maxLength} tecken`;
341
356
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
342
357
  !showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
343
358
  "div",
@@ -369,20 +384,29 @@ var InputTextarea = ({
369
384
  required: question.isQuestionMandatory,
370
385
  "aria-required": question.isQuestionMandatory,
371
386
  "aria-invalid": question.hasValidationError,
387
+ maxLength: ((_a = question.questionExtraAttribute) == null ? void 0 : _a.answerMaxLength) || defaultMaxLength,
372
388
  "aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
373
389
  id: inputId
374
390
  }
375
391
  ),
376
392
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "pts-textarea-counter-error-container", children: [
377
- !isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
393
+ question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
378
394
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "aria-label": "Felmeddelande.", className: "errorDot", children: "!" }),
379
395
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
380
396
  ] }),
381
- isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
382
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "aria-label": "Felmeddelande.", className: "errorDot", children: "!" }),
383
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "errorText", children: maxLengthErrorText })
384
- ] }),
385
- !((_e = question.questionExtraAttribute) == null ? void 0 : _e.hideTextCounter) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "aria-live": "polite", className: `pts-character-counter`, children: counterText })
397
+ !((_b = question.questionExtraAttribute) == null ? void 0 : _b.hideTextCounter) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
398
+ "div",
399
+ {
400
+ 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" : ""}`,
401
+ children: [
402
+ question.answer ? question.answer.length : 0,
403
+ " av",
404
+ " ",
405
+ ((_e = question.questionExtraAttribute) == null ? void 0 : _e.answerMaxLength) || defaultMaxLength,
406
+ " tecken"
407
+ ]
408
+ }
409
+ )
386
410
  ] })
387
411
  ]
388
412
  }
@@ -419,21 +443,18 @@ var TextFieldStandard = ({
419
443
  showPreview = false,
420
444
  activatedLanguage
421
445
  }) => {
422
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
446
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
423
447
  const questionId = `question-${question.id}`;
424
448
  const inputId = `textField-${question.id}`;
425
449
  const aboutId = `about-${question.id}`;
426
450
  const errorId = `error-${question.id}`;
427
- const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
428
- const maxLength = 100;
429
- const isTooLong = answerLength > maxLength;
430
- const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r max vara ${maxLength} tecken`;
451
+ const defaultMaxLength = 1e3;
431
452
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
432
453
  !showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
433
454
  "div",
434
455
  {
435
456
  id: questionId,
436
- className: `pts-root-question pts-textField-container${((_c = question.questionExtraAttribute) == null ? void 0 : _c.disabled) ? " pts-textField-disabled" : ""}${question.aboutText ? " pts-question-hasAbout" : ""}`.trim(),
457
+ className: `pts-root-question pts-textField-container${((_a = question.questionExtraAttribute) == null ? void 0 : _a.disabled) ? " pts-textField-disabled" : ""}${question.aboutText ? " pts-question-hasAbout" : ""}`.trim(),
437
458
  children: [
438
459
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { htmlFor: inputId, children: [
439
460
  question.questionLabel,
@@ -453,33 +474,29 @@ var TextFieldStandard = ({
453
474
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
454
475
  "input",
455
476
  {
456
- type: (_e = (_d = question.questionExtraAttribute) == null ? void 0 : _d.inputType) != null ? _e : "text",
457
- autoComplete: (_g = (_f = question.questionExtraAttribute) == null ? void 0 : _f.autoComplete) != null ? _g : void 0,
458
- inputMode: (_i = (_h = question.questionExtraAttribute) == null ? void 0 : _h.inputMode) != null ? _i : void 0,
477
+ type: (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.inputType) != null ? _c : "text",
478
+ autoComplete: (_e = (_d = question.questionExtraAttribute) == null ? void 0 : _d.autoComplete) != null ? _e : void 0,
479
+ inputMode: (_g = (_f = question.questionExtraAttribute) == null ? void 0 : _f.inputMode) != null ? _g : void 0,
459
480
  name: `question-name-${question.id}`,
460
481
  className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
461
482
  onChange: (e) => handleQuestionInputChange(e, question),
462
483
  value: question.answer,
484
+ maxLength: ((_h = question.questionExtraAttribute) == null ? void 0 : _h.answerMaxLength) || defaultMaxLength,
463
485
  id: inputId,
464
- disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
486
+ disabled: (_i = question.questionExtraAttribute) == null ? void 0 : _i.disabled,
465
487
  required: question.isQuestionMandatory,
466
488
  "aria-required": question.isQuestionMandatory,
467
489
  "aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
468
490
  "aria-invalid": question.hasValidationError,
469
491
  "aria-errormessage": question.hasValidationError ? errorId : void 0,
470
- spellCheck: (_l = (_k = question.questionExtraAttribute) == null ? void 0 : _k.spellCheck) != null ? _l : void 0,
471
- autoCapitalize: (_n = (_m = question.questionExtraAttribute) == null ? void 0 : _m.autoCapitalize) != null ? _n : void 0
492
+ spellCheck: (_k = (_j = question.questionExtraAttribute) == null ? void 0 : _j.spellCheck) != null ? _k : void 0,
493
+ autoCapitalize: (_m = (_l = question.questionExtraAttribute) == null ? void 0 : _l.autoCapitalize) != null ? _m : void 0
472
494
  }
473
495
  ),
474
- !isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
496
+ question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
475
497
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
476
498
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
477
499
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
478
- ] }),
479
- isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
480
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
481
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
482
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "errorText", children: maxLengthErrorText })
483
500
  ] })
484
501
  ]
485
502
  }
@@ -705,12 +722,14 @@ var SelectedFiles = ({
705
722
  let newFiles = questionObject.files.filter((f) => f !== file);
706
723
  const newCountOfFiles = newFiles.length;
707
724
  setNumberOfFiles(newCountOfFiles);
708
- let e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
709
- const targetValue = e.target.value === "0 files" ? "" : e.target.value;
710
- e = { ...e, target: { ...e.target, value: targetValue } };
725
+ const e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
711
726
  isTouched(e, questionObject);
712
727
  removeFile(newCountOfFiles);
713
728
  };
729
+ (0, import_react6.useEffect)(() => {
730
+ var _a;
731
+ numberOfFiles > 0 && ((_a = theDiv.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "end" }));
732
+ }, [numberOfFiles]);
714
733
  const useWindowWidth = () => {
715
734
  const [windowWidth2, setWindowWidth] = (0, import_react6.useState)(window.innerWidth);
716
735
  (0, import_react6.useEffect)(() => {
@@ -993,7 +1012,7 @@ var AddFiles = ({
993
1012
  const currentFiles = questionObject.files ? questionObject.files : [];
994
1013
  const e = {
995
1014
  target: {
996
- value: currentFiles.length + newFiles.length > 0 ? `${currentFiles.length + newFiles.length} files` : "",
1015
+ value: `${currentFiles.length + newFiles.length} files`,
997
1016
  files: [...currentFiles, ...newFiles]
998
1017
  }
999
1018
  };
@@ -1016,75 +1035,68 @@ var AddFiles = ({
1016
1035
  setErrorMessageAddingFile([]);
1017
1036
  };
1018
1037
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1019
- !showPreview && visible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1020
- "div",
1021
- {
1022
- className: "root-question addFile-question-container",
1023
- id: `question-${questionObject.id}`,
1024
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { role: "group", children: [
1025
- questionObject.aboutText && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1026
- "p",
1027
- {
1028
- id: aboutId,
1029
- className: (0, import_clsx3.default)(
1030
- "addFilesMandatory",
1031
- questionObject.hasValidationError ? " error" : ""
1032
- ),
1033
- children: [
1034
- questionObject.aboutText,
1035
- questionObject.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "pts-root-mandatoryAsterisk", "aria-label": "Obligatorisk fr\xE5ga", children: [
1036
- " ",
1037
- "*"
1038
- ] })
1039
- ]
1040
- }
1041
- ),
1042
- questionObject.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "pts-root-error error addfileserror", id: errorId, children: [
1043
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
1044
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
1045
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "errorText", children: questionObject.validationDefaultMessesege })
1046
- ] }),
1047
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1048
- ExploreFilesStandard_default,
1049
- {
1050
- FilesSelected: onDrop,
1051
- numberOfFiles,
1052
- allowedNumberOfFiles,
1053
- activatedLanguage,
1054
- inputId,
1055
- labelId,
1056
- aboutId,
1057
- errorId,
1058
- questionObject,
1059
- errorMessageAddingFile,
1060
- removeUploadErrors: handleRemoveErrors
1061
- }
1062
- ),
1063
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1064
- DropFilesStandard_default,
1065
- {
1066
- FilesSelected: onDrop,
1067
- DropFilesText: dropFilesText,
1068
- language: activatedLanguage
1069
- }
1038
+ !showPreview && visible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "root-question addFile-question-container", id: `question-${questionObject.id}`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { role: "group", children: [
1039
+ questionObject.aboutText && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1040
+ "p",
1041
+ {
1042
+ id: aboutId,
1043
+ className: (0, import_clsx3.default)(
1044
+ "addFilesMandatory",
1045
+ questionObject.hasValidationError ? " error" : ""
1070
1046
  ),
1071
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1072
- SelectedFilesStandard_default,
1073
- {
1074
- questionObject,
1075
- isTouched: handleQuestionInputChange,
1076
- removeFile: removeFileFromNumberOfFiles,
1077
- removeError,
1078
- errorMessageAddingFile,
1079
- activatedLanguage,
1080
- numberOfFiles,
1081
- setNumberOfFiles,
1082
- removeUploadErrors: handleRemoveErrors
1083
- }
1084
- )
1085
- ] })
1086
- }
1087
- ),
1047
+ children: [
1048
+ questionObject.aboutText,
1049
+ questionObject.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "pts-root-mandatoryAsterisk", "aria-label": "Obligatorisk fr\xE5ga", children: [
1050
+ " ",
1051
+ "*"
1052
+ ] })
1053
+ ]
1054
+ }
1055
+ ),
1056
+ questionObject.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "pts-root-error error addfileserror", id: errorId, children: [
1057
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
1058
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
1059
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "errorText", children: questionObject.validationDefaultMessesege })
1060
+ ] }),
1061
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1062
+ ExploreFilesStandard_default,
1063
+ {
1064
+ FilesSelected: onDrop,
1065
+ numberOfFiles,
1066
+ allowedNumberOfFiles,
1067
+ activatedLanguage,
1068
+ inputId,
1069
+ labelId,
1070
+ aboutId,
1071
+ errorId,
1072
+ questionObject,
1073
+ errorMessageAddingFile,
1074
+ removeUploadErrors: handleRemoveErrors
1075
+ }
1076
+ ),
1077
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1078
+ DropFilesStandard_default,
1079
+ {
1080
+ FilesSelected: onDrop,
1081
+ DropFilesText: dropFilesText,
1082
+ language: activatedLanguage
1083
+ }
1084
+ ),
1085
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1086
+ SelectedFilesStandard_default,
1087
+ {
1088
+ questionObject,
1089
+ isTouched: handleQuestionInputChange,
1090
+ removeFile: removeFileFromNumberOfFiles,
1091
+ removeError,
1092
+ errorMessageAddingFile,
1093
+ activatedLanguage,
1094
+ numberOfFiles,
1095
+ setNumberOfFiles,
1096
+ removeUploadErrors: handleRemoveErrors
1097
+ }
1098
+ )
1099
+ ] }) }),
1088
1100
  showPreview && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PreviewAddFiles, { activatedLanguage, questionObject })
1089
1101
  ] });
1090
1102
  };
@@ -1198,7 +1210,7 @@ var PreviewSingleCheckbox = ({
1198
1210
  // src/helpers/hasQuestionValidationError/hasQuestionValidationError.tsx
1199
1211
  var import_date_fns = require("date-fns");
1200
1212
  var hasQuestionValidationError = (question, questions) => {
1201
- var _a, _b, _c, _d, _e, _f, _g, _h;
1213
+ var _a, _b, _c, _d, _e;
1202
1214
  let error = false;
1203
1215
  if (question.isQuestionMandatory) {
1204
1216
  if (question.isTouched === false) {
@@ -1211,28 +1223,19 @@ var hasQuestionValidationError = (question, questions) => {
1211
1223
  error = true;
1212
1224
  }
1213
1225
  }
1214
- const maxLength = (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.answerMaxLength) != null ? _c : 1e3;
1215
- if (((_d = question.validationType) == null ? void 0 : _d.includes("maxLength")) && question.answer.length > maxLength) {
1216
- error = true;
1217
- }
1218
- if (question.questionType === "TextField") {
1219
- if (question.answer.length > 100) {
1220
- error = true;
1221
- }
1222
- }
1223
- if (((_e = question.validationType) == null ? void 0 : _e.find((e) => e === "email")) && (question.isQuestionMandatory || question.answer !== "")) {
1226
+ if (((_b = question.validationType) == null ? void 0 : _b.find((e) => e === "email")) && (question.isQuestionMandatory || question.answer !== "")) {
1224
1227
  const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
1225
1228
  if (!emailRegex.test(question.answer)) {
1226
1229
  error = true;
1227
1230
  }
1228
1231
  }
1229
- if (((_f = question.validationType) == null ? void 0 : _f.find((e) => e === "fourNumbers")) && (question.isQuestionMandatory || question.answer !== "")) {
1232
+ if (((_c = question.validationType) == null ? void 0 : _c.find((e) => e === "fourNumbers")) && (question.isQuestionMandatory || question.answer !== "")) {
1230
1233
  const fourNumbersRegex = /^\d{4}$/.test(question.answer);
1231
1234
  if (!fourNumbersRegex) {
1232
1235
  error = true;
1233
1236
  }
1234
1237
  }
1235
- if (((_g = question.validationType) == null ? void 0 : _g.find((e) => e === "isDateFormatValid")) && question.answer !== "") {
1238
+ if (((_d = question.validationType) == null ? void 0 : _d.find((e) => e === "isDateFormatValid")) && question.answer !== "") {
1236
1239
  const regex = /^\d{4}-\d{2}-\d{2}$/;
1237
1240
  if (!regex.test(question.answer)) {
1238
1241
  error = true;
@@ -1246,18 +1249,16 @@ var hasQuestionValidationError = (question, questions) => {
1246
1249
  error = true;
1247
1250
  }
1248
1251
  }
1249
- const groupCheckError = (_h = question.validationType) == null ? void 0 : _h.find((e) => e.startsWith("groupCheck-"));
1252
+ const groupCheckError = (_e = question.validationType) == null ? void 0 : _e.find((e) => e.startsWith("groupCheck-"));
1250
1253
  if (groupCheckError) {
1251
1254
  const ids = groupCheckError.replace("groupCheck-", "").split("-");
1252
- const relatedAnswers = ids.map(
1253
- (id) => {
1254
- var _a2;
1255
- return (_a2 = questions.find((q) => {
1256
- var _a3;
1257
- return ((_a3 = q.id) == null ? void 0 : _a3.toString()) === id;
1258
- })) == null ? void 0 : _a2.answer;
1259
- }
1260
- );
1255
+ const relatedAnswers = ids.map((id) => {
1256
+ var _a2;
1257
+ return (_a2 = questions.find((q) => {
1258
+ var _a3;
1259
+ return ((_a3 = q.id) == null ? void 0 : _a3.toString()) === id;
1260
+ })) == null ? void 0 : _a2.answer;
1261
+ });
1261
1262
  const currentAnswer = question.answer;
1262
1263
  const allAnswers = [...relatedAnswers, currentAnswer];
1263
1264
  if (allAnswers.every((ans) => ans === "")) {
@@ -2126,7 +2127,7 @@ var CookieBanner = ({
2126
2127
  href: "https://pts.se/om-oss/om-pts.se/kakor-pa-webbplatsen/kakor-pa-pts-e-tjanster/",
2127
2128
  target: "_blank",
2128
2129
  rel: "noopener noreferrer",
2129
- children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i ny flik)"
2130
+ children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i nytt f\xF6nster)"
2130
2131
  }
2131
2132
  )
2132
2133
  ] }),
@@ -2238,7 +2239,7 @@ var LanguageIcon = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", {
2238
2239
  fill: "#6E3282"
2239
2240
  }
2240
2241
  ) });
2241
- var Logo_sv = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("svg", { width: "168.8", height: "40", viewBox: "0 0 168.8 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2242
+ var Logo_sv = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("svg", { width: "168.8", height: "46.67", viewBox: "0 0 168.8 46.67", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2242
2243
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2243
2244
  "path",
2244
2245
  {
@@ -2384,7 +2385,7 @@ var Logo_sv = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("svg", { widt
2384
2385
  ),
2385
2386
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M82.2223 18.3335V37.2224", stroke: "currentColor", strokeWidth: "0.8", strokeMiterlimit: "10" })
2386
2387
  ] });
2387
- var Logo_en = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("svg", { width: "189.0", height: "40", viewBox: "0 0 189 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", role: "img", children: [
2388
+ var Logo_en = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("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: [
2388
2389
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2389
2390
  "path",
2390
2391
  {