@react-types/shared 3.0.0-nightly.1626 → 3.0.0-nightly.1642
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/dnd.d.ts +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-types/shared",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.1642+3d93a8a75",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "3d93a8a75cc429d0a95ee4f380b7dc19f9b29ccd"
|
|
18
18
|
}
|
package/src/dnd.d.ts
CHANGED
|
@@ -119,11 +119,20 @@ export interface DragTypes {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
export interface DroppableCollectionProps {
|
|
122
|
+
/**
|
|
123
|
+
* A function returning the drop operation to be performed when items matching the given types are dropped
|
|
124
|
+
* on the drop target.
|
|
125
|
+
*/
|
|
122
126
|
getDropOperation?: (target: DropTarget, types: DragTypes, allowedOperations: DropOperation[]) => DropOperation,
|
|
127
|
+
/** Handler that is called when a valid drag element enters the drop target. */
|
|
123
128
|
onDropEnter?: (e: DroppableCollectionEnterEvent) => void,
|
|
129
|
+
/** Handler that is called when a valid drag element is moved within the drop target. */
|
|
124
130
|
onDropMove?: (e: DroppableCollectionMoveEvent) => void,
|
|
131
|
+
/** Handler that is called after a valid drag element is held over the drop target for a period of time. */
|
|
125
132
|
onDropActivate?: (e: DroppableCollectionActivateEvent) => void,
|
|
133
|
+
/** Handler that is called when a valid drag element exits the drop target. */
|
|
126
134
|
onDropExit?: (e: DroppableCollectionExitEvent) => void,
|
|
135
|
+
/** Handler that is called when a valid drag element is dropped on the drop target. */
|
|
127
136
|
onDrop?: (e: DroppableCollectionDropEvent) => void
|
|
128
137
|
}
|
|
129
138
|
|
|
@@ -142,10 +151,16 @@ interface DraggableCollectionEndEvent extends DragEndEvent {
|
|
|
142
151
|
export type DragPreviewRenderer = (items: DragItem[], callback: (node: HTMLElement) => void) => void;
|
|
143
152
|
|
|
144
153
|
export interface DraggableCollectionProps {
|
|
154
|
+
/** Handler that is called when a drag operation is started. */
|
|
145
155
|
onDragStart?: (e: DraggableCollectionStartEvent) => void,
|
|
156
|
+
/** Handler that is called when the dragged element is moved. */
|
|
146
157
|
onDragMove?: (e: DraggableCollectionMoveEvent) => void,
|
|
158
|
+
/** Handler that is called when the drag operation is ended, either as a result of a drop or a cancellation. */
|
|
147
159
|
onDragEnd?: (e: DraggableCollectionEndEvent) => void,
|
|
160
|
+
/** A function that returns the items being dragged. */
|
|
148
161
|
getItems: (keys: Set<Key>) => DragItem[],
|
|
162
|
+
/** The ref of the element that will be rendered as the drag preview while dragging. */
|
|
149
163
|
preview?: RefObject<DragPreviewRenderer>,
|
|
164
|
+
/** Function that returns the drop operations that are allowed for the dragged items. If not provided, all drop operations are allowed. */
|
|
150
165
|
getAllowedDropOperations?: () => DropOperation[]
|
|
151
166
|
}
|