optimized-react-component-library-xyz123 0.26.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 +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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.
|
|
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,
|
|
176
|
+
const handleInputChange = (event, optionId) => {
|
|
177
177
|
let updatedValues = [...checkedValues];
|
|
178
|
-
if (updatedValues.includes(
|
|
179
|
-
updatedValues = updatedValues.filter((val) => val !==
|
|
178
|
+
if (updatedValues.includes(optionId)) {
|
|
179
|
+
updatedValues = updatedValues.filter((val) => val !== optionId);
|
|
180
180
|
} else {
|
|
181
|
-
updatedValues.push(
|
|
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.
|
|
204
|
-
checked: checkedValues.includes(option.
|
|
205
|
-
onChange: (e) => handleInputChange(e, option.
|
|
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
|
),
|