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.js
CHANGED
|
@@ -31,7 +31,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
AddFilesStandard: () => AddFilesStandard_default,
|
|
34
|
-
CheckboxGroupStandard: () => CheckboxGroupStandard_default,
|
|
35
34
|
CookieBanner: () => CookieBanner_default,
|
|
36
35
|
EditPreviewLinkStandard: () => EditPreviewLinkStandard_default,
|
|
37
36
|
FooterStandard: () => FooterStandard_default,
|
|
@@ -43,6 +42,7 @@ __export(index_exports, {
|
|
|
43
42
|
QuestionGroup: () => QuestionGroup_default,
|
|
44
43
|
QuestionRenderer: () => QuestionRenderer_default,
|
|
45
44
|
RadioMultipleStandard: () => RadioMultipleStandard_default,
|
|
45
|
+
SingleCheckboxStandard: () => SingleCheckboxStandard_default,
|
|
46
46
|
SkipLinkStandard: () => SkipLinkStandard_default,
|
|
47
47
|
StartApplicationButton: () => StartApplicationButton_default,
|
|
48
48
|
StepperButtonsStandard: () => StepperButtonsStandard_default,
|
|
@@ -228,100 +228,9 @@ var PrevieMultipleCheckboxes = ({
|
|
|
228
228
|
] });
|
|
229
229
|
};
|
|
230
230
|
|
|
231
|
-
// src/components/input-components/CheckboxGroupStandard/CheckboxGroupStandard.tsx
|
|
232
|
-
var import_react2 = require("react");
|
|
233
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
234
|
-
var CheckboxGroup = ({
|
|
235
|
-
question,
|
|
236
|
-
handleQuestionInputChange,
|
|
237
|
-
showPreview = false,
|
|
238
|
-
activatedLanguage = "sv"
|
|
239
|
-
}) => {
|
|
240
|
-
var _a, _b;
|
|
241
|
-
const questionId = `question-${question.id}`;
|
|
242
|
-
const errorId = `error-${question.id}`;
|
|
243
|
-
const groupId = `checkbox-group-${question.id}`;
|
|
244
|
-
const [checkedValues, setCheckedValues] = (0, import_react2.useState)([]);
|
|
245
|
-
(0, import_react2.useEffect)(() => {
|
|
246
|
-
var _a2;
|
|
247
|
-
const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
|
|
248
|
-
var _a3;
|
|
249
|
-
return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.label);
|
|
250
|
-
}).map((option) => option.label)) || [];
|
|
251
|
-
console.log("Initial values:", initialValues);
|
|
252
|
-
setCheckedValues(initialValues);
|
|
253
|
-
}, [question.answer, question.options]);
|
|
254
|
-
const handleInputChange = (event, optionValue) => {
|
|
255
|
-
let updatedValues = [...checkedValues];
|
|
256
|
-
if (updatedValues.includes(optionValue)) {
|
|
257
|
-
updatedValues = updatedValues.filter((val) => val !== optionValue);
|
|
258
|
-
} else {
|
|
259
|
-
updatedValues.push(optionValue);
|
|
260
|
-
}
|
|
261
|
-
setCheckedValues(updatedValues);
|
|
262
|
-
const e = { target: { value: updatedValues.toString() } };
|
|
263
|
-
handleQuestionInputChange(e, question);
|
|
264
|
-
console.log("checkedValues" + checkedValues);
|
|
265
|
-
};
|
|
266
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
267
|
-
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { id: questionId, className: "pts-root-question pts-checkboxGroup-container", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
268
|
-
"fieldset",
|
|
269
|
-
{
|
|
270
|
-
"aria-required": question.isQuestionMandatory,
|
|
271
|
-
"aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
|
|
272
|
-
"aria-errormessage": question.hasValidationError ? errorId : void 0,
|
|
273
|
-
children: [
|
|
274
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("legend", { className: "pts-checkboxGroup-legend", id: `label-${groupId}`, children: [
|
|
275
|
-
question.questionLabel,
|
|
276
|
-
" ",
|
|
277
|
-
question.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" })
|
|
278
|
-
] }),
|
|
279
|
-
(_a = question.options) == null ? void 0 : _a.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "pts-checkboxGroup-options", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
280
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
281
|
-
"input",
|
|
282
|
-
{
|
|
283
|
-
type: "checkbox",
|
|
284
|
-
name: `${question.id}-option`,
|
|
285
|
-
id: `${question.id}-option-${index}`,
|
|
286
|
-
value: option.label,
|
|
287
|
-
checked: checkedValues.includes(option.label),
|
|
288
|
-
onChange: (e) => handleInputChange(e, option.label),
|
|
289
|
-
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
|
|
290
|
-
}
|
|
291
|
-
),
|
|
292
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { htmlFor: `${groupId}-option-${index}`, children: option.label })
|
|
293
|
-
] }) }, index)),
|
|
294
|
-
question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
|
|
295
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
296
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
297
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "errorText", children: ((_b = question.validationDefaultMessesege) != null ? _b : activatedLanguage === "sv") ? "V\xE4nligen besvara" : "Please reply" })
|
|
298
|
-
] })
|
|
299
|
-
]
|
|
300
|
-
}
|
|
301
|
-
) }),
|
|
302
|
-
showPreview && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PreviewCheckboxGroup, { activatedLanguage, question })
|
|
303
|
-
] });
|
|
304
|
-
};
|
|
305
|
-
var CheckboxGroupStandard_default = CheckboxGroup;
|
|
306
|
-
var PreviewCheckboxGroup = ({
|
|
307
|
-
question,
|
|
308
|
-
activatedLanguage
|
|
309
|
-
}) => {
|
|
310
|
-
var _a, _b;
|
|
311
|
-
const previewId = `preview-${question.id}`;
|
|
312
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
313
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
314
|
-
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) => {
|
|
315
|
-
var _a2;
|
|
316
|
-
return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
|
|
317
|
-
}).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" }),
|
|
318
|
-
" "
|
|
319
|
-
] });
|
|
320
|
-
};
|
|
321
|
-
|
|
322
231
|
// src/components/input-components/TextAreaStandard/TextAreaStandard.tsx
|
|
323
232
|
var import_dompurify = __toESM(require("dompurify"));
|
|
324
|
-
var
|
|
233
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
325
234
|
var InputTextarea = ({
|
|
326
235
|
question,
|
|
327
236
|
handleQuestionInputChange,
|
|
@@ -334,19 +243,19 @@ var InputTextarea = ({
|
|
|
334
243
|
const aboutId = `about-${question.id}`;
|
|
335
244
|
const errorId = `error-${question.id}`;
|
|
336
245
|
const defaultMaxLength = 1e3;
|
|
337
|
-
return /* @__PURE__ */ (0,
|
|
338
|
-
!showPreview && question.visible && /* @__PURE__ */ (0,
|
|
246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
247
|
+
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
339
248
|
"div",
|
|
340
249
|
{
|
|
341
250
|
id: questionId,
|
|
342
251
|
className: `pts-root-question pts-textArea-container${question.aboutText ? " pts-question-hasAbout" : ""}`,
|
|
343
252
|
children: [
|
|
344
|
-
/* @__PURE__ */ (0,
|
|
253
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { htmlFor: inputId, children: [
|
|
345
254
|
question.questionLabel,
|
|
346
255
|
" ",
|
|
347
|
-
question.isQuestionMandatory && /* @__PURE__ */ (0,
|
|
256
|
+
question.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "pts-root-mandatoryAsterisk", "aria-hidden": "true", children: "*" })
|
|
348
257
|
] }),
|
|
349
|
-
question.aboutText && /* @__PURE__ */ (0,
|
|
258
|
+
question.aboutText && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
350
259
|
"div",
|
|
351
260
|
{
|
|
352
261
|
id: aboutId,
|
|
@@ -356,7 +265,7 @@ var InputTextarea = ({
|
|
|
356
265
|
}
|
|
357
266
|
}
|
|
358
267
|
),
|
|
359
|
-
/* @__PURE__ */ (0,
|
|
268
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
360
269
|
"textarea",
|
|
361
270
|
{
|
|
362
271
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
@@ -370,12 +279,12 @@ var InputTextarea = ({
|
|
|
370
279
|
id: inputId
|
|
371
280
|
}
|
|
372
281
|
),
|
|
373
|
-
/* @__PURE__ */ (0,
|
|
374
|
-
question.hasValidationError && /* @__PURE__ */ (0,
|
|
375
|
-
/* @__PURE__ */ (0,
|
|
376
|
-
/* @__PURE__ */ (0,
|
|
282
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "pts-textarea-counter-error-container", children: [
|
|
283
|
+
question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
|
|
284
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-label": "Felmeddelande.", className: "errorDot", children: "!" }),
|
|
285
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
377
286
|
] }),
|
|
378
|
-
!((_b = question.questionExtraAttribute) == null ? void 0 : _b.hideTextCounter) && /* @__PURE__ */ (0,
|
|
287
|
+
!((_b = question.questionExtraAttribute) == null ? void 0 : _b.hideTextCounter) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
379
288
|
"div",
|
|
380
289
|
{
|
|
381
290
|
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" : ""}`,
|
|
@@ -392,7 +301,7 @@ var InputTextarea = ({
|
|
|
392
301
|
]
|
|
393
302
|
}
|
|
394
303
|
),
|
|
395
|
-
showPreview && /* @__PURE__ */ (0,
|
|
304
|
+
showPreview && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PreviewTextarea, { activatedLanguage, question })
|
|
396
305
|
] });
|
|
397
306
|
};
|
|
398
307
|
var TextAreaStandard_default = InputTextarea;
|
|
@@ -402,9 +311,9 @@ var PreviewTextarea = ({
|
|
|
402
311
|
}) => {
|
|
403
312
|
var _a, _b;
|
|
404
313
|
const previewId = `preview-${question.id}`;
|
|
405
|
-
return /* @__PURE__ */ (0,
|
|
406
|
-
/* @__PURE__ */ (0,
|
|
407
|
-
((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0,
|
|
314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
315
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
316
|
+
((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dd", { className: "pts-textArea-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
408
317
|
"dd",
|
|
409
318
|
{
|
|
410
319
|
className: "pts-textArea-preview pts-root-answer no-answer-preview-page",
|
|
@@ -417,7 +326,7 @@ var PreviewTextarea = ({
|
|
|
417
326
|
|
|
418
327
|
// src/components/input-components/TextFieldStandard/TextFieldStandard.tsx
|
|
419
328
|
var import_dompurify2 = __toESM(require("dompurify"));
|
|
420
|
-
var
|
|
329
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
421
330
|
var TextFieldStandard = ({
|
|
422
331
|
question,
|
|
423
332
|
handleQuestionInputChange,
|
|
@@ -430,19 +339,19 @@ var TextFieldStandard = ({
|
|
|
430
339
|
const aboutId = `about-${question.id}`;
|
|
431
340
|
const errorId = `error-${question.id}`;
|
|
432
341
|
const defaultMaxLength = 1e3;
|
|
433
|
-
return /* @__PURE__ */ (0,
|
|
434
|
-
!showPreview && question.visible && /* @__PURE__ */ (0,
|
|
342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
343
|
+
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
435
344
|
"div",
|
|
436
345
|
{
|
|
437
346
|
id: questionId,
|
|
438
347
|
className: `pts-root-question pts-textField-container${((_a = question.questionExtraAttribute) == null ? void 0 : _a.disabled) ? " pts-textField-disabled" : ""}${question.aboutText ? " pts-question-hasAbout" : ""}`.trim(),
|
|
439
348
|
children: [
|
|
440
|
-
/* @__PURE__ */ (0,
|
|
349
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { htmlFor: inputId, children: [
|
|
441
350
|
question.questionLabel,
|
|
442
351
|
" ",
|
|
443
|
-
question.isQuestionMandatory && /* @__PURE__ */ (0,
|
|
352
|
+
question.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "aria-hidden": "true", className: "pts-root-mandatoryAsterisk", children: "*" })
|
|
444
353
|
] }),
|
|
445
|
-
question.aboutText && /* @__PURE__ */ (0,
|
|
354
|
+
question.aboutText && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
446
355
|
"div",
|
|
447
356
|
{
|
|
448
357
|
id: aboutId,
|
|
@@ -452,7 +361,7 @@ var TextFieldStandard = ({
|
|
|
452
361
|
}
|
|
453
362
|
}
|
|
454
363
|
),
|
|
455
|
-
/* @__PURE__ */ (0,
|
|
364
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
456
365
|
"input",
|
|
457
366
|
{
|
|
458
367
|
type: (_c = (_b = question.questionExtraAttribute) == null ? void 0 : _b.inputType) != null ? _c : "text",
|
|
@@ -474,15 +383,15 @@ var TextFieldStandard = ({
|
|
|
474
383
|
autoCapitalize: (_m = (_l = question.questionExtraAttribute) == null ? void 0 : _l.autoCapitalize) != null ? _m : void 0
|
|
475
384
|
}
|
|
476
385
|
),
|
|
477
|
-
question.hasValidationError && /* @__PURE__ */ (0,
|
|
478
|
-
/* @__PURE__ */ (0,
|
|
479
|
-
/* @__PURE__ */ (0,
|
|
480
|
-
/* @__PURE__ */ (0,
|
|
386
|
+
question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
|
|
387
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
388
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
389
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
481
390
|
] })
|
|
482
391
|
]
|
|
483
392
|
}
|
|
484
393
|
),
|
|
485
|
-
showPreview && /* @__PURE__ */ (0,
|
|
394
|
+
showPreview && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(PreviewTextField, { activatedLanguage, question })
|
|
486
395
|
] });
|
|
487
396
|
};
|
|
488
397
|
var TextFieldStandard_default = TextFieldStandard;
|
|
@@ -492,9 +401,9 @@ var PreviewTextField = ({
|
|
|
492
401
|
}) => {
|
|
493
402
|
var _a, _b;
|
|
494
403
|
const previewId = `preview-${question.id}`;
|
|
495
|
-
return /* @__PURE__ */ (0,
|
|
496
|
-
/* @__PURE__ */ (0,
|
|
497
|
-
((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0,
|
|
404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
405
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
406
|
+
((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { className: "pts-textField-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
498
407
|
"dd",
|
|
499
408
|
{
|
|
500
409
|
className: "pts-textField-preview pts-root-answer no-answer-preview-page",
|
|
@@ -506,12 +415,12 @@ var PreviewTextField = ({
|
|
|
506
415
|
};
|
|
507
416
|
|
|
508
417
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
509
|
-
var
|
|
418
|
+
var import_react6 = require("react");
|
|
510
419
|
var import_clsx3 = __toESM(require("clsx"));
|
|
511
420
|
|
|
512
421
|
// src/components/input-components/AddFilesStandard/DropFilesStandard.tsx
|
|
513
422
|
var import_react_dropzone = require("react-dropzone");
|
|
514
|
-
var
|
|
423
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
515
424
|
var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h\xE4r", language }) => {
|
|
516
425
|
const onDrop = FilesSelected;
|
|
517
426
|
const { getRootProps, getInputProps, isDragActive } = (0, import_react_dropzone.useDropzone)({ onDrop, noKeyboard: true });
|
|
@@ -519,10 +428,10 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
519
428
|
event.preventDefault();
|
|
520
429
|
event.stopPropagation();
|
|
521
430
|
};
|
|
522
|
-
return /* @__PURE__ */ (0,
|
|
523
|
-
/* @__PURE__ */ (0,
|
|
431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "DropZoneContainer", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "DropZone", ...getRootProps(), onClick: handleFileExplorer, children: [
|
|
432
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { htmlFor: "fileDropInput", hidden: true, children: [
|
|
524
433
|
"Dra och sl\xE4pp filer h\xE4r omr\xE5de",
|
|
525
|
-
/* @__PURE__ */ (0,
|
|
434
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
526
435
|
"input",
|
|
527
436
|
{
|
|
528
437
|
...getInputProps({
|
|
@@ -533,8 +442,8 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
533
442
|
}
|
|
534
443
|
)
|
|
535
444
|
] }),
|
|
536
|
-
isDragActive ? /* @__PURE__ */ (0,
|
|
537
|
-
/* @__PURE__ */ (0,
|
|
445
|
+
isDragActive ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("b", { className: "dropFilesNowText", children: language === "sv" ? "Sl\xE4pp filerna, nu ...!" : "Drop files here!" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "DropZone-label-container", children: [
|
|
446
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
538
447
|
"svg",
|
|
539
448
|
{
|
|
540
449
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -542,7 +451,7 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
542
451
|
height: "2.4rem",
|
|
543
452
|
viewBox: "0 0 7 15",
|
|
544
453
|
fill: "#fff",
|
|
545
|
-
children: /* @__PURE__ */ (0,
|
|
454
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
546
455
|
"path",
|
|
547
456
|
{
|
|
548
457
|
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",
|
|
@@ -551,26 +460,26 @@ var DropFiles = ({ FilesSelected, DropFilesText = "Dra och sl\xE4pp dina filer h
|
|
|
551
460
|
)
|
|
552
461
|
}
|
|
553
462
|
),
|
|
554
|
-
/* @__PURE__ */ (0,
|
|
463
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "dropFilesText", children: DropFilesText })
|
|
555
464
|
] })
|
|
556
465
|
] }) }) });
|
|
557
466
|
};
|
|
558
467
|
var DropFilesStandard_default = DropFiles;
|
|
559
468
|
|
|
560
469
|
// src/components/input-components/AddFilesStandard/ExploreFilesStandard.tsx
|
|
561
|
-
var
|
|
470
|
+
var import_react3 = require("react");
|
|
562
471
|
var import_clsx = __toESM(require("clsx"));
|
|
563
472
|
|
|
564
473
|
// src/components/input-components/AddFilesStandard/ScreenReaderErrors.tsx
|
|
565
|
-
var
|
|
566
|
-
var
|
|
474
|
+
var import_react2 = __toESM(require("react"));
|
|
475
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
567
476
|
var ScreenReaderErrors = ({
|
|
568
477
|
errorMessageAddingFile,
|
|
569
478
|
activatedLanguage
|
|
570
479
|
}) => {
|
|
571
|
-
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] =
|
|
572
|
-
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] =
|
|
573
|
-
|
|
480
|
+
const [activateErrorMessagesForScreenReader, setActivateErrorMessagesForScreenReader] = import_react2.default.useState(false);
|
|
481
|
+
const [errorMessagesForScreenReader, setErrorMessagesForScreenReader] = import_react2.default.useState("");
|
|
482
|
+
import_react2.default.useEffect(() => {
|
|
574
483
|
if (errorMessageAddingFile.length > 0) {
|
|
575
484
|
let errorMessages = "";
|
|
576
485
|
errorMessages += errorMessageAddingFile.length;
|
|
@@ -582,12 +491,12 @@ var ScreenReaderErrors = ({
|
|
|
582
491
|
setActivateErrorMessagesForScreenReader(true);
|
|
583
492
|
}
|
|
584
493
|
}, [errorMessageAddingFile]);
|
|
585
|
-
return /* @__PURE__ */ (0,
|
|
494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: activateErrorMessagesForScreenReader && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "alert", className: "sr-only", "aria-atomic": "true", children: errorMessagesForScreenReader }) });
|
|
586
495
|
};
|
|
587
496
|
var ScreenReaderErrors_default = ScreenReaderErrors;
|
|
588
497
|
|
|
589
498
|
// src/components/input-components/AddFilesStandard/ExploreFilesStandard.tsx
|
|
590
|
-
var
|
|
499
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
591
500
|
var ExploreFiles = ({
|
|
592
501
|
FilesSelected,
|
|
593
502
|
numberOfFiles,
|
|
@@ -601,8 +510,8 @@ var ExploreFiles = ({
|
|
|
601
510
|
showErrors,
|
|
602
511
|
errorMessageAddingFile
|
|
603
512
|
}) => {
|
|
604
|
-
const fileInputRef = (0,
|
|
605
|
-
const buttonInputRef = (0,
|
|
513
|
+
const fileInputRef = (0, import_react3.useRef)(null);
|
|
514
|
+
const buttonInputRef = (0, import_react3.useRef)(null);
|
|
606
515
|
const handleFiles = (event) => {
|
|
607
516
|
const files = Array.from(event.target.files || []);
|
|
608
517
|
FilesSelected(files);
|
|
@@ -614,8 +523,8 @@ var ExploreFiles = ({
|
|
|
614
523
|
};
|
|
615
524
|
let addFilesInfoText = numberOfFiles > 0 ? activatedLanguage === "sv" ? `${numberOfFiles} filer valda (max ${allowedNumberOfFiles})` : `${numberOfFiles} files chosed (max ${allowedNumberOfFiles})` : activatedLanguage === "sv" ? "Ingen fil vald" : "No file chosen";
|
|
616
525
|
const ariaLabelText = `${activatedLanguage === "sv" ? "V\xE4lj fil" : "Choose file"} ${addFilesInfoText}`;
|
|
617
|
-
return /* @__PURE__ */ (0,
|
|
618
|
-
/* @__PURE__ */ (0,
|
|
526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "inputContainer", children: [
|
|
527
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
619
528
|
"div",
|
|
620
529
|
{
|
|
621
530
|
className: (0, import_clsx.default)(
|
|
@@ -625,7 +534,7 @@ var ExploreFiles = ({
|
|
|
625
534
|
),
|
|
626
535
|
id: labelId,
|
|
627
536
|
children: [
|
|
628
|
-
/* @__PURE__ */ (0,
|
|
537
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
629
538
|
"button",
|
|
630
539
|
{
|
|
631
540
|
ref: buttonInputRef,
|
|
@@ -639,12 +548,12 @@ var ExploreFiles = ({
|
|
|
639
548
|
children: activatedLanguage === "sv" ? "V\xE4lj fil" : "Choose file"
|
|
640
549
|
}
|
|
641
550
|
),
|
|
642
|
-
/* @__PURE__ */ (0,
|
|
643
|
-
/* @__PURE__ */ (0,
|
|
551
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": true, className: "filePickText", children: addFilesInfoText }),
|
|
552
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: inputId, "aria-hidden": true, className: "invisible" })
|
|
644
553
|
]
|
|
645
554
|
}
|
|
646
555
|
),
|
|
647
|
-
/* @__PURE__ */ (0,
|
|
556
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
648
557
|
"input",
|
|
649
558
|
{
|
|
650
559
|
"aria-hidden": true,
|
|
@@ -657,7 +566,7 @@ var ExploreFiles = ({
|
|
|
657
566
|
id: inputId
|
|
658
567
|
}
|
|
659
568
|
),
|
|
660
|
-
/* @__PURE__ */ (0,
|
|
569
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
661
570
|
ScreenReaderErrors_default,
|
|
662
571
|
{
|
|
663
572
|
errorMessageAddingFile,
|
|
@@ -669,22 +578,22 @@ var ExploreFiles = ({
|
|
|
669
578
|
var ExploreFilesStandard_default = ExploreFiles;
|
|
670
579
|
|
|
671
580
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
672
|
-
var
|
|
581
|
+
var import_react5 = __toESM(require("react"));
|
|
673
582
|
var import_react_bootstrap = require("react-bootstrap");
|
|
674
583
|
|
|
675
584
|
// src/components/input-components/AddFilesStandard/IndicatorStandard.tsx
|
|
676
|
-
var
|
|
585
|
+
var import_react4 = require("react");
|
|
677
586
|
var import_clsx2 = __toESM(require("clsx"));
|
|
678
|
-
var
|
|
587
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
679
588
|
var Indicator = (filename) => {
|
|
680
|
-
const [uploadPercentage, setUploadPercentage] = (0,
|
|
681
|
-
const [uploadDone, setUploadDone] = (0,
|
|
682
|
-
return /* @__PURE__ */ (0,
|
|
589
|
+
const [uploadPercentage, setUploadPercentage] = (0, import_react4.useState)(0);
|
|
590
|
+
const [uploadDone, setUploadDone] = (0, import_react4.useState)(false);
|
|
591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: (0, import_clsx2.default)("uploadIndicator", "uploadDone") }) });
|
|
683
592
|
};
|
|
684
593
|
var IndicatorStandard_default = Indicator;
|
|
685
594
|
|
|
686
595
|
// src/components/input-components/AddFilesStandard/SelectedFilesStandard.tsx
|
|
687
|
-
var
|
|
596
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
688
597
|
var SelectedFiles = ({
|
|
689
598
|
questionObject,
|
|
690
599
|
isTouched,
|
|
@@ -697,7 +606,7 @@ var SelectedFiles = ({
|
|
|
697
606
|
setNumberOfFiles,
|
|
698
607
|
removeUploadErrors
|
|
699
608
|
}) => {
|
|
700
|
-
const theDiv = (0,
|
|
609
|
+
const theDiv = (0, import_react5.useRef)(null);
|
|
701
610
|
const remove = (file) => {
|
|
702
611
|
let newFiles = questionObject.files.filter((f) => f !== file);
|
|
703
612
|
const newCountOfFiles = newFiles.length;
|
|
@@ -706,13 +615,13 @@ var SelectedFiles = ({
|
|
|
706
615
|
isTouched(e, questionObject);
|
|
707
616
|
removeFile(newCountOfFiles);
|
|
708
617
|
};
|
|
709
|
-
(0,
|
|
618
|
+
(0, import_react5.useEffect)(() => {
|
|
710
619
|
var _a;
|
|
711
620
|
numberOfFiles > 0 && ((_a = theDiv.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth", block: "end" }));
|
|
712
621
|
}, [numberOfFiles]);
|
|
713
622
|
const useWindowWidth = () => {
|
|
714
|
-
const [windowWidth2, setWindowWidth] = (0,
|
|
715
|
-
(0,
|
|
623
|
+
const [windowWidth2, setWindowWidth] = (0, import_react5.useState)(window.innerWidth);
|
|
624
|
+
(0, import_react5.useEffect)(() => {
|
|
716
625
|
const handleResize = () => {
|
|
717
626
|
setWindowWidth(window.innerWidth);
|
|
718
627
|
};
|
|
@@ -724,10 +633,10 @@ var SelectedFiles = ({
|
|
|
724
633
|
return windowWidth2;
|
|
725
634
|
};
|
|
726
635
|
const windowWidth = useWindowWidth();
|
|
727
|
-
return /* @__PURE__ */ (0,
|
|
728
|
-
/* @__PURE__ */ (0,
|
|
729
|
-
/* @__PURE__ */ (0,
|
|
730
|
-
/* @__PURE__ */ (0,
|
|
636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
637
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: errorMessageAddingFile.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "pts-errorSummary-container pts-addFile-error-container", children: [
|
|
638
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-hidden": "true", className: "errorDot", children: "!" }),
|
|
639
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "addFile-error-list-container", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("ul", { "aria-hidden": true, className: "fileListUnorderedList", id: "errorSummary-ul", children: [
|
|
731
640
|
" ",
|
|
732
641
|
errorMessageAddingFile.map((errorObj, index) => {
|
|
733
642
|
const errorFileName = errorObj.FileName;
|
|
@@ -735,9 +644,9 @@ var SelectedFiles = ({
|
|
|
735
644
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
736
645
|
const fileType = errorObj.FileName.split(".").pop();
|
|
737
646
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
738
|
-
return /* @__PURE__ */ (0,
|
|
739
|
-
/* @__PURE__ */ (0,
|
|
740
|
-
/* @__PURE__ */ (0,
|
|
647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react5.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "fileInListContainer", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "fileInList", children: [
|
|
648
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_bootstrap.Col, { children: windowWidth < 768 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "mobileFirstFileName", children: mobileFirstFileName }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "desktopFileName", children: errorObj.FileName }) }) }),
|
|
649
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
741
650
|
import_react_bootstrap.Col,
|
|
742
651
|
{
|
|
743
652
|
className: "errorMessageAddingFile",
|
|
@@ -752,7 +661,7 @@ var SelectedFiles = ({
|
|
|
752
661
|
] }, index) }) }) }, `error-${errorObj.FileName}-${index}`) });
|
|
753
662
|
})
|
|
754
663
|
] }) }),
|
|
755
|
-
/* @__PURE__ */ (0,
|
|
664
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "addFile-error-close-button", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
756
665
|
"button",
|
|
757
666
|
{
|
|
758
667
|
className: "selectedFilesLinkButton error-close",
|
|
@@ -760,7 +669,7 @@ var SelectedFiles = ({
|
|
|
760
669
|
removeError();
|
|
761
670
|
},
|
|
762
671
|
"aria-label": activatedLanguage === "sv" ? `St\xE4ng felmeddelande` : `Close error message`,
|
|
763
|
-
children: /* @__PURE__ */ (0,
|
|
672
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
764
673
|
"svg",
|
|
765
674
|
{
|
|
766
675
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -768,7 +677,7 @@ var SelectedFiles = ({
|
|
|
768
677
|
height: "14",
|
|
769
678
|
viewBox: "0 0 14 14",
|
|
770
679
|
fill: "none",
|
|
771
|
-
children: /* @__PURE__ */ (0,
|
|
680
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
772
681
|
"path",
|
|
773
682
|
{
|
|
774
683
|
d: "M0.75 12.75L12.75 0.75M0.75 0.75L12.75 12.75",
|
|
@@ -782,15 +691,15 @@ var SelectedFiles = ({
|
|
|
782
691
|
}
|
|
783
692
|
) })
|
|
784
693
|
] }) }),
|
|
785
|
-
questionObject.files.length > 0 && /* @__PURE__ */ (0,
|
|
694
|
+
questionObject.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "fileListUnorderedList", "aria-label": "Uppladdade filer", children: questionObject.files.map((file, index) => {
|
|
786
695
|
const indicatorfileName = file.FileName;
|
|
787
696
|
let mobileFirstFileName = file.FileName.split(".").shift();
|
|
788
697
|
mobileFirstFileName = mobileFirstFileName.length > 8 ? mobileFirstFileName.substring(0, 8) + ".." : mobileFirstFileName;
|
|
789
698
|
const fileType = file.FileName.split(".").pop();
|
|
790
699
|
mobileFirstFileName = mobileFirstFileName + "." + fileType;
|
|
791
|
-
return /* @__PURE__ */ (0,
|
|
792
|
-
/* @__PURE__ */ (0,
|
|
793
|
-
/* @__PURE__ */ (0,
|
|
700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react5.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "fileInListContainer", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "fileInList", children: [
|
|
701
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "fileItem", children: [
|
|
702
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_bootstrap.Col, { style: { maxWidth: "30px" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-hidden": "true", className: "uploadedDot", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
794
703
|
"svg",
|
|
795
704
|
{
|
|
796
705
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -798,7 +707,7 @@ var SelectedFiles = ({
|
|
|
798
707
|
height: "8",
|
|
799
708
|
viewBox: "0 0 8 8",
|
|
800
709
|
fill: "none",
|
|
801
|
-
children: /* @__PURE__ */ (0,
|
|
710
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
802
711
|
"path",
|
|
803
712
|
{
|
|
804
713
|
d: "M1 4.65913L2.8 6.45913L7 1.35913",
|
|
@@ -809,20 +718,20 @@ var SelectedFiles = ({
|
|
|
809
718
|
)
|
|
810
719
|
}
|
|
811
720
|
) }) }),
|
|
812
|
-
/* @__PURE__ */ (0,
|
|
721
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_bootstrap.Col, { children: windowWidth < 768 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "mobileFirstFileName", children: [
|
|
813
722
|
mobileFirstFileName,
|
|
814
723
|
" (",
|
|
815
724
|
Math.ceil(file.FileSize / (1024 * 1024)),
|
|
816
725
|
" ",
|
|
817
726
|
"MB)"
|
|
818
|
-
] }) : /* @__PURE__ */ (0,
|
|
727
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "desktopFileName", children: [
|
|
819
728
|
file.FileName,
|
|
820
729
|
" (",
|
|
821
|
-
/* @__PURE__ */ (0,
|
|
730
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "fileSizeText", children: file.FileSize < 1024 * 1024 ? `${Math.round(file.FileSize / 1024)} kB` : `${(file.FileSize / (1024 * 1024)).toFixed(1)} MB` }),
|
|
822
731
|
" ",
|
|
823
732
|
")"
|
|
824
733
|
] }) }),
|
|
825
|
-
/* @__PURE__ */ (0,
|
|
734
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_bootstrap.Col, { className: "lastCol", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
826
735
|
"button",
|
|
827
736
|
{
|
|
828
737
|
className: "selectedFilesLinkButton",
|
|
@@ -832,17 +741,17 @@ var SelectedFiles = ({
|
|
|
832
741
|
}
|
|
833
742
|
) })
|
|
834
743
|
] }),
|
|
835
|
-
showIndicator && /* @__PURE__ */ (0,
|
|
836
|
-
/* @__PURE__ */ (0,
|
|
744
|
+
showIndicator && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_bootstrap.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_bootstrap.Col, { style: { width: "100%", padding: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IndicatorStandard_default, { filename: indicatorfileName }) }) }),
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_bootstrap.Row, { style: { marginTop: "12px", marginBottom: "12px" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_bootstrap.Col, { className: "makeSpace" }) })
|
|
837
746
|
] }, index) }) }) }, `file-${file.FileName}-${index}`) });
|
|
838
747
|
}) }),
|
|
839
|
-
/* @__PURE__ */ (0,
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ref: theDiv, className: "pts-clipboard-container" })
|
|
840
749
|
] });
|
|
841
750
|
};
|
|
842
751
|
var SelectedFilesStandard_default = SelectedFiles;
|
|
843
752
|
|
|
844
753
|
// src/components/input-components/AddFilesStandard/AddFilesStandard.tsx
|
|
845
|
-
var
|
|
754
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
846
755
|
var AddFiles = ({
|
|
847
756
|
questionObject,
|
|
848
757
|
handleQuestionInputChange = (e, questionObject2) => {
|
|
@@ -880,24 +789,24 @@ var AddFiles = ({
|
|
|
880
789
|
const errorId = `error-${questionObject.id}`;
|
|
881
790
|
const labelId = `label-${questionObject.id}`;
|
|
882
791
|
const maxSizeMB = Math.round(allowedTotalFileSize / 1048576);
|
|
883
|
-
const [numberOfFiles, setNumberOfFiles] = (0,
|
|
884
|
-
const [totalFileSize, setTotalFileSize] = (0,
|
|
885
|
-
const [errorMessageAddingFile, setErrorMessageAddingFile] = (0,
|
|
886
|
-
const [newFiles, setNewFiles] = (0,
|
|
887
|
-
const [dropFilesText, setDropFilesText] = (0,
|
|
888
|
-
(0,
|
|
792
|
+
const [numberOfFiles, setNumberOfFiles] = (0, import_react6.useState)(0);
|
|
793
|
+
const [totalFileSize, setTotalFileSize] = (0, import_react6.useState)(0);
|
|
794
|
+
const [errorMessageAddingFile, setErrorMessageAddingFile] = (0, import_react6.useState)([]);
|
|
795
|
+
const [newFiles, setNewFiles] = (0, import_react6.useState)([]);
|
|
796
|
+
const [dropFilesText, setDropFilesText] = (0, import_react6.useState)("Dra och sl\xE4pp dina filer h\xE4r");
|
|
797
|
+
(0, import_react6.useEffect)(() => {
|
|
889
798
|
if (activatedLanguage === "sv") {
|
|
890
799
|
setDropFilesText("Dra och sl\xE4pp dina filer h\xE4r");
|
|
891
800
|
} else {
|
|
892
801
|
setDropFilesText("Drag and drop your files here");
|
|
893
802
|
}
|
|
894
803
|
}, [activatedLanguage]);
|
|
895
|
-
(0,
|
|
804
|
+
(0, import_react6.useEffect)(() => {
|
|
896
805
|
if (questionObject.files && questionObject.files.length > 0) {
|
|
897
806
|
setNumberOfFiles(questionObject.files.length);
|
|
898
807
|
}
|
|
899
808
|
}, []);
|
|
900
|
-
const onDrop = (0,
|
|
809
|
+
const onDrop = (0, import_react6.useCallback)(
|
|
901
810
|
(acceptedFiles) => {
|
|
902
811
|
var _a, _b, _c;
|
|
903
812
|
const validationErrors = [];
|
|
@@ -987,7 +896,7 @@ var AddFiles = ({
|
|
|
987
896
|
reader.readAsDataURL(file);
|
|
988
897
|
});
|
|
989
898
|
};
|
|
990
|
-
(0,
|
|
899
|
+
(0, import_react6.useEffect)(() => {
|
|
991
900
|
if (newFiles.length > 0) {
|
|
992
901
|
const currentFiles = questionObject.files ? questionObject.files : [];
|
|
993
902
|
const e = {
|
|
@@ -1014,9 +923,9 @@ var AddFiles = ({
|
|
|
1014
923
|
const handleRemoveErrors = () => {
|
|
1015
924
|
setErrorMessageAddingFile([]);
|
|
1016
925
|
};
|
|
1017
|
-
return /* @__PURE__ */ (0,
|
|
1018
|
-
!showPreview && visible && /* @__PURE__ */ (0,
|
|
1019
|
-
questionObject.aboutText && /* @__PURE__ */ (0,
|
|
926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
927
|
+
!showPreview && visible && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "root-question addFile-question-container", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { role: "group", children: [
|
|
928
|
+
questionObject.aboutText && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1020
929
|
"p",
|
|
1021
930
|
{
|
|
1022
931
|
id: aboutId,
|
|
@@ -1026,19 +935,19 @@ var AddFiles = ({
|
|
|
1026
935
|
),
|
|
1027
936
|
children: [
|
|
1028
937
|
questionObject.aboutText,
|
|
1029
|
-
questionObject.isQuestionMandatory && /* @__PURE__ */ (0,
|
|
938
|
+
questionObject.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "pts-root-mandatoryAsterisk", "aria-hidden": "true", children: [
|
|
1030
939
|
" ",
|
|
1031
940
|
"*"
|
|
1032
941
|
] })
|
|
1033
942
|
]
|
|
1034
943
|
}
|
|
1035
944
|
),
|
|
1036
|
-
questionObject.hasValidationError && /* @__PURE__ */ (0,
|
|
1037
|
-
/* @__PURE__ */ (0,
|
|
1038
|
-
/* @__PURE__ */ (0,
|
|
1039
|
-
/* @__PURE__ */ (0,
|
|
945
|
+
questionObject.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "pts-root-error error addfileserror", id: errorId, children: [
|
|
946
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
947
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
948
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "errorText", children: questionObject.validationDefaultMessesege })
|
|
1040
949
|
] }),
|
|
1041
|
-
/* @__PURE__ */ (0,
|
|
950
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1042
951
|
ExploreFilesStandard_default,
|
|
1043
952
|
{
|
|
1044
953
|
FilesSelected: onDrop,
|
|
@@ -1054,7 +963,7 @@ var AddFiles = ({
|
|
|
1054
963
|
removeUploadErrors: handleRemoveErrors
|
|
1055
964
|
}
|
|
1056
965
|
),
|
|
1057
|
-
/* @__PURE__ */ (0,
|
|
966
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1058
967
|
DropFilesStandard_default,
|
|
1059
968
|
{
|
|
1060
969
|
FilesSelected: onDrop,
|
|
@@ -1062,7 +971,7 @@ var AddFiles = ({
|
|
|
1062
971
|
language: activatedLanguage
|
|
1063
972
|
}
|
|
1064
973
|
),
|
|
1065
|
-
/* @__PURE__ */ (0,
|
|
974
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1066
975
|
SelectedFilesStandard_default,
|
|
1067
976
|
{
|
|
1068
977
|
questionObject,
|
|
@@ -1077,7 +986,7 @@ var AddFiles = ({
|
|
|
1077
986
|
}
|
|
1078
987
|
)
|
|
1079
988
|
] }) }),
|
|
1080
|
-
showPreview && /* @__PURE__ */ (0,
|
|
989
|
+
showPreview && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PreviewAddFiles, { activatedLanguage, questionObject })
|
|
1081
990
|
] });
|
|
1082
991
|
};
|
|
1083
992
|
var AddFilesStandard_default = AddFiles;
|
|
@@ -1086,11 +995,95 @@ var PreviewAddFiles = ({
|
|
|
1086
995
|
activatedLanguage
|
|
1087
996
|
}) => {
|
|
1088
997
|
const previewId = `preview-${questionObject.Id}`;
|
|
998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
999
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dt", { id: `question-${previewId}`, children: questionObject.questionLabel ? questionObject.questionLabel : activatedLanguage === "en" ? "Attached files" : "Bifogade filer" }),
|
|
1000
|
+
questionObject.files && questionObject.files.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dd", { className: "pts-addFiles-answer", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { "aria-labelledby": previewId, className: "pts-preview-answer-list", children: questionObject.files.map((file, index) => {
|
|
1001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { children: file.FileName }, `file-${index}-${file.FileName}`);
|
|
1002
|
+
}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dd", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No attached files" : "Inga bifogade filer" })
|
|
1003
|
+
] });
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
// src/components/input-components/SingleCheckboxStandard/SingleCheckboxStandard.tsx
|
|
1007
|
+
var import_react7 = require("react");
|
|
1008
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1009
|
+
var SingleCheckboxes = ({
|
|
1010
|
+
question,
|
|
1011
|
+
handleQuestionInputChange,
|
|
1012
|
+
showPreview = false,
|
|
1013
|
+
activatedLanguage = "sv"
|
|
1014
|
+
}) => {
|
|
1015
|
+
var _a, _b;
|
|
1016
|
+
const questionId = `question-${question.id}`;
|
|
1017
|
+
const inputId = `checkbox-${question.id}`;
|
|
1018
|
+
const aboutId = `about-${question.id}`;
|
|
1019
|
+
const errorId = `error-${question.id}`;
|
|
1020
|
+
const [checked, setChecked] = (0, import_react7.useState)(false);
|
|
1021
|
+
const handleInputChange = (event) => {
|
|
1022
|
+
let answer = checked ? question.questionLabel : "";
|
|
1023
|
+
setChecked(event.target.checked);
|
|
1024
|
+
const e = { target: { value: answer } };
|
|
1025
|
+
handleQuestionInputChange(e, question);
|
|
1026
|
+
};
|
|
1027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1028
|
+
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { id: questionId, className: "pts-root-question pts-singleCheckbox-container", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("legend", { id: `label-${questionId}`, children: [
|
|
1029
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1030
|
+
"input",
|
|
1031
|
+
{
|
|
1032
|
+
type: "checkbox",
|
|
1033
|
+
name: `question-name-${question.id}`,
|
|
1034
|
+
id: `${inputId}`,
|
|
1035
|
+
value: (_a = question.questionLabel) != null ? _a : "",
|
|
1036
|
+
checked,
|
|
1037
|
+
onChange: (e) => handleInputChange(e),
|
|
1038
|
+
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
1039
|
+
disabled: (_b = question.questionExtraAttribute) == null ? void 0 : _b.disabled,
|
|
1040
|
+
required: question.isQuestionMandatory,
|
|
1041
|
+
"aria-required": question.isQuestionMandatory,
|
|
1042
|
+
"aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
|
|
1043
|
+
"aria-invalid": question.hasValidationError,
|
|
1044
|
+
"aria-errormessage": question.hasValidationError ? errorId : void 0
|
|
1045
|
+
}
|
|
1046
|
+
),
|
|
1047
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: `${questionId}`, children: question.questionLabel }),
|
|
1048
|
+
question.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": true, className: "pts-root-mandatoryAsterisk", children: "*" }),
|
|
1049
|
+
" ",
|
|
1050
|
+
question.aboutText && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1051
|
+
"div",
|
|
1052
|
+
{
|
|
1053
|
+
id: aboutId,
|
|
1054
|
+
className: "pts-about",
|
|
1055
|
+
dangerouslySetInnerHTML: { __html: question.aboutText }
|
|
1056
|
+
}
|
|
1057
|
+
),
|
|
1058
|
+
" ",
|
|
1059
|
+
question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
|
|
1060
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
1061
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
1062
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
1063
|
+
] }),
|
|
1064
|
+
" "
|
|
1065
|
+
] }) }),
|
|
1066
|
+
" ",
|
|
1067
|
+
showPreview && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PreviewSingleCheckboxes, { activatedLanguage, question })
|
|
1068
|
+
] });
|
|
1069
|
+
};
|
|
1070
|
+
var SingleCheckboxStandard_default = SingleCheckboxes;
|
|
1071
|
+
var PreviewSingleCheckboxes = ({
|
|
1072
|
+
question,
|
|
1073
|
+
activatedLanguage
|
|
1074
|
+
}) => {
|
|
1075
|
+
var _a, _b;
|
|
1076
|
+
const previewId = `preview-${question.id}`;
|
|
1089
1077
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1090
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { id: `question-${previewId}`, children:
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1078
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
|
|
1079
|
+
((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { className: "pts-singleCheckbox-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1080
|
+
"dd",
|
|
1081
|
+
{
|
|
1082
|
+
className: "pts-singleCheckbox-preview pts-root-answer no-answer-preview-page",
|
|
1083
|
+
id: `answer-${previewId}`,
|
|
1084
|
+
children: activatedLanguage === "en" ? "No Answer" : "Inget svar"
|
|
1085
|
+
}
|
|
1086
|
+
)
|
|
1094
1087
|
] });
|
|
1095
1088
|
};
|
|
1096
1089
|
|
|
@@ -1814,6 +1807,14 @@ var QuestionRenderer = ({
|
|
|
1814
1807
|
showPreview
|
|
1815
1808
|
}
|
|
1816
1809
|
),
|
|
1810
|
+
question.questionType === "SingleCheckboxStandard" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1811
|
+
SingleCheckboxStandard_default,
|
|
1812
|
+
{
|
|
1813
|
+
question,
|
|
1814
|
+
handleQuestionInputChange,
|
|
1815
|
+
showPreview
|
|
1816
|
+
}
|
|
1817
|
+
),
|
|
1817
1818
|
question.questionType === "TextField" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1818
1819
|
TextFieldStandard_default,
|
|
1819
1820
|
{
|
|
@@ -1842,15 +1843,6 @@ var QuestionRenderer = ({
|
|
|
1842
1843
|
activatedLanguage
|
|
1843
1844
|
}
|
|
1844
1845
|
),
|
|
1845
|
-
question.questionType === "CheckboxGroup" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1846
|
-
CheckboxGroupStandard_default,
|
|
1847
|
-
{
|
|
1848
|
-
question,
|
|
1849
|
-
handleQuestionInputChange,
|
|
1850
|
-
showPreview,
|
|
1851
|
-
activatedLanguage
|
|
1852
|
-
}
|
|
1853
|
-
),
|
|
1854
1846
|
question.questionType === "TextArea" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1855
1847
|
TextAreaStandard_default,
|
|
1856
1848
|
{
|
|
@@ -2990,7 +2982,6 @@ var FormStatusMessagesScreenReader_default = FormStatusMessagesScreenReader;
|
|
|
2990
2982
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2991
2983
|
0 && (module.exports = {
|
|
2992
2984
|
AddFilesStandard,
|
|
2993
|
-
CheckboxGroupStandard,
|
|
2994
2985
|
CookieBanner,
|
|
2995
2986
|
EditPreviewLinkStandard,
|
|
2996
2987
|
FooterStandard,
|
|
@@ -3002,6 +2993,7 @@ var FormStatusMessagesScreenReader_default = FormStatusMessagesScreenReader;
|
|
|
3002
2993
|
QuestionGroup,
|
|
3003
2994
|
QuestionRenderer,
|
|
3004
2995
|
RadioMultipleStandard,
|
|
2996
|
+
SingleCheckboxStandard,
|
|
3005
2997
|
SkipLinkStandard,
|
|
3006
2998
|
StartApplicationButton,
|
|
3007
2999
|
StepperButtonsStandard,
|