@@ -3,7 +3,6 @@ import { CheckboxGroup, Text, Stack, FieldsetRoot } from '@chakra-ui/react';
33import {
44 ariaDescribedByIds ,
55 enumOptionsIndexForValue ,
6- enumOptionsIsSelected ,
76 enumOptionsValueForIndex ,
87 labelValue ,
98 optionId ,
@@ -35,7 +34,6 @@ export default function CheckboxesWidget<
3534 } = props ;
3635 const { enumOptions, enumDisabled, emptyValue } = options ;
3736 // const chakraProps = getChakra({ uiSchema });
38- const checkboxesValues = Array . isArray ( value ) ? value : [ value ] ;
3937
4038 const _onBlur = ( { target } : FocusEvent < HTMLInputElement | any > ) =>
4139 onBlur ( id , enumOptionsValueForIndex < S > ( target && target . value , enumOptions , emptyValue ) ) ;
@@ -54,7 +52,7 @@ export default function CheckboxesWidget<
5452 >
5553 < CheckboxGroup
5654 onValueChange = { ( option ) => onChange ( enumOptionsValueForIndex < S > ( option , enumOptions , emptyValue ) ) }
57- defaultValue = { selectedIndexes }
55+ value = { selectedIndexes }
5856 aria-describedby = { ariaDescribedByIds < T > ( id ) }
5957 readOnly = { readonly }
6058 required = { required }
@@ -63,15 +61,13 @@ export default function CheckboxesWidget<
6361 < Stack direction = { row ? 'row' : 'column' } >
6462 { Array . isArray ( enumOptions ) &&
6563 enumOptions . map ( ( option , index ) => {
66- const checked = enumOptionsIsSelected < S > ( option . value , checkboxesValues ) ;
6764 const itemDisabled = Array . isArray ( enumDisabled ) && enumDisabled . indexOf ( option . value ) !== - 1 ;
6865 return (
6966 < Checkbox
7067 key = { index }
7168 id = { optionId ( id , index ) }
7269 name = { id }
7370 value = { String ( index ) }
74- checked = { checked }
7571 disabled = { disabled || itemDisabled || readonly }
7672 onBlur = { _onBlur }
7773 onFocus = { _onFocus }
0 commit comments