import isEmpty from 'lodash/isEmpty' ; import React from 'react' ; import { isBooleanControl , RankedTester , rankWith , ControlProps } from '@jsonforms/core' ; import { withJsonFormsControlProps } from '@jsonforms/react' ; import { FormControlLabel , Hidden } from '@mui/material' ; import { MuiCheckbox } from '../mui-controls/MuiCheckbox' ; export const MaterialBooleanControl = ( { data , visible , label , id , enabled , uischema , schema , rootSchema , handleChange , errors , path , config } ) => { return ( < Hidden xsUp = { ! visible } > < FormControlLabel label = { label } id = { id } control = { < MuiCheckbox id = { `${ id }-input` } isValid = { isEmpty ( errors ) } data = { data } enabled = { enabled } visible = { visible } path = { path } uischema = { uischema } schema = { schema } rootSchema = { rootSchema } handleChange = { handleChange } errors = { errors } config = { config } / > } /> < /Hidden>); } ; export const materialBooleanControlTester = rankWith ( 2 , isBooleanControl ) ; export default withJsonFormsControlProps ( MaterialBooleanControl ) ;