"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const FormControl_1 = tslib_1.__importDefault(require("@material-ui/core/FormControl"));
const FormHelperText_1 = tslib_1.__importDefault(require("@material-ui/core/FormHelperText"));
const FormLabel_1 = tslib_1.__importDefault(require("@material-ui/core/FormLabel"));
const RadioGroup_1 = tslib_1.__importDefault(require("@material-ui/core/RadioGroup"));
const react_1 = tslib_1.__importDefault(require("react"));
const component_mapper_1 = require("@bluebase/component-mapper");
RadioGroup_1.default.displayName = 'RadioGroup';
exports.RadioGroup = component_mapper_1.componentMapper(RadioGroup_1.default, {
    onChange: ({ onChange, onValueChange }) => (event, value) => {
        if (onChange) {
            onChange(event, value);
        }
        if (onValueChange) {
            onValueChange(value);
        }
    },
}, {
    ignore: ['onValueChange'],
    rest: true,
    render(props, Component) {
        const { helperText, label } = props, rest = tslib_1.__rest(props, ["helperText", "label"]);
        return (react_1.default.createElement(FormControl_1.default, { component: "fieldset" },
            label ? react_1.default.createElement(FormLabel_1.default, { component: "legend" }, label) : null,
            react_1.default.createElement(Component, Object.assign({}, rest)),
            helperText ? react_1.default.createElement(FormHelperText_1.default, null, helperText) : null));
    },
});
