File tree Expand file tree Collapse file tree 2 files changed +242
-95
lines changed
documentation/src/components/Demos/Form Expand file tree Collapse file tree 2 files changed +242
-95
lines changed Original file line number Diff line number Diff line change @@ -25,38 +25,27 @@ const labels = {
2525 d : "Label 4" ,
2626} as const ;
2727
28- function toCheckedChange < P extends { onChange ( ) : void } > ( {
29- onChange,
30- ...props
31- } : P ) : Omit < P , "onChange" > & { onCheckedChange ( ) : void } {
32- return {
33- ...props ,
34- onCheckedChange : onChange ,
35- } ;
36- }
37-
3828export default function MenusWithFormControls ( ) : ReactElement | null {
3929 const [ bold , setBold ] = useState ( false ) ;
4030 const [ italic , setItalic ] = useState ( false ) ;
4131 const [ decoration , setDecoration ] = useState < Decoration > ( "none" ) ;
4232 const [ checked , setChecked ] = useState ( false ) ;
43- const { rootProps, getProps } = useIndeterminateChecked ( values ) ;
33+ const { rootProps, getProps } = useIndeterminateChecked ( values , {
34+ menu : true ,
35+ } ) ;
4436
4537 return (
4638 < DropdownMenu
4739 id = "some-id"
4840 items = { [
4941 < MenuItem id = "item-1" > Item 1</ MenuItem > ,
50- < MenuItemCheckbox
51- id = "some-group-id-root"
52- { ...toCheckedChange ( rootProps ) }
53- >
42+ < MenuItemCheckbox id = "some-group-id-root" { ...rootProps } >
5443 Toggle All
5544 </ MenuItemCheckbox > ,
5645 ...values . map ( ( value , i ) => (
5746 < MenuItemCheckbox
5847 id = { `some-group-id-${ i + 1 } ` }
59- { ...toCheckedChange ( getProps ( value ) ) }
48+ { ...getProps ( value ) }
6049 key = { value }
6150 >
6251 { labels [ value ] }
You can’t perform that action at this time.
0 commit comments