@deque/cauldron-react 6.26.0-canary.a71356d9 → 6.26.0-canary.aae50b7a

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.
@@ -9,7 +9,7 @@ export interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElemen
9
9
  className?: string;
10
10
  radios: RadioItem[];
11
11
  defaultValue?: string;
12
- value?: any;
12
+ value?: string;
13
13
  inline?: boolean;
14
14
  onChange?: (radio: RadioItem, input: HTMLElement) => void;
15
15
  }
package/lib/index.js CHANGED
@@ -2444,7 +2444,9 @@ var RadioGroup = React.forwardRef(function (_a, ref) {
2444
2444
  var _d = tslib.__read(React.useState(value || defaultValue || null), 2), currentValue = _d[0], setCurrentValue = _d[1];
2445
2445
  var _e = tslib.__read(React.useState(null), 2), focusIndex = _e[0], setFocusIndex = _e[1];
2446
2446
  var inputs = React.useRef([]);
2447
- var handleChange = function (value) { return setCurrentValue(value); };
2447
+ var handleChange = function (value) {
2448
+ return setCurrentValue(value !== null && value !== void 0 ? value : null);
2449
+ };
2448
2450
  var onRadioFocus = function (index) { return setFocusIndex(index); };
2449
2451
  var onRadioBlur = function () { return setFocusIndex(null); };
2450
2452
  var onRadioClick = function (index) {
@@ -2469,10 +2471,9 @@ var RadioGroup = React.forwardRef(function (_a, ref) {
2469
2471
  return (React__default["default"].createElement("div", { className: "Radio__wrap", key: id },
2470
2472
  React__default["default"].createElement("div", { className: classNames__default["default"]('Radio is--flex-row', className) },
2471
2473
  React__default["default"].createElement("input", tslib.__assign({ type: "radio", name: name, value: radioValue, id: id, ref: function (input) {
2472
- if (!input) {
2473
- return;
2474
+ if (input) {
2475
+ inputs.current[index] = input;
2474
2476
  }
2475
- inputs.current.push(input);
2476
2477
  }, onFocus: function () { return onRadioFocus(index); }, onBlur: function () { return onRadioBlur(); }, onChange: function () {
2477
2478
  var _a;
2478
2479
  handleChange(radioValue);
@@ -2489,10 +2490,6 @@ var RadioGroup = React.forwardRef(function (_a, ref) {
2489
2490
  'Field__labelDescription--disabled': disabled
2490
2491
  }) }, labelDescription))));
2491
2492
  });
2492
- // reset the input refs array
2493
- // refs get clobbered every re-render anyway and this supports "dynamic" radios
2494
- // (changing the number of radio buttons for example)
2495
- inputs.current = [];
2496
2493
  return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"](className, { 'Radio--inline': inline }), role: "radiogroup", ref: ref }, other), radioButtons));
2497
2494
  });
2498
2495
  RadioGroup.displayName = 'RadioGroup';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "6.26.0-canary.a71356d9",
3
+ "version": "6.26.0-canary.aae50b7a",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",