@jsonforms/material-renderers 3.2.0-alpha.4 → 3.2.0-beta.1

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.
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { ArrayTranslations } from '@jsonforms/core';
3
3
  export interface ArrayLayoutToolbarProps {
4
4
  label: string;
5
+ description: string;
5
6
  errors: string;
6
7
  path: string;
7
8
  enabled: boolean;
@@ -1,3 +1,5 @@
1
1
  import dayjs from 'dayjs';
2
- export declare const createOnChangeHandler: (path: string, handleChange: (path: string, value: any) => void, saveFormat: string | undefined) => (time: dayjs.Dayjs) => void;
2
+ export declare const createOnChangeHandler: (path: string, handleChange: (path: string, value: any) => void, saveFormat: string) => (value: dayjs.Dayjs) => void;
3
+ export declare const createOnBlurHandler: (path: string, handleChange: (path: string, value: any) => void, format: string, saveFormat: string, rerenderChild: () => void, onBlur: () => void) => (e: React.FocusEvent<HTMLTextAreaElement | HTMLInputElement, Element>) => void;
4
+ export declare const formatDate: (date: dayjs.Dayjs, saveFormat: string) => string;
3
5
  export declare const getData: (data: any, saveFormat: string | undefined) => dayjs.Dayjs | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonforms/material-renderers",
3
- "version": "3.2.0-alpha.4",
3
+ "version": "3.2.0-beta.1",
4
4
  "description": "Material Renderer Set for JSON Forms",
5
5
  "repository": "https://github.com/eclipsesource/jsonforms",
6
6
  "bugs": "https://github.com/eclipsesource/jsonforms/issues",
@@ -35,19 +35,6 @@
35
35
  "main": "lib/jsonforms-react-material.cjs.js",
36
36
  "module": "lib/jsonforms-react-material.esm.js",
37
37
  "typings": "lib/index.d.ts",
38
- "scripts": {
39
- "build": "rollup -c rollup.config.js",
40
- "build:examples-app": "rollup -c rollup.example.config.js",
41
- "dev": "webpack --config webpack/webpack.dev.js && webpack-dev-server --config webpack/webpack.dev.js --env=dev --inline",
42
- "clean": "rimraf lib coverage dist .nyc_output example/dist 2> /dev/null",
43
- "lint": "eslint .",
44
- "lint:fix": "eslint --fix .",
45
- "test": "jest --no-cache",
46
- "test-cov": "jest --no-cache --coverage",
47
- "report": "nyc report --reporter=html",
48
- "doc": "typedoc --name 'JSON Forms React Material Renderers' --excludeExternals --theme ../../typedoc-jsonforms --out docs src",
49
- "tsc": "tsc --build tsconfig.json"
50
- },
51
38
  "jest": {
52
39
  "moduleFileExtensions": [
53
40
  "ts",
@@ -59,7 +46,8 @@
59
46
  },
60
47
  "testEnvironment": "jsdom",
61
48
  "testMatch": [
62
- "**/test/**/*.test.tsx"
49
+ "**/test/**/*.test.tsx",
50
+ "**/test/**.test.ts"
63
51
  ],
64
52
  "testPathIgnorePatterns": [
65
53
  "/node_modules/",
@@ -85,8 +73,8 @@
85
73
  "peerDependencies": {
86
74
  "@emotion/react": "^11.4.1",
87
75
  "@emotion/styled": "^11.3.0",
88
- "@jsonforms/core": "3.2.0-alpha.4",
89
- "@jsonforms/react": "3.2.0-alpha.4",
76
+ "@jsonforms/core": "3.2.0-beta.1",
77
+ "@jsonforms/react": "3.2.0-beta.1",
90
78
  "@mui/icons-material": "^5.11.16",
91
79
  "@mui/material": "^5.13.0",
92
80
  "@mui/x-date-pickers": "^6.0.0",
@@ -95,8 +83,6 @@
95
83
  "devDependencies": {
96
84
  "@emotion/react": "^11.5.0",
97
85
  "@emotion/styled": "^11.3.0",
98
- "@jsonforms/core": "3.2.0-alpha.4",
99
- "@jsonforms/react": "3.2.0-alpha.4",
100
86
  "@mui/icons-material": "^5.11.16",
101
87
  "@mui/material": "~5.13.0",
102
88
  "@mui/x-date-pickers": "^6.5.0",
@@ -135,11 +121,25 @@
135
121
  "ts-jest": "^27.1.4",
136
122
  "ts-loader": "^6.2.1",
137
123
  "tslib": "^2.5.0",
138
- "typedoc": "~0.21.9",
139
- "typescript": "4.2.3",
124
+ "typedoc": "~0.25.3",
125
+ "typescript": "~4.9.5",
140
126
  "webpack": "^4.41.2",
141
127
  "webpack-cli": "^3.2.1",
142
- "webpack-dev-server": "^3.9.0"
128
+ "webpack-dev-server": "^3.9.0",
129
+ "@jsonforms/core": "3.2.0-beta.1",
130
+ "@jsonforms/react": "3.2.0-beta.1"
143
131
  },
144
- "gitHead": "288f0dc97d0e861583f5a3c3f8a65ffb5eab8568"
145
- }
132
+ "scripts": {
133
+ "build": "rollup -c rollup.config.js",
134
+ "build:examples-app": "rollup -c rollup.example.config.js",
135
+ "dev": "webpack --config webpack/webpack.dev.js && webpack-dev-server --config webpack/webpack.dev.js --env=dev --inline",
136
+ "clean": "rimraf lib coverage dist .nyc_output example/dist 2> /dev/null",
137
+ "lint": "eslint .",
138
+ "lint:fix": "eslint --fix .",
139
+ "test": "jest --no-cache",
140
+ "test-cov": "jest --no-cache --coverage",
141
+ "report": "nyc report --reporter=html",
142
+ "doc": "typedoc --name 'JSON Forms React Material Renderers' --excludeExternals --out docs src",
143
+ "tsc": "tsc --build tsconfig.json"
144
+ }
145
+ }
@@ -32,7 +32,7 @@ import {
32
32
  ListItemSecondaryAction,
33
33
  ListItemText,
34
34
  } from '@mui/material';
35
- import DeleteIcon from '@mui/icons-material/Delete';
35
+ import { Delete as DeleteIcon } from '@mui/icons-material';
36
36
  import React from 'react';
37
37
 
38
38
  export const ListWithDetailMasterItem = ({
@@ -64,6 +64,7 @@ export const MaterialListWithDetailRenderer = ({
64
64
  config,
65
65
  rootSchema,
66
66
  translations,
67
+ description,
67
68
  }: ArrayLayoutProps) => {
68
69
  const [selectedIndex, setSelectedIndex] = useState(undefined);
69
70
  const handleRemoveItem = useCallback(
@@ -113,6 +114,7 @@ export const MaterialListWithDetailRenderer = ({
113
114
  required,
114
115
  appliedUiSchemaOptions.hideRequiredAsterisk
115
116
  )}
117
+ description={description}
116
118
  errors={errors}
117
119
  path={path}
118
120
  enabled={enabled}
@@ -39,7 +39,7 @@ export const MaterialEnumArrayRenderer = ({
39
39
  ...otherProps
40
40
  }: ControlProps & OwnPropsOfEnum & DispatchPropsOfMultiEnumControl) => {
41
41
  return (
42
- <Hidden xlUp={!visible}>
42
+ <Hidden xsUp={!visible}>
43
43
  <FormControl component='fieldset'>
44
44
  <FormGroup row>
45
45
  {options.map((option: any, index: number) => {
@@ -57,9 +57,11 @@ import {
57
57
  encode,
58
58
  ArrayTranslations,
59
59
  } from '@jsonforms/core';
60
- import DeleteIcon from '@mui/icons-material/Delete';
61
- import ArrowDownward from '@mui/icons-material/ArrowDownward';
62
- import ArrowUpward from '@mui/icons-material/ArrowUpward';
60
+ import {
61
+ Delete as DeleteIcon,
62
+ ArrowDownward,
63
+ ArrowUpward,
64
+ } from '@mui/icons-material';
63
65
 
64
66
  import { WithDeleteDialogSupport } from './DeleteDialog';
65
67
  import NoBorderTableCell from './NoBorderTableCell';
@@ -431,6 +433,7 @@ export class MaterialTableControl extends React.Component<
431
433
  render() {
432
434
  const {
433
435
  label,
436
+ description,
434
437
  path,
435
438
  schema,
436
439
  rootSchema,
@@ -456,6 +459,7 @@ export class MaterialTableControl extends React.Component<
456
459
  <TableToolbar
457
460
  errors={errors}
458
461
  label={label}
462
+ description={description}
459
463
  addItem={this.addItem}
460
464
  numColumns={isObjectSchema ? headerCells.length : 1}
461
465
  path={path}
@@ -29,8 +29,16 @@ import {
29
29
  JsonSchema,
30
30
  ArrayTranslations,
31
31
  } from '@jsonforms/core';
32
- import { IconButton, TableRow, Tooltip, Grid, Typography } from '@mui/material';
33
- import AddIcon from '@mui/icons-material/Add';
32
+ import {
33
+ IconButton,
34
+ TableRow,
35
+ Tooltip,
36
+ Grid,
37
+ Typography,
38
+ FormHelperText,
39
+ Stack,
40
+ } from '@mui/material';
41
+ import { Add as AddIcon } from '@mui/icons-material';
34
42
  import ValidationIcon from './ValidationIcon';
35
43
  import NoBorderTableCell from './NoBorderTableCell';
36
44
 
@@ -38,6 +46,7 @@ export interface MaterialTableToolbarProps {
38
46
  numColumns: number;
39
47
  errors: string;
40
48
  label: string;
49
+ description: string;
41
50
  path: string;
42
51
  uischema: ControlElement;
43
52
  schema: JsonSchema;
@@ -56,6 +65,7 @@ const TableToolbar = React.memo(function TableToolbar({
56
65
  numColumns,
57
66
  errors,
58
67
  label,
68
+ description,
59
69
  path,
60
70
  addItem,
61
71
  schema,
@@ -66,26 +76,29 @@ const TableToolbar = React.memo(function TableToolbar({
66
76
  return (
67
77
  <TableRow>
68
78
  <NoBorderTableCell colSpan={numColumns}>
69
- <Grid
70
- container
71
- justifyContent={'flex-start'}
72
- alignItems={'center'}
73
- spacing={2}
74
- >
75
- <Grid item>
76
- <Typography variant={'h6'}>{label}</Typography>
77
- </Grid>
78
- <Grid item>
79
- {errors.length !== 0 && (
80
- <Grid item>
81
- <ValidationIcon
82
- id='tooltip-validation'
83
- errorMessages={errors}
84
- />
85
- </Grid>
86
- )}
79
+ <Stack>
80
+ <Grid
81
+ container
82
+ justifyContent={'flex-start'}
83
+ alignItems={'center'}
84
+ spacing={2}
85
+ >
86
+ <Grid item>
87
+ <Typography variant={'h6'}>{label}</Typography>
88
+ </Grid>
89
+ <Grid item>
90
+ {errors.length !== 0 && (
91
+ <Grid item>
92
+ <ValidationIcon
93
+ id='tooltip-validation'
94
+ errorMessages={errors}
95
+ />
96
+ </Grid>
97
+ )}
98
+ </Grid>
87
99
  </Grid>
88
- </Grid>
100
+ {description && <FormHelperText>{description}</FormHelperText>}
101
+ </Stack>
89
102
  </NoBorderTableCell>
90
103
  {enabled ? (
91
104
  <NoBorderTableCell align='right' style={fixedCellSmall}>
@@ -24,7 +24,7 @@
24
24
  */
25
25
  import React from 'react';
26
26
 
27
- import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
27
+ import { ErrorOutline as ErrorOutlineIcon } from '@mui/icons-material';
28
28
  import { Badge, Tooltip, styled } from '@mui/material';
29
29
 
30
30
  const StyledBadge = styled(Badge)(({ theme }: any) => ({
@@ -23,9 +23,10 @@
23
23
  THE SOFTWARE.
24
24
  */
25
25
  import merge from 'lodash/merge';
26
- import React, { useMemo } from 'react';
26
+ import React, { useCallback, useMemo, useState } from 'react';
27
27
  import {
28
28
  ControlProps,
29
+ defaultDateFormat,
29
30
  isDateControl,
30
31
  isDescriptionHidden,
31
32
  RankedTester,
@@ -35,7 +36,12 @@ import { withJsonFormsControlProps } from '@jsonforms/react';
35
36
  import { FormHelperText, Hidden } from '@mui/material';
36
37
  import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
37
38
  import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
38
- import { createOnChangeHandler, getData, useFocus } from '../util';
39
+ import {
40
+ createOnBlurHandler,
41
+ createOnChangeHandler,
42
+ getData,
43
+ useFocus,
44
+ } from '../util';
39
45
 
40
46
  export const MaterialDateControl = (props: ControlProps) => {
41
47
  const [focused, onFocus, onBlur] = useFocus();
@@ -62,8 +68,10 @@ export const MaterialDateControl = (props: ControlProps) => {
62
68
  appliedUiSchemaOptions.showUnfocusedDescription
63
69
  );
64
70
 
71
+ const [key, setKey] = useState<number>(0);
72
+
65
73
  const format = appliedUiSchemaOptions.dateFormat ?? 'YYYY-MM-DD';
66
- const saveFormat = appliedUiSchemaOptions.dateSaveFormat ?? 'YYYY-MM-DD';
74
+ const saveFormat = appliedUiSchemaOptions.dateSaveFormat ?? defaultDateFormat;
67
75
 
68
76
  const views = appliedUiSchemaOptions.views ?? ['year', 'day'];
69
77
 
@@ -73,20 +81,36 @@ export const MaterialDateControl = (props: ControlProps) => {
73
81
  ? errors
74
82
  : null;
75
83
  const secondFormHelperText = showDescription && !isValid ? errors : null;
84
+
85
+ const updateChild = useCallback(() => setKey((key) => key + 1), []);
86
+
76
87
  const onChange = useMemo(
77
88
  () => createOnChangeHandler(path, handleChange, saveFormat),
78
89
  [path, handleChange, saveFormat]
79
90
  );
80
91
 
92
+ const onBlurHandler = useMemo(
93
+ () =>
94
+ createOnBlurHandler(
95
+ path,
96
+ handleChange,
97
+ format,
98
+ saveFormat,
99
+ updateChild,
100
+ onBlur
101
+ ),
102
+ [path, handleChange, format, saveFormat, updateChild]
103
+ );
81
104
  const value = getData(data, saveFormat);
82
105
 
83
106
  return (
84
107
  <Hidden xsUp={!visible}>
85
108
  <LocalizationProvider dateAdapter={AdapterDayjs}>
86
109
  <DatePicker
110
+ key={key}
87
111
  label={label}
88
112
  value={value}
89
- onChange={onChange}
113
+ onAccept={onChange}
90
114
  format={format}
91
115
  views={views}
92
116
  disabled={!enabled}
@@ -109,7 +133,7 @@ export const MaterialDateControl = (props: ControlProps) => {
109
133
  },
110
134
  InputLabelProps: data ? { shrink: true } : undefined,
111
135
  onFocus: onFocus,
112
- onBlur: onBlur,
136
+ onBlur: onBlurHandler,
113
137
  },
114
138
  }}
115
139
  />
@@ -22,10 +22,11 @@
22
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  THE SOFTWARE.
24
24
  */
25
- import React, { useMemo } from 'react';
25
+ import React, { useCallback, useMemo, useState } from 'react';
26
26
  import merge from 'lodash/merge';
27
27
  import {
28
28
  ControlProps,
29
+ defaultDateTimeFormat,
29
30
  isDateTimeControl,
30
31
  isDescriptionHidden,
31
32
  RankedTester,
@@ -35,7 +36,12 @@ import { withJsonFormsControlProps } from '@jsonforms/react';
35
36
  import { FormHelperText, Hidden } from '@mui/material';
36
37
  import { DateTimePicker, LocalizationProvider } from '@mui/x-date-pickers';
37
38
  import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
38
- import { createOnChangeHandler, getData, useFocus } from '../util';
39
+ import {
40
+ createOnBlurHandler,
41
+ createOnChangeHandler,
42
+ getData,
43
+ useFocus,
44
+ } from '../util';
39
45
 
40
46
  export const MaterialDateTimeControl = (props: ControlProps) => {
41
47
  const [focused, onFocus, onBlur] = useFocus();
@@ -64,7 +70,10 @@ export const MaterialDateTimeControl = (props: ControlProps) => {
64
70
  );
65
71
 
66
72
  const format = appliedUiSchemaOptions.dateTimeFormat ?? 'YYYY-MM-DD HH:mm';
67
- const saveFormat = appliedUiSchemaOptions.dateTimeSaveFormat ?? undefined;
73
+ const saveFormat =
74
+ appliedUiSchemaOptions.dateTimeSaveFormat ?? defaultDateTimeFormat;
75
+
76
+ const [key, setKey] = useState<number>(0);
68
77
 
69
78
  const views = appliedUiSchemaOptions.views ?? [
70
79
  'year',
@@ -80,20 +89,35 @@ export const MaterialDateTimeControl = (props: ControlProps) => {
80
89
  : null;
81
90
  const secondFormHelperText = showDescription && !isValid ? errors : null;
82
91
 
92
+ const updateChild = useCallback(() => setKey((key) => key + 1), []);
93
+
83
94
  const onChange = useMemo(
84
95
  () => createOnChangeHandler(path, handleChange, saveFormat),
85
96
  [path, handleChange, saveFormat]
86
97
  );
87
98
 
99
+ const onBlurHandler = useMemo(
100
+ () =>
101
+ createOnBlurHandler(
102
+ path,
103
+ handleChange,
104
+ format,
105
+ saveFormat,
106
+ updateChild,
107
+ onBlur
108
+ ),
109
+ [path, handleChange, format, saveFormat, updateChild]
110
+ );
88
111
  const value = getData(data, saveFormat);
89
112
 
90
113
  return (
91
114
  <Hidden xsUp={!visible}>
92
115
  <LocalizationProvider dateAdapter={AdapterDayjs}>
93
116
  <DateTimePicker
117
+ key={key}
94
118
  label={label}
95
119
  value={value}
96
- onChange={onChange}
120
+ onAccept={onChange}
97
121
  format={format}
98
122
  ampm={!!appliedUiSchemaOptions.ampm}
99
123
  views={views}
@@ -117,7 +141,7 @@ export const MaterialDateTimeControl = (props: ControlProps) => {
117
141
  },
118
142
  InputLabelProps: data ? { shrink: true } : undefined,
119
143
  onFocus: onFocus,
120
- onBlur: onBlur,
144
+ onBlur: onBlurHandler,
121
145
  },
122
146
  }}
123
147
  />
@@ -22,7 +22,7 @@
22
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  THE SOFTWARE.
24
24
  */
25
- import React, { useMemo } from 'react';
25
+ import React, { useCallback, useMemo, useState } from 'react';
26
26
  import merge from 'lodash/merge';
27
27
  import {
28
28
  ControlProps,
@@ -30,12 +30,18 @@ import {
30
30
  isDescriptionHidden,
31
31
  RankedTester,
32
32
  rankWith,
33
+ defaultTimeFormat,
33
34
  } from '@jsonforms/core';
34
35
  import { withJsonFormsControlProps } from '@jsonforms/react';
35
36
  import { FormHelperText, Hidden } from '@mui/material';
36
37
  import { TimePicker, LocalizationProvider } from '@mui/x-date-pickers';
37
38
  import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
38
- import { createOnChangeHandler, getData, useFocus } from '../util';
39
+ import {
40
+ createOnBlurHandler,
41
+ createOnChangeHandler,
42
+ getData,
43
+ useFocus,
44
+ } from '../util';
39
45
 
40
46
  export const MaterialTimeControl = (props: ControlProps) => {
41
47
  const [focused, onFocus, onBlur] = useFocus();
@@ -56,6 +62,8 @@ export const MaterialTimeControl = (props: ControlProps) => {
56
62
  const appliedUiSchemaOptions = merge({}, config, uischema.options);
57
63
  const isValid = errors.length === 0;
58
64
 
65
+ const [key, setKey] = useState<number>(0);
66
+
59
67
  const showDescription = !isDescriptionHidden(
60
68
  visible,
61
69
  description,
@@ -64,7 +72,7 @@ export const MaterialTimeControl = (props: ControlProps) => {
64
72
  );
65
73
 
66
74
  const format = appliedUiSchemaOptions.timeFormat ?? 'HH:mm';
67
- const saveFormat = appliedUiSchemaOptions.timeSaveFormat ?? 'HH:mm:ss';
75
+ const saveFormat = appliedUiSchemaOptions.timeSaveFormat ?? defaultTimeFormat;
68
76
 
69
77
  const views = appliedUiSchemaOptions.views ?? ['hours', 'minutes'];
70
78
 
@@ -75,19 +83,35 @@ export const MaterialTimeControl = (props: ControlProps) => {
75
83
  : null;
76
84
  const secondFormHelperText = showDescription && !isValid ? errors : null;
77
85
 
86
+ const updateChild = useCallback(() => setKey((key) => key + 1), []);
87
+
78
88
  const onChange = useMemo(
79
89
  () => createOnChangeHandler(path, handleChange, saveFormat),
80
90
  [path, handleChange, saveFormat]
81
91
  );
82
92
 
93
+ const onBlurHandler = useMemo(
94
+ () =>
95
+ createOnBlurHandler(
96
+ path,
97
+ handleChange,
98
+ format,
99
+ saveFormat,
100
+ updateChild,
101
+ onBlur
102
+ ),
103
+ [path, handleChange, format, saveFormat, updateChild]
104
+ );
83
105
  const value = getData(data, saveFormat);
106
+
84
107
  return (
85
108
  <Hidden xsUp={!visible}>
86
109
  <LocalizationProvider dateAdapter={AdapterDayjs}>
87
110
  <TimePicker
111
+ key={key}
88
112
  label={label}
89
113
  value={value}
90
- onChange={onChange}
114
+ onAccept={onChange}
91
115
  format={format}
92
116
  ampm={!!appliedUiSchemaOptions.ampm}
93
117
  views={views}
@@ -111,7 +135,7 @@ export const MaterialTimeControl = (props: ControlProps) => {
111
135
  },
112
136
  InputLabelProps: data ? { shrink: true } : undefined,
113
137
  onFocus: onFocus,
114
- onBlur: onBlur,
138
+ onBlur: onBlurHandler,
115
139
  },
116
140
  }}
117
141
  />
@@ -1,10 +1,19 @@
1
- import { Grid, IconButton, Toolbar, Tooltip, Typography } from '@mui/material';
1
+ import {
2
+ FormHelperText,
3
+ Grid,
4
+ IconButton,
5
+ Stack,
6
+ Toolbar,
7
+ Tooltip,
8
+ Typography,
9
+ } from '@mui/material';
2
10
  import AddIcon from '@mui/icons-material/Add';
3
11
  import React from 'react';
4
12
  import ValidationIcon from '../complex/ValidationIcon';
5
13
  import { ArrayTranslations } from '@jsonforms/core';
6
14
  export interface ArrayLayoutToolbarProps {
7
15
  label: string;
16
+ description: string;
8
17
  errors: string;
9
18
  path: string;
10
19
  enabled: boolean;
@@ -14,6 +23,7 @@ export interface ArrayLayoutToolbarProps {
14
23
  }
15
24
  export const ArrayLayoutToolbar = React.memo(function ArrayLayoutToolbar({
16
25
  label,
26
+ description,
17
27
  errors,
18
28
  addItem,
19
29
  path,
@@ -23,51 +33,54 @@ export const ArrayLayoutToolbar = React.memo(function ArrayLayoutToolbar({
23
33
  }: ArrayLayoutToolbarProps) {
24
34
  return (
25
35
  <Toolbar disableGutters={true}>
26
- <Grid container alignItems='center' justifyContent='space-between'>
27
- <Grid item>
28
- <Grid
29
- container
30
- justifyContent={'flex-start'}
31
- alignItems={'center'}
32
- spacing={2}
33
- >
34
- <Grid item>
35
- <Typography variant={'h6'}>{label}</Typography>
36
+ <Stack>
37
+ <Grid container alignItems='center' justifyContent='space-between'>
38
+ <Grid item>
39
+ <Grid
40
+ container
41
+ justifyContent={'flex-start'}
42
+ alignItems={'center'}
43
+ spacing={2}
44
+ >
45
+ <Grid item>
46
+ <Typography variant={'h6'}>{label}</Typography>
47
+ </Grid>
48
+ <Grid item>
49
+ {errors.length !== 0 && (
50
+ <Grid item>
51
+ <ValidationIcon
52
+ id='tooltip-validation'
53
+ errorMessages={errors}
54
+ />
55
+ </Grid>
56
+ )}
57
+ </Grid>
36
58
  </Grid>
59
+ </Grid>
60
+ {enabled && (
37
61
  <Grid item>
38
- {errors.length !== 0 && (
62
+ <Grid container>
39
63
  <Grid item>
40
- <ValidationIcon
41
- id='tooltip-validation'
42
- errorMessages={errors}
43
- />
44
- </Grid>
45
- )}
46
- </Grid>
47
- </Grid>
48
- </Grid>
49
- {enabled && (
50
- <Grid item>
51
- <Grid container>
52
- <Grid item>
53
- <Tooltip
54
- id='tooltip-add'
55
- title={translations.addTooltip}
56
- placement='bottom'
57
- >
58
- <IconButton
59
- aria-label={translations.addTooltip}
60
- onClick={addItem(path, createDefault())}
61
- size='large'
64
+ <Tooltip
65
+ id='tooltip-add'
66
+ title={translations.addTooltip}
67
+ placement='bottom'
62
68
  >
63
- <AddIcon />
64
- </IconButton>
65
- </Tooltip>
69
+ <IconButton
70
+ aria-label={translations.addTooltip}
71
+ onClick={addItem(path, createDefault())}
72
+ size='large'
73
+ >
74
+ <AddIcon />
75
+ </IconButton>
76
+ </Tooltip>
77
+ </Grid>
66
78
  </Grid>
67
79
  </Grid>
68
- </Grid>
69
- )}
70
- </Grid>
80
+ )}
81
+ </Grid>
82
+ {description && <FormHelperText>{description}</FormHelperText>}
83
+ </Stack>
71
84
  </Toolbar>
72
85
  );
73
86
  });
@@ -40,10 +40,12 @@ import {
40
40
  Grid,
41
41
  IconButton,
42
42
  } from '@mui/material';
43
- import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
44
- import DeleteIcon from '@mui/icons-material/Delete';
45
- import ArrowUpward from '@mui/icons-material/ArrowUpward';
46
- import ArrowDownward from '@mui/icons-material/ArrowDownward';
43
+ import {
44
+ ExpandMore as ExpandMoreIcon,
45
+ Delete as DeleteIcon,
46
+ ArrowUpward,
47
+ ArrowDownward,
48
+ } from '@mui/icons-material';
47
49
 
48
50
  const iconStyle: any = { float: 'right' };
49
51