@sonardigital/carbon-ui 1.1.87 → 1.1.89

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonardigital/carbon-ui",
3
- "version": "1.1.87",
3
+ "version": "1.1.89",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "files": [
@@ -5,12 +5,12 @@ import CheckCircleIcon from '@mui/icons-material/CheckCircle';
5
5
  export interface FormBoxProps {
6
6
  value: string;
7
7
  color?: string;
8
+ children: React.ReactNode;
9
+ sx?: Record<string, unknown>;
8
10
  }
9
11
 
10
12
  interface LocalFormBoxProps extends FormBoxProps {
11
13
  name: string;
12
- children: React.ReactNode;
13
- sx?: Record<string, unknown>;
14
14
  }
15
15
 
16
16
  export function FormBox({
@@ -1,22 +1,23 @@
1
1
  import { Controller } from 'react-hook-form';
2
2
  import { FormBox, FormBoxProps } from './FormBox';
3
- import { Typography } from '@mui/material';
3
+ import { Grid, Typography } from '@mui/material';
4
4
 
5
5
  interface LocalFormBoxProps extends FormBoxProps {
6
6
  label: string;
7
+ size?: { xs: number; sm: number; md: number };
7
8
  }
8
9
 
9
10
  export function FormBoxes({
10
11
  name,
11
- children,
12
12
  options,
13
+ sx,
13
14
  }: {
14
15
  name: string;
15
- children: React.ReactNode;
16
16
  options: LocalFormBoxProps[];
17
+ sx?: Record<string, unknown>;
17
18
  }): React.ReactElement {
18
19
  return (
19
- <>
20
+ <Grid container width="100%" spacing={2}>
20
21
  {options.map(option => (
21
22
  <Controller
22
23
  name={name}
@@ -25,9 +26,11 @@ export function FormBoxes({
25
26
  option.value === undefined || option.value === null;
26
27
  const isSelected = option.value === field.value;
27
28
  return (
28
- <>
29
+ <Grid
30
+ size={{ xs: 6, sm: 4, md: 3, ...option.size }}
31
+ key={option.value}
32
+ >
29
33
  <FormBox
30
- key={option.value}
31
34
  name={name}
32
35
  value={option.value}
33
36
  color={option.color}
@@ -35,9 +38,11 @@ export function FormBoxes({
35
38
  height: 90,
36
39
  transition: 'all 0.1s',
37
40
  opacity: isEmpty ? 1 : isSelected ? 1 : 0.5,
41
+ ...sx,
42
+ ...option.sx,
38
43
  }}
39
44
  >
40
- {children}
45
+ {option.children}
41
46
  </FormBox>
42
47
  <Typography
43
48
  paddingTop={0.5}
@@ -49,11 +54,11 @@ export function FormBoxes({
49
54
  >
50
55
  {option.label}
51
56
  </Typography>
52
- </>
57
+ </Grid>
53
58
  );
54
59
  }}
55
60
  />
56
61
  ))}
57
- </>
62
+ </Grid>
58
63
  );
59
64
  }