11'use client' ;
22
3- import { GridList , GridListItem } from 'vanilla-starter/GridList' ;
3+ import { ListBox , ListBoxItem } from 'vanilla-starter/ListBox' ;
4+ import { Folder , File } from 'lucide-react' ;
45import { useDragAndDrop , isTextDropItem } from 'react-aria-components' ;
56import { useListData } from 'react-stately' ;
6- import File from '@react-spectrum/s2/icons/File' ;
7- import Folder from '@react-spectrum/s2/icons/Folder' ;
87import React from 'react' ;
98
10- function BidirectionalDnDGridList ( props ) {
9+ function BidirectionalDnDListBox ( props ) {
1110 let { list} = props ;
1211 let { dragAndDropHooks} = useDragAndDrop ( {
1312 acceptedDragTypes : [ 'custom-app-type-bidirectional' ] ,
@@ -78,20 +77,19 @@ function BidirectionalDnDGridList(props) {
7877 } ) ;
7978
8079 return (
81- < GridList
80+ < ListBox
8281 aria-label = { props [ 'aria-label' ] }
8382 selectionMode = "multiple"
84- layout = "list"
8583 items = { list . items }
8684 dragAndDropHooks = { dragAndDropHooks }
87- style = { { width : 300 , height : 300 } } >
85+ style = { { width : 300 , height : 300 , overflow : 'auto' } } >
8886 { item => (
89- < GridListItem textValue = { item . name } >
87+ < ListBoxItem textValue = { item . name } style = { { display : 'flex' , alignItems : 'center' , gap : 8 , flexDirection : 'row' , justifyContent : 'flex-start' } } >
9088 { item . type === 'folder' ? < Folder /> : < File /> }
9189 < span > { item . name } </ span >
92- </ GridListItem >
90+ </ ListBoxItem >
9391 ) }
94- </ GridList >
92+ </ ListBox >
9593 ) ;
9694}
9795
@@ -121,8 +119,8 @@ export default function DragBetweenListsExample() {
121119
122120 return (
123121 < div style = { { display : 'flex' , justifyContent : 'center' , flexWrap : 'wrap' , gap : 8 } } >
124- < BidirectionalDnDGridList list = { list1 } aria-label = "First GridList in drag between list example" />
125- < BidirectionalDnDGridList list = { list2 } aria-label = "Second GridList in drag between list example" />
122+ < BidirectionalDnDListBox list = { list1 } aria-label = "First ListBox in drag between list example" />
123+ < BidirectionalDnDListBox list = { list2 } aria-label = "Second ListBox in drag between list example" />
126124 </ div >
127125 ) ;
128126}
0 commit comments