@sonardigital/carbon-ui 1.1.34 → 1.1.36
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.
package/package.json
CHANGED
|
@@ -4,15 +4,15 @@ import { Row } from './Row';
|
|
|
4
4
|
import { RemoveCircleOutline, AddCircleOutline, CheckOutlined } from '@mui/icons-material';
|
|
5
5
|
import { FormError } from '../../layout';
|
|
6
6
|
|
|
7
|
-
export interface
|
|
7
|
+
export interface FormListField {
|
|
8
8
|
component: React.ReactElement;
|
|
9
9
|
size?: number;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export interface
|
|
12
|
+
export interface FormListProps {
|
|
13
13
|
name: string;
|
|
14
14
|
label: string;
|
|
15
|
-
fields:
|
|
15
|
+
fields: FormListField[];
|
|
16
16
|
maxItems?: number;
|
|
17
17
|
defaultValues?: Record<string, unknown>;
|
|
18
18
|
}
|
|
@@ -24,13 +24,13 @@ const getErrorMessage = (error: any): string | undefined => {
|
|
|
24
24
|
return error.message;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export
|
|
27
|
+
export function FormList({
|
|
28
28
|
name,
|
|
29
29
|
label,
|
|
30
30
|
fields,
|
|
31
31
|
maxItems,
|
|
32
32
|
defaultValues,
|
|
33
|
-
}:
|
|
33
|
+
}: FormListProps): React.ReactElement {
|
|
34
34
|
const {
|
|
35
35
|
control,
|
|
36
36
|
formState: { errors },
|
|
@@ -77,7 +77,7 @@ export default function ListField({
|
|
|
77
77
|
<IconButton
|
|
78
78
|
size="large"
|
|
79
79
|
disabled={arrayFields.length === maxItems}
|
|
80
|
-
|
|
80
|
+
sx={{ marginTop: 30, cursor: 'default' }}
|
|
81
81
|
>
|
|
82
82
|
<CheckOutlined sx={{ width: 20, height: 20 }} />
|
|
83
83
|
</IconButton>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Grid, Stack } from '@mui/material';
|
|
3
3
|
import { UseFieldArrayRemove } from 'react-hook-form';
|
|
4
|
-
import {
|
|
4
|
+
import { FormListField } from './FormList';
|
|
5
5
|
|
|
6
6
|
export function Row(props: {
|
|
7
7
|
name: string;
|
|
8
|
-
fields:
|
|
8
|
+
fields: FormListField[];
|
|
9
9
|
index: number;
|
|
10
10
|
remove?: UseFieldArrayRemove;
|
|
11
11
|
}): React.ReactElement {
|
|
@@ -14,7 +14,7 @@ export function Row(props: {
|
|
|
14
14
|
return (
|
|
15
15
|
<Stack width="100%" direction="row" alignItems="start" gap={0.5}>
|
|
16
16
|
<Grid width="100%" container spacing={2}>
|
|
17
|
-
{fields?.map((field:
|
|
17
|
+
{fields?.map((field: FormListField, i: number) => {
|
|
18
18
|
const Component = field.component;
|
|
19
19
|
return (
|
|
20
20
|
<Grid size={field?.size || 3} key={i}>
|