10
10
* governing permissions and limitations under the License.
11
11
*/
12
12
13
- import { DOMAttributes , Node as RSNode } from '@react-types/shared' ;
14
- import type { ListState } from '@react-stately/list' ;
13
+ import { DOMAttributes } from '@react-types/shared' ;
15
14
import { useLabels , useSlotId } from '@react-aria/utils' ;
16
15
17
16
export interface AriaGridListSectionProps {
18
17
/** An accessibility label for the section. Required if `heading` is not present. */
19
- 'aria-label' ?: string ,
20
- /** Whether the list row is contained in a virtual scroller. */
21
- isVirtualized ?: boolean ,
22
- /** An object representing the list item. Contains all the relevant information that makes up the list row. */
23
- node : RSNode < unknown >
18
+ 'aria-label' ?: string
24
19
}
25
20
26
21
export interface GridListSectionAria {
@@ -39,26 +34,16 @@ export interface GridListSectionAria {
39
34
* See `useGridList` for more details about grid list.
40
35
* @param props - Props for the section.
41
36
*/
42
- export function useGridListSection < T > ( props : AriaGridListSectionProps , state : ListState < T > ) : GridListSectionAria {
43
- let { 'aria-label' : ariaLabel , isVirtualized , node } = props ;
37
+ export function useGridListSection ( props : AriaGridListSectionProps ) : GridListSectionAria {
38
+ let { 'aria-label' : ariaLabel } = props ;
44
39
let headingId = useSlotId ( ) ;
45
40
let labelProps = useLabels ( {
46
41
'aria-label' : ariaLabel ,
47
42
'aria-labelledby' : headingId
48
43
} ) ;
49
- let rowIndex : number | undefined = undefined ;
50
-
51
- if ( isVirtualized ) {
52
- let { collection} = state ;
53
- let filteredCollection = [ ...collection . getKeys ( ) ] . filter ( ( key ) => collection . getItem ( key ) ?. type !== 'header' ) ;
54
- let prevItem = node . prevKey ? state . collection . getItem ( node . prevKey ) : undefined ;
55
- rowIndex = prevItem ? filteredCollection . findIndex ( ( key ) => key === prevItem . key ) + 2 : node . index + 1 ;
56
- }
57
-
58
44
return {
59
45
rowProps : {
60
- role : 'row' ,
61
- 'aria-rowindex' : rowIndex
46
+ role : 'row'
62
47
} ,
63
48
rowHeaderProps : {
64
49
id : headingId ,
0 commit comments