-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(dnd): pass keys and draggedKey as arguments to renderDropIndicator #8459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Build successful! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I keyboard drag, every drop indicator appears in the storybook example
Build successful! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Behavior looks good to me, just one small comment. Happy for it to go in as it is though
@@ -59,7 +59,7 @@ interface DropHooks { | |||
useDroppableCollection?: (props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DroppableCollectionResult, | |||
useDroppableItem?: (options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DroppableItemResult, | |||
useDropIndicator?: (props: AriaDropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DropIndicatorAria, | |||
renderDropIndicator?: (target: DropTarget) => JSX.Element, | |||
renderDropIndicator?: (target: DropTarget, keys: Set<Key>, draggedKey?: Key) => JSX.Element, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the API is fine, its consistent with things like renderPreview
. One small nit would be to perhaps make keys
optional instead since we won't have access to keys/draggedKeys if the user is dropping from Finder for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was debating the same thing, and I think I agree. Just updated.
Build successful! 🎉 |
Build successful! 🎉 |
## API Changes
react-aria-components/react-aria-components:DragAndDropOptions DragAndDropOptions {
acceptedDragTypes?: 'all' | Array<string | symbol> = 'all'
dropTargetDelegate?: DropTargetDelegate
getAllowedDropOperations?: () => Array<DropOperation>
getDropOperation?: (DropTarget, DragTypes, Array<DropOperation>) => DropOperation
getItems?: (Set<Key>) => Array<DragItem> = () => []
isDisabled?: boolean
onDragEnd?: (DraggableCollectionEndEvent) => void
onDragMove?: (DraggableCollectionMoveEvent) => void
onDragStart?: (DraggableCollectionStartEvent) => void
onDrop?: (DroppableCollectionDropEvent) => void
onDropActivate?: (DroppableCollectionActivateEvent) => void
onDropEnter?: (DroppableCollectionEnterEvent) => void
onDropExit?: (DroppableCollectionExitEvent) => void
onInsert?: (DroppableCollectionInsertDropEvent) => void
onItemDrop?: (DroppableCollectionOnItemDropEvent) => void
onMove?: (DroppableCollectionReorderEvent) => void
onReorder?: (DroppableCollectionReorderEvent) => void
onRootDrop?: (DroppableCollectionRootDropEvent) => void
renderDragPreview?: (Array<DragItem>) => JSX.Element
- renderDropIndicator?: (DropTarget) => JSX.Element
+ renderDropIndicator?: (DropTarget, Set<Key>, Key) => JSX.Element
shouldAcceptItemDrop?: (ItemDropTarget, DragTypes) => boolean
} |
Closes #8410
Open to discussion on API/naming and if we want both of these.
✅ Pull Request Checklist:
📝 Test Instructions:
Try new story: https://reactspectrum.blob.core.windows.net/reactspectrum/6090fc812482ff07fece9c51c51dcab2b4a4e821/storybook/index.html?path=/story/react-aria-components--list-box-dnd-custom-drop-indicator&providerSwitcher-express=false
(not sure why the styles are broken in that story on the build, but they're also broken in the other listbox dnd story on main)
🧢 Your Project: