optimized-react-component-library-xyz123 0.28.7 → 0.29.1

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
@@ -80,32 +80,25 @@ __export(index_exports, {
80
80
  });
81
81
  module.exports = __toCommonJS(index_exports);
82
82
 
83
- // src/components/input-components/InfoTextStandard/InfoTextStandard.tsx
84
- var import_dompurify = __toESM(require("dompurify"));
83
+ // src/components/layout/ValidationMessage/ValidationMessage.tsx
85
84
  var import_jsx_runtime = require("react/jsx-runtime");
86
- var InfoTextStandard = ({ infoText, selectedValue, questionId, activatedLanguage }) => {
87
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
88
- "div",
89
- {
90
- id: `textinfo-${questionId}-${selectedValue}`,
91
- "aria-live": "polite",
92
- "aria-atomic": "true",
93
- children: infoText.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { id: questionId, className: "pts-root-question pts-infoTextdStandard-container", children: [
94
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "sr-only", children: activatedLanguage === "en" ? `Information about selected alternative - ${selectedValue}` : `Information om valt alternativ - ${selectedValue}` }),
95
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
96
- "div",
97
- {
98
- id: questionId,
99
- dangerouslySetInnerHTML: {
100
- __html: import_dompurify.default.sanitize(infoText != null ? infoText : "")
101
- }
102
- }
103
- )
104
- ] })
105
- }
106
- );
85
+ var ValidationSummary = ({
86
+ validationMessesege,
87
+ validationId,
88
+ activatedLanguage = "sv",
89
+ showValidationMessage = false,
90
+ extraCssClass = ""
91
+ }) => {
92
+ return showValidationMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `pts-root-error ${extraCssClass}`, id: validationId, children: [
93
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": true, className: "pts-validation-error-icon", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
94
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { width: "16", height: "16", rx: "8", fill: "#8E0039" }),
95
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M7.45996 10.4268L6.96094 5.34082V2.98926H9.03906V5.34082L8.54688 10.4268H7.45996ZM7.04297 13.0107V11.0898H8.96387V13.0107H7.04297Z", fill: "white" })
96
+ ] }) }),
97
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: activatedLanguage === "sv" ? "Valideringsfel" : "Validation error" }),
98
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "errorText", children: validationMessesege })
99
+ ] });
107
100
  };
108
- var InfoTextStandard_default = InfoTextStandard;
101
+ var ValidationMessage_default = ValidationSummary;
109
102
 
110
103
  // src/components/input-components/RadioMultipleStandard/RadioMultipleStandard.tsx
111
104
  var import_jsx_runtime2 = require("react/jsx-runtime");
@@ -115,7 +108,7 @@ var InputRadio = ({
115
108
  showPreview = false,
116
109
  activatedLanguage = "sv"
117
110
  }) => {
118
- var _a, _b, _c, _d;
111
+ var _a, _b, _c;
119
112
  const questionId = `question-${question.id}`;
120
113
  const groupId = `radio-group-${question.id}`;
121
114
  const errorId = `error-${question.id}`;
@@ -123,64 +116,51 @@ var InputRadio = ({
123
116
  const e = { target: { value: event.target.value } };
124
117
  handleQuestionInputChange(e, question);
125
118
  };
126
- const languageObj = question.languageSupport[0];
127
- var optionsInfoText = [];
128
- if ("optionsInfoText" in languageObj) {
129
- optionsInfoText = languageObj.optionsInfoText;
130
- }
131
- console.log(optionsInfoText);
132
119
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
133
- !showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "pts-root-question pts-radioMultiple-container", id: questionId, children: [
134
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
135
- "fieldset",
136
- {
137
- "aria-required": question.isQuestionMandatory,
138
- "aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
139
- "aria-errormessage": question.hasValidationError ? errorId : void 0,
140
- children: [
141
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("legend", { id: `label-${groupId}`, children: [
142
- question.questionLabel,
143
- " ",
144
- question.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" })
145
- ] }),
146
- (_a = question.options) == null ? void 0 : _a.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "pts-radio-option", children: [
147
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
148
- "input",
149
- {
150
- type: "radio",
151
- name: `name-${question.id}`,
152
- id: `${groupId}-option-${index}`,
153
- value: option.value,
154
- checked: question.answer === option.value,
155
- onChange: handleInputChange
156
- }
157
- ),
158
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: `${groupId}-option-${index}`, children: option.label }),
159
- " "
160
- ] }, index)),
161
- question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
162
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
163
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
164
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
165
- ] })
166
- ]
167
- }
168
- ),
169
- optionsInfoText.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
170
- InfoTextStandard_default,
171
- {
172
- infoText: (_c = (_b = optionsInfoText.find((op) => op.selectedValue === question.answer)) == null ? void 0 : _b.infoText) != null ? _c : "",
173
- selectedValue: (_d = question.answer) != null ? _d : "",
174
- questionId,
175
- activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
176
- }
177
- )
178
- ] }),
179
- showPreview && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PreviewRadio, { question })
120
+ !showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "pts-root-question pts-radioMultiple-container", id: questionId, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
121
+ "fieldset",
122
+ {
123
+ "aria-required": question.isQuestionMandatory,
124
+ "aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
125
+ "aria-errormessage": question.hasValidationError ? errorId : void 0,
126
+ children: [
127
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("legend", { id: `label-${groupId}`, children: [
128
+ question.questionLabel,
129
+ " ",
130
+ question.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" })
131
+ ] }),
132
+ (_a = question.options) == null ? void 0 : _a.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "pts-radio-option", children: [
133
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
134
+ "input",
135
+ {
136
+ type: "radio",
137
+ name: `name-${question.id}`,
138
+ id: `${groupId}-option-${index}`,
139
+ value: option.value,
140
+ checked: question.answer === option.value,
141
+ onChange: handleInputChange
142
+ }
143
+ ),
144
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: `${groupId}-option-${index}`, children: option.label }),
145
+ " "
146
+ ] }, index)),
147
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
148
+ ValidationMessage_default,
149
+ {
150
+ showValidationMessage: (_b = question.hasValidationError) != null ? _b : false,
151
+ validationId: errorId,
152
+ validationMessesege: (_c = question.validationDefaultMessesege) != null ? _c : "",
153
+ activatedLanguage
154
+ }
155
+ )
156
+ ]
157
+ }
158
+ ) }),
159
+ showPreview && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PreviewRadio, { question, activatedLanguage })
180
160
  ] });
181
161
  };
182
162
  var RadioMultipleStandard_default = InputRadio;
183
- var PreviewRadio = ({ question }) => {
163
+ var PreviewRadio = ({ question, activatedLanguage }) => {
184
164
  var _a, _b;
185
165
  const previewId = `preview-${question.id}`;
186
166
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
@@ -190,7 +170,7 @@ var PreviewRadio = ({ question }) => {
190
170
  {
191
171
  className: "pts-radioMultiple-preview pts-root-answer no-answer-preview-page",
192
172
  id: `answer-${previewId}`,
193
- children: "Inget svar"
173
+ children: activatedLanguage === "en" ? "No answer" : "Inget svar"
194
174
  }
195
175
  )
196
176
  ] });
@@ -212,17 +192,17 @@ var MultipleCheckboxes = ({
212
192
  var _a2;
213
193
  const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
214
194
  var _a3;
215
- return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.label);
216
- }).map((option) => option.label)) || [];
195
+ return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.id);
196
+ }).map((option) => option.id)) || [];
217
197
  console.log("Initial values:", initialValues);
218
198
  setCheckedValues(initialValues);
219
199
  }, [question.answer, question.options]);
220
- const handleInputChange = (event, optionValue) => {
200
+ const handleInputChange = (event, optionId) => {
221
201
  let updatedValues = [...checkedValues];
222
- if (updatedValues.includes(optionValue)) {
223
- updatedValues = updatedValues.filter((val) => val !== optionValue);
202
+ if (updatedValues.includes(optionId)) {
203
+ updatedValues = updatedValues.filter((val) => val !== optionId);
224
204
  } else {
225
- updatedValues.push(optionValue);
205
+ updatedValues.push(optionId);
226
206
  }
227
207
  setCheckedValues(updatedValues);
228
208
  const e = { target: { value: updatedValues.toString() } };
@@ -244,9 +224,9 @@ var MultipleCheckboxes = ({
244
224
  type: "checkbox",
245
225
  name: `${question.id}-option`,
246
226
  id: `${question.id}-option-${index}`,
247
- value: option.label,
248
- checked: checkedValues.includes(option.label),
249
- onChange: (e) => handleInputChange(e, option.label),
227
+ value: option.id,
228
+ checked: checkedValues.includes(option.id),
229
+ onChange: (e) => handleInputChange(e, option.id),
250
230
  className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
251
231
  }
252
232
  ),
@@ -268,7 +248,7 @@ var PrevieMultipleCheckboxes = ({
268
248
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
269
249
  question.answer ? question.options && question.options.length === 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dd", { children: question.options[0].label }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "pts-preview-answer-list", children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
270
250
  var _a2;
271
- return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
251
+ return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.id);
272
252
  }).map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: option.label }, index)) }) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dd", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }),
273
253
  " "
274
254
  ] });
@@ -283,7 +263,7 @@ var CheckboxGroup = ({
283
263
  showPreview = false,
284
264
  activatedLanguage = "sv"
285
265
  }) => {
286
- var _a;
266
+ var _a, _b, _c;
287
267
  const questionId = `question-${question.id}`;
288
268
  const errorId = `error-${question.id}`;
289
269
  const groupId = `checkbox-group-${question.id}`;
@@ -292,8 +272,8 @@ var CheckboxGroup = ({
292
272
  var _a2;
293
273
  const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
294
274
  var _a3;
295
- return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.label);
296
- }).map((option) => option.label)) || [];
275
+ return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.id);
276
+ }).map((option) => option.id)) || [];
297
277
  setCheckedValues(initialValues);
298
278
  }, [question.answer, question.options]);
299
279
  const handleInputChange = (event, optionValue) => {
@@ -327,19 +307,23 @@ var CheckboxGroup = ({
327
307
  type: "checkbox",
328
308
  name: `name-${question.id}`,
329
309
  id: `${groupId}-option-${index}`,
330
- value: option.label,
331
- checked: checkedValues.includes(option.label),
332
- onChange: (e) => handleInputChange(e, option.label),
310
+ value: option.id,
311
+ checked: checkedValues.includes(option.id),
312
+ onChange: (e) => handleInputChange(e, option.id),
333
313
  className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
334
314
  }
335
315
  ),
336
316
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { htmlFor: `${groupId}-option-${index}`, children: option.label })
337
317
  ] }, index)),
338
- question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
339
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
340
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
341
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
342
- ] })
318
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
319
+ ValidationMessage_default,
320
+ {
321
+ showValidationMessage: (_b = question.hasValidationError) != null ? _b : false,
322
+ validationId: errorId,
323
+ validationMessesege: (_c = question.validationDefaultMessesege) != null ? _c : "",
324
+ activatedLanguage
325
+ }
326
+ )
343
327
  ]
344
328
  }
345
329
  ) }),
@@ -357,14 +341,14 @@ var PreviewCheckboxGroup = ({
357
341
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
358
342
  question.answer ? question.options && question.options.length === 1 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: question.options[0].label }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { className: "pts-preview-answer-list", children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
359
343
  var _a2;
360
- return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
344
+ return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.id);
361
345
  }).map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { children: option.label }, index)) }) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }),
362
346
  " "
363
347
  ] });
364
348
  };
365
349
 
366
350
  // src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
367
- var import_dompurify2 = __toESM(require("dompurify"));
351
+ var import_dompurify = __toESM(require("dompurify"));
368
352
  var import_jsx_runtime5 = require("react/jsx-runtime");
369
353
  var InputTextarea = ({
370
354
  question,
@@ -372,12 +356,17 @@ var InputTextarea = ({
372
356
  showPreview = false,
373
357
  activatedLanguage
374
358
  }) => {
375
- var _a, _b, _c, _d, _e;
359
+ var _a, _b, _c, _d, _e, _f;
376
360
  const questionId = `question-${question.id}`;
377
361
  const inputId = `textarea-${question.id}`;
378
362
  const aboutId = `about-${question.id}`;
379
363
  const errorId = `error-${question.id}`;
380
364
  const defaultMaxLength = 1e3;
365
+ const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
366
+ const maxLength = (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.answerMaxLength) != null ? _d : defaultMaxLength;
367
+ const isTooLong = answerLength > maxLength;
368
+ const counterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
369
+ const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r max vara ${maxLength} tecken`;
381
370
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
382
371
  !showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
383
372
  "div",
@@ -396,7 +385,7 @@ var InputTextarea = ({
396
385
  id: aboutId,
397
386
  className: "pts-about",
398
387
  dangerouslySetInnerHTML: {
399
- __html: import_dompurify2.default.sanitize(question.aboutText)
388
+ __html: import_dompurify.default.sanitize(question.aboutText)
400
389
  }
401
390
  }
402
391
  ),
@@ -409,29 +398,30 @@ var InputTextarea = ({
409
398
  required: question.isQuestionMandatory,
410
399
  "aria-required": question.isQuestionMandatory,
411
400
  "aria-invalid": question.hasValidationError,
412
- maxLength: ((_a = question.questionExtraAttribute) == null ? void 0 : _a.answerMaxLength) || defaultMaxLength,
413
401
  "aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
414
402
  id: inputId
415
403
  }
416
404
  ),
417
405
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "pts-textarea-counter-error-container", children: [
418
- question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
419
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "aria-label": "Felmeddelande.", className: "errorDot", children: "!" }),
420
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
421
- ] }),
422
- !((_b = question.questionExtraAttribute) == null ? void 0 : _b.hideTextCounter) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
423
- "div",
406
+ !isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
407
+ ValidationMessage_default,
424
408
  {
425
- 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" : ""}`,
426
- children: [
427
- question.answer ? question.answer.length : 0,
428
- " av",
429
- " ",
430
- ((_e = question.questionExtraAttribute) == null ? void 0 : _e.answerMaxLength) || defaultMaxLength,
431
- " tecken"
432
- ]
409
+ showValidationMessage: true,
410
+ validationId: errorId,
411
+ validationMessesege: (_e = question.validationDefaultMessesege) != null ? _e : "",
412
+ activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
433
413
  }
434
- )
414
+ ),
415
+ isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
416
+ ValidationMessage_default,
417
+ {
418
+ showValidationMessage: true,
419
+ validationId: errorId,
420
+ validationMessesege: maxLengthErrorText,
421
+ activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
422
+ }
423
+ ),
424
+ !((_f = question.questionExtraAttribute) == null ? void 0 : _f.hideTextCounter) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { "aria-live": "polite", className: `pts-character-counter`, children: counterText })
435
425
  ] })
436
426
  ]
437
427
  }
@@ -460,7 +450,7 @@ var PreviewTextarea = ({
460
450
  };
461
451
 
462
452
  // src/components/input-components/TextFieldStandard/TextFieldStandard.tsx
463
- var import_dompurify3 = __toESM(require("dompurify"));
453
+ var import_dompurify2 = __toESM(require("dompurify"));
464
454
  var import_jsx_runtime6 = require("react/jsx-runtime");
465
455
  var TextFieldStandard = ({
466
456
  question,
@@ -468,18 +458,21 @@ var TextFieldStandard = ({
468
458
  showPreview = false,
469
459
  activatedLanguage
470
460
  }) => {
471
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
461
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
472
462
  const questionId = `question-${question.id}`;
473
463
  const inputId = `textField-${question.id}`;
474
464
  const aboutId = `about-${question.id}`;
475
465
  const errorId = `error-${question.id}`;
476
- const defaultMaxLength = 1e3;
466
+ const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
467
+ const maxLength = 100;
468
+ const isTooLong = answerLength > maxLength;
469
+ const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r max vara ${maxLength} tecken`;
477
470
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
478
471
  !showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
479
472
  "div",
480
473
  {
481
474
  id: questionId,
482
- className: `pts-root-question pts-textField-container${((_a = question.questionExtraAttribute) == null ? void 0 : _a.disabled) ? " pts-textField-disabled" : ""}${question.aboutText ? " pts-question-hasAbout" : ""}`.trim(),
475
+ className: `pts-root-question pts-textField-container${((_c = question.questionExtraAttribute) == null ? void 0 : _c.disabled) ? " pts-textField-disabled" : ""}${question.aboutText ? " pts-question-hasAbout" : ""}`.trim(),
483
476
  children: [
484
477
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { htmlFor: inputId, children: [
485
478
  question.questionLabel,
@@ -492,37 +485,49 @@ var TextFieldStandard = ({
492
485
  id: aboutId,
493
486
  className: "pts-about",
494
487
  dangerouslySetInnerHTML: {
495
- __html: import_dompurify3.default.sanitize(question.aboutText)
488
+ __html: import_dompurify2.default.sanitize(question.aboutText)
496
489
  }
497
490
  }
498
491
  ),
499
492
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
500
493
  "input",
501
494
  {
502
- type: (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.inputType) != null ? _c : "text",
503
- autoComplete: (_e = (_d = question.questionExtraAttribute) == null ? void 0 : _d.autoComplete) != null ? _e : void 0,
504
- inputMode: (_g = (_f = question.questionExtraAttribute) == null ? void 0 : _f.inputMode) != null ? _g : void 0,
495
+ type: (_e = (_d = question.questionExtraAttribute) == null ? void 0 : _d.inputType) != null ? _e : "text",
496
+ autoComplete: (_g = (_f = question.questionExtraAttribute) == null ? void 0 : _f.autoComplete) != null ? _g : void 0,
497
+ inputMode: (_i = (_h = question.questionExtraAttribute) == null ? void 0 : _h.inputMode) != null ? _i : void 0,
505
498
  name: `question-name-${question.id}`,
506
499
  className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
507
500
  onChange: (e) => handleQuestionInputChange(e, question),
508
501
  value: question.answer,
509
- maxLength: ((_h = question.questionExtraAttribute) == null ? void 0 : _h.answerMaxLength) || defaultMaxLength,
510
502
  id: inputId,
511
- disabled: (_i = question.questionExtraAttribute) == null ? void 0 : _i.disabled,
503
+ disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
512
504
  required: question.isQuestionMandatory,
513
505
  "aria-required": question.isQuestionMandatory,
514
506
  "aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
515
507
  "aria-invalid": question.hasValidationError,
516
508
  "aria-errormessage": question.hasValidationError ? errorId : void 0,
517
- spellCheck: (_k = (_j = question.questionExtraAttribute) == null ? void 0 : _j.spellCheck) != null ? _k : void 0,
518
- autoCapitalize: (_m = (_l = question.questionExtraAttribute) == null ? void 0 : _l.autoCapitalize) != null ? _m : void 0
509
+ spellCheck: (_l = (_k = question.questionExtraAttribute) == null ? void 0 : _k.spellCheck) != null ? _l : void 0,
510
+ autoCapitalize: (_n = (_m = question.questionExtraAttribute) == null ? void 0 : _m.autoCapitalize) != null ? _n : void 0
519
511
  }
520
512
  ),
521
- question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
522
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
523
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
524
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
525
- ] })
513
+ !isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
514
+ ValidationMessage_default,
515
+ {
516
+ showValidationMessage: true,
517
+ validationId: errorId,
518
+ validationMessesege: (_o = question.validationDefaultMessesege) != null ? _o : "",
519
+ activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
520
+ }
521
+ ),
522
+ isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
523
+ ValidationMessage_default,
524
+ {
525
+ showValidationMessage: true,
526
+ validationId: errorId,
527
+ validationMessesege: maxLengthErrorText,
528
+ activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
529
+ }
530
+ )
526
531
  ]
527
532
  }
528
533
  ),
@@ -747,14 +752,12 @@ var SelectedFiles = ({
747
752
  let newFiles = questionObject.files.filter((f) => f !== file);
748
753
  const newCountOfFiles = newFiles.length;
749
754
  setNumberOfFiles(newCountOfFiles);
750
- const e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
755
+ let e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
756
+ const targetValue = e.target.value === "0 files" ? "" : e.target.value;
757
+ e = { ...e, target: { ...e.target, value: targetValue } };
751
758
  isTouched(e, questionObject);
752
759
  removeFile(newCountOfFiles);
753
760
  };
754
- (0, import_react6.useEffect)(() => {
755
- var _a;
756
- numberOfFiles > 0 && ((_a = theDiv.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "end" }));
757
- }, [numberOfFiles]);
758
761
  const useWindowWidth = () => {
759
762
  const [windowWidth2, setWindowWidth] = (0, import_react6.useState)(window.innerWidth);
760
763
  (0, import_react6.useEffect)(() => {
@@ -827,7 +830,7 @@ var SelectedFiles = ({
827
830
  }
828
831
  ) })
829
832
  ] }) }),
830
- questionObject.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "fileListUnorderedList", "aria-label": "Uppladdade filer", children: questionObject.files.map((file, index) => {
833
+ questionObject.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "fileListUnorderedList", "aria-label": activatedLanguage === "en" ? "Uploaded files" : "Uppladdade filer", children: questionObject.files.map((file, index) => {
831
834
  const indicatorfileName = file.FileName;
832
835
  let mobileFirstFileName = file.FileName.split(".").shift();
833
836
  mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
@@ -901,6 +904,7 @@ var AddFiles = ({
901
904
  allowedTotalFileSize = 20971520
902
905
  // 20MB = (1024 * 1024) * 20
903
906
  }) => {
907
+ var _a, _b;
904
908
  if (allowedFileTypes.length < 1) {
905
909
  allowedFileTypes = [
906
910
  "pdf",
@@ -944,7 +948,7 @@ var AddFiles = ({
944
948
  }, []);
945
949
  const onDrop = (0, import_react7.useCallback)(
946
950
  (acceptedFiles) => {
947
- var _a, _b, _c;
951
+ var _a2, _b2, _c;
948
952
  const validationErrors = [];
949
953
  const validFiles = [];
950
954
  const currentTotalFileSize = (questionObject.files || []).reduce(
@@ -952,7 +956,7 @@ var AddFiles = ({
952
956
  0
953
957
  );
954
958
  setTotalFileSize(currentTotalFileSize);
955
- if ((((_a = questionObject.files) == null ? void 0 : _a.length) || 0) >= allowedNumberOfFiles) {
959
+ if ((((_a2 = questionObject.files) == null ? void 0 : _a2.length) || 0) >= allowedNumberOfFiles) {
956
960
  acceptedFiles.forEach((file) => {
957
961
  validationErrors.push({
958
962
  FileName: file.name,
@@ -965,7 +969,7 @@ var AddFiles = ({
965
969
  }
966
970
  let accumulatedNewSize = 0;
967
971
  for (const file of acceptedFiles) {
968
- const fileExtension = ((_b = file.name.split(".").pop()) == null ? void 0 : _b.toLowerCase()) || "";
972
+ const fileExtension = ((_b2 = file.name.split(".").pop()) == null ? void 0 : _b2.toLowerCase()) || "";
969
973
  if (!allowedFileTypes.includes(fileExtension)) {
970
974
  validationErrors.push({
971
975
  FileName: file.name,
@@ -1037,7 +1041,7 @@ var AddFiles = ({
1037
1041
  const currentFiles = questionObject.files ? questionObject.files : [];
1038
1042
  const e = {
1039
1043
  target: {
1040
- value: `${currentFiles.length + newFiles.length} files`,
1044
+ value: currentFiles.length + newFiles.length > 0 ? `${currentFiles.length + newFiles.length} files` : "",
1041
1045
  files: [...currentFiles, ...newFiles]
1042
1046
  }
1043
1047
  };
@@ -1060,68 +1064,80 @@ var AddFiles = ({
1060
1064
  setErrorMessageAddingFile([]);
1061
1065
  };
1062
1066
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1063
- !showPreview && visible && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "root-question addFile-question-container", id: `question-${questionObject.id}`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { role: "group", children: [
1064
- questionObject.aboutText && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1065
- "p",
1066
- {
1067
- id: aboutId,
1068
- className: (0, import_clsx3.default)(
1069
- "addFilesMandatory",
1070
- questionObject.hasValidationError ? " error" : ""
1067
+ !showPreview && visible && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1068
+ "div",
1069
+ {
1070
+ className: "root-question addFile-question-container",
1071
+ id: `question-${questionObject.id}`,
1072
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { role: "group", children: [
1073
+ questionObject.aboutText && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1074
+ "p",
1075
+ {
1076
+ id: aboutId,
1077
+ className: (0, import_clsx3.default)(
1078
+ "addFilesMandatory",
1079
+ questionObject.hasValidationError ? " error" : ""
1080
+ ),
1081
+ children: [
1082
+ questionObject.aboutText,
1083
+ questionObject.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "pts-root-mandatoryAsterisk", "aria-label": "Obligatorisk fr\xE5ga", children: [
1084
+ " ",
1085
+ "*"
1086
+ ] })
1087
+ ]
1088
+ }
1071
1089
  ),
1072
- children: [
1073
- questionObject.aboutText,
1074
- questionObject.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "pts-root-mandatoryAsterisk", "aria-label": "Obligatorisk fr\xE5ga", children: [
1075
- " ",
1076
- "*"
1077
- ] })
1078
- ]
1079
- }
1080
- ),
1081
- questionObject.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "pts-root-error error addfileserror", id: errorId, children: [
1082
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
1083
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
1084
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "errorText", children: questionObject.validationDefaultMessesege })
1085
- ] }),
1086
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1087
- ExploreFilesStandard_default,
1088
- {
1089
- FilesSelected: onDrop,
1090
- numberOfFiles,
1091
- allowedNumberOfFiles,
1092
- activatedLanguage,
1093
- inputId,
1094
- labelId,
1095
- aboutId,
1096
- errorId,
1097
- questionObject,
1098
- errorMessageAddingFile,
1099
- removeUploadErrors: handleRemoveErrors
1100
- }
1101
- ),
1102
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1103
- DropFilesStandard_default,
1104
- {
1105
- FilesSelected: onDrop,
1106
- DropFilesText: dropFilesText,
1107
- language: activatedLanguage
1108
- }
1109
- ),
1110
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1111
- SelectedFilesStandard_default,
1112
- {
1113
- questionObject,
1114
- isTouched: handleQuestionInputChange,
1115
- removeFile: removeFileFromNumberOfFiles,
1116
- removeError,
1117
- errorMessageAddingFile,
1118
- activatedLanguage,
1119
- numberOfFiles,
1120
- setNumberOfFiles,
1121
- removeUploadErrors: handleRemoveErrors
1122
- }
1123
- )
1124
- ] }) }),
1090
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1091
+ ValidationMessage_default,
1092
+ {
1093
+ showValidationMessage: (_a = questionObject.hasValidationError) != null ? _a : false,
1094
+ validationId: errorId,
1095
+ validationMessesege: (_b = questionObject.validationDefaultMessesege) != null ? _b : "",
1096
+ activatedLanguage,
1097
+ extraCssClass: "error addfileserror"
1098
+ }
1099
+ ),
1100
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1101
+ ExploreFilesStandard_default,
1102
+ {
1103
+ FilesSelected: onDrop,
1104
+ numberOfFiles,
1105
+ allowedNumberOfFiles,
1106
+ activatedLanguage,
1107
+ inputId,
1108
+ labelId,
1109
+ aboutId,
1110
+ errorId,
1111
+ questionObject,
1112
+ errorMessageAddingFile,
1113
+ removeUploadErrors: handleRemoveErrors
1114
+ }
1115
+ ),
1116
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1117
+ DropFilesStandard_default,
1118
+ {
1119
+ FilesSelected: onDrop,
1120
+ DropFilesText: dropFilesText,
1121
+ language: activatedLanguage
1122
+ }
1123
+ ),
1124
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1125
+ SelectedFilesStandard_default,
1126
+ {
1127
+ questionObject,
1128
+ isTouched: handleQuestionInputChange,
1129
+ removeFile: removeFileFromNumberOfFiles,
1130
+ removeError,
1131
+ errorMessageAddingFile,
1132
+ activatedLanguage,
1133
+ numberOfFiles,
1134
+ setNumberOfFiles,
1135
+ removeUploadErrors: handleRemoveErrors
1136
+ }
1137
+ )
1138
+ ] })
1139
+ }
1140
+ ),
1125
1141
  showPreview && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PreviewAddFiles, { activatedLanguage, questionObject })
1126
1142
  ] });
1127
1143
  };
@@ -1148,7 +1164,7 @@ var SingleCheckbox = ({
1148
1164
  showPreview = false,
1149
1165
  activatedLanguage = "sv"
1150
1166
  }) => {
1151
- var _a, _b;
1167
+ var _a, _b, _c, _d;
1152
1168
  const questionId = `question-${question.id}`;
1153
1169
  const inputId = `checkbox-${question.id}`;
1154
1170
  const aboutId = `about-${question.id}`;
@@ -1201,12 +1217,15 @@ var SingleCheckbox = ({
1201
1217
  }
1202
1218
  ),
1203
1219
  " ",
1204
- question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
1205
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
1206
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
1207
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
1208
- ] }),
1209
- " "
1220
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1221
+ ValidationMessage_default,
1222
+ {
1223
+ showValidationMessage: (_c = question.hasValidationError) != null ? _c : false,
1224
+ validationId: errorId,
1225
+ validationMessesege: (_d = question.validationDefaultMessesege) != null ? _d : "",
1226
+ activatedLanguage
1227
+ }
1228
+ )
1210
1229
  ] }),
1211
1230
  " ",
1212
1231
  showPreview && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PreviewSingleCheckbox, { activatedLanguage, question })
@@ -1235,7 +1254,7 @@ var PreviewSingleCheckbox = ({
1235
1254
  // src/helpers/hasQuestionValidationError/hasQuestionValidationError.tsx
1236
1255
  var import_date_fns = require("date-fns");
1237
1256
  var hasQuestionValidationError = (question, questions) => {
1238
- var _a, _b, _c, _d, _e;
1257
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1239
1258
  let error = false;
1240
1259
  if (question.isQuestionMandatory) {
1241
1260
  if (question.isTouched === false) {
@@ -1248,19 +1267,28 @@ var hasQuestionValidationError = (question, questions) => {
1248
1267
  error = true;
1249
1268
  }
1250
1269
  }
1251
- if (((_b = question.validationType) == null ? void 0 : _b.find((e) => e === "email")) && (question.isQuestionMandatory || question.answer !== "")) {
1270
+ const maxLength = (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.answerMaxLength) != null ? _c : 1e3;
1271
+ if (((_d = question.validationType) == null ? void 0 : _d.includes("maxLength")) && question.answer.length > maxLength) {
1272
+ error = true;
1273
+ }
1274
+ if (question.questionType === "TextField") {
1275
+ if (question.answer.length > 100) {
1276
+ error = true;
1277
+ }
1278
+ }
1279
+ if (((_e = question.validationType) == null ? void 0 : _e.find((e) => e === "email")) && (question.isQuestionMandatory || question.answer !== "")) {
1252
1280
  const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
1253
1281
  if (!emailRegex.test(question.answer)) {
1254
1282
  error = true;
1255
1283
  }
1256
1284
  }
1257
- if (((_c = question.validationType) == null ? void 0 : _c.find((e) => e === "fourNumbers")) && (question.isQuestionMandatory || question.answer !== "")) {
1285
+ if (((_f = question.validationType) == null ? void 0 : _f.find((e) => e === "fourNumbers")) && (question.isQuestionMandatory || question.answer !== "")) {
1258
1286
  const fourNumbersRegex = /^\d{4}$/.test(question.answer);
1259
1287
  if (!fourNumbersRegex) {
1260
1288
  error = true;
1261
1289
  }
1262
1290
  }
1263
- if (((_d = question.validationType) == null ? void 0 : _d.find((e) => e === "isDateFormatValid")) && question.answer !== "") {
1291
+ if (((_g = question.validationType) == null ? void 0 : _g.find((e) => e === "isDateFormatValid")) && question.answer !== "") {
1264
1292
  const regex = /^\d{4}-\d{2}-\d{2}$/;
1265
1293
  if (!regex.test(question.answer)) {
1266
1294
  error = true;
@@ -1274,16 +1302,18 @@ var hasQuestionValidationError = (question, questions) => {
1274
1302
  error = true;
1275
1303
  }
1276
1304
  }
1277
- const groupCheckError = (_e = question.validationType) == null ? void 0 : _e.find((e) => e.startsWith("groupCheck-"));
1305
+ const groupCheckError = (_h = question.validationType) == null ? void 0 : _h.find((e) => e.startsWith("groupCheck-"));
1278
1306
  if (groupCheckError) {
1279
1307
  const ids = groupCheckError.replace("groupCheck-", "").split("-");
1280
- const relatedAnswers = ids.map((id) => {
1281
- var _a2;
1282
- return (_a2 = questions.find((q) => {
1283
- var _a3;
1284
- return ((_a3 = q.id) == null ? void 0 : _a3.toString()) === id;
1285
- })) == null ? void 0 : _a2.answer;
1286
- });
1308
+ const relatedAnswers = ids.map(
1309
+ (id) => {
1310
+ var _a2;
1311
+ return (_a2 = questions.find((q) => {
1312
+ var _a3;
1313
+ return ((_a3 = q.id) == null ? void 0 : _a3.toString()) === id;
1314
+ })) == null ? void 0 : _a2.answer;
1315
+ }
1316
+ );
1287
1317
  const currentAnswer = question.answer;
1288
1318
  const allAnswers = [...relatedAnswers, currentAnswer];
1289
1319
  if (allAnswers.every((ans) => ans === "")) {
@@ -1304,7 +1334,7 @@ function createApiDataObject(data, specialMappedQuestions, translatedAnswers) {
1304
1334
  let translatedAnswer = question.answer;
1305
1335
  if (question.answer && typeof question.answer === "string" && Array.isArray(question.options) && question.mappingId && specialMappedQuestions.has(question.mappingId)) {
1306
1336
  const answerNormalized = normalize(question.answer);
1307
- const matchingIds = question.options.filter((option) => answerNormalized.includes(normalize(option.label))).map((option) => `^${option.id}^`);
1337
+ const matchingIds = question.options.filter((option) => answerNormalized.includes(normalize(option.id))).map((option) => `^${option.id}^`);
1308
1338
  if (matchingIds.length > 0) {
1309
1339
  translatedAnswer = matchingIds.join(",");
1310
1340
  }
@@ -2024,11 +2054,12 @@ var QuestionGroup = ({
2024
2054
  showPreview = false,
2025
2055
  markQuestionAsDisplayed
2026
2056
  }) => {
2027
- var _a;
2057
+ var _a, _b, _c;
2028
2058
  if (!questions || questions.length === 0) {
2029
2059
  return null;
2030
2060
  }
2031
2061
  const firstQuestion = questions[0];
2062
+ const errorId = firstQuestion.id + "-error";
2032
2063
  const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find((e) => e.startsWith("groupCheck-"));
2033
2064
  (0, import_react12.useEffect)(() => {
2034
2065
  questions.forEach((question) => {
@@ -2069,10 +2100,15 @@ var QuestionGroup = ({
2069
2100
  firstQuestion.validationDefaultMessesege
2070
2101
  ] })
2071
2102
  ] }),
2072
- firstQuestion.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "pts-root-error", id: firstQuestion.id + "-error", children: [
2073
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-label": "Valideringsfel", className: "errorDot", children: "!" }),
2074
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "errorText", children: firstQuestion.validationDefaultMessesege })
2075
- ] }),
2103
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2104
+ ValidationMessage_default,
2105
+ {
2106
+ showValidationMessage: (_b = firstQuestion.hasValidationError) != null ? _b : false,
2107
+ validationId: errorId,
2108
+ validationMessesege: (_c = firstQuestion.validationDefaultMessesege) != null ? _c : "",
2109
+ activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
2110
+ }
2111
+ ),
2076
2112
  groupQuestions
2077
2113
  ]
2078
2114
  }
@@ -2095,7 +2131,8 @@ var CookieBanner = ({
2095
2131
  onCookieStateChange,
2096
2132
  onClose,
2097
2133
  acceptCookies,
2098
- rejectCookies
2134
+ rejectCookies,
2135
+ activatedLanguage = "sv"
2099
2136
  }) => {
2100
2137
  if (!visible) return null;
2101
2138
  const handleCookieChoice = (accepted) => {
@@ -2122,8 +2159,13 @@ var CookieBanner = ({
2122
2159
  id: "cookie-banner",
2123
2160
  tabIndex: -1,
2124
2161
  children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "content", children: [
2125
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", { id: "cookie-banner-title", children: "Kakor (cookies)" }),
2126
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { id: "cookie-banner-description", children: "PTS skulle vilja anv\xE4nda en statistikkaka i syfte att l\xF6pande f\xF6rb\xE4ttra webbplatsen. Samtycker du till det? Du kan n\xE4r som helst \xE4ndra ditt val. F\xF6r att \xE5terkalla ditt samtycke klickar du p\xE5 \u201DKakor\u201D i avsnittet l\xE4ngst ned p\xE5 webbplatsen." }),
2162
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("h3", { id: "cookie-banner-title", children: [
2163
+ " ",
2164
+ activatedLanguage === "en" ? "Cookies" : "Kakor (cookies)"
2165
+ ] }),
2166
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { id: "cookie-banner-description", children: activatedLanguage === "en" ? `PTS would like to use a web analytics cookie in order to continuously improve pts.se. Do you consent? You can change your choice at any time. To withdraw your consent, click on \u201CCookies\u201D at the bottom of the website.` : `PTS skulle vilja anv\xE4nda en statistikkaka i syfte att l\xF6pande f\xF6rb\xE4ttra webbplatsen.
2167
+ Samtycker du till det? Du kan n\xE4r som helst \xE4ndra ditt val. F\xF6r att \xE5terkalla ditt
2168
+ samtycke klickar du p\xE5 \u201DKakor\u201D i avsnittet l\xE4ngst ned p\xE5 webbplatsen.` }),
2127
2169
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "pts-cookieBanner-Links", children: [
2128
2170
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
2129
2171
  "svg",
@@ -2152,13 +2194,13 @@ var CookieBanner = ({
2152
2194
  href: "https://pts.se/om-oss/om-pts.se/kakor-pa-webbplatsen/kakor-pa-pts-e-tjanster/",
2153
2195
  target: "_blank",
2154
2196
  rel: "noopener noreferrer",
2155
- children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i nytt f\xF6nster)"
2197
+ children: activatedLanguage === "en" ? "Cookies on pts.se (opens in new tab)" : "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i ny flik)"
2156
2198
  }
2157
2199
  )
2158
2200
  ] }),
2159
2201
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "pts-cookieBanner-Buttons", children: [
2160
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { onClick: () => handleCookieChoice(true), children: "Ja, jag samtycker" }),
2161
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { onClick: () => handleCookieChoice(false), children: "Nej, jag samtycker inte" })
2202
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { onClick: () => handleCookieChoice(true), children: activatedLanguage === "en" ? "Yes, I consent" : "Ja, jag samtycker" }),
2203
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { onClick: () => handleCookieChoice(false), children: activatedLanguage === "en" ? "No, I do not consent" : "Nej, jag samtycker inte" })
2162
2204
  ] })
2163
2205
  ] })
2164
2206
  }
@@ -2264,7 +2306,7 @@ var LanguageIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", {
2264
2306
  fill: "#6E3282"
2265
2307
  }
2266
2308
  ) });
2267
- var Logo_sv = () => /* @__PURE__ */ (0, import_jsx_runtime18.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: [
2309
+ var Logo_sv = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", { width: "168.8", height: "40", viewBox: "0 0 168.8 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2268
2310
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2269
2311
  "path",
2270
2312
  {
@@ -2410,7 +2452,7 @@ var Logo_sv = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", { widt
2410
2452
  ),
2411
2453
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M82.2223 18.3335V37.2224", stroke: "currentColor", strokeWidth: "0.8", strokeMiterlimit: "10" })
2412
2454
  ] });
2413
- var Logo_en = () => /* @__PURE__ */ (0, import_jsx_runtime18.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: [
2455
+ var Logo_en = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", { width: "189.0", height: "40", viewBox: "0 0 189 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", role: "img", children: [
2414
2456
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2415
2457
  "path",
2416
2458
  {
@@ -2706,9 +2748,9 @@ var ModalStandard_default = Modal;
2706
2748
 
2707
2749
  // src/components/layout/SkipLinkStandard/SkipLinkStandard.tsx
2708
2750
  var import_jsx_runtime21 = require("react/jsx-runtime");
2709
- var SkipLink = () => {
2751
+ var SkipLink = ({ activatedLanguage = "sv" }) => {
2710
2752
  function scrollToMainContent() {
2711
- const container = document.getElementById(`main-content`);
2753
+ const container = document.getElementById(`pts-main-service-headline`);
2712
2754
  if (container) {
2713
2755
  container.scrollIntoView({ behavior: "smooth", block: "center" });
2714
2756
  container.focus();
@@ -2722,7 +2764,7 @@ var SkipLink = () => {
2722
2764
  e.preventDefault();
2723
2765
  scrollToMainContent();
2724
2766
  },
2725
- children: "Till huvudinneh\xE5ll"
2767
+ children: activatedLanguage === "en" ? "Skip to main content" : "Till huvudinneh\xE5ll"
2726
2768
  }
2727
2769
  ) });
2728
2770
  };
@@ -2730,7 +2772,7 @@ var SkipLinkStandard_default = SkipLink;
2730
2772
 
2731
2773
  // src/components/text-blocks/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
2732
2774
  var import_react13 = require("react");
2733
- var import_dompurify4 = __toESM(require("dompurify"));
2775
+ var import_dompurify3 = __toESM(require("dompurify"));
2734
2776
  var import_jsx_runtime22 = require("react/jsx-runtime");
2735
2777
  var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
2736
2778
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
@@ -2739,7 +2781,7 @@ var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
2739
2781
  className: "pts-textHeadlineAndBody-container",
2740
2782
  children: [
2741
2783
  data.headline && (0, import_react13.createElement)(headlineType, { id: "textHeadlineAndBody-headline" }, data.headline),
2742
- data.body && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify4.default.sanitize(data.body) } }),
2784
+ data.body && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify3.default.sanitize(data.body) } }),
2743
2785
  data.linksForMoreInfo && data.linksForMoreInfo.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2744
2786
  "a",
2745
2787
  {
@@ -2860,11 +2902,11 @@ var PrincipleOfPublicity = ({ activatedLanguage = "" }) => {
2860
2902
  var PrincipleOfPublicityStandard_default = PrincipleOfPublicity;
2861
2903
 
2862
2904
  // src/components/text-blocks/TextBody/TextBody.tsx
2863
- var import_dompurify5 = __toESM(require("dompurify"));
2905
+ var import_dompurify4 = __toESM(require("dompurify"));
2864
2906
  var import_jsx_runtime24 = require("react/jsx-runtime");
2865
2907
  var TextBody = ({ data }) => {
2866
2908
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "pts-textBody-container", children: [
2867
- data.body && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify5.default.sanitize(data.body) } }),
2909
+ data.body && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify4.default.sanitize(data.body) } }),
2868
2910
  data.linksForMoreInfo && data.linksForMoreInfo.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2869
2911
  "a",
2870
2912
  {
@@ -2954,16 +2996,18 @@ var EditPreviewLinkStandard_default = EditPreviewLink;
2954
2996
  var import_jsx_runtime26 = require("react/jsx-runtime");
2955
2997
  var StartApplicationButton = ({
2956
2998
  onClick,
2957
- label = "Starta e-tj\xE4nsten",
2958
- className = ""
2999
+ label,
3000
+ className = "",
3001
+ activatedLanguage = "sv"
2959
3002
  }) => {
3003
+ const defaultLabel = activatedLanguage === "en" ? "Start e-service" : "Starta e-tj\xE4nsten";
2960
3004
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2961
3005
  "button",
2962
3006
  {
2963
3007
  type: "button",
2964
3008
  className: `pts-forwardButton pts-start-applicationButton ${className}`,
2965
3009
  onClick,
2966
- children: label
3010
+ children: label || defaultLabel
2967
3011
  }
2968
3012
  );
2969
3013
  };
@@ -3122,10 +3166,10 @@ var ValidationErrorSummaryList_default = ValidationErrorSummaryList;
3122
3166
 
3123
3167
  // src/components/validation-and-status/FormStatusMessagesScreenReader/FormStatusMessagesScreenReader.tsx
3124
3168
  var import_jsx_runtime30 = require("react/jsx-runtime");
3125
- var FormStatusMessagesScreenReader = ({ formStatus }) => {
3169
+ var FormStatusMessagesScreenReader = ({ formStatus, activatedLanguage = "sv" }) => {
3126
3170
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
3127
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { "aria-live": "assertive", children: formStatus === "failed" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "pts-root-mandatoryAsterisk", children: "N\xE5got gick fel, f\xF6rs\xF6k igen senare eller kontakta oss!" }) }),
3128
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { "aria-live": "polite", className: "visually-hidden", children: formStatus === "loading" ? "Ditt \xE4rende registreras. Uppdatera eller st\xE4ng inte sidan." : "" })
3171
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { "aria-live": "assertive", children: formStatus === "failed" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "pts-root-mandatoryAsterisk", children: activatedLanguage === "en" ? "Something went wrong, please try again later or contact us!" : "N\xE5got gick fel, f\xF6rs\xF6k igen senare eller kontakta oss!" }) }),
3172
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { "aria-live": "polite", className: "visually-hidden", children: formStatus === "loading" ? activatedLanguage === "en" ? "Your case is being registered. Please do not refresh or close the page." : "Ditt \xE4rende registreras. Uppdatera eller st\xE4ng inte sidan." : "" })
3129
3173
  ] });
3130
3174
  };
3131
3175
  var FormStatusMessagesScreenReader_default = FormStatusMessagesScreenReader;