11import * as React from 'react' ;
2- import { useState , useEffect } from 'react' ;
2+ import { useEffect , useState } from 'react' ;
33import { PrimeReactContext , ariaLabel } from '../api/Api' ;
44import { useHandleStyle } from '../componentbase/ComponentBase' ;
55import { useMergeProps , useMountEffect } from '../hooks/Hooks' ;
@@ -15,7 +15,7 @@ export const TriStateCheckbox = React.memo(
1515 const context = React . useContext ( PrimeReactContext ) ;
1616 const props = TriStateCheckboxBase . getProps ( inProps , context ) ;
1717
18- const [ checkBoxValue , setCheckBoxValue ] = useState ( '' ) ;
18+ const [ checkBoxValue , setCheckBoxValue ] = useState ( null ) ;
1919 const elementRef = React . useRef ( null ) ;
2020
2121 const { ptm, cx, isUnstyled } = TriStateCheckboxBase . setMetaData ( {
@@ -25,10 +25,10 @@ export const TriStateCheckbox = React.memo(
2525 useHandleStyle ( TriStateCheckboxBase . css . styles , isUnstyled , { name : 'tristatecheckbox' } ) ;
2626
2727 useEffect ( ( ) => {
28- if ( [ true , false , '' ] . includes ( props . value ) ) {
28+ if ( [ true , false , null ] . includes ( props . value ) ) {
2929 setCheckBoxValue ( props . value ) ;
3030 } else {
31- setCheckBoxValue ( '' ) ;
31+ setCheckBoxValue ( null ) ;
3232 }
3333 } , [ props . value ] ) ;
3434
@@ -39,12 +39,12 @@ export const TriStateCheckbox = React.memo(
3939
4040 let newValue ;
4141
42- if ( checkBoxValue === '' ) {
42+ if ( checkBoxValue === null ) {
4343 newValue = true ;
4444 } else if ( checkBoxValue === true ) {
4545 newValue = false ;
4646 } else if ( checkBoxValue === false ) {
47- newValue = '' ;
47+ newValue = null ;
4848 }
4949
5050 if ( props . onChange ) {
0 commit comments