UNPKG

@novin-dev/formalite

Version:

Generate MUI form with few line of code

34 lines (31 loc) 1.99 kB
import { __assign } from 'tslib'; import React from 'react'; import { ViewTypes } from '../../Formalite.type.js'; import RadioGroupView from '../RadioGroupView/RadioGroupView.js'; import { Box } from '@mui/material'; var formatOptionFn = function (option) { return __assign(__assign({}, option), { label: (React.createElement(Box, null, React.createElement(Box, { sx: { fontWeight: 600, fontSize: "1.1rem", lineHeight: "0.9", } }, option.label), React.createElement(Box, { sx: { fontSize: "1rem", color: "text.disabled", } }, option.description))) }); }; var BigRadioGroupView = function (props) { var _a; var allData = props.allData, name = props.name, formik = props.formik, loading = props.loading, validationSchema = props.validationSchema, translator = props.translator; return (React.createElement(RadioGroupView, { key: String(name), name: String(name), allData: __assign(__assign({}, allData), { inputProps: __assign(__assign({}, allData.inputProps), { sx: __assign(__assign({}, allData.inputProps.sx), { "& .MuiFormControlLabel-root": { alignItems: "flex-start", marginBottom: 1.5, ".MuiRadio-root": { marginTop: -1, }, } }), row: false }), labelProps: __assign(__assign({}, allData.labelProps), { style: __assign(__assign({}, (_a = allData.labelProps) === null || _a === void 0 ? void 0 : _a.style), { display: "none" }) }), type: ViewTypes.RadioGroupView }), formik: formik, loading: loading, validationSchema: validationSchema, translator: translator, formatOptionFn: formatOptionFn })); }; var BigRadioGroupView$1 = React.memo(BigRadioGroupView); export { BigRadioGroupView$1 as default }; //# sourceMappingURL=BigRadioGroupView.js.map