optimized-react-component-library-xyz123 0.1.159 → 0.1.161
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 +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +210 -218
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +200 -208
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/css/mobileView.css +0 -3
- package/src/css/questions.css +51 -38
package/dist/index.mjs
CHANGED
|
@@ -147,100 +147,9 @@ var PrevieMultipleCheckboxes = ({
|
|
|
147
147
|
] });
|
|
148
148
|
};
|
|
149
149
|
|
|
150
|
-
// src/components/input-components/CheckboxGroupStandard/CheckboxGroupStandard.tsx
|
|
151
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
152
|
-
import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
153
|
-
var CheckboxGroup = ({
|
|
154
|
-
question,
|
|
155
|
-
handleQuestionInputChange,
|
|
156
|
-
showPreview = false,
|
|
157
|
-
activatedLanguage = "sv"
|
|
158
|
-
}) => {
|
|
159
|
-
var _a, _b;
|
|
160
|
-
const questionId = `question-${question.id}`;
|
|
161
|
-
const errorId = `error-${question.id}`;
|
|
162
|
-
const groupId = `checkbox-group-${question.id}`;
|
|
163
|
-
const [checkedValues, setCheckedValues] = useState2([]);
|
|
164
|
-
useEffect2(() => {
|
|
165
|
-
var _a2;
|
|
166
|
-
const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
|
|
167
|
-
var _a3;
|
|
168
|
-
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.label);
|
|
169
|
-
}).map((option) => option.label)) || [];
|
|
170
|
-
console.log("Initial values:", initialValues);
|
|
171
|
-
setCheckedValues(initialValues);
|
|
172
|
-
}, [question.answer, question.options]);
|
|
173
|
-
const handleInputChange = (event, optionValue) => {
|
|
174
|
-
let updatedValues = [...checkedValues];
|
|
175
|
-
if (updatedValues.includes(optionValue)) {
|
|
176
|
-
updatedValues = updatedValues.filter((val) => val !== optionValue);
|
|
177
|
-
} else {
|
|
178
|
-
updatedValues.push(optionValue);
|
|
179
|
-
}
|
|
180
|
-
setCheckedValues(updatedValues);
|
|
181
|
-
const e = { target: { value: updatedValues.toString() } };
|
|
182
|
-
handleQuestionInputChange(e, question);
|
|
183
|
-
console.log("checkedValues" + checkedValues);
|
|
184
|
-
};
|
|
185
|
-
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
186
|
-
!showPreview && question.visible && /* @__PURE__ */ jsx3("div", { id: questionId, className: "pts-root-question pts-checkboxGroup-container", children: /* @__PURE__ */ jsxs3(
|
|
187
|
-
"fieldset",
|
|
188
|
-
{
|
|
189
|
-
"aria-required": question.isQuestionMandatory,
|
|
190
|
-
"aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
|
|
191
|
-
"aria-errormessage": question.hasValidationError ? errorId : void 0,
|
|
192
|
-
children: [
|
|
193
|
-
/* @__PURE__ */ jsxs3("legend", { className: "pts-checkboxGroup-legend", id: `label-${groupId}`, children: [
|
|
194
|
-
question.questionLabel,
|
|
195
|
-
" ",
|
|
196
|
-
question.isQuestionMandatory && /* @__PURE__ */ jsx3("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" })
|
|
197
|
-
] }),
|
|
198
|
-
(_a = question.options) == null ? void 0 : _a.map((option, index) => /* @__PURE__ */ jsx3("div", { className: "pts-checkboxGroup-options", children: /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
199
|
-
/* @__PURE__ */ jsx3(
|
|
200
|
-
"input",
|
|
201
|
-
{
|
|
202
|
-
type: "checkbox",
|
|
203
|
-
name: `${question.id}-option`,
|
|
204
|
-
id: `${question.id}-option-${index}`,
|
|
205
|
-
value: option.label,
|
|
206
|
-
checked: checkedValues.includes(option.label),
|
|
207
|
-
onChange: (e) => handleInputChange(e, option.label),
|
|
208
|
-
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
|
|
209
|
-
}
|
|
210
|
-
),
|
|
211
|
-
/* @__PURE__ */ jsx3("label", { htmlFor: `${groupId}-option-${index}`, children: option.label })
|
|
212
|
-
] }) }, index)),
|
|
213
|
-
question.hasValidationError && /* @__PURE__ */ jsxs3("div", { className: "pts-root-error", id: errorId, children: [
|
|
214
|
-
/* @__PURE__ */ jsx3("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
215
|
-
/* @__PURE__ */ jsx3("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
216
|
-
/* @__PURE__ */ jsx3("span", { className: "errorText", children: ((_b = question.validationDefaultMessesege) != null ? _b : activatedLanguage === "sv") ? "V\xE4nligen besvara" : "Please reply" })
|
|
217
|
-
] })
|
|
218
|
-
]
|
|
219
|
-
}
|
|
220
|
-
) }),
|
|
221
|
-
showPreview && /* @__PURE__ */ jsx3(PreviewCheckboxGroup, { activatedLanguage, question })
|
|
222
|
-
] });
|
|
223
|
-
};
|
|
224
|
-
var CheckboxGroupStandard_default = CheckboxGroup;
|
|
225
|
-
var PreviewCheckboxGroup = ({
|
|
226
|
-
question,
|
|
227
|
-
activatedLanguage
|
|
228
|
-
}) => {
|
|
229
|
-
var _a, _b;
|
|
230
|
-
const previewId = `preview-${question.id}`;
|
|
231
|
-
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
232
|
-
/* @__PURE__ */ jsx3("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
233
|
-
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) => {
|
|
234
|
-
var _a2;
|
|
235
|
-
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
|
|
236
|
-
}).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" }),
|
|
237
|
-
" "
|
|
238
|
-
] });
|
|
239
|
-
};
|
|
240
|
-
|
|
241
150
|
// src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
|
|
242
151
|
import DOMPurify from "dompurify";
|
|
243
|
-
import { Fragment as
|
|
152
|
+
import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
244
153
|
var InputTextarea = ({
|
|
245
154
|
question,
|
|
246
155
|
handleQuestionInputChange,
|
|
@@ -253,19 +162,19 @@ var InputTextarea = ({
|
|
|
253
162
|
const aboutId = `about-${question.id}`;
|
|
254
163
|
const errorId = `error-${question.id}`;
|
|
255
164
|
const defaultMaxLength = 1e3;
|
|
256
|
-
return /* @__PURE__ */
|
|
257
|
-
!showPreview && question.visible && /* @__PURE__ */
|
|
165
|
+
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
166
|
+
!showPreview && question.visible && /* @__PURE__ */ jsxs3(
|
|
258
167
|
"div",
|
|
259
168
|
{
|
|
260
169
|
id: questionId,
|
|
261
170
|
className: `pts-root-question pts-textArea-container${question.aboutText ? " pts-question-hasAbout" : ""}`,
|
|
262
171
|
children: [
|
|
263
|
-
/* @__PURE__ */
|
|
172
|
+
/* @__PURE__ */ jsxs3("label", { htmlFor: inputId, children: [
|
|
264
173
|
question.questionLabel,
|
|
265
174
|
" ",
|
|
266
|
-
question.isQuestionMandatory && /* @__PURE__ */
|
|
175
|
+
question.isQuestionMandatory && /* @__PURE__ */ jsx3("span", { className: "pts-root-mandatoryAsterisk", "aria-hidden": "true", children: "*" })
|
|
267
176
|
] }),
|
|
268
|
-
question.aboutText && /* @__PURE__ */
|
|
177
|
+
question.aboutText && /* @__PURE__ */ jsx3(
|
|
269
178
|
"div",
|
|
270
179
|
{
|
|
271
180
|
id: aboutId,
|
|
@@ -275,7 +184,7 @@ var InputTextarea = ({
|
|
|
275
184
|
}
|
|
276
185
|
}
|
|
277
186
|
),
|
|
278
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ jsx3(
|
|
279
188
|
"textarea",
|
|
280
189
|
{
|
|
281
190
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
@@ -289,12 +198,12 @@ var InputTextarea = ({
|
|
|
289
198
|
id: inputId
|
|
290
199
|
}
|
|
291
200
|
),
|
|
292
|
-
/* @__PURE__ */
|
|
293
|
-
question.hasValidationError && /* @__PURE__ */
|
|
294
|
-
/* @__PURE__ */
|
|
295
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ jsxs3("div", { className: "pts-textarea-counter-error-container", children: [
|
|
202
|
+
question.hasValidationError && /* @__PURE__ */ jsxs3("div", { className: "pts-root-error", id: errorId, children: [
|
|
203
|
+
/* @__PURE__ */ jsx3("span", { "aria-label": "Felmeddelande.", className: "errorDot", children: "!" }),
|
|
204
|
+
/* @__PURE__ */ jsx3("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
296
205
|
] }),
|
|
297
|
-
!((_b = question.questionExtraAttribute) == null ? void 0 : _b.hideTextCounter) && /* @__PURE__ */
|
|
206
|
+
!((_b = question.questionExtraAttribute) == null ? void 0 : _b.hideTextCounter) && /* @__PURE__ */ jsxs3(
|
|
298
207
|
"div",
|
|
299
208
|
{
|
|
300
209
|
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" : ""}`,
|
|
@@ -311,7 +220,7 @@ var InputTextarea = ({
|
|
|
311
220
|
]
|
|
312
221
|
}
|
|
313
222
|
),
|
|
314
|
-
showPreview && /* @__PURE__ */
|
|
223
|
+
showPreview && /* @__PURE__ */ jsx3(PreviewTextarea, { activatedLanguage, question })
|
|
315
224
|
] });
|
|
316
225
|
};
|
|
317
226
|
var TextAreaStandard_default = InputTextarea;
|
|
@@ -321,9 +230,9 @@ var PreviewTextarea = ({
|
|
|
321
230
|
}) => {
|
|
322
231
|
var _a, _b;
|
|
323
232
|
const previewId = `preview-${question.id}`;
|
|
324
|
-
return /* @__PURE__ */
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
-
((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */
|
|
233
|
+
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
234
|
+
/* @__PURE__ */ jsx3("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
235
|
+
((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ jsx3("dd", { className: "pts-textArea-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer }) : /* @__PURE__ */ jsx3(
|
|
327
236
|
"dd",
|
|
328
237
|
{
|
|
329
238
|
className: "pts-textArea-preview pts-root-answer no-answer-preview-page",
|
|
@@ -336,7 +245,7 @@ var PreviewTextarea = ({
|
|
|
336
245
|
|
|
337
246
|
// src/components/input-components/TextFieldStandard/TextFieldStandard.tsx
|
|
338
247
|
import DOMPurify2 from "dompurify";
|
|
339
|
-
import { Fragment as
|
|
248
|
+
import { Fragment as Fragment4, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
340
249
|
var TextFieldStandard = ({
|
|
341
250
|
question,
|
|
342
251
|
handleQuestionInputChange,
|
|
@@ -349,19 +258,19 @@ var TextFieldStandard = ({
|
|
|
349
258
|
const aboutId = `about-${question.id}`;
|
|
350
259
|
const errorId = `error-${question.id}`;
|
|
351
260
|
const defaultMaxLength = 1e3;
|
|
352
|
-
return /* @__PURE__ */
|
|
353
|
-
!showPreview && question.visible && /* @__PURE__ */
|
|
261
|
+
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
262
|
+
!showPreview && question.visible && /* @__PURE__ */ jsxs4(
|
|
354
263
|
"div",
|
|
355
264
|
{
|
|
356
265
|
id: questionId,
|
|
357
266
|
className: `pts-root-question pts-textField-container${((_a = question.questionExtraAttribute) == null ? void 0 : _a.disabled) ? " pts-textField-disabled" : ""}${question.aboutText ? " pts-question-hasAbout" : ""}`.trim(),
|
|
358
267
|
children: [
|
|
359
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ jsxs4("label", { htmlFor: inputId, children: [
|
|
360
269
|
question.questionLabel,
|
|
361
270
|
" ",
|
|
362
|
-
question.isQuestionMandatory && /* @__PURE__ */
|
|
271
|
+
question.isQuestionMandatory && /* @__PURE__ */ jsx4("span", { "aria-hidden": "true", className: "pts-root-mandatoryAsterisk", children: "*" })
|
|
363
272
|
] }),
|
|
364
|
-
question.aboutText && /* @__PURE__ */
|
|
273
|
+
question.aboutText && /* @__PURE__ */ jsx4(
|
|
365
274
|
"div",
|
|
366
275
|
{
|
|
367
276
|
id: aboutId,
|
|
@@ -371,7 +280,7 @@ var TextFieldStandard = ({
|
|
|
371
280
|
}
|
|
372
281
|
}
|
|
373
282
|
),
|
|
374
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ jsx4(
|
|
375
284
|
"input",
|
|
376
285
|
{
|
|
377
286
|
type: (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.inputType) != null ? _c : "text",
|
|
@@ -393,15 +302,15 @@ var TextFieldStandard = ({
|
|
|
393
302
|
autoCapitalize: (_m = (_l = question.questionExtraAttribute) == null ? void 0 : _l.autoCapitalize) != null ? _m : void 0
|
|
394
303
|
}
|
|
395
304
|
),
|
|
396
|
-
question.hasValidationError && /* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
398
|
-
/* @__PURE__ */
|
|
399
|
-
/* @__PURE__ */
|
|
305
|
+
question.hasValidationError && /* @__PURE__ */ jsxs4("div", { className: "pts-root-error", id: errorId, children: [
|
|
306
|
+
/* @__PURE__ */ jsx4("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
307
|
+
/* @__PURE__ */ jsx4("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
308
|
+
/* @__PURE__ */ jsx4("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
400
309
|
] })
|
|
401
310
|
]
|
|
402
311
|
}
|
|
403
312
|
),
|
|
404
|
-
showPreview && /* @__PURE__ */
|
|
313
|
+
showPreview && /* @__PURE__ */ jsx4(PreviewTextField, { activatedLanguage, question })
|
|
405
314
|
] });
|
|
406
315
|
};
|
|
407
316
|
var TextFieldStandard_default = TextFieldStandard;
|
|
@@ -411,9 +320,9 @@ var PreviewTextField = ({
|
|
|
411
320
|
}) => {
|
|
412
321
|
var _a, _b;
|
|
413
322
|
const previewId = `preview-${question.id}`;
|
|
414
|
-
return /* @__PURE__ */
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */
|
|
323
|
+
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
324
|
+
/* @__PURE__ */ jsx4("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
325
|
+
((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ jsx4("dd", { className: "pts-textField-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer }) : /* @__PURE__ */ jsx4(
|
|
417
326
|
"dd",
|
|
418
327
|
{
|
|
419
328
|
className: "pts-textField-preview pts-root-answer no-answer-preview-page",
|
|
@@ -425,12 +334,12 @@ var PreviewTextField = ({
|
|
|
425
334
|
};
|
|
426
335
|
|
|
427
336
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
428
|
-
import { useCallback, useEffect as
|
|
337
|
+
import { useCallback, useEffect as useEffect4, useState as useState4 } from "react";
|
|
429
338
|
import clsx3 from "clsx";
|
|
430
339
|
|
|
431
340
|
// src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
|
|
432
341
|
import { useDropzone } from "react-dropzone";
|
|
433
|
-
import { Fragment as
|
|
342
|
+
import { Fragment as Fragment5, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
434
343
|
var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h\xE4r", language }) => {
|
|
435
344
|
const onDrop = FilesSelected;
|
|
436
345
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop, noKeyboard: true });
|
|
@@ -438,10 +347,10 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
438
347
|
event.preventDefault();
|
|
439
348
|
event.stopPropagation();
|
|
440
349
|
};
|
|
441
|
-
return /* @__PURE__ */
|
|
442
|
-
/* @__PURE__ */
|
|
350
|
+
return /* @__PURE__ */ jsx5(Fragment5, { children: /* @__PURE__ */ jsx5("div", { className: "DropZoneContainer", children: /* @__PURE__ */ jsxs5("div", { className: "DropZone", ...getRootProps(), onClick: handleFileExplorer, children: [
|
|
351
|
+
/* @__PURE__ */ jsxs5("label", { htmlFor: "fileDropInput", hidden: true, children: [
|
|
443
352
|
"Dra och sl\xE4pp filer h\xE4r omr\xE5de",
|
|
444
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ jsx5(
|
|
445
354
|
"input",
|
|
446
355
|
{
|
|
447
356
|
...getInputProps({
|
|
@@ -452,8 +361,8 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
452
361
|
}
|
|
453
362
|
)
|
|
454
363
|
] }),
|
|
455
|
-
isDragActive ? /* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */
|
|
364
|
+
isDragActive ? /* @__PURE__ */ jsx5("b", { className: "dropFilesNowText", children: language === "sv" ? "Sl\xE4pp filerna, nu ...!" : "Drop files here!" }) : /* @__PURE__ */ jsxs5("div", { className: "DropZone-label-container", children: [
|
|
365
|
+
/* @__PURE__ */ jsx5(
|
|
457
366
|
"svg",
|
|
458
367
|
{
|
|
459
368
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -461,7 +370,7 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
461
370
|
height: "2.4rem",
|
|
462
371
|
viewBox: "0 0 7 15",
|
|
463
372
|
fill: "#fff",
|
|
464
|
-
children: /* @__PURE__ */
|
|
373
|
+
children: /* @__PURE__ */ jsx5(
|
|
465
374
|
"path",
|
|
466
375
|
{
|
|
467
376
|
d: "M0 2.5C0 1.83696 0.263392 1.20107 0.732233 0.732233C1.20107 0.263392 1.83696 0 2.5 0C3.16304 0 3.79893 0.263392 4.26777 0.732233C4.73661 1.20107 5 1.83696 5 2.5V11.5C5 11.8978 4.84196 12.2794 4.56066 12.5607C4.27936 12.842 3.89782 13 3.5 13C3.10218 13 2.72064 12.842 2.43934 12.5607C2.15804 12.2794 2 11.8978 2 11.5V4.5C2 4.36739 2.05268 4.24021 2.14645 4.14645C2.24021 4.05268 2.36739 4 2.5 4C2.63261 4 2.75979 4.05268 2.85355 4.14645C2.94732 4.24021 3 4.36739 3 4.5V11.5C3 11.6326 3.05268 11.7598 3.14645 11.8536C3.24021 11.9473 3.36739 12 3.5 12C3.63261 12 3.75979 11.9473 3.85355 11.8536C3.94732 11.7598 4 11.6326 4 11.5V2.5C4 2.30302 3.9612 2.10796 3.88582 1.92597C3.81044 1.74399 3.69995 1.57863 3.56066 1.43934C3.42137 1.30005 3.25601 1.18956 3.07403 1.11418C2.89204 1.0388 2.69698 1 2.5 1C2.30302 1 2.10796 1.0388 1.92597 1.11418C1.74399 1.18956 1.57863 1.30005 1.43934 1.43934C1.30005 1.57863 1.18956 1.74399 1.11418 1.92597C1.0388 2.10796 1 2.30302 1 2.5V11.5C1 12.163 1.26339 12.7989 1.73223 13.2678C2.20107 13.7366 2.83696 14 3.5 14C4.16304 14 4.79893 13.7366 5.26777 13.2678C5.73661 12.7989 6 12.163 6 11.5V4.5C6 4.36739 6.05268 4.24021 6.14645 4.14645C6.24021 4.05268 6.36739 4 6.5 4C6.63261 4 6.75979 4.05268 6.85355 4.14645C6.94732 4.24021 7 4.36739 7 4.5V11.5C7 12.4283 6.63125 13.3185 5.97487 13.9749C5.3185 14.6313 4.42826 15 3.5 15C2.57174 15 1.6815 14.6313 1.02513 13.9749C0.368749 13.3185 0 12.4283 0 11.5V2.5Z",
|
|
@@ -470,7 +379,7 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
470
379
|
)
|
|
471
380
|
}
|
|
472
381
|
),
|
|
473
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ jsx5("p", { className: "dropFilesText", children: DropFilesText })
|
|
474
383
|
] })
|
|
475
384
|
] }) }) });
|
|
476
385
|
};
|
|
@@ -482,7 +391,7 @@ import clsx from "clsx";
|
|
|
482
391
|
|
|
483
392
|
// src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
|
|
484
393
|
import React from "react";
|
|
485
|
-
import { Fragment as
|
|
394
|
+
import { Fragment as Fragment6, jsx as jsx6 } from "react/jsx-runtime";
|
|
486
395
|
var ScreenReaderErrors = ({
|
|
487
396
|
errorMessageAddingFile,
|
|
488
397
|
activatedLanguage
|
|
@@ -501,12 +410,12 @@ var ScreenReaderErrors = ({
|
|
|
501
410
|
setActivateErrorMessagesForScreenReader(true);
|
|
502
411
|
}
|
|
503
412
|
}, [errorMessageAddingFile]);
|
|
504
|
-
return /* @__PURE__ */
|
|
413
|
+
return /* @__PURE__ */ jsx6(Fragment6, { children: activateErrorMessagesForScreenReader && /* @__PURE__ */ jsx6("p", { role: "alert", className: "sr-only", "aria-atomic": "true", children: errorMessagesForScreenReader }) });
|
|
505
414
|
};
|
|
506
415
|
var ScreenReaderErrors_default = ScreenReaderErrors;
|
|
507
416
|
|
|
508
417
|
// src/components/input-components/AddFilesStandard/ExploreFilesStandard.tsx
|
|
509
|
-
import { Fragment as
|
|
418
|
+
import { Fragment as Fragment7, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
510
419
|
var ExploreFiles = ({
|
|
511
420
|
FilesSelected,
|
|
512
421
|
numberOfFiles,
|
|
@@ -533,8 +442,8 @@ var ExploreFiles = ({
|
|
|
533
442
|
};
|
|
534
443
|
let addFilesInfoText = numberOfFiles > 0 ? activatedLanguage === "sv" ? `${numberOfFiles} filer valda (max ${allowedNumberOfFiles})` : `${numberOfFiles} files chosed (max ${allowedNumberOfFiles})` : activatedLanguage === "sv" ? "Ingen fil vald" : "No file chosen";
|
|
535
444
|
const ariaLabelText = `${activatedLanguage === "sv" ? "V\xE4lj fil" : "Choose file"} ${addFilesInfoText}`;
|
|
536
|
-
return /* @__PURE__ */
|
|
537
|
-
/* @__PURE__ */
|
|
445
|
+
return /* @__PURE__ */ jsx7(Fragment7, { children: /* @__PURE__ */ jsxs6("div", { className: "inputContainer", children: [
|
|
446
|
+
/* @__PURE__ */ jsxs6(
|
|
538
447
|
"div",
|
|
539
448
|
{
|
|
540
449
|
className: clsx(
|
|
@@ -544,7 +453,7 @@ var ExploreFiles = ({
|
|
|
544
453
|
),
|
|
545
454
|
id: labelId,
|
|
546
455
|
children: [
|
|
547
|
-
/* @__PURE__ */
|
|
456
|
+
/* @__PURE__ */ jsx7(
|
|
548
457
|
"button",
|
|
549
458
|
{
|
|
550
459
|
ref: buttonInputRef,
|
|
@@ -558,12 +467,12 @@ var ExploreFiles = ({
|
|
|
558
467
|
children: activatedLanguage === "sv" ? "V\xE4lj fil" : "Choose file"
|
|
559
468
|
}
|
|
560
469
|
),
|
|
561
|
-
/* @__PURE__ */
|
|
562
|
-
/* @__PURE__ */
|
|
470
|
+
/* @__PURE__ */ jsx7("span", { "aria-hidden": true, className: "filePickText", children: addFilesInfoText }),
|
|
471
|
+
/* @__PURE__ */ jsx7("label", { htmlFor: inputId, "aria-hidden": true, className: "invisible" })
|
|
563
472
|
]
|
|
564
473
|
}
|
|
565
474
|
),
|
|
566
|
-
/* @__PURE__ */
|
|
475
|
+
/* @__PURE__ */ jsx7(
|
|
567
476
|
"input",
|
|
568
477
|
{
|
|
569
478
|
"aria-hidden": true,
|
|
@@ -576,7 +485,7 @@ var ExploreFiles = ({
|
|
|
576
485
|
id: inputId
|
|
577
486
|
}
|
|
578
487
|
),
|
|
579
|
-
/* @__PURE__ */
|
|
488
|
+
/* @__PURE__ */ jsx7(
|
|
580
489
|
ScreenReaderErrors_default,
|
|
581
490
|
{
|
|
582
491
|
errorMessageAddingFile,
|
|
@@ -588,22 +497,22 @@ var ExploreFiles = ({
|
|
|
588
497
|
var ExploreFilesStandard_default = ExploreFiles;
|
|
589
498
|
|
|
590
499
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
591
|
-
import React4, { useEffect as
|
|
500
|
+
import React4, { useEffect as useEffect3, useState as useState3, useRef as useRef2 } from "react";
|
|
592
501
|
import { Col, Row } from "react-bootstrap";
|
|
593
502
|
|
|
594
503
|
// src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
|
|
595
|
-
import { useState as
|
|
504
|
+
import { useState as useState2 } from "react";
|
|
596
505
|
import clsx2 from "clsx";
|
|
597
|
-
import { Fragment as
|
|
506
|
+
import { Fragment as Fragment8, jsx as jsx8 } from "react/jsx-runtime";
|
|
598
507
|
var Indicator = (filename) => {
|
|
599
|
-
const [uploadPercentage, setUploadPercentage] =
|
|
600
|
-
const [uploadDone, setUploadDone] =
|
|
601
|
-
return /* @__PURE__ */
|
|
508
|
+
const [uploadPercentage, setUploadPercentage] = useState2(0);
|
|
509
|
+
const [uploadDone, setUploadDone] = useState2(false);
|
|
510
|
+
return /* @__PURE__ */ jsx8(Fragment8, { children: /* @__PURE__ */ jsx8("div", { className: clsx2("uploadIndicator", "uploadDone") }) });
|
|
602
511
|
};
|
|
603
512
|
var IndicatorStandard_default = Indicator;
|
|
604
513
|
|
|
605
514
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
606
|
-
import { Fragment as
|
|
515
|
+
import { Fragment as Fragment9, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
607
516
|
var SelectedFiles = ({
|
|
608
517
|
questionObject,
|
|
609
518
|
isTouched,
|
|
@@ -625,13 +534,13 @@ var SelectedFiles = ({
|
|
|
625
534
|
isTouched(e, questionObject);
|
|
626
535
|
removeFile(newCountOfFiles);
|
|
627
536
|
};
|
|
628
|
-
|
|
537
|
+
useEffect3(() => {
|
|
629
538
|
var _a;
|
|
630
539
|
numberOfFiles > 0 && ((_a = theDiv.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "end" }));
|
|
631
540
|
}, [numberOfFiles]);
|
|
632
541
|
const useWindowWidth = () => {
|
|
633
|
-
const [windowWidth2, setWindowWidth] =
|
|
634
|
-
|
|
542
|
+
const [windowWidth2, setWindowWidth] = useState3(window.innerWidth);
|
|
543
|
+
useEffect3(() => {
|
|
635
544
|
const handleResize = () => {
|
|
636
545
|
setWindowWidth(window.innerWidth);
|
|
637
546
|
};
|
|
@@ -643,10 +552,10 @@ var SelectedFiles = ({
|
|
|
643
552
|
return windowWidth2;
|
|
644
553
|
};
|
|
645
554
|
const windowWidth = useWindowWidth();
|
|
646
|
-
return /* @__PURE__ */
|
|
647
|
-
/* @__PURE__ */
|
|
648
|
-
/* @__PURE__ */
|
|
649
|
-
/* @__PURE__ */
|
|
555
|
+
return /* @__PURE__ */ jsxs7(Fragment9, { children: [
|
|
556
|
+
/* @__PURE__ */ jsx9("div", { children: errorMessageAddingFile.length > 0 && /* @__PURE__ */ jsxs7("div", { className: "pts-errorSummary-container pts-addFile-error-container", children: [
|
|
557
|
+
/* @__PURE__ */ jsx9("span", { "aria-hidden": "true", className: "errorDot", children: "!" }),
|
|
558
|
+
/* @__PURE__ */ jsx9("div", { className: "addFile-error-list-container", children: /* @__PURE__ */ jsxs7("ul", { "aria-hidden": true, className: "fileListUnorderedList", id: "errorSummary-ul", children: [
|
|
650
559
|
" ",
|
|
651
560
|
errorMessageAddingFile.map((errorObj, index) => {
|
|
652
561
|
const errorFileName = errorObj.FileName;
|
|
@@ -654,9 +563,9 @@ var SelectedFiles = ({
|
|
|
654
563
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
655
564
|
const fileType = errorObj.FileName.split(".").pop();
|
|
656
565
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
657
|
-
return /* @__PURE__ */
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
/* @__PURE__ */
|
|
566
|
+
return /* @__PURE__ */ jsx9("li", { children: /* @__PURE__ */ jsx9(React4.Fragment, { children: /* @__PURE__ */ jsx9("div", { children: /* @__PURE__ */ jsx9("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs7("div", { className: "fileInList", children: [
|
|
567
|
+
/* @__PURE__ */ jsx9(Row, { children: /* @__PURE__ */ jsx9(Col, { children: windowWidth < 768 ? /* @__PURE__ */ jsx9("span", { className: "mobileFirstFileName", children: mobileFirstFileName }) : /* @__PURE__ */ jsx9("span", { className: "desktopFileName", children: errorObj.FileName }) }) }),
|
|
568
|
+
/* @__PURE__ */ jsx9(Row, { children: /* @__PURE__ */ jsx9(
|
|
660
569
|
Col,
|
|
661
570
|
{
|
|
662
571
|
className: "errorMessageAddingFile",
|
|
@@ -671,7 +580,7 @@ var SelectedFiles = ({
|
|
|
671
580
|
] }, index) }) }) }, `error-${errorObj.FileName}-${index}`) });
|
|
672
581
|
})
|
|
673
582
|
] }) }),
|
|
674
|
-
/* @__PURE__ */
|
|
583
|
+
/* @__PURE__ */ jsx9("div", { className: "addFile-error-close-button", children: /* @__PURE__ */ jsx9(
|
|
675
584
|
"button",
|
|
676
585
|
{
|
|
677
586
|
className: "selectedFilesLinkButton error-close",
|
|
@@ -679,7 +588,7 @@ var SelectedFiles = ({
|
|
|
679
588
|
removeError();
|
|
680
589
|
},
|
|
681
590
|
"aria-label": activatedLanguage === "sv" ? `St\xE4ng felmeddelande` : `Close error message`,
|
|
682
|
-
children: /* @__PURE__ */
|
|
591
|
+
children: /* @__PURE__ */ jsx9(
|
|
683
592
|
"svg",
|
|
684
593
|
{
|
|
685
594
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -687,7 +596,7 @@ var SelectedFiles = ({
|
|
|
687
596
|
height: "14",
|
|
688
597
|
viewBox: "0 0 14 14",
|
|
689
598
|
fill: "none",
|
|
690
|
-
children: /* @__PURE__ */
|
|
599
|
+
children: /* @__PURE__ */ jsx9(
|
|
691
600
|
"path",
|
|
692
601
|
{
|
|
693
602
|
d: "M0.75 12.75L12.75 0.75M0.75 0.75L12.75 12.75",
|
|
@@ -701,15 +610,15 @@ var SelectedFiles = ({
|
|
|
701
610
|
}
|
|
702
611
|
) })
|
|
703
612
|
] }) }),
|
|
704
|
-
questionObject.files.length > 0 && /* @__PURE__ */
|
|
613
|
+
questionObject.files.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "fileListUnorderedList", "aria-label": "Uppladdade filer", children: questionObject.files.map((file, index) => {
|
|
705
614
|
const indicatorfileName = file.FileName;
|
|
706
615
|
let mobileFirstFileName = file.FileName.split(".").shift();
|
|
707
616
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
708
617
|
const fileType = file.FileName.split(".").pop();
|
|
709
618
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
710
|
-
return /* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */
|
|
712
|
-
/* @__PURE__ */
|
|
619
|
+
return /* @__PURE__ */ jsx9("li", { children: /* @__PURE__ */ jsx9(React4.Fragment, { children: /* @__PURE__ */ jsx9("div", { children: /* @__PURE__ */ jsx9("div", { className: "fileInListContainer", children: /* @__PURE__ */ jsxs7("div", { className: "fileInList", children: [
|
|
620
|
+
/* @__PURE__ */ jsxs7("div", { className: "fileItem", children: [
|
|
621
|
+
/* @__PURE__ */ jsx9(Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", className: "uploadedDot", children: /* @__PURE__ */ jsx9(
|
|
713
622
|
"svg",
|
|
714
623
|
{
|
|
715
624
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -717,7 +626,7 @@ var SelectedFiles = ({
|
|
|
717
626
|
height: "8",
|
|
718
627
|
viewBox: "0 0 8 8",
|
|
719
628
|
fill: "none",
|
|
720
|
-
children: /* @__PURE__ */
|
|
629
|
+
children: /* @__PURE__ */ jsx9(
|
|
721
630
|
"path",
|
|
722
631
|
{
|
|
723
632
|
d: "M1 4.65913L2.8 6.45913L7 1.35913",
|
|
@@ -728,20 +637,20 @@ var SelectedFiles = ({
|
|
|
728
637
|
)
|
|
729
638
|
}
|
|
730
639
|
) }) }),
|
|
731
|
-
/* @__PURE__ */
|
|
640
|
+
/* @__PURE__ */ jsx9(Col, { children: windowWidth < 768 ? /* @__PURE__ */ jsxs7("span", { className: "mobileFirstFileName", children: [
|
|
732
641
|
mobileFirstFileName,
|
|
733
642
|
" (",
|
|
734
643
|
Math.ceil(file.FileSize / (1024 * 1024)),
|
|
735
644
|
" ",
|
|
736
645
|
"MB)"
|
|
737
|
-
] }) : /* @__PURE__ */
|
|
646
|
+
] }) : /* @__PURE__ */ jsxs7("span", { className: "desktopFileName", children: [
|
|
738
647
|
file.FileName,
|
|
739
648
|
" (",
|
|
740
|
-
/* @__PURE__ */
|
|
649
|
+
/* @__PURE__ */ jsx9("span", { className: "fileSizeText", children: file.FileSize < 1024 * 1024 ? `${Math.round(file.FileSize / 1024)} kB` : `${(file.FileSize / (1024 * 1024)).toFixed(1)} MB` }),
|
|
741
650
|
" ",
|
|
742
651
|
")"
|
|
743
652
|
] }) }),
|
|
744
|
-
/* @__PURE__ */
|
|
653
|
+
/* @__PURE__ */ jsx9(Col, { className: "lastCol", children: /* @__PURE__ */ jsx9(
|
|
745
654
|
"button",
|
|
746
655
|
{
|
|
747
656
|
className: "selectedFilesLinkButton",
|
|
@@ -751,17 +660,17 @@ var SelectedFiles = ({
|
|
|
751
660
|
}
|
|
752
661
|
) })
|
|
753
662
|
] }),
|
|
754
|
-
showIndicator && /* @__PURE__ */
|
|
755
|
-
/* @__PURE__ */
|
|
663
|
+
showIndicator && /* @__PURE__ */ jsx9(Row, { children: /* @__PURE__ */ jsx9(Col, { style: { width: "100%", padding: 0 }, children: /* @__PURE__ */ jsx9(IndicatorStandard_default, { filename: indicatorfileName }) }) }),
|
|
664
|
+
/* @__PURE__ */ jsx9(Row, { style: { marginTop: "12px", marginBottom: "12px" }, children: /* @__PURE__ */ jsx9(Col, { className: "makeSpace" }) })
|
|
756
665
|
] }, index) }) }) }, `file-${file.FileName}-${index}`) });
|
|
757
666
|
}) }),
|
|
758
|
-
/* @__PURE__ */
|
|
667
|
+
/* @__PURE__ */ jsx9("div", { ref: theDiv, className: "pts-clipboard-container" })
|
|
759
668
|
] });
|
|
760
669
|
};
|
|
761
670
|
var SelectedFilesStandard_default = SelectedFiles;
|
|
762
671
|
|
|
763
672
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
764
|
-
import { Fragment as
|
|
673
|
+
import { Fragment as Fragment10, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
765
674
|
var AddFiles = ({
|
|
766
675
|
questionObject,
|
|
767
676
|
handleQuestionInputChange = (e, questionObject2) => {
|
|
@@ -799,19 +708,19 @@ var AddFiles = ({
|
|
|
799
708
|
const errorId = `error-${questionObject.id}`;
|
|
800
709
|
const labelId = `label-${questionObject.id}`;
|
|
801
710
|
const maxSizeMB = Math.round(allowedTotalFileSize / 1048576);
|
|
802
|
-
const [numberOfFiles, setNumberOfFiles] =
|
|
803
|
-
const [totalFileSize, setTotalFileSize] =
|
|
804
|
-
const [errorMessageAddingFile, setErrorMessageAddingFile] =
|
|
805
|
-
const [newFiles, setNewFiles] =
|
|
806
|
-
const [dropFilesText, setDropFilesText] =
|
|
807
|
-
|
|
711
|
+
const [numberOfFiles, setNumberOfFiles] = useState4(0);
|
|
712
|
+
const [totalFileSize, setTotalFileSize] = useState4(0);
|
|
713
|
+
const [errorMessageAddingFile, setErrorMessageAddingFile] = useState4([]);
|
|
714
|
+
const [newFiles, setNewFiles] = useState4([]);
|
|
715
|
+
const [dropFilesText, setDropFilesText] = useState4("Dra och sl\xE4pp dina filer h\xE4r");
|
|
716
|
+
useEffect4(() => {
|
|
808
717
|
if (activatedLanguage === "sv") {
|
|
809
718
|
setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
|
|
810
719
|
} else {
|
|
811
720
|
setDropFilesText("Drag and drop your files here");
|
|
812
721
|
}
|
|
813
722
|
}, [activatedLanguage]);
|
|
814
|
-
|
|
723
|
+
useEffect4(() => {
|
|
815
724
|
if (questionObject.files && questionObject.files.length > 0) {
|
|
816
725
|
setNumberOfFiles(questionObject.files.length);
|
|
817
726
|
}
|
|
@@ -906,7 +815,7 @@ var AddFiles = ({
|
|
|
906
815
|
reader.readAsDataURL(file);
|
|
907
816
|
});
|
|
908
817
|
};
|
|
909
|
-
|
|
818
|
+
useEffect4(() => {
|
|
910
819
|
if (newFiles.length > 0) {
|
|
911
820
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
912
821
|
const e = {
|
|
@@ -933,9 +842,9 @@ var AddFiles = ({
|
|
|
933
842
|
const handleRemoveErrors = () => {
|
|
934
843
|
setErrorMessageAddingFile([]);
|
|
935
844
|
};
|
|
936
|
-
return /* @__PURE__ */
|
|
937
|
-
!showPreview && visible && /* @__PURE__ */
|
|
938
|
-
questionObject.aboutText && /* @__PURE__ */
|
|
845
|
+
return /* @__PURE__ */ jsxs8(Fragment10, { children: [
|
|
846
|
+
!showPreview && visible && /* @__PURE__ */ jsx10("div", { className: "root-question addFile-question-container", children: /* @__PURE__ */ jsxs8("div", { role: "group", children: [
|
|
847
|
+
questionObject.aboutText && /* @__PURE__ */ jsxs8(
|
|
939
848
|
"p",
|
|
940
849
|
{
|
|
941
850
|
id: aboutId,
|
|
@@ -945,19 +854,19 @@ var AddFiles = ({
|
|
|
945
854
|
),
|
|
946
855
|
children: [
|
|
947
856
|
questionObject.aboutText,
|
|
948
|
-
questionObject.isQuestionMandatory && /* @__PURE__ */
|
|
857
|
+
questionObject.isQuestionMandatory && /* @__PURE__ */ jsxs8("span", { className: "pts-root-mandatoryAsterisk", "aria-hidden": "true", children: [
|
|
949
858
|
" ",
|
|
950
859
|
"*"
|
|
951
860
|
] })
|
|
952
861
|
]
|
|
953
862
|
}
|
|
954
863
|
),
|
|
955
|
-
questionObject.hasValidationError && /* @__PURE__ */
|
|
956
|
-
/* @__PURE__ */
|
|
957
|
-
/* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */
|
|
864
|
+
questionObject.hasValidationError && /* @__PURE__ */ jsxs8("div", { className: "pts-root-error error addfileserror", id: errorId, children: [
|
|
865
|
+
/* @__PURE__ */ jsx10("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
866
|
+
/* @__PURE__ */ jsx10("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
867
|
+
/* @__PURE__ */ jsx10("span", { className: "errorText", children: questionObject.validationDefaultMessesege })
|
|
959
868
|
] }),
|
|
960
|
-
/* @__PURE__ */
|
|
869
|
+
/* @__PURE__ */ jsx10(
|
|
961
870
|
ExploreFilesStandard_default,
|
|
962
871
|
{
|
|
963
872
|
FilesSelected: onDrop,
|
|
@@ -973,7 +882,7 @@ var AddFiles = ({
|
|
|
973
882
|
removeUploadErrors: handleRemoveErrors
|
|
974
883
|
}
|
|
975
884
|
),
|
|
976
|
-
/* @__PURE__ */
|
|
885
|
+
/* @__PURE__ */ jsx10(
|
|
977
886
|
DropFilesStandard_default,
|
|
978
887
|
{
|
|
979
888
|
FilesSelected: onDrop,
|
|
@@ -981,7 +890,7 @@ var AddFiles = ({
|
|
|
981
890
|
language: activatedLanguage
|
|
982
891
|
}
|
|
983
892
|
),
|
|
984
|
-
/* @__PURE__ */
|
|
893
|
+
/* @__PURE__ */ jsx10(
|
|
985
894
|
SelectedFilesStandard_default,
|
|
986
895
|
{
|
|
987
896
|
questionObject,
|
|
@@ -996,7 +905,7 @@ var AddFiles = ({
|
|
|
996
905
|
}
|
|
997
906
|
)
|
|
998
907
|
] }) }),
|
|
999
|
-
showPreview && /* @__PURE__ */
|
|
908
|
+
showPreview && /* @__PURE__ */ jsx10(PreviewAddFiles, { activatedLanguage, questionObject })
|
|
1000
909
|
] });
|
|
1001
910
|
};
|
|
1002
911
|
var AddFilesStandard_default = AddFiles;
|
|
@@ -1005,11 +914,95 @@ var PreviewAddFiles = ({
|
|
|
1005
914
|
activatedLanguage
|
|
1006
915
|
}) => {
|
|
1007
916
|
const previewId = `preview-${questionObject.Id}`;
|
|
917
|
+
return /* @__PURE__ */ jsxs8(Fragment10, { children: [
|
|
918
|
+
/* @__PURE__ */ jsx10("dt", { id: `question-${previewId}`, children: questionObject.questionLabel ? questionObject.questionLabel : activatedLanguage === "en" ? "Attached files" : "Bifogade filer" }),
|
|
919
|
+
questionObject.files && questionObject.files.length > 0 ? /* @__PURE__ */ jsx10("dd", { className: "pts-addFiles-answer", children: /* @__PURE__ */ jsx10("ul", { "aria-labelledby": previewId, className: "pts-preview-answer-list", children: questionObject.files.map((file, index) => {
|
|
920
|
+
return /* @__PURE__ */ jsx10("li", { children: file.FileName }, `file-${index}-${file.FileName}`);
|
|
921
|
+
}) }) }) : /* @__PURE__ */ jsx10("dd", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No attached files" : "Inga bifogade filer" })
|
|
922
|
+
] });
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
// src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
|
|
926
|
+
import { useState as useState5 } from "react";
|
|
927
|
+
import { Fragment as Fragment11, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
928
|
+
var SingleCheckboxes = ({
|
|
929
|
+
question,
|
|
930
|
+
handleQuestionInputChange,
|
|
931
|
+
showPreview = false,
|
|
932
|
+
activatedLanguage = "sv"
|
|
933
|
+
}) => {
|
|
934
|
+
var _a, _b;
|
|
935
|
+
const questionId = `question-${question.id}`;
|
|
936
|
+
const inputId = `checkbox-${question.id}`;
|
|
937
|
+
const aboutId = `about-${question.id}`;
|
|
938
|
+
const errorId = `error-${question.id}`;
|
|
939
|
+
const [checked, setChecked] = useState5(false);
|
|
940
|
+
const handleInputChange = (event) => {
|
|
941
|
+
let answer = checked ? question.questionLabel : "";
|
|
942
|
+
setChecked(event.target.checked);
|
|
943
|
+
const e = { target: { value: answer } };
|
|
944
|
+
handleQuestionInputChange(e, question);
|
|
945
|
+
};
|
|
946
|
+
return /* @__PURE__ */ jsxs9(Fragment11, { children: [
|
|
947
|
+
!showPreview && question.visible && /* @__PURE__ */ jsx11("div", { id: questionId, className: "pts-root-question pts-singleCheckbox-container", children: /* @__PURE__ */ jsxs9("legend", { id: `label-${questionId}`, children: [
|
|
948
|
+
/* @__PURE__ */ jsx11(
|
|
949
|
+
"input",
|
|
950
|
+
{
|
|
951
|
+
type: "checkbox",
|
|
952
|
+
name: `question-name-${question.id}`,
|
|
953
|
+
id: `${inputId}`,
|
|
954
|
+
value: (_a = question.questionLabel) != null ? _a : "",
|
|
955
|
+
checked,
|
|
956
|
+
onChange: (e) => handleInputChange(e),
|
|
957
|
+
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
958
|
+
disabled: (_b = question.questionExtraAttribute) == null ? void 0 : _b.disabled,
|
|
959
|
+
required: question.isQuestionMandatory,
|
|
960
|
+
"aria-required": question.isQuestionMandatory,
|
|
961
|
+
"aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
|
|
962
|
+
"aria-invalid": question.hasValidationError,
|
|
963
|
+
"aria-errormessage": question.hasValidationError ? errorId : void 0
|
|
964
|
+
}
|
|
965
|
+
),
|
|
966
|
+
/* @__PURE__ */ jsx11("label", { htmlFor: `${questionId}`, children: question.questionLabel }),
|
|
967
|
+
question.isQuestionMandatory && /* @__PURE__ */ jsx11("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" }),
|
|
968
|
+
" ",
|
|
969
|
+
question.aboutText && /* @__PURE__ */ jsx11(
|
|
970
|
+
"div",
|
|
971
|
+
{
|
|
972
|
+
id: aboutId,
|
|
973
|
+
className: "pts-about",
|
|
974
|
+
dangerouslySetInnerHTML: { __html: question.aboutText }
|
|
975
|
+
}
|
|
976
|
+
),
|
|
977
|
+
" ",
|
|
978
|
+
question.hasValidationError && /* @__PURE__ */ jsxs9("div", { className: "pts-root-error", id: errorId, children: [
|
|
979
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
980
|
+
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
981
|
+
/* @__PURE__ */ jsx11("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
982
|
+
] }),
|
|
983
|
+
" "
|
|
984
|
+
] }) }),
|
|
985
|
+
" ",
|
|
986
|
+
showPreview && /* @__PURE__ */ jsx11(PreviewSingleCheckboxes, { activatedLanguage, question })
|
|
987
|
+
] });
|
|
988
|
+
};
|
|
989
|
+
var SingleCheckboxStandard_default = SingleCheckboxes;
|
|
990
|
+
var PreviewSingleCheckboxes = ({
|
|
991
|
+
question,
|
|
992
|
+
activatedLanguage
|
|
993
|
+
}) => {
|
|
994
|
+
var _a, _b;
|
|
995
|
+
const previewId = `preview-${question.id}`;
|
|
1008
996
|
return /* @__PURE__ */ jsxs9(Fragment11, { children: [
|
|
1009
|
-
/* @__PURE__ */ jsx11("dt", { id: `question-${previewId}`, children:
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
997
|
+
/* @__PURE__ */ jsx11("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
998
|
+
((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ jsx11("dd", { className: "pts-singleCheckbox-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer }) : /* @__PURE__ */ jsx11(
|
|
999
|
+
"dd",
|
|
1000
|
+
{
|
|
1001
|
+
className: "pts-singleCheckbox-preview pts-root-answer no-answer-preview-page",
|
|
1002
|
+
id: `answer-${previewId}`,
|
|
1003
|
+
children: activatedLanguage === "en" ? "No Answer" : "Inget svar"
|
|
1004
|
+
}
|
|
1005
|
+
)
|
|
1013
1006
|
] });
|
|
1014
1007
|
};
|
|
1015
1008
|
|
|
@@ -1736,6 +1729,14 @@ var QuestionRenderer = ({
|
|
|
1736
1729
|
showPreview
|
|
1737
1730
|
}
|
|
1738
1731
|
),
|
|
1732
|
+
question.questionType === "SingleCheckboxStandard" && /* @__PURE__ */ jsx12(
|
|
1733
|
+
SingleCheckboxStandard_default,
|
|
1734
|
+
{
|
|
1735
|
+
question,
|
|
1736
|
+
handleQuestionInputChange,
|
|
1737
|
+
showPreview
|
|
1738
|
+
}
|
|
1739
|
+
),
|
|
1739
1740
|
question.questionType === "TextField" && /* @__PURE__ */ jsx12(
|
|
1740
1741
|
TextFieldStandard_default,
|
|
1741
1742
|
{
|
|
@@ -1764,15 +1765,6 @@ var QuestionRenderer = ({
|
|
|
1764
1765
|
activatedLanguage
|
|
1765
1766
|
}
|
|
1766
1767
|
),
|
|
1767
|
-
question.questionType === "CheckboxGroup" && /* @__PURE__ */ jsx12(
|
|
1768
|
-
CheckboxGroupStandard_default,
|
|
1769
|
-
{
|
|
1770
|
-
question,
|
|
1771
|
-
handleQuestionInputChange,
|
|
1772
|
-
showPreview,
|
|
1773
|
-
activatedLanguage
|
|
1774
|
-
}
|
|
1775
|
-
),
|
|
1776
1768
|
question.questionType === "TextArea" && /* @__PURE__ */ jsx12(
|
|
1777
1769
|
TextAreaStandard_default,
|
|
1778
1770
|
{
|
|
@@ -2911,7 +2903,6 @@ var FormStatusMessagesScreenReader = ({ formStatus }) => {
|
|
|
2911
2903
|
var FormStatusMessagesScreenReader_default = FormStatusMessagesScreenReader;
|
|
2912
2904
|
export {
|
|
2913
2905
|
AddFilesStandard_default as AddFilesStandard,
|
|
2914
|
-
CheckboxGroupStandard_default as CheckboxGroupStandard,
|
|
2915
2906
|
CookieBanner_default as CookieBanner,
|
|
2916
2907
|
EditPreviewLinkStandard_default as EditPreviewLinkStandard,
|
|
2917
2908
|
FooterStandard_default as FooterStandard,
|
|
@@ -2923,6 +2914,7 @@ export {
|
|
|
2923
2914
|
QuestionGroup_default as QuestionGroup,
|
|
2924
2915
|
QuestionRenderer_default as QuestionRenderer,
|
|
2925
2916
|
RadioMultipleStandard_default as RadioMultipleStandard,
|
|
2917
|
+
SingleCheckboxStandard_default as SingleCheckboxStandard,
|
|
2926
2918
|
SkipLinkStandard_default as SkipLinkStandard,
|
|
2927
2919
|
StartApplicationButton_default as StartApplicationButton,
|
|
2928
2920
|
StepperButtonsStandard_default as StepperButtonsStandard,
|