@arc-ui/components 5.0.0 → 6.0.0
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.es.js +11 -9
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/polyfills.js +3331 -17
- package/dist/polyfills.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts +1 -6
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +4 -4
- package/dist/types/components/RadioGroup/context.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -967,7 +967,6 @@ var FormControl = function (_a) {
|
|
|
967
967
|
}), id: id }, elementProps, filterDataAttrs(props)),
|
|
968
968
|
React.createElement(LabelType, __assign({ className: "arc-FormControl-label" }, labelProps),
|
|
969
969
|
label,
|
|
970
|
-
" ",
|
|
971
970
|
requirementStatus === "optional" && (React.createElement("span", { className: "arc-FormControl-labelOptional" }, "(optional)"))),
|
|
972
971
|
helper && (React.createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper)),
|
|
973
972
|
children,
|
|
@@ -1008,7 +1007,6 @@ var Checkbox = forwardRef(function (_a, ref) {
|
|
|
1008
1007
|
React.createElement("span", { className: "arc-Checkbox-box" }),
|
|
1009
1008
|
React.createElement("span", null,
|
|
1010
1009
|
label,
|
|
1011
|
-
" ",
|
|
1012
1010
|
!isRequired && requirementStatus !== "optional" ? (React.createElement("span", { className: "arc-Checkbox-labelOptional" }, "(optional)")) : null,
|
|
1013
1011
|
helper && React.createElement("span", { className: "arc-Checkbox-helper" }, helper))),
|
|
1014
1012
|
errorMessage && (React.createElement("div", { id: idError, className: "arc-Checkbox-error" }, errorMessage))));
|
|
@@ -1249,9 +1247,6 @@ var RadioContext = createContext({});
|
|
|
1249
1247
|
var Provider$2 = RadioContext.Provider;
|
|
1250
1248
|
var useRadioContext = function () {
|
|
1251
1249
|
var context = useContext(RadioContext);
|
|
1252
|
-
if (!context) {
|
|
1253
|
-
console.warn("Ensure to use <RadioGroup.RadioButton /> within the <RadioGroup /> or its branded version.");
|
|
1254
|
-
}
|
|
1255
1250
|
return context;
|
|
1256
1251
|
};
|
|
1257
1252
|
|
|
@@ -1260,10 +1255,10 @@ var useRadioContext = function () {
|
|
|
1260
1255
|
*/
|
|
1261
1256
|
var RadioButton = forwardRef(function (_a, ref) {
|
|
1262
1257
|
var helper = _a.helper, id = _a.id, isDisabled = _a.isDisabled, label = _a.label, value = _a.value, props = __rest(_a, ["helper", "id", "isDisabled", "label", "value"]);
|
|
1263
|
-
var _b = useRadioContext(), blurEvent = _b.blurEvent, changeEvent = _b.changeEvent, groupDisabled = _b.groupDisabled,
|
|
1258
|
+
var _b = useRadioContext(), blurEvent = _b.blurEvent, changeEvent = _b.changeEvent, groupDisabled = _b.groupDisabled, checkedValue = _b.checkedValue, labelSize = _b.labelSize, name = _b.name, size = _b.size;
|
|
1264
1259
|
var surface = useContext(Context$3).surface;
|
|
1265
1260
|
var idLabel = "".concat(id, "-label");
|
|
1266
|
-
var checked =
|
|
1261
|
+
var checked = checkedValue === value ? true : false;
|
|
1267
1262
|
return (React.createElement("div", __assign({ className: classNames({
|
|
1268
1263
|
"arc-RadioButton": true,
|
|
1269
1264
|
"arc-RadioButton--disabled": isDisabled || groupDisabled,
|
|
@@ -1282,12 +1277,19 @@ var RadioButton = forwardRef(function (_a, ref) {
|
|
|
1282
1277
|
* Use `RadioGroup` to wrap and control radio buttons and apply default values
|
|
1283
1278
|
*/
|
|
1284
1279
|
var RadioGroup = function (_a) {
|
|
1285
|
-
var children = _a.children,
|
|
1280
|
+
var children = _a.children, checkedValue = _a.checkedValue, _b = _a.isDisabled, isDisabled = _b === void 0 ? false : _b, id = _a.id, helper = _a.helper, label = _a.label, _c = _a.labelSize, labelSize = _c === void 0 ? "l" : _c, name = _a.name, onBlur = _a.onBlur, onChange = _a.onChange, _d = _a.size, size = _d === void 0 ? "l" : _d, props = __rest(_a, ["children", "checkedValue", "isDisabled", "id", "helper", "label", "labelSize", "name", "onBlur", "onChange", "size"]);
|
|
1281
|
+
useEffect(function () {
|
|
1282
|
+
React.Children.map(children, function (item) {
|
|
1283
|
+
if (item && item.type !== RadioButton) {
|
|
1284
|
+
throw new Error("Illegal child passed to <RadioGroup />. Ensure to only use <RadioGroup.RadioButton />.");
|
|
1285
|
+
}
|
|
1286
|
+
});
|
|
1287
|
+
}, [children]);
|
|
1286
1288
|
return (React.createElement(Provider$2, { value: {
|
|
1287
1289
|
blurEvent: onBlur,
|
|
1288
1290
|
changeEvent: onChange,
|
|
1289
1291
|
groupDisabled: isDisabled,
|
|
1290
|
-
|
|
1292
|
+
checkedValue: checkedValue,
|
|
1291
1293
|
labelSize: labelSize,
|
|
1292
1294
|
name: name,
|
|
1293
1295
|
size: size
|