@@ -88,17 +88,19 @@ export interface MenuProps<T> extends Omit<AriaMenuProps<T>, 'children' | 'style
88
88
89
89
export const MenuContext = createContext < ContextValue < MenuProps < any > , DOMRefValue < HTMLDivElement > > > ( null ) ;
90
90
91
+ const menuItemGrid = {
92
+ size : {
93
+ S : [ edgeToText ( 24 ) , 'auto' , 'auto' , 'minmax(0, 1fr)' , 'auto' , 'auto' , 'auto' , edgeToText ( 24 ) ] ,
94
+ M : [ edgeToText ( 32 ) , 'auto' , 'auto' , 'minmax(0, 1fr)' , 'auto' , 'auto' , 'auto' , edgeToText ( 32 ) ] ,
95
+ L : [ edgeToText ( 40 ) , 'auto' , 'auto' , 'minmax(0, 1fr)' , 'auto' , 'auto' , 'auto' , edgeToText ( 40 ) ] ,
96
+ XL : [ edgeToText ( 48 ) , 'auto' , 'auto' , 'minmax(0, 1fr)' , 'auto' , 'auto' , 'auto' , edgeToText ( 48 ) ]
97
+ }
98
+ } as const ;
99
+
91
100
export let menu = style ( {
92
101
outlineStyle : 'none' ,
93
102
display : 'grid' ,
94
- gridTemplateColumns : {
95
- size : {
96
- S : [ edgeToText ( 24 ) , 'auto' , 'auto' , 'minmax(0, 1fr)' , 'auto' , 'auto' , 'auto' , edgeToText ( 24 ) ] ,
97
- M : [ edgeToText ( 32 ) , 'auto' , 'auto' , 'minmax(0, 1fr)' , 'auto' , 'auto' , 'auto' , edgeToText ( 32 ) ] ,
98
- L : [ edgeToText ( 40 ) , 'auto' , 'auto' , 'minmax(0, 1fr)' , 'auto' , 'auto' , 'auto' , edgeToText ( 40 ) ] ,
99
- XL : [ edgeToText ( 48 ) , 'auto' , 'auto' , 'minmax(0, 1fr)' , 'auto' , 'auto' , 'auto' , edgeToText ( 48 ) ]
100
- }
101
- } ,
103
+ gridTemplateColumns : menuItemGrid ,
102
104
boxSizing : 'border-box' ,
103
105
maxHeight : '[inherit]' ,
104
106
overflow : {
@@ -123,7 +125,7 @@ export let section = style({
123
125
'. checkmark icon label value keyboard descriptor .' ,
124
126
'. . . description . . . .'
125
127
] ,
126
- gridTemplateColumns : 'subgrid'
128
+ gridTemplateColumns : menuItemGrid
127
129
} ) ;
128
130
129
131
export let sectionHeader = style < { size ?: 'S' | 'M' | 'L' | 'XL' } > ( {
@@ -425,11 +427,12 @@ export function Divider(props: SeparatorProps) {
425
427
export interface MenuSectionProps < T extends object > extends AriaMenuSectionProps < T > { }
426
428
export function MenuSection < T extends object > ( props : MenuSectionProps < T > ) {
427
429
// remember, context doesn't work if it's around Section nor inside
430
+ let { size} = useContext ( InternalMenuContext ) ;
428
431
return (
429
432
< >
430
433
< AriaMenuSection
431
434
{ ...props }
432
- className = { section } >
435
+ className = { section ( { size } ) } >
433
436
{ props . children }
434
437
</ AriaMenuSection >
435
438
< Divider />
0 commit comments