@sonardigital/carbon-ui 1.1.96 → 1.1.98

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.96",
3
+ "version": "1.1.98",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "files": [
@@ -26,6 +26,9 @@ export function FormBox<T>({
26
26
  <Controller
27
27
  name={name}
28
28
  render={({ field }) => {
29
+ const isChecked = multiple
30
+ ? field.value?.includes(value)
31
+ : field.value === value;
29
32
  const onChange = () => {
30
33
  if (multiple) {
31
34
  if (
@@ -44,13 +47,18 @@ export function FormBox<T>({
44
47
  field.onChange([...field.value, value] as T[]);
45
48
  }
46
49
  }
50
+ } else {
51
+ if (field.value === value) {
52
+ field.onChange(undefined);
53
+ } else {
54
+ field.onChange(value as T);
55
+ }
47
56
  }
48
- field.onChange(value as T);
49
57
  };
50
58
 
51
59
  return (
52
60
  <Stack sx={{ position: 'relative' }}>
53
- {value === field.value && (
61
+ {isChecked && (
54
62
  <Grow in={true} timeout={250}>
55
63
  <CheckCircleIcon
56
64
  sx={{