optimized-react-component-library-xyz123 0.28.6 → 0.28.8
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.d.mts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +185 -149
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +185 -149
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/css/darkMode.css +5 -0
- package/src/css/questions.css +0 -1
package/dist/index.js
CHANGED
|
@@ -156,11 +156,11 @@ var InputRadio = ({
|
|
|
156
156
|
]
|
|
157
157
|
}
|
|
158
158
|
) }),
|
|
159
|
-
showPreview && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PreviewRadio, { question })
|
|
159
|
+
showPreview && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(PreviewRadio, { question, activatedLanguage })
|
|
160
160
|
] });
|
|
161
161
|
};
|
|
162
162
|
var RadioMultipleStandard_default = InputRadio;
|
|
163
|
-
var PreviewRadio = ({ question }) => {
|
|
163
|
+
var PreviewRadio = ({ question, activatedLanguage }) => {
|
|
164
164
|
var _a, _b;
|
|
165
165
|
const previewId = `preview-${question.id}`;
|
|
166
166
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
@@ -170,7 +170,7 @@ var PreviewRadio = ({ question }) => {
|
|
|
170
170
|
{
|
|
171
171
|
className: "pts-radioMultiple-preview pts-root-answer no-answer-preview-page",
|
|
172
172
|
id: `answer-${previewId}`,
|
|
173
|
-
children: "Inget svar"
|
|
173
|
+
children: activatedLanguage === "en" ? "No answer" : "Inget svar"
|
|
174
174
|
}
|
|
175
175
|
)
|
|
176
176
|
] });
|
|
@@ -192,17 +192,17 @@ var MultipleCheckboxes = ({
|
|
|
192
192
|
var _a2;
|
|
193
193
|
const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
|
|
194
194
|
var _a3;
|
|
195
|
-
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.
|
|
196
|
-
}).map((option) => option.
|
|
195
|
+
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.id);
|
|
196
|
+
}).map((option) => option.id)) || [];
|
|
197
197
|
console.log("Initial values:", initialValues);
|
|
198
198
|
setCheckedValues(initialValues);
|
|
199
199
|
}, [question.answer, question.options]);
|
|
200
|
-
const handleInputChange = (event,
|
|
200
|
+
const handleInputChange = (event, optionId) => {
|
|
201
201
|
let updatedValues = [...checkedValues];
|
|
202
|
-
if (updatedValues.includes(
|
|
203
|
-
updatedValues = updatedValues.filter((val) => val !==
|
|
202
|
+
if (updatedValues.includes(optionId)) {
|
|
203
|
+
updatedValues = updatedValues.filter((val) => val !== optionId);
|
|
204
204
|
} else {
|
|
205
|
-
updatedValues.push(
|
|
205
|
+
updatedValues.push(optionId);
|
|
206
206
|
}
|
|
207
207
|
setCheckedValues(updatedValues);
|
|
208
208
|
const e = { target: { value: updatedValues.toString() } };
|
|
@@ -224,9 +224,9 @@ var MultipleCheckboxes = ({
|
|
|
224
224
|
type: "checkbox",
|
|
225
225
|
name: `${question.id}-option`,
|
|
226
226
|
id: `${question.id}-option-${index}`,
|
|
227
|
-
value: option.
|
|
228
|
-
checked: checkedValues.includes(option.
|
|
229
|
-
onChange: (e) => handleInputChange(e, option.
|
|
227
|
+
value: option.id,
|
|
228
|
+
checked: checkedValues.includes(option.id),
|
|
229
|
+
onChange: (e) => handleInputChange(e, option.id),
|
|
230
230
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
|
|
231
231
|
}
|
|
232
232
|
),
|
|
@@ -248,7 +248,7 @@ var PrevieMultipleCheckboxes = ({
|
|
|
248
248
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
249
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) => {
|
|
250
250
|
var _a2;
|
|
251
|
-
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.
|
|
251
|
+
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.id);
|
|
252
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" }),
|
|
253
253
|
" "
|
|
254
254
|
] });
|
|
@@ -272,8 +272,8 @@ var CheckboxGroup = ({
|
|
|
272
272
|
var _a2;
|
|
273
273
|
const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
|
|
274
274
|
var _a3;
|
|
275
|
-
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.
|
|
276
|
-
}).map((option) => option.
|
|
275
|
+
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.id);
|
|
276
|
+
}).map((option) => option.id)) || [];
|
|
277
277
|
setCheckedValues(initialValues);
|
|
278
278
|
}, [question.answer, question.options]);
|
|
279
279
|
const handleInputChange = (event, optionValue) => {
|
|
@@ -307,9 +307,9 @@ var CheckboxGroup = ({
|
|
|
307
307
|
type: "checkbox",
|
|
308
308
|
name: `name-${question.id}`,
|
|
309
309
|
id: `${groupId}-option-${index}`,
|
|
310
|
-
value: option.
|
|
311
|
-
checked: checkedValues.includes(option.
|
|
312
|
-
onChange: (e) => handleInputChange(e, option.
|
|
310
|
+
value: option.id,
|
|
311
|
+
checked: checkedValues.includes(option.id),
|
|
312
|
+
onChange: (e) => handleInputChange(e, option.id),
|
|
313
313
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
|
|
314
314
|
}
|
|
315
315
|
),
|
|
@@ -341,7 +341,7 @@ var PreviewCheckboxGroup = ({
|
|
|
341
341
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
342
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) => {
|
|
343
343
|
var _a2;
|
|
344
|
-
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.
|
|
344
|
+
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.id);
|
|
345
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" }),
|
|
346
346
|
" "
|
|
347
347
|
] });
|
|
@@ -356,12 +356,17 @@ var InputTextarea = ({
|
|
|
356
356
|
showPreview = false,
|
|
357
357
|
activatedLanguage
|
|
358
358
|
}) => {
|
|
359
|
-
var _a, _b, _c, _d, _e, _f
|
|
359
|
+
var _a, _b, _c, _d, _e, _f;
|
|
360
360
|
const questionId = `question-${question.id}`;
|
|
361
361
|
const inputId = `textarea-${question.id}`;
|
|
362
362
|
const aboutId = `about-${question.id}`;
|
|
363
363
|
const errorId = `error-${question.id}`;
|
|
364
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`;
|
|
365
370
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
366
371
|
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
367
372
|
"div",
|
|
@@ -393,34 +398,30 @@ var InputTextarea = ({
|
|
|
393
398
|
required: question.isQuestionMandatory,
|
|
394
399
|
"aria-required": question.isQuestionMandatory,
|
|
395
400
|
"aria-invalid": question.hasValidationError,
|
|
396
|
-
maxLength: ((_a = question.questionExtraAttribute) == null ? void 0 : _a.answerMaxLength) || defaultMaxLength,
|
|
397
401
|
"aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
|
|
398
402
|
id: inputId
|
|
399
403
|
}
|
|
400
404
|
),
|
|
401
405
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "pts-textarea-counter-error-container", children: [
|
|
402
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
406
|
+
!isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
403
407
|
ValidationMessage_default,
|
|
404
408
|
{
|
|
405
|
-
showValidationMessage:
|
|
409
|
+
showValidationMessage: true,
|
|
406
410
|
validationId: errorId,
|
|
407
|
-
validationMessesege: (
|
|
411
|
+
validationMessesege: (_e = question.validationDefaultMessesege) != null ? _e : "",
|
|
408
412
|
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
409
413
|
}
|
|
410
414
|
),
|
|
411
|
-
|
|
412
|
-
|
|
415
|
+
isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
416
|
+
ValidationMessage_default,
|
|
413
417
|
{
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
" ",
|
|
419
|
-
((_g = question.questionExtraAttribute) == null ? void 0 : _g.answerMaxLength) || defaultMaxLength,
|
|
420
|
-
" tecken"
|
|
421
|
-
]
|
|
418
|
+
showValidationMessage: true,
|
|
419
|
+
validationId: errorId,
|
|
420
|
+
validationMessesege: maxLengthErrorText,
|
|
421
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
422
422
|
}
|
|
423
|
-
)
|
|
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 })
|
|
424
425
|
] })
|
|
425
426
|
]
|
|
426
427
|
}
|
|
@@ -462,13 +463,16 @@ var TextFieldStandard = ({
|
|
|
462
463
|
const inputId = `textField-${question.id}`;
|
|
463
464
|
const aboutId = `about-${question.id}`;
|
|
464
465
|
const errorId = `error-${question.id}`;
|
|
465
|
-
const
|
|
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`;
|
|
466
470
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
467
471
|
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
468
472
|
"div",
|
|
469
473
|
{
|
|
470
474
|
id: questionId,
|
|
471
|
-
className: `pts-root-question pts-textField-container${((
|
|
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(),
|
|
472
476
|
children: [
|
|
473
477
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { htmlFor: inputId, children: [
|
|
474
478
|
question.questionLabel,
|
|
@@ -488,33 +492,41 @@ var TextFieldStandard = ({
|
|
|
488
492
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
489
493
|
"input",
|
|
490
494
|
{
|
|
491
|
-
type: (
|
|
492
|
-
autoComplete: (
|
|
493
|
-
inputMode: (
|
|
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,
|
|
494
498
|
name: `question-name-${question.id}`,
|
|
495
499
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
496
500
|
onChange: (e) => handleQuestionInputChange(e, question),
|
|
497
501
|
value: question.answer,
|
|
498
|
-
maxLength: ((_h = question.questionExtraAttribute) == null ? void 0 : _h.answerMaxLength) || defaultMaxLength,
|
|
499
502
|
id: inputId,
|
|
500
|
-
disabled: (
|
|
503
|
+
disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
|
|
501
504
|
required: question.isQuestionMandatory,
|
|
502
505
|
"aria-required": question.isQuestionMandatory,
|
|
503
506
|
"aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
|
|
504
507
|
"aria-invalid": question.hasValidationError,
|
|
505
508
|
"aria-errormessage": question.hasValidationError ? errorId : void 0,
|
|
506
|
-
spellCheck: (
|
|
507
|
-
autoCapitalize: (
|
|
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
|
|
508
511
|
}
|
|
509
512
|
),
|
|
510
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
513
|
+
!isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
511
514
|
ValidationMessage_default,
|
|
512
515
|
{
|
|
513
|
-
showValidationMessage:
|
|
516
|
+
showValidationMessage: true,
|
|
514
517
|
validationId: errorId,
|
|
515
518
|
validationMessesege: (_o = question.validationDefaultMessesege) != null ? _o : "",
|
|
516
519
|
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
517
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
|
+
}
|
|
518
530
|
)
|
|
519
531
|
]
|
|
520
532
|
}
|
|
@@ -740,14 +752,12 @@ var SelectedFiles = ({
|
|
|
740
752
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
741
753
|
const newCountOfFiles = newFiles.length;
|
|
742
754
|
setNumberOfFiles(newCountOfFiles);
|
|
743
|
-
|
|
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 } };
|
|
744
758
|
isTouched(e, questionObject);
|
|
745
759
|
removeFile(newCountOfFiles);
|
|
746
760
|
};
|
|
747
|
-
(0, import_react6.useEffect)(() => {
|
|
748
|
-
var _a;
|
|
749
|
-
numberOfFiles > 0 && ((_a = theDiv.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "end" }));
|
|
750
|
-
}, [numberOfFiles]);
|
|
751
761
|
const useWindowWidth = () => {
|
|
752
762
|
const [windowWidth2, setWindowWidth] = (0, import_react6.useState)(window.innerWidth);
|
|
753
763
|
(0, import_react6.useEffect)(() => {
|
|
@@ -820,7 +830,7 @@ var SelectedFiles = ({
|
|
|
820
830
|
}
|
|
821
831
|
) })
|
|
822
832
|
] }) }),
|
|
823
|
-
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) => {
|
|
824
834
|
const indicatorfileName = file.FileName;
|
|
825
835
|
let mobileFirstFileName = file.FileName.split(".").shift();
|
|
826
836
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
@@ -1031,7 +1041,7 @@ var AddFiles = ({
|
|
|
1031
1041
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
1032
1042
|
const e = {
|
|
1033
1043
|
target: {
|
|
1034
|
-
value: `${currentFiles.length + newFiles.length} files
|
|
1044
|
+
value: currentFiles.length + newFiles.length > 0 ? `${currentFiles.length + newFiles.length} files` : "",
|
|
1035
1045
|
files: [...currentFiles, ...newFiles]
|
|
1036
1046
|
}
|
|
1037
1047
|
};
|
|
@@ -1054,73 +1064,80 @@ var AddFiles = ({
|
|
|
1054
1064
|
setErrorMessageAddingFile([]);
|
|
1055
1065
|
};
|
|
1056
1066
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1057
|
-
!showPreview && visible && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
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
|
+
}
|
|
1065
1089
|
),
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
activatedLanguage,
|
|
1118
|
-
numberOfFiles,
|
|
1119
|
-
setNumberOfFiles,
|
|
1120
|
-
removeUploadErrors: handleRemoveErrors
|
|
1121
|
-
}
|
|
1122
|
-
)
|
|
1123
|
-
] }) }),
|
|
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
|
+
),
|
|
1124
1141
|
showPreview && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PreviewAddFiles, { activatedLanguage, questionObject })
|
|
1125
1142
|
] });
|
|
1126
1143
|
};
|
|
@@ -1237,7 +1254,7 @@ var PreviewSingleCheckbox = ({
|
|
|
1237
1254
|
// src/helpers/hasQuestionValidationError/hasQuestionValidationError.tsx
|
|
1238
1255
|
var import_date_fns = require("date-fns");
|
|
1239
1256
|
var hasQuestionValidationError = (question, questions) => {
|
|
1240
|
-
var _a, _b, _c, _d, _e;
|
|
1257
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1241
1258
|
let error = false;
|
|
1242
1259
|
if (question.isQuestionMandatory) {
|
|
1243
1260
|
if (question.isTouched === false) {
|
|
@@ -1250,19 +1267,28 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1250
1267
|
error = true;
|
|
1251
1268
|
}
|
|
1252
1269
|
}
|
|
1253
|
-
|
|
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 !== "")) {
|
|
1254
1280
|
const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
1255
1281
|
if (!emailRegex.test(question.answer)) {
|
|
1256
1282
|
error = true;
|
|
1257
1283
|
}
|
|
1258
1284
|
}
|
|
1259
|
-
if (((
|
|
1285
|
+
if (((_f = question.validationType) == null ? void 0 : _f.find((e) => e === "fourNumbers")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1260
1286
|
const fourNumbersRegex = /^\d{4}$/.test(question.answer);
|
|
1261
1287
|
if (!fourNumbersRegex) {
|
|
1262
1288
|
error = true;
|
|
1263
1289
|
}
|
|
1264
1290
|
}
|
|
1265
|
-
if (((
|
|
1291
|
+
if (((_g = question.validationType) == null ? void 0 : _g.find((e) => e === "isDateFormatValid")) && question.answer !== "") {
|
|
1266
1292
|
const regex = /^\d{4}-\d{2}-\d{2}$/;
|
|
1267
1293
|
if (!regex.test(question.answer)) {
|
|
1268
1294
|
error = true;
|
|
@@ -1276,16 +1302,18 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1276
1302
|
error = true;
|
|
1277
1303
|
}
|
|
1278
1304
|
}
|
|
1279
|
-
const groupCheckError = (
|
|
1305
|
+
const groupCheckError = (_h = question.validationType) == null ? void 0 : _h.find((e) => e.startsWith("groupCheck-"));
|
|
1280
1306
|
if (groupCheckError) {
|
|
1281
1307
|
const ids = groupCheckError.replace("groupCheck-", "").split("-");
|
|
1282
|
-
const relatedAnswers = ids.map(
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
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
|
+
);
|
|
1289
1317
|
const currentAnswer = question.answer;
|
|
1290
1318
|
const allAnswers = [...relatedAnswers, currentAnswer];
|
|
1291
1319
|
if (allAnswers.every((ans) => ans === "")) {
|
|
@@ -1306,7 +1334,7 @@ function createApiDataObject(data, specialMappedQuestions, translatedAnswers) {
|
|
|
1306
1334
|
let translatedAnswer = question.answer;
|
|
1307
1335
|
if (question.answer && typeof question.answer === "string" && Array.isArray(question.options) && question.mappingId && specialMappedQuestions.has(question.mappingId)) {
|
|
1308
1336
|
const answerNormalized = normalize(question.answer);
|
|
1309
|
-
const matchingIds = question.options.filter((option) => answerNormalized.includes(normalize(option.
|
|
1337
|
+
const matchingIds = question.options.filter((option) => answerNormalized.includes(normalize(option.id))).map((option) => `^${option.id}^`);
|
|
1310
1338
|
if (matchingIds.length > 0) {
|
|
1311
1339
|
translatedAnswer = matchingIds.join(",");
|
|
1312
1340
|
}
|
|
@@ -2103,7 +2131,8 @@ var CookieBanner = ({
|
|
|
2103
2131
|
onCookieStateChange,
|
|
2104
2132
|
onClose,
|
|
2105
2133
|
acceptCookies,
|
|
2106
|
-
rejectCookies
|
|
2134
|
+
rejectCookies,
|
|
2135
|
+
activatedLanguage = "sv"
|
|
2107
2136
|
}) => {
|
|
2108
2137
|
if (!visible) return null;
|
|
2109
2138
|
const handleCookieChoice = (accepted) => {
|
|
@@ -2130,8 +2159,13 @@ var CookieBanner = ({
|
|
|
2130
2159
|
id: "cookie-banner",
|
|
2131
2160
|
tabIndex: -1,
|
|
2132
2161
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "content", children: [
|
|
2133
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.
|
|
2134
|
-
|
|
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.` }),
|
|
2135
2169
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "pts-cookieBanner-Links", children: [
|
|
2136
2170
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2137
2171
|
"svg",
|
|
@@ -2160,13 +2194,13 @@ var CookieBanner = ({
|
|
|
2160
2194
|
href: "https://pts.se/om-oss/om-pts.se/kakor-pa-webbplatsen/kakor-pa-pts-e-tjanster/",
|
|
2161
2195
|
target: "_blank",
|
|
2162
2196
|
rel: "noopener noreferrer",
|
|
2163
|
-
children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i
|
|
2197
|
+
children: activatedLanguage === "en" ? "Cookies on pts.se (opens in new tab)" : "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i ny flik)"
|
|
2164
2198
|
}
|
|
2165
2199
|
)
|
|
2166
2200
|
] }),
|
|
2167
2201
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "pts-cookieBanner-Buttons", children: [
|
|
2168
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { onClick: () => handleCookieChoice(true), children: "Ja, jag samtycker" }),
|
|
2169
|
-
/* @__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" })
|
|
2170
2204
|
] })
|
|
2171
2205
|
] })
|
|
2172
2206
|
}
|
|
@@ -2272,7 +2306,7 @@ var LanguageIcon = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", {
|
|
|
2272
2306
|
fill: "#6E3282"
|
|
2273
2307
|
}
|
|
2274
2308
|
) });
|
|
2275
|
-
var Logo_sv = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", { width: "168.8", height: "
|
|
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: [
|
|
2276
2310
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2277
2311
|
"path",
|
|
2278
2312
|
{
|
|
@@ -2418,7 +2452,7 @@ var Logo_sv = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", { widt
|
|
|
2418
2452
|
),
|
|
2419
2453
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M82.2223 18.3335V37.2224", stroke: "currentColor", strokeWidth: "0.8", strokeMiterlimit: "10" })
|
|
2420
2454
|
] });
|
|
2421
|
-
var Logo_en = () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("svg", { width: "189.0", height: "
|
|
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: [
|
|
2422
2456
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2423
2457
|
"path",
|
|
2424
2458
|
{
|
|
@@ -2714,9 +2748,9 @@ var ModalStandard_default = Modal;
|
|
|
2714
2748
|
|
|
2715
2749
|
// src/components/layout/SkipLinkStandard/SkipLinkStandard.tsx
|
|
2716
2750
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2717
|
-
var SkipLink = () => {
|
|
2751
|
+
var SkipLink = ({ activatedLanguage = "sv" }) => {
|
|
2718
2752
|
function scrollToMainContent() {
|
|
2719
|
-
const container = document.getElementById(`main-
|
|
2753
|
+
const container = document.getElementById(`pts-main-service-headline`);
|
|
2720
2754
|
if (container) {
|
|
2721
2755
|
container.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
2722
2756
|
container.focus();
|
|
@@ -2730,7 +2764,7 @@ var SkipLink = () => {
|
|
|
2730
2764
|
e.preventDefault();
|
|
2731
2765
|
scrollToMainContent();
|
|
2732
2766
|
},
|
|
2733
|
-
children: "Till huvudinneh\xE5ll"
|
|
2767
|
+
children: activatedLanguage === "en" ? "Skip to main content" : "Till huvudinneh\xE5ll"
|
|
2734
2768
|
}
|
|
2735
2769
|
) });
|
|
2736
2770
|
};
|
|
@@ -2962,16 +2996,18 @@ var EditPreviewLinkStandard_default = EditPreviewLink;
|
|
|
2962
2996
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2963
2997
|
var StartApplicationButton = ({
|
|
2964
2998
|
onClick,
|
|
2965
|
-
label
|
|
2966
|
-
className = ""
|
|
2999
|
+
label,
|
|
3000
|
+
className = "",
|
|
3001
|
+
activatedLanguage = "sv"
|
|
2967
3002
|
}) => {
|
|
3003
|
+
const defaultLabel = activatedLanguage === "en" ? "Start e-service" : "Starta e-tj\xE4nsten";
|
|
2968
3004
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2969
3005
|
"button",
|
|
2970
3006
|
{
|
|
2971
3007
|
type: "button",
|
|
2972
3008
|
className: `pts-forwardButton pts-start-applicationButton ${className}`,
|
|
2973
3009
|
onClick,
|
|
2974
|
-
children: label
|
|
3010
|
+
children: label || defaultLabel
|
|
2975
3011
|
}
|
|
2976
3012
|
);
|
|
2977
3013
|
};
|
|
@@ -3130,10 +3166,10 @@ var ValidationErrorSummaryList_default = ValidationErrorSummaryList;
|
|
|
3130
3166
|
|
|
3131
3167
|
// src/components/validation-and-status/FormStatusMessagesScreenReader/FormStatusMessagesScreenReader.tsx
|
|
3132
3168
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3133
|
-
var FormStatusMessagesScreenReader = ({ formStatus }) => {
|
|
3169
|
+
var FormStatusMessagesScreenReader = ({ formStatus, activatedLanguage = "sv" }) => {
|
|
3134
3170
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
3135
|
-
/* @__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!" }) }),
|
|
3136
|
-
/* @__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." : "" })
|
|
3137
3173
|
] });
|
|
3138
3174
|
};
|
|
3139
3175
|
var FormStatusMessagesScreenReader_default = FormStatusMessagesScreenReader;
|