norma-library
Version:
Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.
15 lines • 1.19 kB
JavaScript
import { __rest } from "tslib";
import React from 'react';
import { FormControl, FormControlLabel, FormLabel, Radio as MuiRadio, RadioGroup as MuiRadioGroup, } from '@mui/material';
import { styled } from '@mui/material/styles';
var RadioStyled = styled(MuiRadio)({});
var sizes = ['small', 'medium'];
export var RadioGroup = function (_a) {
var props = __rest(_a, []);
var onChange = props.onChange;
return (React.createElement(FormControl, { disabled: props.disabled },
React.createElement(FormLabel, { id: props.id }, props.label),
React.createElement(MuiRadioGroup, { "aria-labelledby": props.id, defaultValue: props.checked, name: "radio-buttons-group", row: props.direction === 'horizontal' ? true : false, onChange: !!onChange ? function (event, value) { return onChange(event, value); } : undefined }, props.options &&
props.options.map(function (item, key) { return (React.createElement(FormControlLabel, { value: item.value, control: React.createElement(RadioStyled, { color: props.color, size: item.size ? item.size : sizes[1] }), label: item.label, key: key, sx: { alignItems: "center" } })); }))));
};
//# sourceMappingURL=RadioGroup.js.map