@@ -20,7 +20,6 @@ import {DragAndDropHooks} from './useDragAndDrop';
20
20
import { DraggableCollectionState , DroppableCollectionState , Collection as ICollection , ListState , Node , SelectionBehavior , UNSTABLE_useFilteredListState , useListState } from 'react-stately' ;
21
21
import { filterDOMProps , inertValue , LoadMoreSentinelProps , useLoadMoreSentinel , useObjectRef } from '@react-aria/utils' ;
22
22
import { forwardRefType , GlobalDOMAttributes , HoverEvents , Key , LinkDOMProps , PressEvents , RefObject } from '@react-types/shared' ;
23
- import { HeaderContext } from './Header' ;
24
23
import { ListStateContext } from './ListBox' ;
25
24
import React , { createContext , ForwardedRef , forwardRef , HTMLAttributes , JSX , ReactNode , useContext , useEffect , useMemo , useRef } from 'react' ;
26
25
import { SelectionIndicatorContext } from './SelectionIndicator' ;
@@ -579,11 +578,11 @@ export interface GridListSectionProps<T> extends SectionProps<T> {}
579
578
/**
580
579
* A GridListSection represents a section within a GridList.
581
580
*/
582
- export const GridListSection = /*#__PURE__*/ createBranchComponent ( SectionNode , < T extends object > ( props : GridListSectionProps < T > , ref : ForwardedRef < HTMLElement > , item : Node < T > ) => {
581
+ export const GridListSection = /*#__PURE__*/ createBranchComponent ( SectionNode , < T extends object > ( props : GridListSectionProps < T > , ref : ForwardedRef < HTMLDivElement > , item : Node < T > ) => {
583
582
let state = useContext ( ListStateContext ) ! ;
584
583
let { CollectionBranch} = useContext ( CollectionRendererContext ) ;
585
584
let headingRef = useRef ( null ) ;
586
- ref = useObjectRef < HTMLElement > ( ref ) ;
585
+ ref = useObjectRef < HTMLDivElement > ( ref ) ;
587
586
let { rowHeaderProps, rowProps, rowGroupProps} = useGridListSection ( {
588
587
'aria-label' : props [ 'aria-label' ] ?? undefined
589
588
} , state , ref ) ;
@@ -598,33 +597,34 @@ export const GridListSection = /*#__PURE__*/ createBranchComponent(SectionNode,
598
597
delete DOMProps . id ;
599
598
600
599
return (
601
- < section
600
+ < div
602
601
{ ...mergeProps ( DOMProps , renderProps , rowGroupProps ) }
603
602
ref = { ref } >
604
603
< Provider
605
604
values = { [
606
- [ HeaderContext , { ...rowProps , ref : headingRef } ] ,
607
- [ GridListHeaderContext , { ...rowHeaderProps } ]
605
+ [ GridListHeaderContext , { ...rowProps , ref : headingRef } ] ,
606
+ [ GridListHeaderInnerContext , { ...rowHeaderProps } ]
608
607
] } >
609
608
< CollectionBranch
610
609
collection = { state . collection }
611
610
parent = { item } />
612
611
</ Provider >
613
- </ section >
612
+ </ div >
614
613
) ;
615
614
} ) ;
616
615
617
- const GridListHeaderContext = createContext < HTMLAttributes < HTMLElement > | null > ( null ) ;
616
+ export const GridListHeaderContext = createContext < ContextValue < HTMLAttributes < HTMLDivElement > , HTMLDivElement > > ( { } ) ;
617
+ const GridListHeaderInnerContext = createContext < HTMLAttributes < HTMLElement > | null > ( null ) ;
618
618
619
- export const GridListHeader = /*#__PURE__*/ createLeafComponent ( HeaderNode , function Header ( props : HTMLAttributes < HTMLElement > , ref : ForwardedRef < HTMLElement > ) {
620
- [ props , ref ] = useContextProps ( props , ref , HeaderContext ) ;
621
- let rowHeaderProps = useContext ( GridListHeaderContext ) ;
619
+ export const GridListHeader = /*#__PURE__*/ createLeafComponent ( HeaderNode , function Header ( props : HTMLAttributes < HTMLElement > , ref : ForwardedRef < HTMLDivElement > ) {
620
+ [ props , ref ] = useContextProps ( props , ref , GridListHeaderContext ) ;
621
+ let rowHeaderProps = useContext ( GridListHeaderInnerContext ) ;
622
622
623
623
return (
624
- < header className = "react-aria-GridListHeader" ref = { ref } { ...props } >
624
+ < div className = "react-aria-GridListHeader" ref = { ref } { ...props } >
625
625
< div { ...rowHeaderProps } style = { { display : 'contents' } } >
626
626
{ props . children }
627
627
</ div >
628
- </ header >
628
+ </ div >
629
629
) ;
630
630
} ) ;
0 commit comments