Skip to content

Release a new MUI 5 mapper #1175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a059efe
Update demo to V5
rvsia Oct 12, 2021
12a88ca
Update styles
rvsia Oct 19, 2021
38653e0
Fix lint
rvsia Oct 19, 2021
6576eb1
Merge pull request #1140 from rvsia/migrateToMUI5
Hyperkid123 Oct 19, 2021
f27ecb1
feat(carbon): add string variant of timepicker
rvsia Oct 11, 2021
df808ee
Release of new version: 3.13.0 <no> [skip ci]
semantic-release-bot Oct 13, 2021
fcdbedd
feat(pf4): use FormFieldGroup in FieldArray
rvsia Oct 13, 2021
9cf8161
Add buttonLabels to pf4 field array doc
rvsia Oct 13, 2021
c1521b2
Update link to PF4 documentation
rvsia Oct 13, 2021
f9b090b
Release of new version: 3.14.0 <no> [skip ci]
semantic-release-bot Oct 13, 2021
bc77660
fix(pf4): Update PF4 to latest
rvsia Oct 13, 2021
f60d163
feat(common): allow to flat options
rvsia Oct 13, 2021
6e85d3a
feat(pf4): add group and divider to select options
rvsia Oct 13, 2021
4805faa
fix(common): change useFlatOptions to optionsTransformer
rvsia Oct 14, 2021
fa28e75
Add test for pf4 select with categories
rvsia Oct 14, 2021
4ba12ca
Add documentation for PF4 select groups
rvsia Oct 14, 2021
678218b
fix(common): pass originalOptions when using a transformer
rvsia Oct 14, 2021
556c47b
fix(pf4): add nested filtering for select
rvsia Oct 14, 2021
484aeab
Add test for nested PF4 options with searchable
rvsia Oct 14, 2021
3502623
Update types for common select
rvsia Oct 14, 2021
ea3e07d
Release of new version: 3.15.0 <no> [skip ci]
semantic-release-bot Oct 14, 2021
58e6027
fix(pf4): Field-Array no longer shows delete all when minItems has a …
steverhoades Oct 14, 2021
aaf50ea
Release of new version: 3.15.1 <no> [skip ci]
semantic-release-bot Oct 14, 2021
4461e7c
fix(carbon): fix time picker minute range
GilbertCherrie Oct 15, 2021
febec47
Release of new version: 3.15.2 <no> [skip ci]
semantic-release-bot Oct 18, 2021
9b3610b
Update firebase and node to 12+
rvsia Oct 20, 2021
23bdfbe
Update node in circle ci
rvsia Oct 20, 2021
f3f20b5
Update to Node16
rvsia Oct 20, 2021
2011ada
fix(carbon): update carbon to latest
rvsia Oct 20, 2021
0ba91e8
Go back to node 14 until firebase is fully supporting sdk10
rvsia Oct 20, 2021
9cc0a08
Update yarn lock
rvsia Oct 20, 2021
1c10b45
fix(carbon): exclude next components
rvsia Oct 20, 2021
c2f4869
Change circle ci back to node 14
rvsia Oct 20, 2021
fb41e0e
Release of new version: 3.15.3 <no> [skip ci]
semantic-release-bot Oct 20, 2021
cf76be8
feat(mui): migrate to mui 5
rvsia Oct 20, 2021
1903fe6
Update mui demo to mui 5
rvsia Oct 20, 2021
4861c3d
feat(mui): do not use mui pickers anymore
rvsia Oct 20, 2021
a1f2e1f
fix(mui): fix default color in tab
rvsia Oct 20, 2021
1a1c619
feat(mui): switch jss to styled
rvsia Oct 25, 2021
7044836
Fix mui 5 tests
rvsia Oct 26, 2021
ad71a9a
Merge pull request #1152 from rvsia/migrateMapper
rvsia Oct 26, 2021
e40b0ee
Mui finishing touches
rvsia Oct 26, 2021
ecd6e7f
Temporarily disable live editor
rvsia Oct 27, 2021
4fe1a40
Switch mui building
rvsia Oct 27, 2021
0e624eb
Merge pull request #1161 from rvsia/finishMUIMigration
Hyperkid123 Oct 27, 2021
5af62c4
fix(mui): use correct styled import
rvsia Nov 4, 2021
7bda043
Update yarn.lock
rvsia Nov 4, 2021
4e9df85
Add date-fns dependency
rvsia Nov 5, 2021
e708ca6
Update yarn lock
rvsia Nov 5, 2021
5c4507c
Fix mui version
rvsia Nov 5, 2021
6366f6b
Merge pull request #1169 from rvsia/fixMuiStyled
rvsia Nov 5, 2021
c0f49c5
Update form builder to MUI5
rvsia Nov 9, 2021
8b56ab7
Merge pull request #1171 from rvsia/updateBuilder
Hyperkid123 Nov 9, 2021
2a088f8
Merge branch 'master' into rebeaseMasterMUI5
rvsia Dec 2, 2021
5de9ce9
Merge pull request #1174 from rvsia/rebeaseMasterMUI5
Hyperkid123 Dec 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Data Driven Forms is a React library used for rendering and managing forms with

:tada: Features :tada:
- **Easily readable schema**, you don't need to know any HTML or JS to be able to write your own form schemas!
- You can use your **own components** or use one of our **provided mappers**: [PatternFly 4](https://patternfly-react.surge.sh/patternfly-4/), [Material-UI](https://material-ui.com/), [Ant Design](https://ant.design/)! and more, see below!)
- You can use your **own components** or use one of our **provided mappers**: [PatternFly 4](https://patternfly-react.surge.sh/patternfly-4/), [Material-UI](https://mui.com/), [Ant Design](https://ant.design/)! and more, see below!)
- **Form state manager** out-of-the-box (including error states!)
- Fully **customizable** (you can use your own buttons, actions, etc.)!
- **Conditional** fields!
Expand Down Expand Up @@ -365,7 +365,7 @@ We are trying to avoid breaking changes. Please, open an issue and discuss the i

- [Data Driven Forms documentation](https://data-driven-forms.org/)
- [PatternFly 4 Design documentation](https://www.patternfly.org/v4/)
- [Material-UI documentation](https://material-ui.com/)
- [Material-UI documentation](https://mui.com/)
- [Ant Design documentation](https://ant.design/)
- [Semantic UI React](https://react.semantic-ui.com/)
- [BlueprintJS](https://blueprintjs.com/)
Expand Down
2 changes: 1 addition & 1 deletion packages/ant-component-mapper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Data Driven Forms supports all kinds of component, basic set is consisted of:
### Useful links

- [Data Driven Forms documentation](https://data-driven-forms.org/)
- [Material-UI documentation](https://material-ui.com/)
- [Material-UI documentation](https://mui.com/)
- NPM
- [React Form Renderer](https://www.npmjs.com/package/@data-driven-forms/react-form-renderer)
- [MaterialUI Mapper](https://www.npmjs.com/package/@data-driven-forms/ant-component-mapper)
Expand Down
12 changes: 6 additions & 6 deletions packages/common/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ const createSuirCJSTransform = (env = 'commonjs') => [
const createMuiTransform = (env) => [
'transform-imports',
{
'@material-ui/lab': {
transform: (importName) => (env ? `@material-ui/lab/${env}/${importName}` : `@material-ui/lab/${importName}`),
'@mui/lab': {
transform: (importName) => (env ? `@mui/lab/${env}/${importName}` : `@mui/lab/${importName}`),
preventFullImport: false,
skipDefaultConversion: false
},
'@material-ui/core': {
transform: (importName) => (env ? `@material-ui/core/${env}/${importName}` : `@material-ui/core/${importName}`),
'@mui/material': {
transform: (importName) => (env ? `@mui/material/${env}/${importName}` : `@mui/material/${importName}`),
preventFullImport: false,
skipDefaultConversion: false
}
Expand Down Expand Up @@ -294,7 +294,7 @@ module.exports = {
presets: [['@babel/preset-env', { modules: 'commonjs' }]],
plugins: [
createSuirCJSTransform('commonjs'),
createMuiTransform(),
createMuiTransform('node'),
createPfReactTransform('js'),
createBluePrintTransform('cjs'),
createAntTransform('cjs'),
Expand All @@ -306,7 +306,7 @@ module.exports = {
presets: [['@babel/preset-env', { modules: false }]],
plugins: [
createSuirCJSTransform('es'),
createMuiTransform('esm'),
createMuiTransform(),
createPfReactTransform('esm'),
createBluePrintTransform('esm'),
createAntTransform('esm'),
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-component-mapper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Material-UI component mapper for [Data Driven Forms](https://github.com/data-dri

:book: For more information please visit the [documentation](https://data-driven-forms.org/). :book:

[Material-IU docs](https://material-ui.com/)
[Material-IU docs](https://mui.com/)


**Table of Contents**
Expand Down Expand Up @@ -102,7 +102,7 @@ Data Driven Forms supports all kinds of component, basic set is consisted of:
### Useful links

- [Data Driven Forms documentation](https://data-driven-forms.org/)
- [Material-UI documentation](https://material-ui.com/)
- [Material-UI documentation](https://mui.com/)
- NPM
- [React Form Renderer](https://www.npmjs.com/package/@data-driven-forms/react-form-renderer)
- [MaterialUI Mapper](https://www.npmjs.com/package/@data-driven-forms/mui-component-mapper)
Expand Down
108 changes: 55 additions & 53 deletions packages/mui-component-mapper/demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,73 @@ import React, { useState } from 'react';
import ReactDOM from 'react-dom';
import { FormRenderer, componentTypes } from '@data-driven-forms/react-form-renderer';

import Grid from '@material-ui/core/Grid';
import Grid from '@mui/material/Grid';
import { componentMapper, FormTemplate } from '../src';
import { createMuiTheme } from '@material-ui/core/styles';
import { ThemeProvider } from '@material-ui/styles';
import Typography from '@material-ui/core/Typography';
import { createTheme } from '@mui/material/styles';
import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles';
import LocalizationProvider from '@mui/lab/LocalizationProvider';
import Typography from '@mui/material/Typography';
import demoSchema from '../../../shared/demoschema';
import fieldArraySchema from './demo-schemas/field-array-schema';
import AdapterDateFns from '@mui/lab/AdapterDateFns';

import Button from '@material-ui/core/Button';
import Button from '@mui/material/Button';
import wizardSchema from './demo-schemas/wizard-schema';
import validatorTypes from '@data-driven-forms/react-form-renderer/validator-types';

const theme = createMuiTheme({
typography: {
useNextVariants: true
}
});
const theme = createTheme();

const compositeMapper = {
...componentMapper,
[componentTypes.SWITCH]: {
component: componentMapper[componentTypes.SWITCH],
FormControlLabelProps: {
labelPlacement: 'end'
}
}
labelPlacement: 'end',
},
},
};

const options = [
{
label: 'One',
value: 1
value: 1,
},
{
label: 'Two',
value: 2
value: 2,
},
{
label: 'Three',
value: 3
value: 3,
},
{
label: 'Four',
value: 4
value: 4,
},
{
label: 'Five',
value: 5
value: 5,
},
{
label: 'Six',
value: 6
value: 6,
},
{
label: 'Seven',
value: 7
value: 7,
},
{
label: 'Eight',
value: 8
value: 8,
},
{
label: 'Nine',
value: 9
value: 9,
},
{
label: 'Ten',
value: 10
}
value: 10,
},
];

const loadOptions = (filter) =>
Expand All @@ -95,76 +93,80 @@ const selectSchema = {
isSearchable: true,
isRequired: true,
validate: [{ type: validatorTypes.REQUIRED }],
closeMenuOnSelect: false
closeMenuOnSelect: false,
},
{
name: 'default-select',
component: componentTypes.SELECT,
label: 'Default select',
options,
placeholder: 'Select'
placeholder: 'Select',
},
{
name: 'disabled-select',
component: componentTypes.SELECT,
label: 'Disabled select',
options,
isDisabled: true
isDisabled: true,
},
{
name: 'clearable-select',
component: componentTypes.SELECT,
label: 'Clearable select',
options,
isClearable: true
isClearable: true,
},
{
name: 'multi-select',
component: componentTypes.SELECT,
label: 'Multi select',
options,
isMulti: true
isMulti: true,
},
{
name: 'searchable-select',
component: componentTypes.SELECT,
label: 'Searchable select',
options,
isSearchable: true
isSearchable: true,
},
{
name: 'async-select',
component: componentTypes.SELECT,
label: 'Async select',
loadOptions
}
]
loadOptions,
},
],
};

const App = () => {
const [schema, setSchema] = useState(wizardSchema);

return (
<ThemeProvider theme={theme}>
<Grid container spacing={4} justify="center" alignItems="center">
<Grid item xs={12}>
<Typography variant="h3">Material UI component mapper</Typography>
</Grid>
<Grid item xs={12}>
<Button onClick={() => setSchema(demoSchema)}>Demo schema</Button>
<Button onClick={() => setSchema(fieldArraySchema)}>Field array</Button>
<Button onClick={() => setSchema(wizardSchema)}>Wizard</Button>
<Button onClick={() => setSchema(selectSchema)}>Select</Button>
</Grid>
<FormRenderer
onSubmit={console.log}
componentMapper={compositeMapper}
FormTemplate={(props) => <FormTemplate {...props} />}
schema={schema}
onCancel={() => console.log('canceling')}
/>
</Grid>
</ThemeProvider>
<StyledEngineProvider injectFirst>
<ThemeProvider theme={theme}>
<LocalizationProvider dateAdapter={AdapterDateFns}>
<Grid container spacing={4} justifyContent="center" alignItems="center">
<Grid item xs={12}>
<Typography variant="h3">Material UI component mapper</Typography>
</Grid>
<Grid item xs={12}>
<Button onClick={() => setSchema(demoSchema)}>Demo schema</Button>
<Button onClick={() => setSchema(fieldArraySchema)}>Field array</Button>
<Button onClick={() => setSchema(wizardSchema)}>Wizard</Button>
<Button onClick={() => setSchema(selectSchema)}>Select</Button>
</Grid>
<FormRenderer
onSubmit={console.log}
componentMapper={compositeMapper}
FormTemplate={(props) => <FormTemplate {...props} />}
schema={schema}
onCancel={() => console.log('canceling')}
/>
</Grid>
</LocalizationProvider>
</ThemeProvider>
</StyledEngineProvider>
);
};

Expand Down
28 changes: 13 additions & 15 deletions packages/mui-component-mapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,26 @@
"directory": "packages/mui-component-mapper"
},
"devDependencies": {
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/styles": "^4.10.0"
"@mui/icons-material": "^5.0.5",
"@mui/material": "^5.0.6",
"@mui/styles": "^5.0.2"
},
"peerDependencies": {
"@data-driven-forms/react-form-renderer": ">=3.2.1",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/styles": "^4.9.14",
"@mui/icons-material": "^5.0.5",
"@mui/material": "^5.0.6",
"@mui/styles": "^5.0.2",
"prop-types": ">=15.7.2",
"react": "^16.13.1 || ^17.0.2",
"react-dom": "^16.13.1 || ^17.0.2"
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"dependencies": {
"@data-driven-forms/common": "*",
"@date-io/date-fns": "^1.0.1",
"@date-io/moment": "^1.0.1",
"@material-ui/pickers": "^3.2.10",
"@emotion/react": "^11.5.0",
"@emotion/styled": "^11.3.0",
"@mui/lab": "^5.0.0-alpha.53",
"clsx": "^1.0.4",
"date-fns": "^1.30.1",
"lodash": "^4.17.21",
"moment": "^2.23.0",
"@material-ui/lab": "^4.0.0-alpha.53"
"date-fns": "^2.16.1",
"lodash": "^4.17.21"
}
}
2 changes: 1 addition & 1 deletion packages/mui-component-mapper/src/checkbox/checkbox.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UseFieldApiComponentConfig } from '@data-driven-forms/react-form-renderer';
import { CheckboxProps as MuiCheckboxProps, GridProps, FormControlProps, FormGroupProps, FormControlLabelProps, FormLabelProps, FormHelperTextProps } from '@material-ui/core';
import { CheckboxProps as MuiCheckboxProps, GridProps, FormControlProps, FormGroupProps, FormControlLabelProps, FormLabelProps, FormHelperTextProps } from '@mui/material';

interface InternalCheckboxProps extends MuiCheckboxProps {
FormFieldGridProps?: GridProps;
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-component-mapper/src/checkbox/checkbox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Checkbox as MUICheckbox, FormControl, FormControlLabel, FormHelperText, FormGroup, FormLabel } from '@material-ui/core';
import { Checkbox as MUICheckbox, FormControl, FormControlLabel, FormHelperText, FormGroup, FormLabel } from '@mui/material';
import { meta, input } from '@data-driven-forms/common/prop-types-templates';

import FormFieldGrid from '../form-field-grid/form-field-grid';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { DatePickerProps as MuiDatePickerProps } from "@material-ui/pickers/DatePicker";
import { DatePickerProps as MuiDatePickerProps } from "@mui/lab/DatePicker";
import { UseFieldApiComponentConfig } from "@data-driven-forms/react-form-renderer";
import { GridProps } from "@material-ui/core";
import { MuiPickersUtilsProviderProps } from "@material-ui/pickers/MuiPickersUtilsProvider";

import { GridProps } from "@mui/material";
interface InternalDatePickerProps extends MuiDatePickerProps {
FormFieldGridProps: GridProps;
MuiPickersUtilsProviderProps: MuiPickersUtilsProviderProps;
DatePickerProps: MuiDatePickerProps;
}

Expand Down
Loading