optimized-react-component-library-xyz123 0.29.1 → 0.29.3

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.js CHANGED
@@ -122,7 +122,7 @@ var InputRadio = ({
122
122
  {
123
123
  "aria-required": question.isQuestionMandatory,
124
124
  "aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
125
- "aria-errormessage": question.hasValidationError ? errorId : void 0,
125
+ "aria-describedby": question.hasValidationError ? errorId : void 0,
126
126
  children: [
127
127
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("legend", { id: `label-${groupId}`, children: [
128
128
  question.questionLabel,
@@ -293,7 +293,7 @@ var CheckboxGroup = ({
293
293
  {
294
294
  "aria-required": question.isQuestionMandatory,
295
295
  "aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
296
- "aria-errormessage": question.hasValidationError ? errorId : void 0,
296
+ "aria-describedby": question.hasValidationError ? errorId : void 0,
297
297
  children: [
298
298
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("legend", { className: "pts-checkboxGroup-legend", id: `label-${groupId}`, children: [
299
299
  question.questionLabel,
@@ -503,9 +503,8 @@ var TextFieldStandard = ({
503
503
  disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
504
504
  required: question.isQuestionMandatory,
505
505
  "aria-required": question.isQuestionMandatory,
506
- "aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
506
+ "aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
507
507
  "aria-invalid": question.hasValidationError,
508
- "aria-errormessage": question.hasValidationError ? errorId : void 0,
509
508
  spellCheck: (_l = (_k = question.questionExtraAttribute) == null ? void 0 : _k.spellCheck) != null ? _l : void 0,
510
509
  autoCapitalize: (_n = (_m = question.questionExtraAttribute) == null ? void 0 : _m.autoCapitalize) != null ? _n : void 0
511
510
  }
@@ -1199,9 +1198,8 @@ var SingleCheckbox = ({
1199
1198
  disabled: (_b = question.questionExtraAttribute) == null ? void 0 : _b.disabled,
1200
1199
  required: question.isQuestionMandatory,
1201
1200
  "aria-required": question.isQuestionMandatory,
1202
- "aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
1203
- "aria-invalid": question.hasValidationError,
1204
- "aria-errormessage": question.hasValidationError ? errorId : void 0
1201
+ "aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
1202
+ "aria-invalid": question.hasValidationError
1205
1203
  }
1206
1204
  ),
1207
1205
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: `${inputId}`, children: question.questionLabel }),
@@ -1240,14 +1238,7 @@ var PreviewSingleCheckbox = ({
1240
1238
  const previewId = `preview-${question.id}`;
1241
1239
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
1242
1240
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
1243
- ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dd", { className: "pts-singleCheckbox-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer === "false" ? activatedLanguage === "sv" ? "Nej" : "No" : activatedLanguage === "sv" ? "Ja" : "Yes" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1244
- "dd",
1245
- {
1246
- className: "pts-singleCheckbox-preview pts-root-answer",
1247
- id: `answer-${previewId}`,
1248
- children: activatedLanguage === "sv" ? "Nej" : "No"
1249
- }
1250
- )
1241
+ ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dd", { className: "pts-singleCheckbox-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer === "false" ? activatedLanguage === "sv" ? "Nej" : "No" : activatedLanguage === "sv" ? "Ja" : "Yes" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dd", { className: "pts-singleCheckbox-preview pts-root-answer", id: `answer-${previewId}`, children: activatedLanguage === "sv" ? "Nej" : "No" })
1251
1242
  ] });
1252
1243
  };
1253
1244
 
@@ -2058,9 +2049,11 @@ var QuestionGroup = ({
2058
2049
  if (!questions || questions.length === 0) {
2059
2050
  return null;
2060
2051
  }
2061
- const firstQuestion = questions[0];
2052
+ const firstQuestion = questions.find((question) => question.visible === true) || questions[0];
2062
2053
  const errorId = firstQuestion.id + "-error";
2063
- const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find((e) => e.startsWith("groupCheck-"));
2054
+ const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
2055
+ (e) => e.startsWith("groupCheck-")
2056
+ );
2064
2057
  (0, import_react12.useEffect)(() => {
2065
2058
  questions.forEach((question) => {
2066
2059
  if (question.visible && !question.isDisplayed) {
@@ -2087,7 +2080,6 @@ var QuestionGroup = ({
2087
2080
  className: "pts-root-question-group-fieldset pts-root-question",
2088
2081
  "aria-required": firstQuestion.isQuestionMandatory || void 0,
2089
2082
  "aria-invalid": firstQuestion.hasValidationError || void 0,
2090
- "aria-errormessage": firstQuestion.hasValidationError ? `${firstQuestion.id}-error` : void 0,
2091
2083
  "aria-describedby": firstQuestion.hasValidationError ? `${firstQuestion.id}-error` : void 0,
2092
2084
  children: [
2093
2085
  legendLabel && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("legend", { children: [