optimized-react-component-library-xyz123 0.25.1 → 0.26.2

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
@@ -168,17 +168,17 @@ var MultipleCheckboxes = ({
168
168
  var _a2;
169
169
  const initialValues = ((_a2 = question.options) == null ? void 0 : _a2.filter((option) => {
170
170
  var _a3;
171
- return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.label);
171
+ return (_a3 = question.answer) == null ? void 0 : _a3.includes(option.id);
172
172
  }).map((option) => option.label)) || [];
173
173
  console.log("Initial values:", initialValues);
174
174
  setCheckedValues(initialValues);
175
175
  }, [question.answer, question.options]);
176
- const handleInputChange = (event, optionValue) => {
176
+ const handleInputChange = (event, optionId) => {
177
177
  let updatedValues = [...checkedValues];
178
- if (updatedValues.includes(optionValue)) {
179
- updatedValues = updatedValues.filter((val) => val !== optionValue);
178
+ if (updatedValues.includes(optionId)) {
179
+ updatedValues = updatedValues.filter((val) => val !== optionId);
180
180
  } else {
181
- updatedValues.push(optionValue);
181
+ updatedValues.push(optionId);
182
182
  }
183
183
  setCheckedValues(updatedValues);
184
184
  const e = { target: { value: updatedValues.toString() } };
@@ -200,9 +200,9 @@ var MultipleCheckboxes = ({
200
200
  type: "checkbox",
201
201
  name: `${question.id}-option`,
202
202
  id: `${question.id}-option-${index}`,
203
- value: option.label,
204
- checked: checkedValues.includes(option.label),
205
- onChange: (e) => handleInputChange(e, option.label),
203
+ value: option.id,
204
+ checked: checkedValues.includes(option.id),
205
+ onChange: (e) => handleInputChange(e, option.id),
206
206
  className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0
207
207
  }
208
208
  ),
@@ -2133,7 +2133,7 @@ var CookieBanner = ({
2133
2133
  href: "https://pts.se/om-oss/om-pts.se/kakor-pa-webbplatsen/kakor-pa-pts-e-tjanster/",
2134
2134
  target: "_blank",
2135
2135
  rel: "noopener noreferrer",
2136
- children: activatedLanguage === "en" ? "Cookies on pts.se (opens in new tab)" : "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i ny flik"
2136
+ children: activatedLanguage === "en" ? "Cookies on pts.se (opens in new tab)" : "Kakor (cookies) p\xE5 pts.se (\xF6ppnas i ny flik)"
2137
2137
  }
2138
2138
  )
2139
2139
  ] }),