@data-driven-forms/mui-component-mapper 3.15.2 → 3.16.0-v5-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +2 -2
  2. package/checkbox/checkbox.d.ts +1 -1
  3. package/checkbox/checkbox.js +6 -6
  4. package/date-picker/date-picker.d.ts +2 -5
  5. package/date-picker/date-picker.js +16 -21
  6. package/dual-list-select/dual-list-select.d.ts +1 -1
  7. package/dual-list-select/dual-list-select.js +189 -185
  8. package/esm/checkbox/checkbox.js +6 -6
  9. package/esm/date-picker/date-picker.js +15 -20
  10. package/esm/dual-list-select/dual-list-select.js +187 -183
  11. package/esm/field-array/field-array.js +42 -36
  12. package/esm/form-field-grid/form-field-grid.js +11 -9
  13. package/esm/form-template/form-template.js +52 -53
  14. package/esm/multiple-chioce-list/multiple-choice-list.js +10 -8
  15. package/esm/plain-text/plain-text.js +1 -1
  16. package/esm/radio/radio.js +30 -29
  17. package/esm/select/select.js +4 -4
  18. package/esm/slider/slider.js +6 -6
  19. package/esm/sub-form/sub-form.js +27 -24
  20. package/esm/switch/switch.js +6 -6
  21. package/esm/tabs/tabs.js +59 -41
  22. package/esm/text-field/text-field.js +1 -1
  23. package/esm/textarea/textarea.js +1 -1
  24. package/esm/time-picker/time-picker.js +20 -24
  25. package/esm/wizard/step-buttons.js +40 -37
  26. package/esm/wizard/wizard-nav.js +23 -21
  27. package/esm/wizard/wizard.js +21 -22
  28. package/field-array/field-array.d.ts +1 -1
  29. package/field-array/field-array.js +43 -37
  30. package/form-field-grid/form-field-grid.d.ts +1 -1
  31. package/form-field-grid/form-field-grid.js +13 -10
  32. package/form-template/form-template.js +54 -54
  33. package/multiple-chioce-list/multiple-choice-list.d.ts +1 -1
  34. package/multiple-chioce-list/multiple-choice-list.js +10 -8
  35. package/package.json +13 -16
  36. package/plain-text/plain-text.d.ts +1 -1
  37. package/plain-text/plain-text.js +1 -1
  38. package/radio/radio.d.ts +1 -1
  39. package/radio/radio.js +32 -31
  40. package/select/select.d.ts +2 -2
  41. package/select/select.js +4 -4
  42. package/slider/slider.d.ts +1 -1
  43. package/slider/slider.js +6 -6
  44. package/sub-form/sub-form.d.ts +1 -1
  45. package/sub-form/sub-form.js +29 -25
  46. package/switch/switch.d.ts +1 -1
  47. package/switch/switch.js +6 -6
  48. package/tabs/tabs.d.ts +3 -1
  49. package/tabs/tabs.js +58 -37
  50. package/text-field/text-field.d.ts +1 -1
  51. package/text-field/text-field.js +1 -1
  52. package/textarea/textarea.d.ts +1 -1
  53. package/textarea/textarea.js +1 -1
  54. package/time-picker/time-picker.d.ts +2 -5
  55. package/time-picker/time-picker.js +21 -25
  56. package/wizard/step-buttons.js +42 -37
  57. package/wizard/wizard-nav.js +25 -22
  58. package/wizard/wizard.d.ts +1 -1
  59. package/wizard/wizard.js +22 -23
@@ -1,24 +1,26 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
4
  var _excluded = ["children", "className"];
4
5
  import React from 'react';
6
+ import { styled } from '@mui/material/styles';
5
7
  import PropTypes from 'prop-types';
6
- import Grid from "@material-ui/core/esm/Grid";
7
- import { makeStyles } from '@material-ui/core/styles';
8
+ import Grid from "@mui/material/Grid";
8
9
  import clsx from 'clsx';
9
- var useFinalFormFieldStyles = makeStyles({
10
- grid: {
11
- position: 'relative'
12
- }
13
- });
10
+ var PREFIX = 'FormFieldGrid';
11
+ var classes = {
12
+ grid: "".concat(PREFIX, "-grid")
13
+ };
14
+ var StyledGrid = styled(Grid)(_defineProperty({}, "&.".concat(classes.grid), {
15
+ position: 'relative'
16
+ }));
14
17
 
15
18
  var FormFieldGrid = function FormFieldGrid(_ref) {
16
19
  var children = _ref.children,
17
20
  className = _ref.className,
18
21
  props = _objectWithoutProperties(_ref, _excluded);
19
22
 
20
- var classes = useFinalFormFieldStyles();
21
- return /*#__PURE__*/React.createElement(Grid, _extends({
23
+ return /*#__PURE__*/React.createElement(StyledGrid, _extends({
22
24
  xs: 12,
23
25
  item: true,
24
26
  className: clsx(classes.grid, className)
@@ -1,6 +1,7 @@
1
1
  import _typeof from "@babel/runtime/helpers/typeof";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
5
  var _excluded = ["children", "GridContainerProps", "GridProps"],
5
6
  _excluded2 = ["children", "GridProps"],
6
7
  _excluded3 = ["children", "GridProps"],
@@ -8,32 +9,34 @@ var _excluded = ["children", "GridContainerProps", "GridProps"],
8
9
  _excluded5 = ["label", "variant", "children", "buttonType"],
9
10
  _excluded6 = ["title", "description", "TitleProps", "className"];
10
11
  import React from 'react';
12
+ import { styled } from '@mui/material/styles';
11
13
  import PropTypes from 'prop-types';
12
- import Grid from "@material-ui/core/esm/Grid";
13
- import MUIButton from "@material-ui/core/esm/Button";
14
- import Typography from "@material-ui/core/esm/Typography";
15
- import { makeStyles } from '@material-ui/core/styles';
16
- import Alert from '@material-ui/lab/Alert';
17
- import AlertTitle from '@material-ui/lab/AlertTitle';
14
+ import Grid from "@mui/material/Grid";
15
+ import MUIButton from "@mui/material/Button";
16
+ import Typography from "@mui/material/Typography";
17
+ import Alert from "@mui/material/Alert";
18
+ import AlertTitle from "@mui/material/AlertTitle";
18
19
  import FormTemplate from '@data-driven-forms/common/form-template';
19
20
  import clsx from 'clsx';
20
- var useStyles = makeStyles(function () {
21
- return {
22
- buttonGroup: {
23
- display: 'flex',
24
- justifyContent: 'flex-end',
25
- '&>button:not(last-child)': {
26
- marginLeft: 8
27
- }
21
+ var PREFIX = 'MuiFormTemplate';
22
+ var classes = {
23
+ buttonGroup: "".concat(PREFIX, "-buttonGroup")
24
+ };
25
+ var StyledButtonGroup = styled(Grid)(function () {
26
+ return _defineProperty({}, "& .".concat(classes.buttonGroup), {
27
+ display: 'flex',
28
+ justifyContent: 'flex-end',
29
+ '&>button:not(last-child)': {
30
+ marginLeft: 8
28
31
  }
29
- };
32
+ });
30
33
  });
31
34
 
32
- var Form = function Form(_ref) {
33
- var children = _ref.children,
34
- GridContainerProps = _ref.GridContainerProps,
35
- GridProps = _ref.GridProps,
36
- props = _objectWithoutProperties(_ref, _excluded);
35
+ var Form = function Form(_ref2) {
36
+ var children = _ref2.children,
37
+ GridContainerProps = _ref2.GridContainerProps,
38
+ GridProps = _ref2.GridProps,
39
+ props = _objectWithoutProperties(_ref2, _excluded);
37
40
 
38
41
  return /*#__PURE__*/React.createElement(Grid, _extends({
39
42
  item: true,
@@ -42,8 +45,8 @@ var Form = function Form(_ref) {
42
45
  noValidate: true
43
46
  }, props), /*#__PURE__*/React.createElement(Grid, _extends({
44
47
  container: true,
48
+ rowSpacing: 2,
45
49
  item: true,
46
- spacing: 2,
47
50
  xs: 12
48
51
  }, GridContainerProps), children)));
49
52
  };
@@ -54,10 +57,10 @@ Form.propTypes = {
54
57
  GridContainerProps: PropTypes.object
55
58
  };
56
59
 
57
- var Description = function Description(_ref2) {
58
- var children = _ref2.children,
59
- GridProps = _ref2.GridProps,
60
- props = _objectWithoutProperties(_ref2, _excluded2);
60
+ var Description = function Description(_ref3) {
61
+ var children = _ref3.children,
62
+ GridProps = _ref3.GridProps,
63
+ props = _objectWithoutProperties(_ref3, _excluded2);
61
64
 
62
65
  return /*#__PURE__*/React.createElement(Grid, _extends({
63
66
  item: true,
@@ -73,10 +76,10 @@ Description.propTypes = {
73
76
  GridProps: PropTypes.object
74
77
  };
75
78
 
76
- var Title = function Title(_ref3) {
77
- var children = _ref3.children,
78
- GridProps = _ref3.GridProps,
79
- props = _objectWithoutProperties(_ref3, _excluded3);
79
+ var Title = function Title(_ref4) {
80
+ var children = _ref4.children,
81
+ GridProps = _ref4.GridProps,
82
+ props = _objectWithoutProperties(_ref4, _excluded3);
80
83
 
81
84
  return /*#__PURE__*/React.createElement(Grid, _extends({
82
85
  item: true,
@@ -92,13 +95,12 @@ Title.propTypes = {
92
95
  GridProps: PropTypes.object
93
96
  };
94
97
 
95
- var ButtonGroup = function ButtonGroup(_ref4) {
96
- var children = _ref4.children,
97
- GridProps = _ref4.GridProps,
98
- props = _objectWithoutProperties(_ref4, _excluded4);
98
+ var ButtonGroup = function ButtonGroup(_ref5) {
99
+ var children = _ref5.children,
100
+ GridProps = _ref5.GridProps,
101
+ props = _objectWithoutProperties(_ref5, _excluded4);
99
102
 
100
- var classes = useStyles();
101
- return /*#__PURE__*/React.createElement(Grid, _extends({
103
+ return /*#__PURE__*/React.createElement(StyledButtonGroup, _extends({
102
104
  item: true,
103
105
  xs: 12
104
106
  }, GridProps), /*#__PURE__*/React.createElement("div", _extends({
@@ -111,12 +113,12 @@ ButtonGroup.propTypes = {
111
113
  GridProps: PropTypes.object
112
114
  };
113
115
 
114
- var Button = function Button(_ref5) {
115
- var label = _ref5.label,
116
- variant = _ref5.variant,
117
- children = _ref5.children,
118
- buttonType = _ref5.buttonType,
119
- props = _objectWithoutProperties(_ref5, _excluded5);
116
+ var Button = function Button(_ref6) {
117
+ var label = _ref6.label,
118
+ variant = _ref6.variant,
119
+ children = _ref6.children,
120
+ buttonType = _ref6.buttonType,
121
+ props = _objectWithoutProperties(_ref6, _excluded5);
120
122
 
121
123
  return /*#__PURE__*/React.createElement(MUIButton, _extends({
122
124
  color: variant,
@@ -130,20 +132,17 @@ Button.propTypes = {
130
132
  variant: PropTypes.string,
131
133
  buttonType: PropTypes.string
132
134
  };
133
- var useAlertStyles = makeStyles(function () {
135
+ var StyledAlert = styled(Alert)(function () {
134
136
  return {
135
- alert: {
137
+ '& .alert': {
136
138
  width: '100%',
137
139
  margin: 8
138
140
  }
139
141
  };
140
142
  });
141
- export var FormError = function FormError(_ref6) {
142
- var formError = _ref6.formError,
143
- alertProps = _ref6.alertProps;
144
-
145
- var _useAlertStyles = useAlertStyles(),
146
- alert = _useAlertStyles.alert;
143
+ export var FormError = function FormError(_ref7) {
144
+ var formError = _ref7.formError,
145
+ alertProps = _ref7.alertProps;
147
146
 
148
147
  if (_typeof(formError) === 'object' && (formError.title || formError.title)) {
149
148
  var title = formError.title,
@@ -152,18 +151,18 @@ export var FormError = function FormError(_ref6) {
152
151
  className = formError.className,
153
152
  props = _objectWithoutProperties(formError, _excluded6);
154
153
 
155
- return /*#__PURE__*/React.createElement(Alert, _extends({
154
+ return /*#__PURE__*/React.createElement(StyledAlert, _extends({
156
155
  severity: "error"
157
156
  }, props, alertProps, {
158
- className: clsx(alert, alertProps === null || alertProps === void 0 ? void 0 : alertProps.className, className)
157
+ className: clsx('alert', alertProps === null || alertProps === void 0 ? void 0 : alertProps.className, className)
159
158
  }), title && /*#__PURE__*/React.createElement(AlertTitle, TitleProps, title), description);
160
159
  }
161
160
 
162
161
  if (formError) {
163
- return /*#__PURE__*/React.createElement(Alert, _extends({
162
+ return /*#__PURE__*/React.createElement(StyledAlert, _extends({
164
163
  severity: "error"
165
164
  }, alertProps, {
166
- className: clsx(alert, alertProps === null || alertProps === void 0 ? void 0 : alertProps.className)
165
+ className: clsx('alert', alertProps === null || alertProps === void 0 ? void 0 : alertProps.className)
167
166
  }), formError);
168
167
  }
169
168
 
@@ -11,13 +11,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
11
11
 
12
12
  import React, { createContext, useContext } from 'react';
13
13
  import PropTypes from 'prop-types';
14
- import Grid from "@material-ui/core/esm/Grid";
15
- import Checkbox from "@material-ui/core/esm/Checkbox";
16
- import FormControlLabel from "@material-ui/core/esm/FormControlLabel";
17
- import FormLabel from "@material-ui/core/esm/FormLabel";
18
- import FormGroup from "@material-ui/core/esm/FormGroup";
19
- import FormControl from "@material-ui/core/esm/FormControl";
20
- import FormHelperText from "@material-ui/core/esm/FormHelperText";
14
+ import Grid from "@mui/material/Grid";
15
+ import Checkbox from "@mui/material/Checkbox";
16
+ import FormControlLabel from "@mui/material/FormControlLabel";
17
+ import FormLabel from "@mui/material/FormLabel";
18
+ import FormGroup from "@mui/material/FormGroup";
19
+ import FormControl from "@mui/material/FormControl";
20
+ import FormHelperText from "@mui/material/FormHelperText";
21
21
  import MultipleChoiceListCommon, { wrapperProps } from '@data-driven-forms/common/multiple-choice-list';
22
22
  import { validationError } from '../validation-error/validation-error';
23
23
  var CheckboxContext = /*#__PURE__*/createContext({});
@@ -70,7 +70,9 @@ var Wrapper = function Wrapper(_ref2) {
70
70
  FormHelperTextProps = _useContext2.FormHelperTextProps;
71
71
 
72
72
  return /*#__PURE__*/React.createElement(Grid, _extends({
73
- container: true
73
+ container: true,
74
+ item: true,
75
+ xs: 12
74
76
  }, FormFieldGridProps), /*#__PURE__*/React.createElement(FormControl, _extends({
75
77
  required: isRequired,
76
78
  error: !!invalid,
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["label", "name", "component", "element"];
4
4
  import React from 'react';
5
- import Typography from "@material-ui/core/esm/Typography";
5
+ import Typography from "@mui/material/Typography";
6
6
  import PropTypes from 'prop-types';
7
7
 
8
8
  var PlainText = function PlainText(_ref) {
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  var _excluded = ["inputProps"],
5
5
  _excluded2 = ["name", "option", "isDisabled", "isReadOnly", "FormControlLabelProps", "RadioProps"],
6
6
  _excluded3 = ["name"],
@@ -11,37 +11,39 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
11
11
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
12
12
 
13
13
  import React from 'react';
14
+ import { styled } from '@mui/material/styles';
14
15
  import PropTypes from 'prop-types';
15
- import MUIRadio from "@material-ui/core/esm/Radio";
16
- import FormControlLabel from "@material-ui/core/esm/FormControlLabel";
17
- import FormControl from "@material-ui/core/esm/FormControl";
18
- import FormLabel from "@material-ui/core/esm/FormLabel";
19
- import FormHelperText from "@material-ui/core/esm/FormHelperText";
16
+ import MUIRadio from "@mui/material/Radio";
17
+ import FormControlLabel from "@mui/material/FormControlLabel";
18
+ import FormControl from "@mui/material/FormControl";
19
+ import FormLabel from "@mui/material/FormLabel";
20
+ import FormHelperText from "@mui/material/FormHelperText";
20
21
  import { wrapperProps } from '@data-driven-forms/common/multiple-choice-list';
21
- import { makeStyles } from '@material-ui/core/styles';
22
22
  import FormFieldGrid from '../form-field-grid/form-field-grid';
23
23
  import { validationError } from '../validation-error/validation-error';
24
24
  import useFieldApi from "@data-driven-forms/react-form-renderer/use-field-api";
25
- var useStyles = makeStyles(function () {
26
- return {
27
- grid: {
28
- '&:first-child': {
29
- marginTop: 8
30
- }
25
+ var PREFIX = 'Radio';
26
+ var classes = {
27
+ grid: "".concat(PREFIX, "-grid")
28
+ };
29
+ var StyledFormFieldGrid = styled(FormFieldGrid)(function () {
30
+ return _defineProperty({}, "&.".concat(classes.grid), {
31
+ '&:first-of-type': {
32
+ marginTop: 8
31
33
  }
32
- };
34
+ });
33
35
  });
34
36
 
35
- var RadioOption = function RadioOption(_ref) {
36
- var name = _ref.name,
37
- option = _ref.option,
38
- isDisabled = _ref.isDisabled,
39
- isReadOnly = _ref.isReadOnly,
40
- FormControlLabelProps = _ref.FormControlLabelProps,
41
- _ref$RadioProps = _ref.RadioProps,
42
- inputProps = _ref$RadioProps.inputProps,
43
- RadioProps = _objectWithoutProperties(_ref$RadioProps, _excluded),
44
- props = _objectWithoutProperties(_ref, _excluded2);
37
+ var RadioOption = function RadioOption(_ref2) {
38
+ var name = _ref2.name,
39
+ option = _ref2.option,
40
+ isDisabled = _ref2.isDisabled,
41
+ isReadOnly = _ref2.isReadOnly,
42
+ FormControlLabelProps = _ref2.FormControlLabelProps,
43
+ _ref2$RadioProps = _ref2.RadioProps,
44
+ inputProps = _ref2$RadioProps.inputProps,
45
+ RadioProps = _objectWithoutProperties(_ref2$RadioProps, _excluded),
46
+ props = _objectWithoutProperties(_ref2, _excluded2);
45
47
 
46
48
  var _useFieldApi = useFieldApi({
47
49
  name: name,
@@ -78,9 +80,9 @@ RadioOption.propTypes = {
78
80
  RadioProps: PropTypes.object
79
81
  };
80
82
 
81
- var Radio = function Radio(_ref2) {
82
- var name = _ref2.name,
83
- props = _objectWithoutProperties(_ref2, _excluded3);
83
+ var Radio = function Radio(_ref3) {
84
+ var name = _ref3.name,
85
+ props = _objectWithoutProperties(_ref3, _excluded3);
84
86
 
85
87
  var _useFieldApi2 = useFieldApi(_objectSpread(_objectSpread({}, props), {}, {
86
88
  name: name,
@@ -101,10 +103,9 @@ var Radio = function Radio(_ref2) {
101
103
  FormHelperTextProps = _useFieldApi2.FormHelperTextProps,
102
104
  rest = _objectWithoutProperties(_useFieldApi2, _excluded4);
103
105
 
104
- var classes = useStyles();
105
106
  var invalid = validationError(meta, validateOnMount);
106
107
  var text = invalid || (meta.touched || validateOnMount) && meta.warning || helperText || description;
107
- return /*#__PURE__*/React.createElement(FormFieldGrid, _extends({
108
+ return /*#__PURE__*/React.createElement(StyledFormFieldGrid, _extends({
108
109
  className: classes.grid
109
110
  }, FormFieldGridProps), /*#__PURE__*/React.createElement(FormControl, _extends({
110
111
  required: isRequired,
@@ -18,10 +18,10 @@ import { meta } from '@data-driven-forms/common/prop-types-templates';
18
18
  import DDFSelect from '@data-driven-forms/common/select';
19
19
  import parseInternalValue from '@data-driven-forms/common/select/parse-internal-value';
20
20
  import useFieldApi from "@data-driven-forms/react-form-renderer/use-field-api";
21
- import TextField from "@material-ui/core/esm/TextField";
22
- import CircularProgress from "@material-ui/core/esm/CircularProgress";
23
- import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';
24
- import Autocomplete from '@material-ui/lab/Autocomplete';
21
+ import TextField from "@mui/material/TextField";
22
+ import CircularProgress from "@mui/material/CircularProgress";
23
+ import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
24
+ import Autocomplete from "@mui/material/Autocomplete";
25
25
  /**
26
26
  * Returns label of selected option
27
27
  * @param {Object|Array} option currently selected option
@@ -3,12 +3,12 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  var _excluded = ["input", "isReadOnly", "isDisabled", "isRequired", "label", "helperText", "description", "validateOnMount", "meta", "FormFieldGridProps", "FormControlProps", "FormGroupProps", "FormLabelProps", "FormHelperTextProps", "before", "after", "InputGridProps", "BeforeGridProps", "SliderGridProps", "AfterGridProps"];
4
4
  import React from 'react';
5
5
  import PropTypes from 'prop-types';
6
- import FormControl from "@material-ui/core/esm/FormControl";
7
- import FormGroup from "@material-ui/core/esm/FormGroup";
8
- import FormHelperText from "@material-ui/core/esm/FormHelperText";
9
- import MUISlider from "@material-ui/core/esm/Slider";
10
- import FormLabel from "@material-ui/core/esm/FormLabel";
11
- import Grid from "@material-ui/core/esm/Grid";
6
+ import FormControl from "@mui/material/FormControl";
7
+ import FormGroup from "@mui/material/FormGroup";
8
+ import FormHelperText from "@mui/material/FormHelperText";
9
+ import MUISlider from "@mui/material/Slider";
10
+ import FormLabel from "@mui/material/FormLabel";
11
+ import Grid from "@mui/material/Grid";
12
12
  import useFieldApi from "@data-driven-forms/react-form-renderer/use-field-api";
13
13
  import FormFieldGrid from '../form-field-grid/form-field-grid';
14
14
  import { validationError } from '../validation-error/validation-error';
@@ -1,38 +1,40 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
4
  var _excluded = ["fields", "title", "description", "component", "TitleGridProps", "TitleProps", "DescriptionProps", "DescriptionGridProps", "ItemsGridProps"];
4
5
  import React from 'react';
6
+ import { styled } from '@mui/material/styles';
5
7
  import PropTypes from 'prop-types';
6
- import Typography from "@material-ui/core/esm/Typography";
7
- import Grid from "@material-ui/core/esm/Grid";
8
- import { makeStyles } from '@material-ui/core/styles';
8
+ import Typography from "@mui/material/Typography";
9
+ import Grid from "@mui/material/Grid";
9
10
  import useFormApi from "@data-driven-forms/react-form-renderer/use-form-api";
10
- var useStyles = makeStyles(function () {
11
- return {
12
- grid: {
13
- paddingRight: 0,
14
- paddingLeft: 0
15
- }
16
- };
11
+ var PREFIX = 'SubForm';
12
+ var classes = {
13
+ grid: "".concat(PREFIX, "-grid")
14
+ };
15
+ var StyledGrid = styled(Grid)(function () {
16
+ return _defineProperty({}, "&.".concat(classes.grid), {
17
+ paddingRight: 0,
18
+ paddingLeft: 0
19
+ });
17
20
  });
18
21
 
19
- var SubForm = function SubForm(_ref) {
20
- var fields = _ref.fields,
21
- title = _ref.title,
22
- description = _ref.description,
23
- component = _ref.component,
24
- TitleGridProps = _ref.TitleGridProps,
25
- TitleProps = _ref.TitleProps,
26
- DescriptionProps = _ref.DescriptionProps,
27
- DescriptionGridProps = _ref.DescriptionGridProps,
28
- ItemsGridProps = _ref.ItemsGridProps,
29
- rest = _objectWithoutProperties(_ref, _excluded);
22
+ var SubForm = function SubForm(_ref2) {
23
+ var fields = _ref2.fields,
24
+ title = _ref2.title,
25
+ description = _ref2.description,
26
+ component = _ref2.component,
27
+ TitleGridProps = _ref2.TitleGridProps,
28
+ TitleProps = _ref2.TitleProps,
29
+ DescriptionProps = _ref2.DescriptionProps,
30
+ DescriptionGridProps = _ref2.DescriptionGridProps,
31
+ ItemsGridProps = _ref2.ItemsGridProps,
32
+ rest = _objectWithoutProperties(_ref2, _excluded);
30
33
 
31
34
  var _useFormApi = useFormApi(),
32
35
  renderForm = _useFormApi.renderForm;
33
36
 
34
- var classes = useStyles();
35
- return /*#__PURE__*/React.createElement(Grid, _extends({
37
+ return /*#__PURE__*/React.createElement(StyledGrid, _extends({
36
38
  item: true,
37
39
  xs: 12,
38
40
  container: true,
@@ -50,7 +52,8 @@ var SubForm = function SubForm(_ref) {
50
52
  }, DescriptionProps), description)), /*#__PURE__*/React.createElement(Grid, _extends({
51
53
  item: true,
52
54
  xs: 12,
53
- container: true
55
+ container: true,
56
+ rowSpacing: 2
54
57
  }, ItemsGridProps), renderForm(fields)));
55
58
  };
56
59
 
@@ -9,12 +9,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
9
9
 
10
10
  import React from 'react';
11
11
  import PropTypes from 'prop-types';
12
- import FormControlLabel from "@material-ui/core/esm/FormControlLabel";
13
- import FormHelperText from "@material-ui/core/esm/FormHelperText";
14
- import FormControl from "@material-ui/core/esm/FormControl";
15
- import FormGroup from "@material-ui/core/esm/FormGroup";
16
- import FormLabel from "@material-ui/core/esm/FormLabel";
17
- import MUISwitch from "@material-ui/core/esm/Switch";
12
+ import FormControlLabel from "@mui/material/FormControlLabel";
13
+ import FormHelperText from "@mui/material/FormHelperText";
14
+ import FormControl from "@mui/material/FormControl";
15
+ import FormGroup from "@mui/material/FormGroup";
16
+ import FormLabel from "@mui/material/FormLabel";
17
+ import MUISwitch from "@mui/material/Switch";
18
18
  import { meta, input } from '@data-driven-forms/common/prop-types-templates';
19
19
  import FormFieldGrid from '../form-field-grid/form-field-grid';
20
20
  import { validationError } from '../validation-error/validation-error';
package/esm/tabs/tabs.js CHANGED
@@ -1,34 +1,27 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import React, { Fragment, useState } from 'react';
4
- import PropTypes from 'prop-types';
5
- import AppBar from "@material-ui/core/esm/AppBar";
6
- import Tab from "@material-ui/core/esm/Tab";
7
- import Tabs from "@material-ui/core/esm/Tabs";
8
- import useFormApi from "@data-driven-forms/react-form-renderer/use-form-api";
9
4
 
10
- var TabContent = function TabContent(_ref) {
11
- var name = _ref.name,
12
- fields = _ref.fields,
13
- formOptions = _ref.formOptions;
14
- return /*#__PURE__*/React.createElement(Fragment, {
15
- key: name
16
- }, formOptions.renderForm(fields, formOptions));
17
- };
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
18
6
 
19
- TabContent.propTypes = {
20
- name: PropTypes.string.isRequired,
21
- fields: PropTypes.array.isRequired,
22
- formOptions: PropTypes.shape({
23
- renderForm: PropTypes.func.isRequired
24
- }).isRequired
25
- };
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
26
8
 
27
- var FormTabs = function FormTabs(_ref2) {
28
- var fields = _ref2.fields,
29
- AppBarProps = _ref2.AppBarProps,
30
- TabsProps = _ref2.TabsProps,
31
- TabProps = _ref2.TabProps;
9
+ import React, { useState } from 'react';
10
+ import PropTypes from 'prop-types';
11
+ import AppBar from "@mui/material/AppBar";
12
+ import Grid from "@mui/material/Grid";
13
+ import Tab from "@mui/material/Tab";
14
+ import Tabs from "@mui/material/Tabs";
15
+ import FormFieldGrid from '../form-field-grid';
16
+ import useFormApi from "@data-driven-forms/react-form-renderer/use-form-api";
17
+
18
+ var FormTabs = function FormTabs(_ref) {
19
+ var fields = _ref.fields,
20
+ AppBarProps = _ref.AppBarProps,
21
+ TabsProps = _ref.TabsProps,
22
+ TabProps = _ref.TabProps,
23
+ FormFieldGridProps = _ref.FormFieldGridProps,
24
+ GridItemProps = _ref.GridItemProps;
32
25
  var formOptions = useFormApi();
33
26
 
34
27
  var _useState = useState(0),
@@ -36,28 +29,38 @@ var FormTabs = function FormTabs(_ref2) {
36
29
  activeTab = _useState2[0],
37
30
  setActiveTab = _useState2[1];
38
31
 
39
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AppBar, _extends({
32
+ return /*#__PURE__*/React.createElement(FormFieldGrid, _extends({
33
+ container: true
34
+ }, FormFieldGridProps), /*#__PURE__*/React.createElement(AppBar, _extends({
40
35
  position: "static"
41
36
  }, AppBarProps), /*#__PURE__*/React.createElement(Tabs, _extends({
37
+ textColor: "inherit",
42
38
  value: activeTab,
43
39
  onChange: function onChange(_e, tabIndex) {
44
40
  return setActiveTab(tabIndex);
45
41
  }
46
- }, TabsProps), fields.map(function (_ref3) {
47
- var title = _ref3.title,
48
- name = _ref3.name;
42
+ }, TabsProps), fields.map(function (_ref2) {
43
+ var title = _ref2.title,
44
+ name = _ref2.name;
49
45
  return /*#__PURE__*/React.createElement(Tab, _extends({
50
46
  key: name,
51
47
  label: title
52
48
  }, TabProps));
53
- }))), fields.map(function (field, index) {
54
- return /*#__PURE__*/React.createElement("div", {
55
- key: field.name,
56
- hidden: index !== activeTab
57
- }, /*#__PURE__*/React.createElement(TabContent, _extends({}, field, {
58
- name: field.name,
59
- formOptions: formOptions
60
- })));
49
+ }))), fields.map(function (_ref3, index) {
50
+ var fields = _ref3.fields,
51
+ name = _ref3.name;
52
+ return /*#__PURE__*/React.createElement(Grid, _extends({
53
+ key: name || index,
54
+ container: true,
55
+ item: true,
56
+ xs: 12,
57
+ rowSpacing: 2,
58
+ sx: _objectSpread({
59
+ mt: 1
60
+ }, index !== activeTab && {
61
+ display: 'none'
62
+ })
63
+ }, GridItemProps), formOptions.renderForm(fields));
61
64
  }));
62
65
  };
63
66
 
@@ -65,11 +68,26 @@ FormTabs.propTypes = {
65
68
  fields: PropTypes.array.isRequired,
66
69
  AppBarProps: PropTypes.object,
67
70
  TabsProps: PropTypes.object,
68
- TabProps: PropTypes.object
71
+ TabProps: PropTypes.object,
72
+ FormFieldGridProps: PropTypes.object,
73
+ GridItemProps: PropTypes.object
69
74
  };
70
75
  FormTabs.defaultProps = {
71
76
  AppBarProps: {},
72
77
  TabsProps: {},
73
- TabProps: {}
78
+ TabProps: {},
79
+ FormFieldGridProps: {},
80
+ GridItemProps: {}
74
81
  };
75
- export default FormTabs;
82
+ export default FormTabs;
83
+ /*
84
+ {fields.map(({ fields }, index) =>
85
+ index === activeTab ? (
86
+ formOptions.renderForm(fields)
87
+ ) : (
88
+ <Grid container item xs={12} sx={{ display: 'none' }}>
89
+ {formOptions.renderForm(fields)}
90
+ </Grid>
91
+ )
92
+ )}
93
+ */
@@ -9,7 +9,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
9
9
 
10
10
  import React from 'react';
11
11
  import PropTypes from 'prop-types';
12
- import MuiTextField from "@material-ui/core/esm/TextField";
12
+ import MuiTextField from "@mui/material/TextField";
13
13
  import FormFieldGrid from '../form-field-grid/form-field-grid';
14
14
  import { validationError } from '../validation-error/validation-error';
15
15
  import { meta, input } from '@data-driven-forms/common/prop-types-templates';