optimized-react-component-library-xyz123 0.26.4 → 0.26.6

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
@@ -248,8 +248,8 @@ var CheckboxGroup = ({
248
248
  var _a2;
249
249
  const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
250
250
  var _a3;
251
- return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.label);
252
- }).map((option) => option.label)) || [];
251
+ return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.id);
252
+ }).map((option) => option.id)) || [];
253
253
  setCheckedValues(initialValues);
254
254
  }, [question.answer, question.options]);
255
255
  const handleInputChange = (event, optionValue) => {
@@ -283,9 +283,9 @@ var CheckboxGroup = ({
283
283
  type: "checkbox",
284
284
  name: `name-${question.id}`,
285
285
  id: `${groupId}-option-${index}`,
286
- value: option.label,
287
- checked: checkedValues.includes(option.label),
288
- onChange: (e) => handleInputChange(e, option.label),
286
+ value: option.id,
287
+ checked: checkedValues.includes(option.id),
288
+ onChange: (e) => handleInputChange(e, option.id),
289
289
  className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
290
290
  }
291
291
  ),
@@ -313,7 +313,7 @@ var PreviewCheckboxGroup = ({
313
313
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
314
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
315
  var _a2;
316
- return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
316
+ return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.id);
317
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
318
  " "
319
319
  ] });
@@ -1279,7 +1279,7 @@ function createApiDataObject(data, specialMappedQuestions, translatedAnswers) {
1279
1279
  let translatedAnswer = question.answer;
1280
1280
  if (question.answer && typeof question.answer === "string" && Array.isArray(question.options) && question.mappingId && specialMappedQuestions.has(question.mappingId)) {
1281
1281
  const answerNormalized = normalize(question.answer);
1282
- const matchingIds = question.options.filter((option) => answerNormalized.includes(normalize(option.label))).map((option) => `^${option.id}^`);
1282
+ const matchingIds = question.options.filter((option) => answerNormalized.includes(normalize(option.id))).map((option) => `^${option.id}^`);
1283
1283
  if (matchingIds.length > 0) {
1284
1284
  translatedAnswer = matchingIds.join(",");
1285
1285
  }