optimized-react-component-library-xyz123 0.19.15 → 0.19.16

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 CHANGED
@@ -118,6 +118,7 @@ interface RadioProps {
118
118
  question: IQuestion;
119
119
  handleQuestionInputChange: any;
120
120
  showPreview?: boolean;
121
+ activatedLanguage?: string;
121
122
  }
122
123
 
123
124
  declare const InputRadio: FC<RadioProps>;
package/dist/index.d.ts CHANGED
@@ -118,6 +118,7 @@ interface RadioProps {
118
118
  question: IQuestion;
119
119
  handleQuestionInputChange: any;
120
120
  showPreview?: boolean;
121
+ activatedLanguage?: string;
121
122
  }
122
123
 
123
124
  declare const InputRadio: FC<RadioProps>;
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: "pts-root-error", id: validationId, children: [
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}`;
@@ -146,7 +148,7 @@ var InputRadio = ({
146
148
  showValidationSummary: (_b = question.hasValidationError) != null ? _b : false,
147
149
  validationId: errorId,
148
150
  validationMessesege: (_c = question.validationDefaultMessesege) != null ? _c : "",
149
- activatedLanguage: "sv"
151
+ activatedLanguage
150
152
  }
151
153
  )
152
154
  ]
@@ -259,7 +261,7 @@ var CheckboxGroup = ({
259
261
  showPreview = false,
260
262
  activatedLanguage = "sv"
261
263
  }) => {
262
- var _a;
264
+ var _a, _b, _c;
263
265
  const questionId = `question-${question.id}`;
264
266
  const errorId = `error-${question.id}`;
265
267
  const groupId = `checkbox-group-${question.id}`;
@@ -311,11 +313,15 @@ var CheckboxGroup = ({
311
313
  ),
312
314
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { htmlFor: `${groupId}-option-${index}`, children: option.label })
313
315
  ] }, index)),
314
- question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
315
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
316
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
317
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
318
- ] })
316
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
317
+ ValidationMessage_default,
318
+ {
319
+ showValidationSummary: (_b = question.hasValidationError) != null ? _b : false,
320
+ validationId: errorId,
321
+ validationMessesege: (_c = question.validationDefaultMessesege) != null ? _c : "",
322
+ activatedLanguage
323
+ }
324
+ )
319
325
  ]
320
326
  }
321
327
  ) }),
@@ -348,7 +354,7 @@ var InputTextarea = ({
348
354
  showPreview = false,
349
355
  activatedLanguage
350
356
  }) => {
351
- var _a, _b, _c, _d, _e;
357
+ var _a, _b, _c, _d, _e, _f, _g;
352
358
  const questionId = `question-${question.id}`;
353
359
  const inputId = `textarea-${question.id}`;
354
360
  const aboutId = `about-${question.id}`;
@@ -391,19 +397,24 @@ var InputTextarea = ({
391
397
  }
392
398
  ),
393
399
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "pts-textarea-counter-error-container", children: [
394
- question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
395
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "aria-label": "Felmeddelande.", className: "errorDot", children: "!" }),
396
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
397
- ] }),
398
- !((_b = question.questionExtraAttribute) == null ? void 0 : _b.hideTextCounter) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
400
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
401
+ ValidationMessage_default,
402
+ {
403
+ showValidationSummary: (_b = question.hasValidationError) != null ? _b : false,
404
+ validationId: errorId,
405
+ validationMessesege: (_c = question.validationDefaultMessesege) != null ? _c : "",
406
+ activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
407
+ }
408
+ ),
409
+ !((_d = question.questionExtraAttribute) == null ? void 0 : _d.hideTextCounter) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
399
410
  "div",
400
411
  {
401
- 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" : ""}`,
412
+ 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
413
  children: [
403
414
  question.answer ? question.answer.length : 0,
404
415
  " av",
405
416
  " ",
406
- ((_e = question.questionExtraAttribute) == null ? void 0 : _e.answerMaxLength) || defaultMaxLength,
417
+ ((_g = question.questionExtraAttribute) == null ? void 0 : _g.answerMaxLength) || defaultMaxLength,
407
418
  " tecken"
408
419
  ]
409
420
  }
@@ -444,7 +455,7 @@ var TextFieldStandard = ({
444
455
  showPreview = false,
445
456
  activatedLanguage
446
457
  }) => {
447
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
458
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
448
459
  const questionId = `question-${question.id}`;
449
460
  const inputId = `textField-${question.id}`;
450
461
  const aboutId = `about-${question.id}`;
@@ -494,6 +505,15 @@ var TextFieldStandard = ({
494
505
  autoCapitalize: (_m = (_l = question.questionExtraAttribute) == null ? void 0 : _l.autoCapitalize) != null ? _m : void 0
495
506
  }
496
507
  ),
508
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
509
+ ValidationMessage_default,
510
+ {
511
+ showValidationSummary: (_n = question.hasValidationError) != null ? _n : false,
512
+ validationId: errorId,
513
+ validationMessesege: (_o = question.validationDefaultMessesege) != null ? _o : "",
514
+ activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
515
+ }
516
+ ),
497
517
  question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
498
518
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
499
519
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
@@ -877,6 +897,7 @@ var AddFiles = ({
877
897
  allowedTotalFileSize = 20971520
878
898
  // 20MB = (1024 * 1024) * 20
879
899
  }) => {
900
+ var _a, _b;
880
901
  if (allowedFileTypes.length < 1) {
881
902
  allowedFileTypes = [
882
903
  "pdf",
@@ -920,7 +941,7 @@ var AddFiles = ({
920
941
  }, []);
921
942
  const onDrop = (0, import_react7.useCallback)(
922
943
  (acceptedFiles) => {
923
- var _a, _b, _c;
944
+ var _a2, _b2, _c;
924
945
  const validationErrors = [];
925
946
  const validFiles = [];
926
947
  const currentTotalFileSize = (questionObject.files || []).reduce(
@@ -928,7 +949,7 @@ var AddFiles = ({
928
949
  0
929
950
  );
930
951
  setTotalFileSize(currentTotalFileSize);
931
- if ((((_a = questionObject.files) == null ? void 0 : _a.length) || 0) >= allowedNumberOfFiles) {
952
+ if ((((_a2 = questionObject.files) == null ? void 0 : _a2.length) || 0) >= allowedNumberOfFiles) {
932
953
  acceptedFiles.forEach((file) => {
933
954
  validationErrors.push({
934
955
  FileName: file.name,
@@ -941,7 +962,7 @@ var AddFiles = ({
941
962
  }
942
963
  let accumulatedNewSize = 0;
943
964
  for (const file of acceptedFiles) {
944
- const fileExtension = ((_b = file.name.split(".").pop()) == null ? void 0 : _b.toLowerCase()) || "";
965
+ const fileExtension = ((_b2 = file.name.split(".").pop()) == null ? void 0 : _b2.toLowerCase()) || "";
945
966
  if (!allowedFileTypes.includes(fileExtension)) {
946
967
  validationErrors.push({
947
968
  FileName: file.name,
@@ -1054,6 +1075,16 @@ var AddFiles = ({
1054
1075
  ]
1055
1076
  }
1056
1077
  ),
1078
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1079
+ ValidationMessage_default,
1080
+ {
1081
+ showValidationSummary: (_a = questionObject.hasValidationError) != null ? _a : false,
1082
+ validationId: errorId,
1083
+ validationMessesege: (_b = questionObject.validationDefaultMessesege) != null ? _b : "",
1084
+ activatedLanguage,
1085
+ extraCssClass: "error addfileserror"
1086
+ }
1087
+ ),
1057
1088
  questionObject.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "pts-root-error error addfileserror", id: errorId, children: [
1058
1089
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
1059
1090
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
@@ -1124,7 +1155,7 @@ var SingleCheckbox = ({
1124
1155
  showPreview = false,
1125
1156
  activatedLanguage = "sv"
1126
1157
  }) => {
1127
- var _a, _b;
1158
+ var _a, _b, _c, _d;
1128
1159
  const questionId = `question-${question.id}`;
1129
1160
  const inputId = `checkbox-${question.id}`;
1130
1161
  const aboutId = `about-${question.id}`;
@@ -1177,12 +1208,15 @@ var SingleCheckbox = ({
1177
1208
  }
1178
1209
  ),
1179
1210
  " ",
1180
- question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
1181
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
1182
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
1183
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
1184
- ] }),
1185
- " "
1211
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1212
+ ValidationMessage_default,
1213
+ {
1214
+ showValidationSummary: (_c = question.hasValidationError) != null ? _c : false,
1215
+ validationId: errorId,
1216
+ validationMessesege: (_d = question.validationDefaultMessesege) != null ? _d : "",
1217
+ activatedLanguage
1218
+ }
1219
+ )
1186
1220
  ] }),
1187
1221
  " ",
1188
1222
  showPreview && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PreviewSingleCheckbox, { activatedLanguage, question })
@@ -2000,11 +2034,12 @@ var QuestionGroup = ({
2000
2034
  showPreview = false,
2001
2035
  markQuestionAsDisplayed
2002
2036
  }) => {
2003
- var _a;
2037
+ var _a, _b, _c;
2004
2038
  if (!questions || questions.length === 0) {
2005
2039
  return null;
2006
2040
  }
2007
2041
  const firstQuestion = questions[0];
2042
+ const errorId = firstQuestion.id + "-error";
2008
2043
  const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find((e) => e.startsWith("groupCheck-"));
2009
2044
  (0, import_react12.useEffect)(() => {
2010
2045
  questions.forEach((question) => {
@@ -2045,10 +2080,15 @@ var QuestionGroup = ({
2045
2080
  firstQuestion.validationDefaultMessesege
2046
2081
  ] })
2047
2082
  ] }),
2048
- firstQuestion.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "pts-root-error", id: firstQuestion.id + "-error", children: [
2049
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { "aria-label": "Valideringsfel", className: "errorDot", children: "!" }),
2050
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "errorText", children: firstQuestion.validationDefaultMessesege })
2051
- ] }),
2083
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2084
+ ValidationMessage_default,
2085
+ {
2086
+ showValidationSummary: (_b = firstQuestion.hasValidationError) != null ? _b : false,
2087
+ validationId: errorId,
2088
+ validationMessesege: (_c = firstQuestion.validationDefaultMessesege) != null ? _c : "",
2089
+ activatedLanguage: activatedLanguage != null ? activatedLanguage : "sv"
2090
+ }
2091
+ ),
2052
2092
  groupQuestions
2053
2093
  ]
2054
2094
  }