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.mjs CHANGED
@@ -40,7 +40,7 @@ var InputRadio = ({
40
40
  {
41
41
  "aria-required": question.isQuestionMandatory,
42
42
  "aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
43
- "aria-errormessage": question.hasValidationError ? errorId : void 0,
43
+ "aria-describedby": question.hasValidationError ? errorId : void 0,
44
44
  children: [
45
45
  /* @__PURE__ */ jsxs2("legend", { id: `label-${groupId}`, children: [
46
46
  question.questionLabel,
@@ -211,7 +211,7 @@ var CheckboxGroup = ({
211
211
  {
212
212
  "aria-required": question.isQuestionMandatory,
213
213
  "aria-invalid": question.hasValidationError ? question.hasValidationError : void 0,
214
- "aria-errormessage": question.hasValidationError ? errorId : void 0,
214
+ "aria-describedby": question.hasValidationError ? errorId : void 0,
215
215
  children: [
216
216
  /* @__PURE__ */ jsxs4("legend", { className: "pts-checkboxGroup-legend", id: `label-${groupId}`, children: [
217
217
  question.questionLabel,
@@ -421,9 +421,8 @@ var TextFieldStandard = ({
421
421
  disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
422
422
  required: question.isQuestionMandatory,
423
423
  "aria-required": question.isQuestionMandatory,
424
- "aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
424
+ "aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
425
425
  "aria-invalid": question.hasValidationError,
426
- "aria-errormessage": question.hasValidationError ? errorId : void 0,
427
426
  spellCheck: (_l = (_k = question.questionExtraAttribute) == null ? void 0 : _k.spellCheck) != null ? _l : void 0,
428
427
  autoCapitalize: (_n = (_m = question.questionExtraAttribute) == null ? void 0 : _m.autoCapitalize) != null ? _n : void 0
429
428
  }
@@ -1117,9 +1116,8 @@ var SingleCheckbox = ({
1117
1116
  disabled: (_b = question.questionExtraAttribute) == null ? void 0 : _b.disabled,
1118
1117
  required: question.isQuestionMandatory,
1119
1118
  "aria-required": question.isQuestionMandatory,
1120
- "aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
1121
- "aria-invalid": question.hasValidationError,
1122
- "aria-errormessage": question.hasValidationError ? errorId : void 0
1119
+ "aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
1120
+ "aria-invalid": question.hasValidationError
1123
1121
  }
1124
1122
  ),
1125
1123
  /* @__PURE__ */ jsx13("label", { htmlFor: `${inputId}`, children: question.questionLabel }),
@@ -1158,14 +1156,7 @@ var PreviewSingleCheckbox = ({
1158
1156
  const previewId = `preview-${question.id}`;
1159
1157
  return /* @__PURE__ */ jsxs11(Fragment12, { children: [
1160
1158
  /* @__PURE__ */ jsx13("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
1161
- ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ jsx13("dd", { className: "pts-singleCheckbox-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer === "false" ? activatedLanguage === "sv" ? "Nej" : "No" : activatedLanguage === "sv" ? "Ja" : "Yes" }) : /* @__PURE__ */ jsx13(
1162
- "dd",
1163
- {
1164
- className: "pts-singleCheckbox-preview pts-root-answer",
1165
- id: `answer-${previewId}`,
1166
- children: activatedLanguage === "sv" ? "Nej" : "No"
1167
- }
1168
- )
1159
+ ((_b = question.answer) == null ? void 0 : _b.trim()) ? /* @__PURE__ */ jsx13("dd", { className: "pts-singleCheckbox-preview pts-root-answer", id: `answer-${previewId}`, children: question.answer === "false" ? activatedLanguage === "sv" ? "Nej" : "No" : activatedLanguage === "sv" ? "Ja" : "Yes" }) : /* @__PURE__ */ jsx13("dd", { className: "pts-singleCheckbox-preview pts-root-answer", id: `answer-${previewId}`, children: activatedLanguage === "sv" ? "Nej" : "No" })
1169
1160
  ] });
1170
1161
  };
1171
1162
 
@@ -1979,9 +1970,11 @@ var QuestionGroup = ({
1979
1970
  if (!questions || questions.length === 0) {
1980
1971
  return null;
1981
1972
  }
1982
- const firstQuestion = questions[0];
1973
+ const firstQuestion = questions.find((question) => question.visible === true) || questions[0];
1983
1974
  const errorId = firstQuestion.id + "-error";
1984
- const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find((e) => e.startsWith("groupCheck-"));
1975
+ const groupMandatory = (_a = firstQuestion.validationType) == null ? void 0 : _a.find(
1976
+ (e) => e.startsWith("groupCheck-")
1977
+ );
1985
1978
  useEffect11(() => {
1986
1979
  questions.forEach((question) => {
1987
1980
  if (question.visible && !question.isDisplayed) {
@@ -2008,7 +2001,6 @@ var QuestionGroup = ({
2008
2001
  className: "pts-root-question-group-fieldset pts-root-question",
2009
2002
  "aria-required": firstQuestion.isQuestionMandatory || void 0,
2010
2003
  "aria-invalid": firstQuestion.hasValidationError || void 0,
2011
- "aria-errormessage": firstQuestion.hasValidationError ? `${firstQuestion.id}-error` : void 0,
2012
2004
  "aria-describedby": firstQuestion.hasValidationError ? `${firstQuestion.id}-error` : void 0,
2013
2005
  children: [
2014
2006
  legendLabel && /* @__PURE__ */ jsxs13("legend", { children: [