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.d.mts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +299 -255
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +299 -255
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/css/darkMode.css +14 -0
- package/src/css/questions.css +9 -1
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,22 @@
|
|
|
1
|
-
// src/components/
|
|
2
|
-
import DOMPurify from "dompurify";
|
|
1
|
+
// src/components/layout/ValidationMessage/ValidationMessage.tsx
|
|
3
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
)
|
|
22
|
-
] })
|
|
23
|
-
}
|
|
24
|
-
);
|
|
3
|
+
var ValidationSummary = ({
|
|
4
|
+
validationMessesege,
|
|
5
|
+
validationId,
|
|
6
|
+
activatedLanguage = "sv",
|
|
7
|
+
showValidationMessage = false,
|
|
8
|
+
extraCssClass = ""
|
|
9
|
+
}) => {
|
|
10
|
+
return showValidationMessage && /* @__PURE__ */ jsxs("div", { className: `pts-root-error ${extraCssClass}`, id: validationId, children: [
|
|
11
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "pts-validation-error-icon", children: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
|
|
12
|
+
/* @__PURE__ */ jsx("rect", { width: "16", height: "16", rx: "8", fill: "#8E0039" }),
|
|
13
|
+
/* @__PURE__ */ 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" })
|
|
14
|
+
] }) }),
|
|
15
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: activatedLanguage === "sv" ? "Valideringsfel" : "Validation error" }),
|
|
16
|
+
/* @__PURE__ */ jsx("span", { className: "errorText", children: validationMessesege })
|
|
17
|
+
] });
|
|
25
18
|
};
|
|
26
|
-
var
|
|
19
|
+
var ValidationMessage_default = ValidationSummary;
|
|
27
20
|
|
|
28
21
|
// src/components/input-components/RadioMultipleStandard/RadioMultipleStandard.tsx
|
|
29
22
|
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -33,7 +26,7 @@ var InputRadio = ({
|
|
|
33
26
|
showPreview = false,
|
|
34
27
|
activatedLanguage = "sv"
|
|
35
28
|
}) => {
|
|
36
|
-
var _a, _b, _c
|
|
29
|
+
var _a, _b, _c;
|
|
37
30
|
const questionId = `question-${question.id}`;
|
|
38
31
|
const groupId = `radio-group-${question.id}`;
|
|
39
32
|
const errorId = `error-${question.id}`;
|
|
@@ -41,64 +34,51 @@ var InputRadio = ({
|
|
|
41
34
|
const e = { target: { value: event.target.value } };
|
|
42
35
|
handleQuestionInputChange(e, question);
|
|
43
36
|
};
|
|
44
|
-
const languageObj = question.languageSupport[0];
|
|
45
|
-
var optionsInfoText = [];
|
|
46
|
-
if ("optionsInfoText" in languageObj) {
|
|
47
|
-
optionsInfoText = languageObj.optionsInfoText;
|
|
48
|
-
}
|
|
49
|
-
console.log(optionsInfoText);
|
|
50
37
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
51
|
-
!showPreview && question.visible && /* @__PURE__ */
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
children: [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
selectedValue: (_d = question.answer) != null ? _d : "",
|
|
92
|
-
questionId,
|
|
93
|
-
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
94
|
-
}
|
|
95
|
-
)
|
|
96
|
-
] }),
|
|
97
|
-
showPreview && /* @__PURE__ */ jsx2(PreviewRadio, { question })
|
|
38
|
+
!showPreview && question.visible && /* @__PURE__ */ jsx2("div", { className: "pts-root-question pts-radioMultiple-container", id: questionId, children: /* @__PURE__ */ jsxs2(
|
|
39
|
+
"fieldset",
|
|
40
|
+
{
|
|
41
|
+
"aria-required": question.isQuestionMandatory,
|
|
42
|
+
"aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
|
|
43
|
+
"aria-errormessage": question.hasValidationError ? errorId : void 0,
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsxs2("legend", { id: `label-${groupId}`, children: [
|
|
46
|
+
question.questionLabel,
|
|
47
|
+
" ",
|
|
48
|
+
question.isQuestionMandatory && /* @__PURE__ */ jsx2("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" })
|
|
49
|
+
] }),
|
|
50
|
+
(_a = question.options) == null ? void 0 : _a.map((option, index) => /* @__PURE__ */ jsxs2("div", { className: "pts-radio-option", children: [
|
|
51
|
+
/* @__PURE__ */ jsx2(
|
|
52
|
+
"input",
|
|
53
|
+
{
|
|
54
|
+
type: "radio",
|
|
55
|
+
name: `name-${question.id}`,
|
|
56
|
+
id: `${groupId}-option-${index}`,
|
|
57
|
+
value: option.value,
|
|
58
|
+
checked: question.answer === option.value,
|
|
59
|
+
onChange: handleInputChange
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsx2("label", { htmlFor: `${groupId}-option-${index}`, children: option.label }),
|
|
63
|
+
" "
|
|
64
|
+
] }, index)),
|
|
65
|
+
/* @__PURE__ */ jsx2(
|
|
66
|
+
ValidationMessage_default,
|
|
67
|
+
{
|
|
68
|
+
showValidationMessage: (_b = question.hasValidationError) != null ? _b : false,
|
|
69
|
+
validationId: errorId,
|
|
70
|
+
validationMessesege: (_c = question.validationDefaultMessesege) != null ? _c : "",
|
|
71
|
+
activatedLanguage
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
) }),
|
|
77
|
+
showPreview && /* @__PURE__ */ jsx2(PreviewRadio, { question, activatedLanguage })
|
|
98
78
|
] });
|
|
99
79
|
};
|
|
100
80
|
var RadioMultipleStandard_default = InputRadio;
|
|
101
|
-
var PreviewRadio = ({ question }) => {
|
|
81
|
+
var PreviewRadio = ({ question, activatedLanguage }) => {
|
|
102
82
|
var _a, _b;
|
|
103
83
|
const previewId = `preview-${question.id}`;
|
|
104
84
|
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
@@ -108,7 +88,7 @@ var PreviewRadio = ({ question }) => {
|
|
|
108
88
|
{
|
|
109
89
|
className: "pts-radioMultiple-preview pts-root-answer no-answer-preview-page",
|
|
110
90
|
id: `answer-${previewId}`,
|
|
111
|
-
children: "Inget svar"
|
|
91
|
+
children: activatedLanguage === "en" ? "No answer" : "Inget svar"
|
|
112
92
|
}
|
|
113
93
|
)
|
|
114
94
|
] });
|
|
@@ -130,17 +110,17 @@ var MultipleCheckboxes = ({
|
|
|
130
110
|
var _a2;
|
|
131
111
|
const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
|
|
132
112
|
var _a3;
|
|
133
|
-
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.
|
|
134
|
-
}).map((option) => option.
|
|
113
|
+
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.id);
|
|
114
|
+
}).map((option) => option.id)) || [];
|
|
135
115
|
console.log("Initial values:", initialValues);
|
|
136
116
|
setCheckedValues(initialValues);
|
|
137
117
|
}, [question.answer, question.options]);
|
|
138
|
-
const handleInputChange = (event,
|
|
118
|
+
const handleInputChange = (event, optionId) => {
|
|
139
119
|
let updatedValues = [...checkedValues];
|
|
140
|
-
if (updatedValues.includes(
|
|
141
|
-
updatedValues = updatedValues.filter((val) => val !==
|
|
120
|
+
if (updatedValues.includes(optionId)) {
|
|
121
|
+
updatedValues = updatedValues.filter((val) => val !== optionId);
|
|
142
122
|
} else {
|
|
143
|
-
updatedValues.push(
|
|
123
|
+
updatedValues.push(optionId);
|
|
144
124
|
}
|
|
145
125
|
setCheckedValues(updatedValues);
|
|
146
126
|
const e = { target: { value: updatedValues.toString() } };
|
|
@@ -162,9 +142,9 @@ var MultipleCheckboxes = ({
|
|
|
162
142
|
type: "checkbox",
|
|
163
143
|
name: `${question.id}-option`,
|
|
164
144
|
id: `${question.id}-option-${index}`,
|
|
165
|
-
value: option.
|
|
166
|
-
checked: checkedValues.includes(option.
|
|
167
|
-
onChange: (e) => handleInputChange(e, option.
|
|
145
|
+
value: option.id,
|
|
146
|
+
checked: checkedValues.includes(option.id),
|
|
147
|
+
onChange: (e) => handleInputChange(e, option.id),
|
|
168
148
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
|
|
169
149
|
}
|
|
170
150
|
),
|
|
@@ -186,7 +166,7 @@ var PrevieMultipleCheckboxes = ({
|
|
|
186
166
|
/* @__PURE__ */ jsx3("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
187
167
|
question.answer ? question.options && question.options.length === 1 ? /* @__PURE__ */ jsx3("dd", { children: question.options[0].label }) : /* @__PURE__ */ jsx3("dd", { children: /* @__PURE__ */ jsx3("ul", { className: "pts-preview-answer-list", children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
|
|
188
168
|
var _a2;
|
|
189
|
-
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.
|
|
169
|
+
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.id);
|
|
190
170
|
}).map((option, index) => /* @__PURE__ */ jsx3("li", { children: option.label }, index)) }) }) : /* @__PURE__ */ jsx3("dd", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }),
|
|
191
171
|
" "
|
|
192
172
|
] });
|
|
@@ -201,7 +181,7 @@ var CheckboxGroup = ({
|
|
|
201
181
|
showPreview = false,
|
|
202
182
|
activatedLanguage = "sv"
|
|
203
183
|
}) => {
|
|
204
|
-
var _a;
|
|
184
|
+
var _a, _b, _c;
|
|
205
185
|
const questionId = `question-${question.id}`;
|
|
206
186
|
const errorId = `error-${question.id}`;
|
|
207
187
|
const groupId = `checkbox-group-${question.id}`;
|
|
@@ -210,8 +190,8 @@ var CheckboxGroup = ({
|
|
|
210
190
|
var _a2;
|
|
211
191
|
const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
|
|
212
192
|
var _a3;
|
|
213
|
-
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.
|
|
214
|
-
}).map((option) => option.
|
|
193
|
+
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.id);
|
|
194
|
+
}).map((option) => option.id)) || [];
|
|
215
195
|
setCheckedValues(initialValues);
|
|
216
196
|
}, [question.answer, question.options]);
|
|
217
197
|
const handleInputChange = (event, optionValue) => {
|
|
@@ -245,19 +225,23 @@ var CheckboxGroup = ({
|
|
|
245
225
|
type: "checkbox",
|
|
246
226
|
name: `name-${question.id}`,
|
|
247
227
|
id: `${groupId}-option-${index}`,
|
|
248
|
-
value: option.
|
|
249
|
-
checked: checkedValues.includes(option.
|
|
250
|
-
onChange: (e) => handleInputChange(e, option.
|
|
228
|
+
value: option.id,
|
|
229
|
+
checked: checkedValues.includes(option.id),
|
|
230
|
+
onChange: (e) => handleInputChange(e, option.id),
|
|
251
231
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
|
|
252
232
|
}
|
|
253
233
|
),
|
|
254
234
|
/* @__PURE__ */ jsx4("label", { htmlFor: `${groupId}-option-${index}`, children: option.label })
|
|
255
235
|
] }, index)),
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
236
|
+
/* @__PURE__ */ jsx4(
|
|
237
|
+
ValidationMessage_default,
|
|
238
|
+
{
|
|
239
|
+
showValidationMessage: (_b = question.hasValidationError) != null ? _b : false,
|
|
240
|
+
validationId: errorId,
|
|
241
|
+
validationMessesege: (_c = question.validationDefaultMessesege) != null ? _c : "",
|
|
242
|
+
activatedLanguage
|
|
243
|
+
}
|
|
244
|
+
)
|
|
261
245
|
]
|
|
262
246
|
}
|
|
263
247
|
) }),
|
|
@@ -275,14 +259,14 @@ var PreviewCheckboxGroup = ({
|
|
|
275
259
|
/* @__PURE__ */ jsx4("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
276
260
|
question.answer ? question.options && question.options.length === 1 ? /* @__PURE__ */ jsx4("dd", { children: question.options[0].label }) : /* @__PURE__ */ jsx4("dd", { children: /* @__PURE__ */ jsx4("ul", { className: "pts-preview-answer-list", children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
|
|
277
261
|
var _a2;
|
|
278
|
-
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.
|
|
262
|
+
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.id);
|
|
279
263
|
}).map((option, index) => /* @__PURE__ */ jsx4("li", { children: option.label }, index)) }) }) : /* @__PURE__ */ jsx4("dd", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }),
|
|
280
264
|
" "
|
|
281
265
|
] });
|
|
282
266
|
};
|
|
283
267
|
|
|
284
268
|
// src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
|
|
285
|
-
import
|
|
269
|
+
import DOMPurify from "dompurify";
|
|
286
270
|
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
287
271
|
var InputTextarea = ({
|
|
288
272
|
question,
|
|
@@ -290,12 +274,17 @@ var InputTextarea = ({
|
|
|
290
274
|
showPreview = false,
|
|
291
275
|
activatedLanguage
|
|
292
276
|
}) => {
|
|
293
|
-
var _a, _b, _c, _d, _e;
|
|
277
|
+
var _a, _b, _c, _d, _e, _f;
|
|
294
278
|
const questionId = `question-${question.id}`;
|
|
295
279
|
const inputId = `textarea-${question.id}`;
|
|
296
280
|
const aboutId = `about-${question.id}`;
|
|
297
281
|
const errorId = `error-${question.id}`;
|
|
298
282
|
const defaultMaxLength = 1e3;
|
|
283
|
+
const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
284
|
+
const maxLength = (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.answerMaxLength) != null ? _d : defaultMaxLength;
|
|
285
|
+
const isTooLong = answerLength > maxLength;
|
|
286
|
+
const counterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
|
|
287
|
+
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r max vara ${maxLength} tecken`;
|
|
299
288
|
return /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
300
289
|
!showPreview && question.visible && /* @__PURE__ */ jsxs5(
|
|
301
290
|
"div",
|
|
@@ -314,7 +303,7 @@ var InputTextarea = ({
|
|
|
314
303
|
id: aboutId,
|
|
315
304
|
className: "pts-about",
|
|
316
305
|
dangerouslySetInnerHTML: {
|
|
317
|
-
__html:
|
|
306
|
+
__html: DOMPurify.sanitize(question.aboutText)
|
|
318
307
|
}
|
|
319
308
|
}
|
|
320
309
|
),
|
|
@@ -327,29 +316,30 @@ var InputTextarea = ({
|
|
|
327
316
|
required: question.isQuestionMandatory,
|
|
328
317
|
"aria-required": question.isQuestionMandatory,
|
|
329
318
|
"aria-invalid": question.hasValidationError,
|
|
330
|
-
maxLength: ((_a = question.questionExtraAttribute) == null ? void 0 : _a.answerMaxLength) || defaultMaxLength,
|
|
331
319
|
"aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
|
|
332
320
|
id: inputId
|
|
333
321
|
}
|
|
334
322
|
),
|
|
335
323
|
/* @__PURE__ */ jsxs5("div", { className: "pts-textarea-counter-error-container", children: [
|
|
336
|
-
question.hasValidationError && /* @__PURE__ */
|
|
337
|
-
|
|
338
|
-
/* @__PURE__ */ jsx5("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
339
|
-
] }),
|
|
340
|
-
!((_b = question.questionExtraAttribute) == null ? void 0 : _b.hideTextCounter) && /* @__PURE__ */ jsxs5(
|
|
341
|
-
"div",
|
|
324
|
+
!isTooLong && question.hasValidationError && /* @__PURE__ */ jsx5(
|
|
325
|
+
ValidationMessage_default,
|
|
342
326
|
{
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
" ",
|
|
348
|
-
((_e = question.questionExtraAttribute) == null ? void 0 : _e.answerMaxLength) || defaultMaxLength,
|
|
349
|
-
" tecken"
|
|
350
|
-
]
|
|
327
|
+
showValidationMessage: true,
|
|
328
|
+
validationId: errorId,
|
|
329
|
+
validationMessesege: (_e = question.validationDefaultMessesege) != null ? _e : "",
|
|
330
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
351
331
|
}
|
|
352
|
-
)
|
|
332
|
+
),
|
|
333
|
+
isTooLong && question.hasValidationError && /* @__PURE__ */ jsx5(
|
|
334
|
+
ValidationMessage_default,
|
|
335
|
+
{
|
|
336
|
+
showValidationMessage: true,
|
|
337
|
+
validationId: errorId,
|
|
338
|
+
validationMessesege: maxLengthErrorText,
|
|
339
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
340
|
+
}
|
|
341
|
+
),
|
|
342
|
+
!((_f = question.questionExtraAttribute) == null ? void 0 : _f.hideTextCounter) && /* @__PURE__ */ jsx5("div", { "aria-live": "polite", className: `pts-character-counter`, children: counterText })
|
|
353
343
|
] })
|
|
354
344
|
]
|
|
355
345
|
}
|
|
@@ -378,7 +368,7 @@ var PreviewTextarea = ({
|
|
|
378
368
|
};
|
|
379
369
|
|
|
380
370
|
// src/components/input-components/TextFieldStandard/TextFieldStandard.tsx
|
|
381
|
-
import
|
|
371
|
+
import DOMPurify2 from "dompurify";
|
|
382
372
|
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
383
373
|
var TextFieldStandard = ({
|
|
384
374
|
question,
|
|
@@ -386,18 +376,21 @@ var TextFieldStandard = ({
|
|
|
386
376
|
showPreview = false,
|
|
387
377
|
activatedLanguage
|
|
388
378
|
}) => {
|
|
389
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
379
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
390
380
|
const questionId = `question-${question.id}`;
|
|
391
381
|
const inputId = `textField-${question.id}`;
|
|
392
382
|
const aboutId = `about-${question.id}`;
|
|
393
383
|
const errorId = `error-${question.id}`;
|
|
394
|
-
const
|
|
384
|
+
const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
385
|
+
const maxLength = 100;
|
|
386
|
+
const isTooLong = answerLength > maxLength;
|
|
387
|
+
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r max vara ${maxLength} tecken`;
|
|
395
388
|
return /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
396
389
|
!showPreview && question.visible && /* @__PURE__ */ jsxs6(
|
|
397
390
|
"div",
|
|
398
391
|
{
|
|
399
392
|
id: questionId,
|
|
400
|
-
className: `pts-root-question pts-textField-container${((
|
|
393
|
+
className: `pts-root-question pts-textField-container${((_c = question.questionExtraAttribute) == null ? void 0 : _c.disabled) ? " pts-textField-disabled" : ""}${question.aboutText ? " pts-question-hasAbout" : ""}`.trim(),
|
|
401
394
|
children: [
|
|
402
395
|
/* @__PURE__ */ jsxs6("label", { htmlFor: inputId, children: [
|
|
403
396
|
question.questionLabel,
|
|
@@ -410,37 +403,49 @@ var TextFieldStandard = ({
|
|
|
410
403
|
id: aboutId,
|
|
411
404
|
className: "pts-about",
|
|
412
405
|
dangerouslySetInnerHTML: {
|
|
413
|
-
__html:
|
|
406
|
+
__html: DOMPurify2.sanitize(question.aboutText)
|
|
414
407
|
}
|
|
415
408
|
}
|
|
416
409
|
),
|
|
417
410
|
/* @__PURE__ */ jsx6(
|
|
418
411
|
"input",
|
|
419
412
|
{
|
|
420
|
-
type: (
|
|
421
|
-
autoComplete: (
|
|
422
|
-
inputMode: (
|
|
413
|
+
type: (_e = (_d = question.questionExtraAttribute) == null ? void 0 : _d.inputType) != null ? _e : "text",
|
|
414
|
+
autoComplete: (_g = (_f = question.questionExtraAttribute) == null ? void 0 : _f.autoComplete) != null ? _g : void 0,
|
|
415
|
+
inputMode: (_i = (_h = question.questionExtraAttribute) == null ? void 0 : _h.inputMode) != null ? _i : void 0,
|
|
423
416
|
name: `question-name-${question.id}`,
|
|
424
417
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
425
418
|
onChange: (e) => handleQuestionInputChange(e, question),
|
|
426
419
|
value: question.answer,
|
|
427
|
-
maxLength: ((_h = question.questionExtraAttribute) == null ? void 0 : _h.answerMaxLength) || defaultMaxLength,
|
|
428
420
|
id: inputId,
|
|
429
|
-
disabled: (
|
|
421
|
+
disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
|
|
430
422
|
required: question.isQuestionMandatory,
|
|
431
423
|
"aria-required": question.isQuestionMandatory,
|
|
432
424
|
"aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
|
|
433
425
|
"aria-invalid": question.hasValidationError,
|
|
434
426
|
"aria-errormessage": question.hasValidationError ? errorId : void 0,
|
|
435
|
-
spellCheck: (
|
|
436
|
-
autoCapitalize: (
|
|
427
|
+
spellCheck: (_l = (_k = question.questionExtraAttribute) == null ? void 0 : _k.spellCheck) != null ? _l : void 0,
|
|
428
|
+
autoCapitalize: (_n = (_m = question.questionExtraAttribute) == null ? void 0 : _m.autoCapitalize) != null ? _n : void 0
|
|
437
429
|
}
|
|
438
430
|
),
|
|
439
|
-
question.hasValidationError && /* @__PURE__ */
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
431
|
+
!isTooLong && question.hasValidationError && /* @__PURE__ */ jsx6(
|
|
432
|
+
ValidationMessage_default,
|
|
433
|
+
{
|
|
434
|
+
showValidationMessage: true,
|
|
435
|
+
validationId: errorId,
|
|
436
|
+
validationMessesege: (_o = question.validationDefaultMessesege) != null ? _o : "",
|
|
437
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
438
|
+
}
|
|
439
|
+
),
|
|
440
|
+
isTooLong && question.hasValidationError && /* @__PURE__ */ jsx6(
|
|
441
|
+
ValidationMessage_default,
|
|
442
|
+
{
|
|
443
|
+
showValidationMessage: true,
|
|
444
|
+
validationId: errorId,
|
|
445
|
+
validationMessesege: maxLengthErrorText,
|
|
446
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
447
|
+
}
|
|
448
|
+
)
|
|
444
449
|
]
|
|
445
450
|
}
|
|
446
451
|
),
|
|
@@ -665,14 +670,12 @@ var SelectedFiles = ({
|
|
|
665
670
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
666
671
|
const newCountOfFiles = newFiles.length;
|
|
667
672
|
setNumberOfFiles(newCountOfFiles);
|
|
668
|
-
|
|
673
|
+
let e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
|
|
674
|
+
const targetValue = e.target.value === "0 files" ? "" : e.target.value;
|
|
675
|
+
e = { ...e, target: { ...e.target, value: targetValue } };
|
|
669
676
|
isTouched(e, questionObject);
|
|
670
677
|
removeFile(newCountOfFiles);
|
|
671
678
|
};
|
|
672
|
-
useEffect4(() => {
|
|
673
|
-
var _a;
|
|
674
|
-
numberOfFiles > 0 && ((_a = theDiv.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "end" }));
|
|
675
|
-
}, [numberOfFiles]);
|
|
676
679
|
const useWindowWidth = () => {
|
|
677
680
|
const [windowWidth2, setWindowWidth] = useState4(window.innerWidth);
|
|
678
681
|
useEffect4(() => {
|
|
@@ -745,7 +748,7 @@ var SelectedFiles = ({
|
|
|
745
748
|
}
|
|
746
749
|
) })
|
|
747
750
|
] }) }),
|
|
748
|
-
questionObject.files.length > 0 && /* @__PURE__ */ jsx11("ul", { className: "fileListUnorderedList", "aria-label": "Uppladdade filer", children: questionObject.files.map((file, index) => {
|
|
751
|
+
questionObject.files.length > 0 && /* @__PURE__ */ jsx11("ul", { className: "fileListUnorderedList", "aria-label": activatedLanguage === "en" ? "Uploaded files" : "Uppladdade filer", children: questionObject.files.map((file, index) => {
|
|
749
752
|
const indicatorfileName = file.FileName;
|
|
750
753
|
let mobileFirstFileName = file.FileName.split(".").shift();
|
|
751
754
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
@@ -819,6 +822,7 @@ var AddFiles = ({
|
|
|
819
822
|
allowedTotalFileSize = 20971520
|
|
820
823
|
// 20MB = (1024 * 1024) * 20
|
|
821
824
|
}) => {
|
|
825
|
+
var _a, _b;
|
|
822
826
|
if (allowedFileTypes.length < 1) {
|
|
823
827
|
allowedFileTypes = [
|
|
824
828
|
"pdf",
|
|
@@ -862,7 +866,7 @@ var AddFiles = ({
|
|
|
862
866
|
}, []);
|
|
863
867
|
const onDrop = useCallback(
|
|
864
868
|
(acceptedFiles) => {
|
|
865
|
-
var
|
|
869
|
+
var _a2, _b2, _c;
|
|
866
870
|
const validationErrors = [];
|
|
867
871
|
const validFiles = [];
|
|
868
872
|
const currentTotalFileSize = (questionObject.files || []).reduce(
|
|
@@ -870,7 +874,7 @@ var AddFiles = ({
|
|
|
870
874
|
0
|
|
871
875
|
);
|
|
872
876
|
setTotalFileSize(currentTotalFileSize);
|
|
873
|
-
if ((((
|
|
877
|
+
if ((((_a2 = questionObject.files) == null ? void 0 : _a2.length) || 0) >= allowedNumberOfFiles) {
|
|
874
878
|
acceptedFiles.forEach((file) => {
|
|
875
879
|
validationErrors.push({
|
|
876
880
|
FileName: file.name,
|
|
@@ -883,7 +887,7 @@ var AddFiles = ({
|
|
|
883
887
|
}
|
|
884
888
|
let accumulatedNewSize = 0;
|
|
885
889
|
for (const file of acceptedFiles) {
|
|
886
|
-
const fileExtension = ((
|
|
890
|
+
const fileExtension = ((_b2 = file.name.split(".").pop()) == null ? void 0 : _b2.toLowerCase()) || "";
|
|
887
891
|
if (!allowedFileTypes.includes(fileExtension)) {
|
|
888
892
|
validationErrors.push({
|
|
889
893
|
FileName: file.name,
|
|
@@ -955,7 +959,7 @@ var AddFiles = ({
|
|
|
955
959
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
956
960
|
const e = {
|
|
957
961
|
target: {
|
|
958
|
-
value: `${currentFiles.length + newFiles.length} files
|
|
962
|
+
value: currentFiles.length + newFiles.length > 0 ? `${currentFiles.length + newFiles.length} files` : "",
|
|
959
963
|
files: [...currentFiles, ...newFiles]
|
|
960
964
|
}
|
|
961
965
|
};
|
|
@@ -978,68 +982,80 @@ var AddFiles = ({
|
|
|
978
982
|
setErrorMessageAddingFile([]);
|
|
979
983
|
};
|
|
980
984
|
return /* @__PURE__ */ jsxs10(Fragment11, { children: [
|
|
981
|
-
!showPreview && visible && /* @__PURE__ */ jsx12(
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
985
|
+
!showPreview && visible && /* @__PURE__ */ jsx12(
|
|
986
|
+
"div",
|
|
987
|
+
{
|
|
988
|
+
className: "root-question addFile-question-container",
|
|
989
|
+
id: `question-${questionObject.id}`,
|
|
990
|
+
children: /* @__PURE__ */ jsxs10("div", { role: "group", children: [
|
|
991
|
+
questionObject.aboutText && /* @__PURE__ */ jsxs10(
|
|
992
|
+
"p",
|
|
993
|
+
{
|
|
994
|
+
id: aboutId,
|
|
995
|
+
className: clsx3(
|
|
996
|
+
"addFilesMandatory",
|
|
997
|
+
questionObject.hasValidationError ? " error" : ""
|
|
998
|
+
),
|
|
999
|
+
children: [
|
|
1000
|
+
questionObject.aboutText,
|
|
1001
|
+
questionObject.isQuestionMandatory && /* @__PURE__ */ jsxs10("span", { className: "pts-root-mandatoryAsterisk", "aria-label": "Obligatorisk fr\xE5ga", children: [
|
|
1002
|
+
" ",
|
|
1003
|
+
"*"
|
|
1004
|
+
] })
|
|
1005
|
+
]
|
|
1006
|
+
}
|
|
989
1007
|
),
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
)
|
|
1042
|
-
] }) }),
|
|
1008
|
+
/* @__PURE__ */ jsx12(
|
|
1009
|
+
ValidationMessage_default,
|
|
1010
|
+
{
|
|
1011
|
+
showValidationMessage: (_a = questionObject.hasValidationError) != null ? _a : false,
|
|
1012
|
+
validationId: errorId,
|
|
1013
|
+
validationMessesege: (_b = questionObject.validationDefaultMessesege) != null ? _b : "",
|
|
1014
|
+
activatedLanguage,
|
|
1015
|
+
extraCssClass: "error addfileserror"
|
|
1016
|
+
}
|
|
1017
|
+
),
|
|
1018
|
+
/* @__PURE__ */ jsx12(
|
|
1019
|
+
ExploreFilesStandard_default,
|
|
1020
|
+
{
|
|
1021
|
+
FilesSelected: onDrop,
|
|
1022
|
+
numberOfFiles,
|
|
1023
|
+
allowedNumberOfFiles,
|
|
1024
|
+
activatedLanguage,
|
|
1025
|
+
inputId,
|
|
1026
|
+
labelId,
|
|
1027
|
+
aboutId,
|
|
1028
|
+
errorId,
|
|
1029
|
+
questionObject,
|
|
1030
|
+
errorMessageAddingFile,
|
|
1031
|
+
removeUploadErrors: handleRemoveErrors
|
|
1032
|
+
}
|
|
1033
|
+
),
|
|
1034
|
+
/* @__PURE__ */ jsx12(
|
|
1035
|
+
DropFilesStandard_default,
|
|
1036
|
+
{
|
|
1037
|
+
FilesSelected: onDrop,
|
|
1038
|
+
DropFilesText: dropFilesText,
|
|
1039
|
+
language: activatedLanguage
|
|
1040
|
+
}
|
|
1041
|
+
),
|
|
1042
|
+
/* @__PURE__ */ jsx12(
|
|
1043
|
+
SelectedFilesStandard_default,
|
|
1044
|
+
{
|
|
1045
|
+
questionObject,
|
|
1046
|
+
isTouched: handleQuestionInputChange,
|
|
1047
|
+
removeFile: removeFileFromNumberOfFiles,
|
|
1048
|
+
removeError,
|
|
1049
|
+
errorMessageAddingFile,
|
|
1050
|
+
activatedLanguage,
|
|
1051
|
+
numberOfFiles,
|
|
1052
|
+
setNumberOfFiles,
|
|
1053
|
+
removeUploadErrors: handleRemoveErrors
|
|
1054
|
+
}
|
|
1055
|
+
)
|
|
1056
|
+
] })
|
|
1057
|
+
}
|
|
1058
|
+
),
|
|
1043
1059
|
showPreview && /* @__PURE__ */ jsx12(PreviewAddFiles, { activatedLanguage, questionObject })
|
|
1044
1060
|
] });
|
|
1045
1061
|
};
|
|
@@ -1066,7 +1082,7 @@ var SingleCheckbox = ({
|
|
|
1066
1082
|
showPreview = false,
|
|
1067
1083
|
activatedLanguage = "sv"
|
|
1068
1084
|
}) => {
|
|
1069
|
-
var _a, _b;
|
|
1085
|
+
var _a, _b, _c, _d;
|
|
1070
1086
|
const questionId = `question-${question.id}`;
|
|
1071
1087
|
const inputId = `checkbox-${question.id}`;
|
|
1072
1088
|
const aboutId = `about-${question.id}`;
|
|
@@ -1119,12 +1135,15 @@ var SingleCheckbox = ({
|
|
|
1119
1135
|
}
|
|
1120
1136
|
),
|
|
1121
1137
|
" ",
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1138
|
+
/* @__PURE__ */ jsx13(
|
|
1139
|
+
ValidationMessage_default,
|
|
1140
|
+
{
|
|
1141
|
+
showValidationMessage: (_c = question.hasValidationError) != null ? _c : false,
|
|
1142
|
+
validationId: errorId,
|
|
1143
|
+
validationMessesege: (_d = question.validationDefaultMessesege) != null ? _d : "",
|
|
1144
|
+
activatedLanguage
|
|
1145
|
+
}
|
|
1146
|
+
)
|
|
1128
1147
|
] }),
|
|
1129
1148
|
" ",
|
|
1130
1149
|
showPreview && /* @__PURE__ */ jsx13(PreviewSingleCheckbox, { activatedLanguage, question })
|
|
@@ -1153,7 +1172,7 @@ var PreviewSingleCheckbox = ({
|
|
|
1153
1172
|
// src/helpers/hasQuestionValidationError/hasQuestionValidationError.tsx
|
|
1154
1173
|
import { isValid, parseISO } from "date-fns";
|
|
1155
1174
|
var hasQuestionValidationError = (question, questions) => {
|
|
1156
|
-
var _a, _b, _c, _d, _e;
|
|
1175
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1157
1176
|
let error = false;
|
|
1158
1177
|
if (question.isQuestionMandatory) {
|
|
1159
1178
|
if (question.isTouched === false) {
|
|
@@ -1166,19 +1185,28 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1166
1185
|
error = true;
|
|
1167
1186
|
}
|
|
1168
1187
|
}
|
|
1169
|
-
|
|
1188
|
+
const maxLength = (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.answerMaxLength) != null ? _c : 1e3;
|
|
1189
|
+
if (((_d = question.validationType) == null ? void 0 : _d.includes("maxLength")) && question.answer.length > maxLength) {
|
|
1190
|
+
error = true;
|
|
1191
|
+
}
|
|
1192
|
+
if (question.questionType === "TextField") {
|
|
1193
|
+
if (question.answer.length > 100) {
|
|
1194
|
+
error = true;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
if (((_e = question.validationType) == null ? void 0 : _e.find((e) => e === "email")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1170
1198
|
const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
1171
1199
|
if (!emailRegex.test(question.answer)) {
|
|
1172
1200
|
error = true;
|
|
1173
1201
|
}
|
|
1174
1202
|
}
|
|
1175
|
-
if (((
|
|
1203
|
+
if (((_f = question.validationType) == null ? void 0 : _f.find((e) => e === "fourNumbers")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1176
1204
|
const fourNumbersRegex = /^\d{4}$/.test(question.answer);
|
|
1177
1205
|
if (!fourNumbersRegex) {
|
|
1178
1206
|
error = true;
|
|
1179
1207
|
}
|
|
1180
1208
|
}
|
|
1181
|
-
if (((
|
|
1209
|
+
if (((_g = question.validationType) == null ? void 0 : _g.find((e) => e === "isDateFormatValid")) && question.answer !== "") {
|
|
1182
1210
|
const regex = /^\d{4}-\d{2}-\d{2}$/;
|
|
1183
1211
|
if (!regex.test(question.answer)) {
|
|
1184
1212
|
error = true;
|
|
@@ -1192,16 +1220,18 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1192
1220
|
error = true;
|
|
1193
1221
|
}
|
|
1194
1222
|
}
|
|
1195
|
-
const groupCheckError = (
|
|
1223
|
+
const groupCheckError = (_h = question.validationType) == null ? void 0 : _h.find((e) => e.startsWith("groupCheck-"));
|
|
1196
1224
|
if (groupCheckError) {
|
|
1197
1225
|
const ids = groupCheckError.replace("groupCheck-", "").split("-");
|
|
1198
|
-
const relatedAnswers = ids.map(
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1226
|
+
const relatedAnswers = ids.map(
|
|
1227
|
+
(id) => {
|
|
1228
|
+
var _a2;
|
|
1229
|
+
return (_a2 = questions.find((q) => {
|
|
1230
|
+
var _a3;
|
|
1231
|
+
return ((_a3 = q.id) == null ? void 0 : _a3.toString()) === id;
|
|
1232
|
+
})) == null ? void 0 : _a2.answer;
|
|
1233
|
+
}
|
|
1234
|
+
);
|
|
1205
1235
|
const currentAnswer = question.answer;
|
|
1206
1236
|
const allAnswers = [...relatedAnswers, currentAnswer];
|
|
1207
1237
|
if (allAnswers.every((ans) => ans === "")) {
|
|
@@ -1222,7 +1252,7 @@ function createApiDataObject(data, specialMappedQuestions, translatedAnswers) {
|
|
|
1222
1252
|
let translatedAnswer = question.answer;
|
|
1223
1253
|
if (question.answer && typeof question.answer === "string" && Array.isArray(question.options) && question.mappingId && specialMappedQuestions.has(question.mappingId)) {
|
|
1224
1254
|
const answerNormalized = normalize(question.answer);
|
|
1225
|
-
const matchingIds = question.options.filter((option) => answerNormalized.includes(normalize(option.
|
|
1255
|
+
const matchingIds = question.options.filter((option) => answerNormalized.includes(normalize(option.id))).map((option) => `^${option.id}^`);
|
|
1226
1256
|
if (matchingIds.length > 0) {
|
|
1227
1257
|
translatedAnswer = matchingIds.join(",");
|
|
1228
1258
|
}
|
|
@@ -1945,11 +1975,12 @@ var QuestionGroup = ({
|
|
|
1945
1975
|
showPreview = false,
|
|
1946
1976
|
markQuestionAsDisplayed
|
|
1947
1977
|
}) => {
|
|
1948
|
-
var _a;
|
|
1978
|
+
var _a, _b, _c;
|
|
1949
1979
|
if (!questions || questions.length === 0) {
|
|
1950
1980
|
return null;
|
|
1951
1981
|
}
|
|
1952
1982
|
const firstQuestion = questions[0];
|
|
1983
|
+
const errorId = firstQuestion.id + "-error";
|
|
1953
1984
|
const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find((e) => e.startsWith("groupCheck-"));
|
|
1954
1985
|
useEffect11(() => {
|
|
1955
1986
|
questions.forEach((question) => {
|
|
@@ -1990,10 +2021,15 @@ var QuestionGroup = ({
|
|
|
1990
2021
|
firstQuestion.validationDefaultMessesege
|
|
1991
2022
|
] })
|
|
1992
2023
|
] }),
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
2024
|
+
/* @__PURE__ */ jsx15(
|
|
2025
|
+
ValidationMessage_default,
|
|
2026
|
+
{
|
|
2027
|
+
showValidationMessage: (_b = firstQuestion.hasValidationError) != null ? _b : false,
|
|
2028
|
+
validationId: errorId,
|
|
2029
|
+
validationMessesege: (_c = firstQuestion.validationDefaultMessesege) != null ? _c : "",
|
|
2030
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
2031
|
+
}
|
|
2032
|
+
),
|
|
1997
2033
|
groupQuestions
|
|
1998
2034
|
]
|
|
1999
2035
|
}
|
|
@@ -2016,7 +2052,8 @@ var CookieBanner = ({
|
|
|
2016
2052
|
onCookieStateChange,
|
|
2017
2053
|
onClose,
|
|
2018
2054
|
acceptCookies,
|
|
2019
|
-
rejectCookies
|
|
2055
|
+
rejectCookies,
|
|
2056
|
+
activatedLanguage = "sv"
|
|
2020
2057
|
}) => {
|
|
2021
2058
|
if (!visible) return null;
|
|
2022
2059
|
const handleCookieChoice = (accepted) => {
|
|
@@ -2043,8 +2080,13 @@ var CookieBanner = ({
|
|
|
2043
2080
|
id: "cookie-banner",
|
|
2044
2081
|
tabIndex: -1,
|
|
2045
2082
|
children: /* @__PURE__ */ jsxs14("div", { className: "content", children: [
|
|
2046
|
-
/* @__PURE__ */
|
|
2047
|
-
|
|
2083
|
+
/* @__PURE__ */ jsxs14("h3", { id: "cookie-banner-title", children: [
|
|
2084
|
+
" ",
|
|
2085
|
+
activatedLanguage === "en" ? "Cookies" : "Kakor (cookies)"
|
|
2086
|
+
] }),
|
|
2087
|
+
/* @__PURE__ */ jsx16("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.
|
|
2088
|
+
Samtycker du till det? Du kan n\xE4r som helst \xE4ndra ditt val. F\xF6r att \xE5terkalla ditt
|
|
2089
|
+
samtycke klickar du p\xE5 \u201DKakor\u201D i avsnittet l\xE4ngst ned p\xE5 webbplatsen.` }),
|
|
2048
2090
|
/* @__PURE__ */ jsxs14("div", { className: "pts-cookieBanner-Links", children: [
|
|
2049
2091
|
/* @__PURE__ */ jsxs14(
|
|
2050
2092
|
"svg",
|
|
@@ -2073,13 +2115,13 @@ var CookieBanner = ({
|
|
|
2073
2115
|
href: "https://pts.se/om-oss/om-pts.se/kakor-pa-webbplatsen/kakor-pa-pts-e-tjanster/",
|
|
2074
2116
|
target: "_blank",
|
|
2075
2117
|
rel: "noopener noreferrer",
|
|
2076
|
-
children: "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i
|
|
2118
|
+
children: activatedLanguage === "en" ? "Cookies on pts.se (opens in new tab)" : "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i ny flik)"
|
|
2077
2119
|
}
|
|
2078
2120
|
)
|
|
2079
2121
|
] }),
|
|
2080
2122
|
/* @__PURE__ */ jsxs14("div", { className: "pts-cookieBanner-Buttons", children: [
|
|
2081
|
-
/* @__PURE__ */ jsx16("button", { onClick: () => handleCookieChoice(true), children: "Ja, jag samtycker" }),
|
|
2082
|
-
/* @__PURE__ */ jsx16("button", { onClick: () => handleCookieChoice(false), children: "Nej, jag samtycker inte" })
|
|
2123
|
+
/* @__PURE__ */ jsx16("button", { onClick: () => handleCookieChoice(true), children: activatedLanguage === "en" ? "Yes, I consent" : "Ja, jag samtycker" }),
|
|
2124
|
+
/* @__PURE__ */ jsx16("button", { onClick: () => handleCookieChoice(false), children: activatedLanguage === "en" ? "No, I do not consent" : "Nej, jag samtycker inte" })
|
|
2083
2125
|
] })
|
|
2084
2126
|
] })
|
|
2085
2127
|
}
|
|
@@ -2185,7 +2227,7 @@ var LanguageIcon = () => /* @__PURE__ */ jsx18("svg", { width: "15", height: "15
|
|
|
2185
2227
|
fill: "#6E3282"
|
|
2186
2228
|
}
|
|
2187
2229
|
) });
|
|
2188
|
-
var Logo_sv = () => /* @__PURE__ */ jsxs16("svg", { width: "168.8", height: "
|
|
2230
|
+
var Logo_sv = () => /* @__PURE__ */ jsxs16("svg", { width: "168.8", height: "40", viewBox: "0 0 168.8 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
2189
2231
|
/* @__PURE__ */ jsx18(
|
|
2190
2232
|
"path",
|
|
2191
2233
|
{
|
|
@@ -2331,7 +2373,7 @@ var Logo_sv = () => /* @__PURE__ */ jsxs16("svg", { width: "168.8", height: "46.
|
|
|
2331
2373
|
),
|
|
2332
2374
|
/* @__PURE__ */ jsx18("path", { d: "M82.2223 18.3335V37.2224", stroke: "currentColor", strokeWidth: "0.8", strokeMiterlimit: "10" })
|
|
2333
2375
|
] });
|
|
2334
|
-
var Logo_en = () => /* @__PURE__ */ jsxs16("svg", { width: "189.0", height: "
|
|
2376
|
+
var Logo_en = () => /* @__PURE__ */ jsxs16("svg", { width: "189.0", height: "40", viewBox: "0 0 189 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", role: "img", children: [
|
|
2335
2377
|
/* @__PURE__ */ jsx18(
|
|
2336
2378
|
"path",
|
|
2337
2379
|
{
|
|
@@ -2627,9 +2669,9 @@ var ModalStandard_default = Modal;
|
|
|
2627
2669
|
|
|
2628
2670
|
// src/components/layout/SkipLinkStandard/SkipLinkStandard.tsx
|
|
2629
2671
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2630
|
-
var SkipLink = () => {
|
|
2672
|
+
var SkipLink = ({ activatedLanguage = "sv" }) => {
|
|
2631
2673
|
function scrollToMainContent() {
|
|
2632
|
-
const container = document.getElementById(`main-
|
|
2674
|
+
const container = document.getElementById(`pts-main-service-headline`);
|
|
2633
2675
|
if (container) {
|
|
2634
2676
|
container.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
2635
2677
|
container.focus();
|
|
@@ -2643,7 +2685,7 @@ var SkipLink = () => {
|
|
|
2643
2685
|
e.preventDefault();
|
|
2644
2686
|
scrollToMainContent();
|
|
2645
2687
|
},
|
|
2646
|
-
children: "Till huvudinneh\xE5ll"
|
|
2688
|
+
children: activatedLanguage === "en" ? "Skip to main content" : "Till huvudinneh\xE5ll"
|
|
2647
2689
|
}
|
|
2648
2690
|
) });
|
|
2649
2691
|
};
|
|
@@ -2651,7 +2693,7 @@ var SkipLinkStandard_default = SkipLink;
|
|
|
2651
2693
|
|
|
2652
2694
|
// src/components/text-blocks/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
|
|
2653
2695
|
import { createElement } from "react";
|
|
2654
|
-
import
|
|
2696
|
+
import DOMPurify3 from "dompurify";
|
|
2655
2697
|
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2656
2698
|
var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
2657
2699
|
return /* @__PURE__ */ jsxs19(
|
|
@@ -2660,7 +2702,7 @@ var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
|
2660
2702
|
className: "pts-textHeadlineAndBody-container",
|
|
2661
2703
|
children: [
|
|
2662
2704
|
data.headline && createElement(headlineType, { id: "textHeadlineAndBody-headline" }, data.headline),
|
|
2663
|
-
data.body && /* @__PURE__ */ jsx22("div", { dangerouslySetInnerHTML: { __html:
|
|
2705
|
+
data.body && /* @__PURE__ */ jsx22("div", { dangerouslySetInnerHTML: { __html: DOMPurify3.sanitize(data.body) } }),
|
|
2664
2706
|
data.linksForMoreInfo && data.linksForMoreInfo.length > 1 && /* @__PURE__ */ jsx22("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ jsx22("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ jsxs19(
|
|
2665
2707
|
"a",
|
|
2666
2708
|
{
|
|
@@ -2781,11 +2823,11 @@ var PrincipleOfPublicity = ({ activatedLanguage = "" }) => {
|
|
|
2781
2823
|
var PrincipleOfPublicityStandard_default = PrincipleOfPublicity;
|
|
2782
2824
|
|
|
2783
2825
|
// src/components/text-blocks/TextBody/TextBody.tsx
|
|
2784
|
-
import
|
|
2826
|
+
import DOMPurify4 from "dompurify";
|
|
2785
2827
|
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2786
2828
|
var TextBody = ({ data }) => {
|
|
2787
2829
|
return /* @__PURE__ */ jsxs20("div", { className: "pts-textBody-container", children: [
|
|
2788
|
-
data.body && /* @__PURE__ */ jsx24("div", { dangerouslySetInnerHTML: { __html:
|
|
2830
|
+
data.body && /* @__PURE__ */ jsx24("div", { dangerouslySetInnerHTML: { __html: DOMPurify4.sanitize(data.body) } }),
|
|
2789
2831
|
data.linksForMoreInfo && data.linksForMoreInfo.length > 1 && /* @__PURE__ */ jsx24("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ jsx24("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ jsxs20(
|
|
2790
2832
|
"a",
|
|
2791
2833
|
{
|
|
@@ -2875,16 +2917,18 @@ var EditPreviewLinkStandard_default = EditPreviewLink;
|
|
|
2875
2917
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
2876
2918
|
var StartApplicationButton = ({
|
|
2877
2919
|
onClick,
|
|
2878
|
-
label
|
|
2879
|
-
className = ""
|
|
2920
|
+
label,
|
|
2921
|
+
className = "",
|
|
2922
|
+
activatedLanguage = "sv"
|
|
2880
2923
|
}) => {
|
|
2924
|
+
const defaultLabel = activatedLanguage === "en" ? "Start e-service" : "Starta e-tj\xE4nsten";
|
|
2881
2925
|
return /* @__PURE__ */ jsx26(
|
|
2882
2926
|
"button",
|
|
2883
2927
|
{
|
|
2884
2928
|
type: "button",
|
|
2885
2929
|
className: `pts-forwardButton pts-start-applicationButton ${className}`,
|
|
2886
2930
|
onClick,
|
|
2887
|
-
children: label
|
|
2931
|
+
children: label || defaultLabel
|
|
2888
2932
|
}
|
|
2889
2933
|
);
|
|
2890
2934
|
};
|
|
@@ -3043,10 +3087,10 @@ var ValidationErrorSummaryList_default = ValidationErrorSummaryList;
|
|
|
3043
3087
|
|
|
3044
3088
|
// src/components/validation-and-status/FormStatusMessagesScreenReader/FormStatusMessagesScreenReader.tsx
|
|
3045
3089
|
import { Fragment as Fragment17, jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3046
|
-
var FormStatusMessagesScreenReader = ({ formStatus }) => {
|
|
3090
|
+
var FormStatusMessagesScreenReader = ({ formStatus, activatedLanguage = "sv" }) => {
|
|
3047
3091
|
return /* @__PURE__ */ jsxs24(Fragment17, { children: [
|
|
3048
|
-
/* @__PURE__ */ jsx30("p", { "aria-live": "assertive", children: formStatus === "failed" && /* @__PURE__ */ jsx30("span", { className: "pts-root-mandatoryAsterisk", children: "N\xE5got gick fel, f\xF6rs\xF6k igen senare eller kontakta oss!" }) }),
|
|
3049
|
-
/* @__PURE__ */ jsx30("div", { "aria-live": "polite", className: "visually-hidden", children: formStatus === "loading" ? "Ditt \xE4rende registreras. Uppdatera eller st\xE4ng inte sidan." : "" })
|
|
3092
|
+
/* @__PURE__ */ jsx30("p", { "aria-live": "assertive", children: formStatus === "failed" && /* @__PURE__ */ jsx30("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!" }) }),
|
|
3093
|
+
/* @__PURE__ */ jsx30("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." : "" })
|
|
3050
3094
|
] });
|
|
3051
3095
|
};
|
|
3052
3096
|
var FormStatusMessagesScreenReader_default = FormStatusMessagesScreenReader;
|