@@ -95,13 +95,17 @@ const InputLabel: React.FC<{
9595 const cursorClass = onClick ? ( disabled ? "cursor-not-allowed" : "cursor-pointer" ) : undefined ;
9696
9797 return (
98- < div onClick = { onClick } className = { cursorClass } >
98+ < div onClick = { onClick } className = { cn ( "min-w-0 flex-1" , cursorClass ) } >
9999 { label && (
100- < Label htmlFor = { id } className = { labelSizeVariant ( { density : d } ) } >
100+ < Label htmlFor = { id } className = { cn ( "block truncate" , labelSizeVariant ( { density : d } ) ) } >
101101 { label }
102102 </ Label >
103103 ) }
104- { description && < p className = { descriptionSizeVariant ( { density : d } ) } > { description } </ p > }
104+ { description && (
105+ < p className = { cn ( "block truncate" , descriptionSizeVariant ( { density : d } ) ) } >
106+ { description }
107+ </ p >
108+ ) }
105109 </ div >
106110 ) ;
107111} ) ;
@@ -150,8 +154,10 @@ const VariantComponents = {
150154 const handleLabelClick = ( ) => {
151155 if ( disabled || loading ) return ;
152156 if ( nullable ) {
153- if ( value === null ) onCheckedChange ( true ) ;
154- else if ( value === true ) onCheckedChange ( false ) ;
157+ const isTrue = value === true || ( value as any ) === 1 ;
158+ const isNull = value === null || value === undefined ;
159+ if ( isNull ) onCheckedChange ( true ) ;
160+ else if ( isTrue ) onCheckedChange ( false ) ;
155161 else onCheckedChange ( null ) ;
156162 } else {
157163 onCheckedChange ( ! value ) ;
@@ -365,7 +371,12 @@ export const BoolInputWidget: React.FC<BoolInputWidgetProps> = ({
365371} ) => {
366372 const eventHandler = useEventHandler ( ) ;
367373
368- const normalizedValue = nullable && value === undefined ? null : value ;
374+ const normalizedValue = useMemo ( ( ) => {
375+ if ( value === undefined || value === null ) return nullable ? null : false ;
376+ if ( value === true || ( value as any ) === 1 ) return true ;
377+ if ( value === false || ( value as any ) === 0 ) return false ;
378+ return ! ! value ;
379+ } , [ value , nullable ] ) ;
369380
370381 const [ localValue , setLocalValue ] = useOptimisticValue ( normalizedValue , false ) ;
371382
0 commit comments