@deque/cauldron-react 5.2.0-canary.4eed43e8 → 5.2.0-canary.7c2ddf08
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.
|
@@ -11,10 +11,11 @@ export interface RadioGroupProps {
|
|
|
11
11
|
radios: RadioItem[];
|
|
12
12
|
defaultValue?: string;
|
|
13
13
|
value?: any;
|
|
14
|
+
inline?: boolean;
|
|
14
15
|
onChange: (radio: RadioItem, input: HTMLElement) => void;
|
|
15
16
|
}
|
|
16
17
|
declare const RadioGroup: {
|
|
17
|
-
({ name, radios, defaultValue, value, onChange, className, ...other }: RadioGroupProps): JSX.Element;
|
|
18
|
+
({ name, radios, defaultValue, value, onChange, className, inline, ...other }: RadioGroupProps): JSX.Element;
|
|
18
19
|
propTypes: {
|
|
19
20
|
name: PropTypes.Requireable<string>;
|
|
20
21
|
radios: PropTypes.Validator<(PropTypes.InferProps<{
|
package/lib/index.js
CHANGED
|
@@ -2584,9 +2584,9 @@ var RadioGroup = function (_a) {
|
|
|
2584
2584
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2585
2585
|
_b = _a.onChange,
|
|
2586
2586
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
2587
|
-
onChange = _b === void 0 ? function () { } : _b, className = _a.className, other = tslib.__rest(_a, ["name", "radios", "defaultValue", "value", "onChange", "className"]);
|
|
2588
|
-
var
|
|
2589
|
-
var
|
|
2587
|
+
onChange = _b === void 0 ? function () { } : _b, className = _a.className, _c = _a.inline, inline = _c === void 0 ? false : _c, other = tslib.__rest(_a, ["name", "radios", "defaultValue", "value", "onChange", "className", "inline"]);
|
|
2588
|
+
var _d = tslib.__read(React.useState(value || defaultValue || null), 2), currentValue = _d[0], setCurrentValue = _d[1];
|
|
2589
|
+
var _e = tslib.__read(React.useState(null), 2), focusIndex = _e[0], setFocusIndex = _e[1];
|
|
2590
2590
|
var inputs = React.useRef([]);
|
|
2591
2591
|
var handleChange = function (value) { return setCurrentValue(value); };
|
|
2592
2592
|
var onRadioFocus = function (index) { return setFocusIndex(index); };
|
|
@@ -2636,7 +2636,7 @@ var RadioGroup = function (_a) {
|
|
|
2636
2636
|
// refs get clobbered every re-render anyway and this supports "dynamic" radios
|
|
2637
2637
|
// (changing the number of radio buttons for example)
|
|
2638
2638
|
inputs.current = [];
|
|
2639
|
-
return (React__default.createElement("div", tslib.__assign({ className: className, role: "radiogroup" }, other), radioButtons));
|
|
2639
|
+
return (React__default.createElement("div", tslib.__assign({ className: classNames(className, { 'Radio--inline': inline }), role: "radiogroup" }, other), radioButtons));
|
|
2640
2640
|
};
|
|
2641
2641
|
RadioGroup.propTypes = {
|
|
2642
2642
|
name: PropTypes.string,
|
package/package.json
CHANGED