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 CHANGED
@@ -91,46 +91,63 @@ var InputRadio = ({
91
91
  const questionId = `question-${question.id}`;
92
92
  const groupId = `radio-group-${question.id}`;
93
93
  const errorId = `error-${question.id}`;
94
+ let optionsInfoText = [];
95
+ const languageObj = question.languageSupport[0];
96
+ if ("optionsInfoText" in languageObj) {
97
+ optionsInfoText.push(languageObj.optionsInfoText);
98
+ console.log(languageObj.optionsInfoText);
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
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
143
+ "div",
144
+ {
145
+ id: "textinfo-option3",
146
+ "aria-live": "polite",
147
+ "aria-atomic": "true"
148
+ }
149
+ )
150
+ ] }),
134
151
  showPreview && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PreviewRadio, { question })
135
152
  ] });
136
153
  };
@@ -333,11 +350,6 @@ var InputTextarea = ({
333
350
  const aboutId = `about-${question.id}`;
334
351
  const errorId = `error-${question.id}`;
335
352
  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
353
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
342
354
  !showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
343
355
  "div",
@@ -369,20 +381,29 @@ var InputTextarea = ({
369
381
  required: question.isQuestionMandatory,
370
382
  "aria-required": question.isQuestionMandatory,
371
383
  "aria-invalid": question.hasValidationError,
384
+ maxLength: ((_a = question.questionExtraAttribute) == null ? void 0 : _a.answerMaxLength) || defaultMaxLength,
372
385
  "aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
373
386
  id: inputId
374
387
  }
375
388
  ),
376
389
  /* @__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: [
390
+ question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
378
391
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "aria-label": "Felmeddelande.", className: "errorDot", children: "!" }),
379
392
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
380
393
  ] }),
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 })
394
+ !((_b = question.questionExtraAttribute) == null ? void 0 : _b.hideTextCounter) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
395
+ "div",
396
+ {
397
+ 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" : ""}`,
398
+ children: [
399
+ question.answer ? question.answer.length : 0,
400
+ " av",
401
+ " ",
402
+ ((_e = question.questionExtraAttribute) == null ? void 0 : _e.answerMaxLength) || defaultMaxLength,
403
+ " tecken"
404
+ ]
405
+ }
406
+ )
386
407
  ] })
387
408
  ]
388
409
  }
@@ -419,21 +440,18 @@ var TextFieldStandard = ({
419
440
  showPreview = false,
420
441
  activatedLanguage
421
442
  }) => {
422
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
443
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
423
444
  const questionId = `question-${question.id}`;
424
445
  const inputId = `textField-${question.id}`;
425
446
  const aboutId = `about-${question.id}`;
426
447
  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`;
448
+ const defaultMaxLength = 1e3;
431
449
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
432
450
  !showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
433
451
  "div",
434
452
  {
435
453
  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(),
454
+ 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
455
  children: [
438
456
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { htmlFor: inputId, children: [
439
457
  question.questionLabel,
@@ -453,33 +471,29 @@ var TextFieldStandard = ({
453
471
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
454
472
  "input",
455
473
  {
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,
474
+ type: (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.inputType) != null ? _c : "text",
475
+ autoComplete: (_e = (_d = question.questionExtraAttribute) == null ? void 0 : _d.autoComplete) != null ? _e : void 0,
476
+ inputMode: (_g = (_f = question.questionExtraAttribute) == null ? void 0 : _f.inputMode) != null ? _g : void 0,
459
477
  name: `question-name-${question.id}`,
460
478
  className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
461
479
  onChange: (e) => handleQuestionInputChange(e, question),
462
480
  value: question.answer,
481
+ maxLength: ((_h = question.questionExtraAttribute) == null ? void 0 : _h.answerMaxLength) || defaultMaxLength,
463
482
  id: inputId,
464
- disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
483
+ disabled: (_i = question.questionExtraAttribute) == null ? void 0 : _i.disabled,
465
484
  required: question.isQuestionMandatory,
466
485
  "aria-required": question.isQuestionMandatory,
467
486
  "aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
468
487
  "aria-invalid": question.hasValidationError,
469
488
  "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
489
+ spellCheck: (_k = (_j = question.questionExtraAttribute) == null ? void 0 : _j.spellCheck) != null ? _k : void 0,
490
+ autoCapitalize: (_m = (_l = question.questionExtraAttribute) == null ? void 0 : _l.autoCapitalize) != null ? _m : void 0
472
491
  }
473
492
  ),
474
- !isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
493
+ question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
475
494
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
476
495
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
477
496
  /* @__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
497
  ] })
484
498
  ]
485
499
  }
@@ -705,12 +719,14 @@ var SelectedFiles = ({
705
719
  let newFiles = questionObject.files.filter((f) => f !== file);
706
720
  const newCountOfFiles = newFiles.length;
707
721
  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 } };
722
+ const e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
711
723
  isTouched(e, questionObject);
712
724
  removeFile(newCountOfFiles);
713
725
  };
726
+ (0, import_react6.useEffect)(() => {
727
+ var _a;
728
+ numberOfFiles > 0 && ((_a = theDiv.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "end" }));
729
+ }, [numberOfFiles]);
714
730
  const useWindowWidth = () => {
715
731
  const [windowWidth2, setWindowWidth] = (0, import_react6.useState)(window.innerWidth);
716
732
  (0, import_react6.useEffect)(() => {
@@ -993,7 +1009,7 @@ var AddFiles = ({
993
1009
  const currentFiles = questionObject.files ? questionObject.files : [];
994
1010
  const e = {
995
1011
  target: {
996
- value: currentFiles.length + newFiles.length > 0 ? `${currentFiles.length + newFiles.length} files` : "",
1012
+ value: `${currentFiles.length + newFiles.length} files`,
997
1013
  files: [...currentFiles, ...newFiles]
998
1014
  }
999
1015
  };
@@ -1016,75 +1032,68 @@ var AddFiles = ({
1016
1032
  setErrorMessageAddingFile([]);
1017
1033
  };
1018
1034
  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
- }
1035
+ !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: [
1036
+ questionObject.aboutText && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1037
+ "p",
1038
+ {
1039
+ id: aboutId,
1040
+ className: (0, import_clsx3.default)(
1041
+ "addFilesMandatory",
1042
+ questionObject.hasValidationError ? " error" : ""
1070
1043
  ),
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
- ),
1044
+ children: [
1045
+ questionObject.aboutText,
1046
+ questionObject.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "pts-root-mandatoryAsterisk", "aria-label": "Obligatorisk fr\xE5ga", children: [
1047
+ " ",
1048
+ "*"
1049
+ ] })
1050
+ ]
1051
+ }
1052
+ ),
1053
+ questionObject.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "pts-root-error error addfileserror", id: errorId, children: [
1054
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
1055
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
1056
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "errorText", children: questionObject.validationDefaultMessesege })
1057
+ ] }),
1058
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1059
+ ExploreFilesStandard_default,
1060
+ {
1061
+ FilesSelected: onDrop,
1062
+ numberOfFiles,
1063
+ allowedNumberOfFiles,
1064
+ activatedLanguage,
1065
+ inputId,
1066
+ labelId,
1067
+ aboutId,
1068
+ errorId,
1069
+ questionObject,
1070
+ errorMessageAddingFile,
1071
+ removeUploadErrors: handleRemoveErrors
1072
+ }
1073
+ ),
1074
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1075
+ DropFilesStandard_default,
1076
+ {
1077
+ FilesSelected: onDrop,
1078
+ DropFilesText: dropFilesText,
1079
+ language: activatedLanguage
1080
+ }
1081
+ ),
1082
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1083
+ SelectedFilesStandard_default,
1084
+ {
1085
+ questionObject,
1086
+ isTouched: handleQuestionInputChange,
1087
+ removeFile: removeFileFromNumberOfFiles,
1088
+ removeError,
1089
+ errorMessageAddingFile,
1090
+ activatedLanguage,
1091
+ numberOfFiles,
1092
+ setNumberOfFiles,
1093
+ removeUploadErrors: handleRemoveErrors
1094
+ }
1095
+ )
1096
+ ] }) }),
1088
1097
  showPreview && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PreviewAddFiles, { activatedLanguage, questionObject })
1089
1098
  ] });
1090
1099
  };
@@ -1198,7 +1207,7 @@ var PreviewSingleCheckbox = ({
1198
1207
  // src/helpers/hasQuestionValidationError/hasQuestionValidationError.tsx
1199
1208
  var import_date_fns = require("date-fns");
1200
1209
  var hasQuestionValidationError = (question, questions) => {
1201
- var _a, _b, _c, _d, _e, _f, _g, _h;
1210
+ var _a, _b, _c, _d, _e;
1202
1211
  let error = false;
1203
1212
  if (question.isQuestionMandatory) {
1204
1213
  if (question.isTouched === false) {
@@ -1211,28 +1220,19 @@ var hasQuestionValidationError = (question, questions) => {
1211
1220
  error = true;
1212
1221
  }
1213
1222
  }
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 !== "")) {
1223
+ if (((_b = question.validationType) == null ? void 0 : _b.find((e) => e === "email")) && (question.isQuestionMandatory || question.answer !== "")) {
1224
1224
  const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
1225
1225
  if (!emailRegex.test(question.answer)) {
1226
1226
  error = true;
1227
1227
  }
1228
1228
  }
1229
- if (((_f = question.validationType) == null ? void 0 : _f.find((e) => e === "fourNumbers")) && (question.isQuestionMandatory || question.answer !== "")) {
1229
+ if (((_c = question.validationType) == null ? void 0 : _c.find((e) => e === "fourNumbers")) && (question.isQuestionMandatory || question.answer !== "")) {
1230
1230
  const fourNumbersRegex = /^\d{4}$/.test(question.answer);
1231
1231
  if (!fourNumbersRegex) {
1232
1232
  error = true;
1233
1233
  }
1234
1234
  }
1235
- if (((_g = question.validationType) == null ? void 0 : _g.find((e) => e === "isDateFormatValid")) && question.answer !== "") {
1235
+ if (((_d = question.validationType) == null ? void 0 : _d.find((e) => e === "isDateFormatValid")) && question.answer !== "") {
1236
1236
  const regex = /^\d{4}-\d{2}-\d{2}$/;
1237
1237
  if (!regex.test(question.answer)) {
1238
1238
  error = true;
@@ -1246,18 +1246,16 @@ var hasQuestionValidationError = (question, questions) => {
1246
1246
  error = true;
1247
1247
  }
1248
1248
  }
1249
- const groupCheckError = (_h = question.validationType) == null ? void 0 : _h.find((e) => e.startsWith("groupCheck-"));
1249
+ const groupCheckError = (_e = question.validationType) == null ? void 0 : _e.find((e) => e.startsWith("groupCheck-"));
1250
1250
  if (groupCheckError) {
1251
1251
  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
- );
1252
+ const relatedAnswers = ids.map((id) => {
1253
+ var _a2;
1254
+ return (_a2 = questions.find((q) => {
1255
+ var _a3;
1256
+ return ((_a3 = q.id) == null ? void 0 : _a3.toString()) === id;
1257
+ })) == null ? void 0 : _a2.answer;
1258
+ });
1261
1259
  const currentAnswer = question.answer;
1262
1260
  const allAnswers = [...relatedAnswers, currentAnswer];
1263
1261
  if (allAnswers.every((ans) => ans === "")) {
@@ -2126,7 +2124,7 @@ var CookieBanner = ({
2126
2124
  href: "https://pts.se/om-oss/om-pts.se/kakor-pa-webbplatsen/kakor-pa-pts-e-tjanster/",
2127
2125
  target: "_blank",
2128
2126
  rel: "noopener noreferrer",
2129
- children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i ny flik)"
2127
+ children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i nytt f\xF6nster)"
2130
2128
  }
2131
2129
  )
2132
2130
  ] }),
@@ -2238,7 +2236,7 @@ var LanguageIcon = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", {
2238
2236
  fill: "#6E3282"
2239
2237
  }
2240
2238
  ) });
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: [
2239
+ 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
2240
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2243
2241
  "path",
2244
2242
  {
@@ -2384,7 +2382,7 @@ var Logo_sv = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("svg", { widt
2384
2382
  ),
2385
2383
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M82.2223 18.3335V37.2224", stroke: "currentColor", strokeWidth: "0.8", strokeMiterlimit: "10" })
2386
2384
  ] });
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: [
2385
+ 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
2386
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2389
2387
  "path",
2390
2388
  {