optimized-react-component-library-xyz123 0.19.15 → 0.19.17
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +74 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -86,9 +86,10 @@ var ValidationSummary = ({
|
|
|
86
86
|
validationMessesege,
|
|
87
87
|
validationId,
|
|
88
88
|
activatedLanguage = "sv",
|
|
89
|
-
showValidationSummary = false
|
|
89
|
+
showValidationSummary = false,
|
|
90
|
+
extraCssClass = ""
|
|
90
91
|
}) => {
|
|
91
|
-
return showValidationSummary && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className:
|
|
92
|
+
return showValidationSummary && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `pts-root-error ${extraCssClass}`, id: validationId, children: [
|
|
92
93
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
93
94
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: activatedLanguage === "sv" ? "Valideringsfel" : "Validation error" }),
|
|
94
95
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "errorText", children: validationMessesege })
|
|
@@ -101,7 +102,8 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
|
101
102
|
var InputRadio = ({
|
|
102
103
|
question,
|
|
103
104
|
handleQuestionInputChange,
|
|
104
|
-
showPreview = false
|
|
105
|
+
showPreview = false,
|
|
106
|
+
activatedLanguage = "sv"
|
|
105
107
|
}) => {
|
|
106
108
|
var _a, _b, _c;
|
|
107
109
|
const questionId = `question-${question.id}`;
|
|
@@ -111,7 +113,6 @@ var InputRadio = ({
|
|
|
111
113
|
const e = { target: { value: event.target.value } };
|
|
112
114
|
handleQuestionInputChange(e, question);
|
|
113
115
|
};
|
|
114
|
-
console.log("question", question);
|
|
115
116
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
116
117
|
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "pts-root-question pts-radioMultiple-container", id: questionId, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
117
118
|
"fieldset",
|
|
@@ -146,7 +147,7 @@ var InputRadio = ({
|
|
|
146
147
|
showValidationSummary: (_b = question.hasValidationError) != null ? _b : false,
|
|
147
148
|
validationId: errorId,
|
|
148
149
|
validationMessesege: (_c = question.validationDefaultMessesege) != null ? _c : "",
|
|
149
|
-
activatedLanguage
|
|
150
|
+
activatedLanguage
|
|
150
151
|
}
|
|
151
152
|
)
|
|
152
153
|
]
|
|
@@ -259,7 +260,7 @@ var CheckboxGroup = ({
|
|
|
259
260
|
showPreview = false,
|
|
260
261
|
activatedLanguage = "sv"
|
|
261
262
|
}) => {
|
|
262
|
-
var _a;
|
|
263
|
+
var _a, _b, _c;
|
|
263
264
|
const questionId = `question-${question.id}`;
|
|
264
265
|
const errorId = `error-${question.id}`;
|
|
265
266
|
const groupId = `checkbox-group-${question.id}`;
|
|
@@ -311,11 +312,15 @@ var CheckboxGroup = ({
|
|
|
311
312
|
),
|
|
312
313
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { htmlFor: `${groupId}-option-${index}`, children: option.label })
|
|
313
314
|
] }, index)),
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
315
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
316
|
+
ValidationMessage_default,
|
|
317
|
+
{
|
|
318
|
+
showValidationSummary: (_b = question.hasValidationError) != null ? _b : false,
|
|
319
|
+
validationId: errorId,
|
|
320
|
+
validationMessesege: (_c = question.validationDefaultMessesege) != null ? _c : "",
|
|
321
|
+
activatedLanguage
|
|
322
|
+
}
|
|
323
|
+
)
|
|
319
324
|
]
|
|
320
325
|
}
|
|
321
326
|
) }),
|
|
@@ -348,7 +353,7 @@ var InputTextarea = ({
|
|
|
348
353
|
showPreview = false,
|
|
349
354
|
activatedLanguage
|
|
350
355
|
}) => {
|
|
351
|
-
var _a, _b, _c, _d, _e;
|
|
356
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
352
357
|
const questionId = `question-${question.id}`;
|
|
353
358
|
const inputId = `textarea-${question.id}`;
|
|
354
359
|
const aboutId = `about-${question.id}`;
|
|
@@ -391,19 +396,24 @@ var InputTextarea = ({
|
|
|
391
396
|
}
|
|
392
397
|
),
|
|
393
398
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "pts-textarea-counter-error-container", children: [
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
400
|
+
ValidationMessage_default,
|
|
401
|
+
{
|
|
402
|
+
showValidationSummary: (_b = question.hasValidationError) != null ? _b : false,
|
|
403
|
+
validationId: errorId,
|
|
404
|
+
validationMessesege: (_c = question.validationDefaultMessesege) != null ? _c : "",
|
|
405
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
406
|
+
}
|
|
407
|
+
),
|
|
408
|
+
!((_d = question.questionExtraAttribute) == null ? void 0 : _d.hideTextCounter) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
399
409
|
"div",
|
|
400
410
|
{
|
|
401
|
-
className: `pts-character-counter ${question.answer && (((
|
|
411
|
+
className: `pts-character-counter ${question.answer && (((_e = question.questionExtraAttribute) == null ? void 0 : _e.answerMaxLength) || defaultMaxLength) && question.answer.length > (((_f = question.questionExtraAttribute) == null ? void 0 : _f.answerMaxLength) || defaultMaxLength) ? "error" : ""}`,
|
|
402
412
|
children: [
|
|
403
413
|
question.answer ? question.answer.length : 0,
|
|
404
414
|
" av",
|
|
405
415
|
" ",
|
|
406
|
-
((
|
|
416
|
+
((_g = question.questionExtraAttribute) == null ? void 0 : _g.answerMaxLength) || defaultMaxLength,
|
|
407
417
|
" tecken"
|
|
408
418
|
]
|
|
409
419
|
}
|
|
@@ -444,7 +454,7 @@ var TextFieldStandard = ({
|
|
|
444
454
|
showPreview = false,
|
|
445
455
|
activatedLanguage
|
|
446
456
|
}) => {
|
|
447
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
457
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
448
458
|
const questionId = `question-${question.id}`;
|
|
449
459
|
const inputId = `textField-${question.id}`;
|
|
450
460
|
const aboutId = `about-${question.id}`;
|
|
@@ -494,11 +504,15 @@ var TextFieldStandard = ({
|
|
|
494
504
|
autoCapitalize: (_m = (_l = question.questionExtraAttribute) == null ? void 0 : _l.autoCapitalize) != null ? _m : void 0
|
|
495
505
|
}
|
|
496
506
|
),
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
508
|
+
ValidationMessage_default,
|
|
509
|
+
{
|
|
510
|
+
showValidationSummary: (_n = question.hasValidationError) != null ? _n : false,
|
|
511
|
+
validationId: errorId,
|
|
512
|
+
validationMessesege: (_o = question.validationDefaultMessesege) != null ? _o : "",
|
|
513
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
514
|
+
}
|
|
515
|
+
)
|
|
502
516
|
]
|
|
503
517
|
}
|
|
504
518
|
),
|
|
@@ -877,6 +891,7 @@ var AddFiles = ({
|
|
|
877
891
|
allowedTotalFileSize = 20971520
|
|
878
892
|
// 20MB = (1024 * 1024) * 20
|
|
879
893
|
}) => {
|
|
894
|
+
var _a, _b;
|
|
880
895
|
if (allowedFileTypes.length < 1) {
|
|
881
896
|
allowedFileTypes = [
|
|
882
897
|
"pdf",
|
|
@@ -920,7 +935,7 @@ var AddFiles = ({
|
|
|
920
935
|
}, []);
|
|
921
936
|
const onDrop = (0, import_react7.useCallback)(
|
|
922
937
|
(acceptedFiles) => {
|
|
923
|
-
var
|
|
938
|
+
var _a2, _b2, _c;
|
|
924
939
|
const validationErrors = [];
|
|
925
940
|
const validFiles = [];
|
|
926
941
|
const currentTotalFileSize = (questionObject.files || []).reduce(
|
|
@@ -928,7 +943,7 @@ var AddFiles = ({
|
|
|
928
943
|
0
|
|
929
944
|
);
|
|
930
945
|
setTotalFileSize(currentTotalFileSize);
|
|
931
|
-
if ((((
|
|
946
|
+
if ((((_a2 = questionObject.files) == null ? void 0 : _a2.length) || 0) >= allowedNumberOfFiles) {
|
|
932
947
|
acceptedFiles.forEach((file) => {
|
|
933
948
|
validationErrors.push({
|
|
934
949
|
FileName: file.name,
|
|
@@ -941,7 +956,7 @@ var AddFiles = ({
|
|
|
941
956
|
}
|
|
942
957
|
let accumulatedNewSize = 0;
|
|
943
958
|
for (const file of acceptedFiles) {
|
|
944
|
-
const fileExtension = ((
|
|
959
|
+
const fileExtension = ((_b2 = file.name.split(".").pop()) == null ? void 0 : _b2.toLowerCase()) || "";
|
|
945
960
|
if (!allowedFileTypes.includes(fileExtension)) {
|
|
946
961
|
validationErrors.push({
|
|
947
962
|
FileName: file.name,
|
|
@@ -1054,11 +1069,16 @@ var AddFiles = ({
|
|
|
1054
1069
|
]
|
|
1055
1070
|
}
|
|
1056
1071
|
),
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1073
|
+
ValidationMessage_default,
|
|
1074
|
+
{
|
|
1075
|
+
showValidationSummary: (_a = questionObject.hasValidationError) != null ? _a : false,
|
|
1076
|
+
validationId: errorId,
|
|
1077
|
+
validationMessesege: (_b = questionObject.validationDefaultMessesege) != null ? _b : "",
|
|
1078
|
+
activatedLanguage,
|
|
1079
|
+
extraCssClass: "error addfileserror"
|
|
1080
|
+
}
|
|
1081
|
+
),
|
|
1062
1082
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1063
1083
|
ExploreFilesStandard_default,
|
|
1064
1084
|
{
|
|
@@ -1124,7 +1144,7 @@ var SingleCheckbox = ({
|
|
|
1124
1144
|
showPreview = false,
|
|
1125
1145
|
activatedLanguage = "sv"
|
|
1126
1146
|
}) => {
|
|
1127
|
-
var _a, _b;
|
|
1147
|
+
var _a, _b, _c, _d;
|
|
1128
1148
|
const questionId = `question-${question.id}`;
|
|
1129
1149
|
const inputId = `checkbox-${question.id}`;
|
|
1130
1150
|
const aboutId = `about-${question.id}`;
|
|
@@ -1177,12 +1197,15 @@ var SingleCheckbox = ({
|
|
|
1177
1197
|
}
|
|
1178
1198
|
),
|
|
1179
1199
|
" ",
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1200
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1201
|
+
ValidationMessage_default,
|
|
1202
|
+
{
|
|
1203
|
+
showValidationSummary: (_c = question.hasValidationError) != null ? _c : false,
|
|
1204
|
+
validationId: errorId,
|
|
1205
|
+
validationMessesege: (_d = question.validationDefaultMessesege) != null ? _d : "",
|
|
1206
|
+
activatedLanguage
|
|
1207
|
+
}
|
|
1208
|
+
)
|
|
1186
1209
|
] }),
|
|
1187
1210
|
" ",
|
|
1188
1211
|
showPreview && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PreviewSingleCheckbox, { activatedLanguage, question })
|
|
@@ -2000,11 +2023,12 @@ var QuestionGroup = ({
|
|
|
2000
2023
|
showPreview = false,
|
|
2001
2024
|
markQuestionAsDisplayed
|
|
2002
2025
|
}) => {
|
|
2003
|
-
var _a;
|
|
2026
|
+
var _a, _b, _c;
|
|
2004
2027
|
if (!questions || questions.length === 0) {
|
|
2005
2028
|
return null;
|
|
2006
2029
|
}
|
|
2007
2030
|
const firstQuestion = questions[0];
|
|
2031
|
+
const errorId = firstQuestion.id + "-error";
|
|
2008
2032
|
const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find((e) => e.startsWith("groupCheck-"));
|
|
2009
2033
|
(0, import_react12.useEffect)(() => {
|
|
2010
2034
|
questions.forEach((question) => {
|
|
@@ -2045,10 +2069,15 @@ var QuestionGroup = ({
|
|
|
2045
2069
|
firstQuestion.validationDefaultMessesege
|
|
2046
2070
|
] })
|
|
2047
2071
|
] }),
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2072
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2073
|
+
ValidationMessage_default,
|
|
2074
|
+
{
|
|
2075
|
+
showValidationSummary: (_b = firstQuestion.hasValidationError) != null ? _b : false,
|
|
2076
|
+
validationId: errorId,
|
|
2077
|
+
validationMessesege: (_c = firstQuestion.validationDefaultMessesege) != null ? _c : "",
|
|
2078
|
+
activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
|
|
2079
|
+
}
|
|
2080
|
+
),
|
|
2052
2081
|
groupQuestions
|
|
2053
2082
|
]
|
|
2054
2083
|
}
|