@khanacademy/wonder-blocks-form 3.1.0 → 3.1.1
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/CHANGELOG.md +6 -0
- package/dist/es/index.js +4 -4
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/src/components/checkbox-group.js +10 -18
- package/src/components/radio-group.js +10 -17
package/CHANGELOG.md
CHANGED
package/dist/es/index.js
CHANGED
|
@@ -570,7 +570,7 @@ class CheckboxGroup extends React.Component {
|
|
|
570
570
|
value
|
|
571
571
|
} = child.props;
|
|
572
572
|
const checked = selectedValues.includes(value);
|
|
573
|
-
return React.
|
|
573
|
+
return React.cloneElement(child, {
|
|
574
574
|
checked: checked,
|
|
575
575
|
error: !!errorMessage,
|
|
576
576
|
groupName: groupName,
|
|
@@ -579,7 +579,7 @@ class CheckboxGroup extends React.Component {
|
|
|
579
579
|
onChange: () => this.handleChange(value, checked),
|
|
580
580
|
style: [index > 0 && styles$2.defaultLineGap, style],
|
|
581
581
|
variant: "checkbox"
|
|
582
|
-
})
|
|
582
|
+
});
|
|
583
583
|
})));
|
|
584
584
|
}
|
|
585
585
|
|
|
@@ -623,7 +623,7 @@ class RadioGroup extends React.Component {
|
|
|
623
623
|
value
|
|
624
624
|
} = child.props;
|
|
625
625
|
const checked = selectedValue === value;
|
|
626
|
-
return React.
|
|
626
|
+
return React.cloneElement(child, {
|
|
627
627
|
checked: checked,
|
|
628
628
|
error: !!errorMessage,
|
|
629
629
|
groupName: groupName,
|
|
@@ -632,7 +632,7 @@ class RadioGroup extends React.Component {
|
|
|
632
632
|
onChange: () => this.handleChange(value),
|
|
633
633
|
style: [index > 0 && styles$2.defaultLineGap, style],
|
|
634
634
|
variant: "radio"
|
|
635
|
-
})
|
|
635
|
+
});
|
|
636
636
|
})));
|
|
637
637
|
}
|
|
638
638
|
|
package/dist/index.js
CHANGED
|
@@ -868,7 +868,7 @@ class CheckboxGroup extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
868
868
|
value
|
|
869
869
|
} = child.props;
|
|
870
870
|
const checked = selectedValues.includes(value);
|
|
871
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["
|
|
871
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["cloneElement"](child, {
|
|
872
872
|
checked: checked,
|
|
873
873
|
error: !!errorMessage,
|
|
874
874
|
groupName: groupName,
|
|
@@ -877,7 +877,7 @@ class CheckboxGroup extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
877
877
|
onChange: () => this.handleChange(value, checked),
|
|
878
878
|
style: [index > 0 && _group_styles_js__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].defaultLineGap, style],
|
|
879
879
|
variant: "checkbox"
|
|
880
|
-
})
|
|
880
|
+
});
|
|
881
881
|
})));
|
|
882
882
|
}
|
|
883
883
|
|
|
@@ -980,7 +980,7 @@ class RadioGroup extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
980
980
|
value
|
|
981
981
|
} = child.props;
|
|
982
982
|
const checked = selectedValue === value;
|
|
983
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["
|
|
983
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["cloneElement"](child, {
|
|
984
984
|
checked: checked,
|
|
985
985
|
error: !!errorMessage,
|
|
986
986
|
groupName: groupName,
|
|
@@ -989,7 +989,7 @@ class RadioGroup extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
|
989
989
|
onChange: () => this.handleChange(value),
|
|
990
990
|
style: [index > 0 && _group_styles_js__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].defaultLineGap, style],
|
|
991
991
|
variant: "radio"
|
|
992
|
-
})
|
|
992
|
+
});
|
|
993
993
|
})));
|
|
994
994
|
}
|
|
995
995
|
|
package/package.json
CHANGED
|
@@ -156,24 +156,16 @@ export default class CheckboxGroup extends React.Component<CheckboxGroupProps> {
|
|
|
156
156
|
{allChildren.map((child, index) => {
|
|
157
157
|
const {style, value} = child.props;
|
|
158
158
|
const checked = selectedValues.includes(value);
|
|
159
|
-
return (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
style: [
|
|
170
|
-
index > 0 && styles.defaultLineGap,
|
|
171
|
-
style,
|
|
172
|
-
],
|
|
173
|
-
variant: "checkbox",
|
|
174
|
-
})}
|
|
175
|
-
</React.Fragment>
|
|
176
|
-
);
|
|
159
|
+
return React.cloneElement(child, {
|
|
160
|
+
checked: checked,
|
|
161
|
+
error: !!errorMessage,
|
|
162
|
+
groupName: groupName,
|
|
163
|
+
id: `${groupName}-${value}`,
|
|
164
|
+
key: value,
|
|
165
|
+
onChange: () => this.handleChange(value, checked),
|
|
166
|
+
style: [index > 0 && styles.defaultLineGap, style],
|
|
167
|
+
variant: "checkbox",
|
|
168
|
+
});
|
|
177
169
|
})}
|
|
178
170
|
</View>
|
|
179
171
|
</StyledFieldset>
|
|
@@ -146,23 +146,16 @@ export default class RadioGroup extends React.Component<RadioGroupProps> {
|
|
|
146
146
|
{allChildren.map((child, index) => {
|
|
147
147
|
const {style, value} = child.props;
|
|
148
148
|
const checked = selectedValue === value;
|
|
149
|
-
return (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
index > 0 && styles.defaultLineGap,
|
|
160
|
-
style,
|
|
161
|
-
],
|
|
162
|
-
variant: "radio",
|
|
163
|
-
})}
|
|
164
|
-
</React.Fragment>
|
|
165
|
-
);
|
|
149
|
+
return React.cloneElement(child, {
|
|
150
|
+
checked: checked,
|
|
151
|
+
error: !!errorMessage,
|
|
152
|
+
groupName: groupName,
|
|
153
|
+
id: `${groupName}-${value}`,
|
|
154
|
+
key: value,
|
|
155
|
+
onChange: () => this.handleChange(value),
|
|
156
|
+
style: [index > 0 && styles.defaultLineGap, style],
|
|
157
|
+
variant: "radio",
|
|
158
|
+
});
|
|
166
159
|
})}
|
|
167
160
|
</View>
|
|
168
161
|
</StyledFieldset>
|