@react-spectrum/dnd 3.6.5 → 3.7.0
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/dist/import.mjs +2 -4
- package/dist/main.js +3 -5
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -4
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +3 -0
- package/package.json +15 -28
- package/src/index.ts +4 -27
- package/dist/types.d.ts +0 -42
- package/dist/types.d.ts.map +0 -1
- package/dist/useDragAndDrop.main.js +0 -70
- package/dist/useDragAndDrop.main.js.map +0 -1
- package/dist/useDragAndDrop.mjs +0 -65
- package/dist/useDragAndDrop.module.js +0 -65
- package/dist/useDragAndDrop.module.js.map +0 -1
- package/src/useDragAndDrop.ts +0 -123
package/dist/import.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {useDragAndDrop as $
|
|
2
|
-
import {DIRECTORY_DRAG_TYPE as $bd7af2e3e7bb229d$re_export$DIRECTORY_DRAG_TYPE} from "@react-aria/dnd";
|
|
1
|
+
import {useDragAndDrop as $8559adf414855f01$re_export$useDragAndDrop, DIRECTORY_DRAG_TYPE as $8559adf414855f01$re_export$DIRECTORY_DRAG_TYPE} from "@adobe/react-spectrum/useDragAndDrop";
|
|
3
2
|
|
|
4
3
|
/*
|
|
5
4
|
* Copyright 2022 Adobe. All rights reserved.
|
|
@@ -15,6 +14,5 @@ import {DIRECTORY_DRAG_TYPE as $bd7af2e3e7bb229d$re_export$DIRECTORY_DRAG_TYPE}
|
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
export {$8d44a09a765f4c9c$export$2cfc5be7a55829f6 as useDragAndDrop, $bd7af2e3e7bb229d$re_export$DIRECTORY_DRAG_TYPE as DIRECTORY_DRAG_TYPE};
|
|
17
|
+
export {$8559adf414855f01$re_export$useDragAndDrop as useDragAndDrop, $8559adf414855f01$re_export$DIRECTORY_DRAG_TYPE as DIRECTORY_DRAG_TYPE};
|
|
20
18
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $9OUiQ$reactariadnd = require("@react-aria/dnd");
|
|
1
|
+
var $cndK1$adobereactspectrumuseDragAndDrop = require("@adobe/react-spectrum/useDragAndDrop");
|
|
3
2
|
|
|
4
3
|
|
|
5
4
|
function $parcel$export(e, n, v, s) {
|
|
6
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
6
|
}
|
|
8
7
|
|
|
9
|
-
$parcel$export(module.exports, "useDragAndDrop", ()
|
|
10
|
-
$parcel$export(module.exports, "DIRECTORY_DRAG_TYPE", ()
|
|
8
|
+
$parcel$export(module.exports, "useDragAndDrop", function () { return $cndK1$adobereactspectrumuseDragAndDrop.useDragAndDrop; });
|
|
9
|
+
$parcel$export(module.exports, "DIRECTORY_DRAG_TYPE", function () { return $cndK1$adobereactspectrumuseDragAndDrop.DIRECTORY_DRAG_TYPE; });
|
|
11
10
|
/*
|
|
12
11
|
* Copyright 2022 Adobe. All rights reserved.
|
|
13
12
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -22,5 +21,4 @@ $parcel$export(module.exports, "DIRECTORY_DRAG_TYPE", () => $9OUiQ$reactariadnd.
|
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
|
|
25
|
-
|
|
26
24
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/dnd/src/index.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {useDragAndDrop, DIRECTORY_DRAG_TYPE} from '@adobe/react-spectrum/useDragAndDrop';\n\nexport type {DragAndDropOptions, DragAndDropHooks} from '@adobe/react-spectrum/useDragAndDrop';\n\nexport type {DirectoryDropItem, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem} from '@react-types/shared';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {useDragAndDrop as $
|
|
2
|
-
import {DIRECTORY_DRAG_TYPE as $bd7af2e3e7bb229d$re_export$DIRECTORY_DRAG_TYPE} from "@react-aria/dnd";
|
|
1
|
+
import {useDragAndDrop as $8559adf414855f01$re_export$useDragAndDrop, DIRECTORY_DRAG_TYPE as $8559adf414855f01$re_export$DIRECTORY_DRAG_TYPE} from "@adobe/react-spectrum/useDragAndDrop";
|
|
3
2
|
|
|
4
3
|
/*
|
|
5
4
|
* Copyright 2022 Adobe. All rights reserved.
|
|
@@ -15,6 +14,5 @@ import {DIRECTORY_DRAG_TYPE as $bd7af2e3e7bb229d$re_export$DIRECTORY_DRAG_TYPE}
|
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
export {$8d44a09a765f4c9c$export$2cfc5be7a55829f6 as useDragAndDrop, $bd7af2e3e7bb229d$re_export$DIRECTORY_DRAG_TYPE as DIRECTORY_DRAG_TYPE};
|
|
17
|
+
export {$8559adf414855f01$re_export$useDragAndDrop as useDragAndDrop, $8559adf414855f01$re_export$DIRECTORY_DRAG_TYPE as DIRECTORY_DRAG_TYPE};
|
|
20
18
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/dnd/src/index.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {useDragAndDrop, DIRECTORY_DRAG_TYPE} from '@adobe/react-spectrum/useDragAndDrop';\n\nexport type {DragAndDropOptions, DragAndDropHooks} from '@adobe/react-spectrum/useDragAndDrop';\n\nexport type {DirectoryDropItem, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem} from '@react-types/shared';\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useDragAndDrop, DIRECTORY_DRAG_TYPE } from '@adobe/react-spectrum/useDragAndDrop';
|
|
2
|
+
export type { DragAndDropOptions, DragAndDropHooks } from '@adobe/react-spectrum/useDragAndDrop';
|
|
3
|
+
export type { DirectoryDropItem, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem } from '@react-types/shared';
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/dnd",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
8
|
"exports": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"./dist/types.d.ts",
|
|
12
|
-
"./
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/types/src/index.d.ts",
|
|
12
|
+
"import": "./dist/import.mjs",
|
|
13
|
+
"require": "./dist/main.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
16
|
},
|
|
17
|
-
"types": "dist/types.d.ts",
|
|
17
|
+
"types": "dist/types/src/index.d.ts",
|
|
18
18
|
"source": "src/index.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
@@ -24,37 +24,24 @@
|
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
26
|
"targets": {
|
|
27
|
-
"
|
|
28
|
-
"includeNodeModules": [
|
|
29
|
-
"@adobe/spectrum-css-temp"
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
"module": {
|
|
33
|
-
"includeNodeModules": [
|
|
34
|
-
"@adobe/spectrum-css-temp"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
27
|
+
"types": false
|
|
37
28
|
},
|
|
38
29
|
"repository": {
|
|
39
30
|
"type": "git",
|
|
40
31
|
"url": "https://github.com/adobe/react-spectrum"
|
|
41
32
|
},
|
|
42
33
|
"dependencies": {
|
|
43
|
-
"@react-
|
|
44
|
-
"@react-
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
47
|
-
},
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@adobe/spectrum-css-temp": "3.0.0-alpha.1"
|
|
34
|
+
"@adobe/react-spectrum": "3.47.0",
|
|
35
|
+
"@react-types/shared": "^3.34.0",
|
|
36
|
+
"@swc/helpers": "^0.5.0",
|
|
37
|
+
"react-aria": "3.48.0"
|
|
50
38
|
},
|
|
51
39
|
"peerDependencies": {
|
|
52
|
-
"@react-spectrum/provider": "^3.0.0",
|
|
53
40
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
54
41
|
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
55
42
|
},
|
|
56
43
|
"publishConfig": {
|
|
57
44
|
"access": "public"
|
|
58
45
|
},
|
|
59
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
60
47
|
}
|
package/src/index.ts
CHANGED
|
@@ -12,31 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
/// <reference types="css-module-types" />
|
|
14
14
|
|
|
15
|
-
export
|
|
16
|
-
export {useDragAndDrop} from './useDragAndDrop';
|
|
17
|
-
export {DIRECTORY_DRAG_TYPE} from '@react-aria/dnd';
|
|
15
|
+
export {useDragAndDrop, DIRECTORY_DRAG_TYPE} from '@adobe/react-spectrum/useDragAndDrop';
|
|
18
16
|
|
|
19
|
-
export type {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
DraggableCollectionMoveEvent,
|
|
23
|
-
DraggableCollectionStartEvent,
|
|
24
|
-
DragPreviewRenderer,
|
|
25
|
-
DragTypes,
|
|
26
|
-
DropItem,
|
|
27
|
-
DropOperation,
|
|
28
|
-
DroppableCollectionDropEvent,
|
|
29
|
-
DroppableCollectionEnterEvent,
|
|
30
|
-
DroppableCollectionExitEvent,
|
|
31
|
-
DroppableCollectionInsertDropEvent,
|
|
32
|
-
DroppableCollectionMoveEvent,
|
|
33
|
-
DroppableCollectionOnItemDropEvent,
|
|
34
|
-
DroppableCollectionReorderEvent,
|
|
35
|
-
DroppableCollectionRootDropEvent,
|
|
36
|
-
DropPosition,
|
|
37
|
-
DropTarget,
|
|
38
|
-
FileDropItem,
|
|
39
|
-
ItemDropTarget,
|
|
40
|
-
RootDropTarget,
|
|
41
|
-
TextDropItem
|
|
42
|
-
} from '@react-types/shared';
|
|
17
|
+
export type {DragAndDropOptions, DragAndDropHooks} from '@adobe/react-spectrum/useDragAndDrop';
|
|
18
|
+
|
|
19
|
+
export type {DirectoryDropItem, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem} from '@react-types/shared';
|
package/dist/types.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { DraggableCollectionOptions, DraggableItemProps, DraggableItemResult, DragPreview, DropIndicatorAria, DropIndicatorProps, DroppableCollectionOptions, DroppableCollectionResult, DroppableItemOptions, DroppableItemResult } from "@react-aria/dnd";
|
|
2
|
-
import { DraggableCollectionProps, DragItem, DroppableCollectionProps, Key, RefObject } from "@react-types/shared";
|
|
3
|
-
import { DraggableCollectionState, DraggableCollectionStateOptions, DroppableCollectionState, DroppableCollectionStateOptions } from "@react-stately/dnd";
|
|
4
|
-
import { JSX } from "react";
|
|
5
|
-
interface DraggableCollectionStateOpts<T> extends Omit<DraggableCollectionStateOptions<T>, 'getItems'> {
|
|
6
|
-
}
|
|
7
|
-
interface DragHooks<T = object> {
|
|
8
|
-
useDraggableCollectionState?: (props: DraggableCollectionStateOpts<T>) => DraggableCollectionState;
|
|
9
|
-
useDraggableCollection?: (props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement | null>) => void;
|
|
10
|
-
useDraggableItem?: (props: DraggableItemProps, state: DraggableCollectionState) => DraggableItemResult;
|
|
11
|
-
DragPreview?: typeof DragPreview;
|
|
12
|
-
}
|
|
13
|
-
interface DropHooks {
|
|
14
|
-
useDroppableCollectionState?: (props: DroppableCollectionStateOptions) => DroppableCollectionState;
|
|
15
|
-
useDroppableCollection?: (props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DroppableCollectionResult;
|
|
16
|
-
useDroppableItem?: (options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DroppableItemResult;
|
|
17
|
-
useDropIndicator?: (props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DropIndicatorAria;
|
|
18
|
-
}
|
|
19
|
-
export interface DragAndDropHooks<T = object> {
|
|
20
|
-
/** Drag and drop hooks for the collection element. */
|
|
21
|
-
dragAndDropHooks: DragHooks<T> & DropHooks & {
|
|
22
|
-
isVirtualDragging?: () => boolean;
|
|
23
|
-
renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export interface DragAndDropOptions<T = object> extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, Omit<DroppableCollectionProps, 'onMove'> {
|
|
27
|
-
/**
|
|
28
|
-
* A function that returns the items being dragged. If not specified, we assume that the collection is not draggable.
|
|
29
|
-
* @default () => []
|
|
30
|
-
*/
|
|
31
|
-
getItems?: (keys: Set<Key>, items: T[]) => DragItem[];
|
|
32
|
-
/** Provide a custom drag preview. `draggedKey` represents the key of the item the user actually dragged. */
|
|
33
|
-
renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Provides the hooks required to enable drag and drop behavior for a drag and drop compatible React Spectrum component.
|
|
37
|
-
*/
|
|
38
|
-
export function useDragAndDrop<T = object>(options: DragAndDropOptions<T>): DragAndDropHooks;
|
|
39
|
-
export { DIRECTORY_DRAG_TYPE } from '@react-aria/dnd';
|
|
40
|
-
export type { DirectoryDropItem, DraggableCollectionEndEvent, DraggableCollectionMoveEvent, DraggableCollectionStartEvent, DragPreviewRenderer, DragTypes, DropItem, DropOperation, DroppableCollectionDropEvent, DroppableCollectionEnterEvent, DroppableCollectionExitEvent, DroppableCollectionInsertDropEvent, DroppableCollectionMoveEvent, DroppableCollectionOnItemDropEvent, DroppableCollectionReorderEvent, DroppableCollectionRootDropEvent, DropPosition, DropTarget, FileDropItem, ItemDropTarget, RootDropTarget, TextDropItem } from '@react-types/shared';
|
|
41
|
-
|
|
42
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;AAyCA,uCAAuC,CAAC,CAAE,SAAQ,IAAI,CAAC,gCAAgC,CAAC,CAAC,EAAE,UAAU,CAAC;CAAG;AAEzG,oBAAoB,CAAC,GAAG,MAAM;IAC5B,2BAA2B,CAAC,EAAE,CAAC,KAAK,EAAE,6BAA6B,CAAC,CAAC,KAAK,wBAAwB,CAAC;IACnG,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC;IAC1I,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,wBAAwB,KAAK,mBAAmB,CAAC;IACvG,WAAW,CAAC,EAAE,kBAAkB,CAAA;CACjC;AAED;IACE,2BAA2B,CAAC,EAAE,CAAC,KAAK,EAAE,+BAA+B,KAAK,wBAAwB,CAAC;IACnG,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,KAAK,yBAAyB,CAAC;IAC/J,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,KAAK,mBAAmB,CAAC;IAC/I,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,KAAK,iBAAiB,CAAA;CACzI;AAED,kCAAkC,CAAC,GAAG,MAAM;IAC1C,uDAAuD;IACvD,gBAAgB,EAAE,UAAU,CAAC,CAAC,GAAG,SAAS,GAAG;QAAC,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC;QAAC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,UAAU,EAAE,GAAG,KAAK,IAAI,OAAO,CAAA;KAAC,CAAA;CACnJ;AAED,oCAAoC,CAAC,GAAG,MAAM,CAAE,SAAQ,IAAI,CAAC,wBAAwB,EAAE,SAAS,GAAG,UAAU,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,QAAQ,CAAC;IACtJ;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,QAAQ,EAAE,CAAC;IACtD,4GAA4G;IAC5G,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,UAAU,EAAE,GAAG,KAAK,IAAI,OAAO,CAAA;CACjE;AAED;;GAEG;AACH,+BAA+B,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC,GAAG,gBAAgB,CA+C3F;AC1GD,OAAO,EAAC,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAEpD,YAAY,EACV,iBAAiB,EACjB,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,aAAa,EACb,4BAA4B,EAC5B,6BAA6B,EAC7B,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,kCAAkC,EAClC,+BAA+B,EAC/B,gCAAgC,EAChC,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACb,MAAM,qBAAqB,CAAC","sources":["packages/@react-spectrum/dnd/src/packages/@react-spectrum/dnd/src/useDragAndDrop.ts","packages/@react-spectrum/dnd/src/packages/@react-spectrum/dnd/src/index.ts","packages/@react-spectrum/dnd/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport type {DragAndDropOptions, DragAndDropHooks} from './useDragAndDrop';\nexport {useDragAndDrop} from './useDragAndDrop';\nexport {DIRECTORY_DRAG_TYPE} from '@react-aria/dnd';\n\nexport type {\n DirectoryDropItem,\n DraggableCollectionEndEvent,\n DraggableCollectionMoveEvent,\n DraggableCollectionStartEvent,\n DragPreviewRenderer,\n DragTypes,\n DropItem,\n DropOperation,\n DroppableCollectionDropEvent,\n DroppableCollectionEnterEvent,\n DroppableCollectionExitEvent,\n DroppableCollectionInsertDropEvent,\n DroppableCollectionMoveEvent,\n DroppableCollectionOnItemDropEvent,\n DroppableCollectionReorderEvent,\n DroppableCollectionRootDropEvent,\n DropPosition,\n DropTarget,\n FileDropItem,\n ItemDropTarget,\n RootDropTarget,\n TextDropItem\n} from '@react-types/shared';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
var $9NCiI$reactariadnd = require("@react-aria/dnd");
|
|
2
|
-
var $9NCiI$reactstatelydnd = require("@react-stately/dnd");
|
|
3
|
-
var $9NCiI$react = require("react");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function $parcel$export(e, n, v, s) {
|
|
7
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
$parcel$export(module.exports, "useDragAndDrop", () => $e96ca2229d77f411$export$2cfc5be7a55829f6);
|
|
11
|
-
/*
|
|
12
|
-
* Copyright 2022 Adobe. All rights reserved.
|
|
13
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
-
* governing permissions and limitations under the License.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function $e96ca2229d77f411$export$2cfc5be7a55829f6(options) {
|
|
25
|
-
let dragAndDropHooks = (0, $9NCiI$react.useMemo)(()=>{
|
|
26
|
-
let { onDrop: onDrop, onInsert: onInsert, onItemDrop: onItemDrop, onReorder: onReorder, onRootDrop: onRootDrop, getItems: getItems, renderPreview: renderPreview } = options;
|
|
27
|
-
let isDraggable = !!getItems;
|
|
28
|
-
let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onRootDrop);
|
|
29
|
-
let hooks = {};
|
|
30
|
-
if (isDraggable) {
|
|
31
|
-
hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props) {
|
|
32
|
-
return (0, $9NCiI$reactstatelydnd.useDraggableCollectionState)({
|
|
33
|
-
...props,
|
|
34
|
-
...options,
|
|
35
|
-
getItems: options.getItems
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
hooks.useDraggableCollection = (0, $9NCiI$reactariadnd.useDraggableCollection);
|
|
39
|
-
hooks.useDraggableItem = (0, $9NCiI$reactariadnd.useDraggableItem);
|
|
40
|
-
hooks.DragPreview = (0, $9NCiI$reactariadnd.DragPreview);
|
|
41
|
-
hooks.renderPreview = renderPreview;
|
|
42
|
-
}
|
|
43
|
-
if (isDroppable) {
|
|
44
|
-
hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props) {
|
|
45
|
-
return (0, $9NCiI$reactstatelydnd.useDroppableCollectionState)({
|
|
46
|
-
...props,
|
|
47
|
-
...options
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
hooks.useDroppableItem = (0, $9NCiI$reactariadnd.useDroppableItem);
|
|
51
|
-
hooks.useDroppableCollection = function useDroppableCollectionOverride(props, state, ref) {
|
|
52
|
-
return (0, $9NCiI$reactariadnd.useDroppableCollection)({
|
|
53
|
-
...props,
|
|
54
|
-
...options
|
|
55
|
-
}, state, ref);
|
|
56
|
-
};
|
|
57
|
-
hooks.useDropIndicator = (0, $9NCiI$reactariadnd.useDropIndicator);
|
|
58
|
-
}
|
|
59
|
-
if (isDraggable || isDroppable) hooks.isVirtualDragging = (0, $9NCiI$reactariadnd.isVirtualDragging);
|
|
60
|
-
return hooks;
|
|
61
|
-
}, [
|
|
62
|
-
options
|
|
63
|
-
]);
|
|
64
|
-
return {
|
|
65
|
-
dragAndDropHooks: dragAndDropHooks
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
//# sourceMappingURL=useDragAndDrop.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAiEM,SAAS,0CAA2B,OAA8B;IACvE,IAAI,mBAAmB,CAAA,GAAA,oBAAM,EAAE;QAC7B,IAAI,UACF,MAAM,YACN,QAAQ,cACR,UAAU,aACV,SAAS,cACT,UAAU,YACV,QAAQ,iBACR,aAAa,EACb,GAAG;QAEL,IAAI,cAAc,CAAC,CAAC;QACpB,IAAI,cAAc,CAAC,CAAE,CAAA,UAAU,YAAY,cAAc,aAAa,UAAS;QAE/E,IAAI,QAAQ,CAAC;QACb,IAAI,aAAa;YACf,MAAM,2BAA2B,GAAG,SAAS,oCAAoC,KAAsC;gBACrH,OAAO,CAAA,GAAA,kDAA0B,EAAE;oBAAC,GAAG,KAAK;oBAAE,GAAG,OAAO;oBAAE,UAAU,QAAQ,QAAQ;gBAAC;YACvF;YACA,MAAM,sBAAsB,GAAG,CAAA,GAAA,0CAAqB;YACpD,MAAM,gBAAgB,GAAG,CAAA,GAAA,oCAAe;YACxC,MAAM,WAAW,GAAG,CAAA,GAAA,+BAAU;YAC9B,MAAM,aAAa,GAAG;QACxB;QAEA,IAAI,aAAa;YACf,MAAM,2BAA2B,GAAG,SAAS,oCAAoC,KAAsC;gBACrH,OAAO,CAAA,GAAA,kDAA0B,EAAE;oBAAC,GAAG,KAAK;oBAAE,GAAG,OAAO;gBAAA;YAC1D;YACA,MAAM,gBAAgB,GAAG,CAAA,GAAA,oCAAe;YACxC,MAAM,sBAAsB,GAAG,SAAS,+BAA+B,KAAiC,EAAE,KAA+B,EAAE,GAAkC;gBAC3K,OAAO,CAAA,GAAA,0CAAqB,EAAE;oBAAC,GAAG,KAAK;oBAAE,GAAG,OAAO;gBAAA,GAAG,OAAO;YAC/D;YACA,MAAM,gBAAgB,GAAG,CAAA,GAAA,oCAAe;QAC1C;QAEA,IAAI,eAAe,aACjB,MAAM,iBAAiB,GAAG,CAAA,GAAA,qCAAgB;QAG5C,OAAO;IACT,GAAG;QAAC;KAAQ;IAEZ,OAAO;QACL,kBAAkB;IACpB;AACF","sources":["packages/@react-spectrum/dnd/src/useDragAndDrop.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n DraggableCollectionOptions,\n DraggableItemProps,\n DraggableItemResult,\n DragPreview,\n DropIndicatorAria,\n DropIndicatorProps,\n DroppableCollectionOptions,\n DroppableCollectionResult,\n DroppableItemOptions,\n DroppableItemResult,\n isVirtualDragging,\n useDraggableCollection,\n useDraggableItem,\n useDropIndicator,\n useDroppableCollection,\n useDroppableItem\n} from '@react-aria/dnd';\nimport {DraggableCollectionProps, DragItem, DroppableCollectionProps, Key, RefObject} from '@react-types/shared';\nimport {\n DraggableCollectionState,\n DraggableCollectionStateOptions,\n DroppableCollectionState,\n DroppableCollectionStateOptions,\n useDraggableCollectionState,\n useDroppableCollectionState\n} from '@react-stately/dnd';\nimport {JSX, useMemo} from 'react';\n\ninterface DraggableCollectionStateOpts<T> extends Omit<DraggableCollectionStateOptions<T>, 'getItems'> {}\n\ninterface DragHooks<T = object> {\n useDraggableCollectionState?: (props: DraggableCollectionStateOpts<T>) => DraggableCollectionState,\n useDraggableCollection?: (props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement | null>) => void,\n useDraggableItem?: (props: DraggableItemProps, state: DraggableCollectionState) => DraggableItemResult,\n DragPreview?: typeof DragPreview\n}\n\ninterface DropHooks {\n useDroppableCollectionState?: (props: DroppableCollectionStateOptions) => DroppableCollectionState,\n useDroppableCollection?: (props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DroppableCollectionResult,\n useDroppableItem?: (options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DroppableItemResult,\n useDropIndicator?: (props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DropIndicatorAria\n}\n\nexport interface DragAndDropHooks<T = object> {\n /** Drag and drop hooks for the collection element. */\n dragAndDropHooks: DragHooks<T> & DropHooks & {isVirtualDragging?: () => boolean, renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element}\n}\n\nexport interface DragAndDropOptions<T = object> extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, Omit<DroppableCollectionProps, 'onMove'> {\n /**\n * A function that returns the items being dragged. If not specified, we assume that the collection is not draggable.\n * @default () => []\n */\n getItems?: (keys: Set<Key>, items: T[]) => DragItem[],\n /** Provide a custom drag preview. `draggedKey` represents the key of the item the user actually dragged. */\n renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element\n}\n\n/**\n * Provides the hooks required to enable drag and drop behavior for a drag and drop compatible React Spectrum component.\n */\nexport function useDragAndDrop<T = object>(options: DragAndDropOptions<T>): DragAndDropHooks {\n let dragAndDropHooks = useMemo(() => {\n let {\n onDrop,\n onInsert,\n onItemDrop,\n onReorder,\n onRootDrop,\n getItems,\n renderPreview\n } = options;\n\n let isDraggable = !!getItems;\n let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onRootDrop);\n\n let hooks = {} as DragHooks & DropHooks & {isVirtualDragging?: () => boolean, renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element};\n if (isDraggable) {\n hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props: DraggableCollectionStateOpts<T>) {\n return useDraggableCollectionState({...props, ...options, getItems: options.getItems!});\n };\n hooks.useDraggableCollection = useDraggableCollection;\n hooks.useDraggableItem = useDraggableItem;\n hooks.DragPreview = DragPreview;\n hooks.renderPreview = renderPreview;\n }\n\n if (isDroppable) {\n hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props: DroppableCollectionStateOptions) {\n return useDroppableCollectionState({...props, ...options});\n };\n hooks.useDroppableItem = useDroppableItem;\n hooks.useDroppableCollection = function useDroppableCollectionOverride(props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) {\n return useDroppableCollection({...props, ...options}, state, ref);\n };\n hooks.useDropIndicator = useDropIndicator;\n }\n\n if (isDraggable || isDroppable) {\n hooks.isVirtualDragging = isVirtualDragging;\n }\n\n return hooks;\n }, [options]);\n\n return {\n dragAndDropHooks: dragAndDropHooks\n };\n}\n"],"names":[],"version":3,"file":"useDragAndDrop.main.js.map"}
|
package/dist/useDragAndDrop.mjs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {useDraggableCollection as $ejrPO$useDraggableCollection, useDraggableItem as $ejrPO$useDraggableItem, DragPreview as $ejrPO$DragPreview, useDroppableItem as $ejrPO$useDroppableItem, useDroppableCollection as $ejrPO$useDroppableCollection, useDropIndicator as $ejrPO$useDropIndicator, isVirtualDragging as $ejrPO$isVirtualDragging} from "@react-aria/dnd";
|
|
2
|
-
import {useDraggableCollectionState as $ejrPO$useDraggableCollectionState, useDroppableCollectionState as $ejrPO$useDroppableCollectionState} from "@react-stately/dnd";
|
|
3
|
-
import {useMemo as $ejrPO$useMemo} from "react";
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright 2022 Adobe. All rights reserved.
|
|
7
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
-
* governing permissions and limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function $8d44a09a765f4c9c$export$2cfc5be7a55829f6(options) {
|
|
19
|
-
let dragAndDropHooks = (0, $ejrPO$useMemo)(()=>{
|
|
20
|
-
let { onDrop: onDrop, onInsert: onInsert, onItemDrop: onItemDrop, onReorder: onReorder, onRootDrop: onRootDrop, getItems: getItems, renderPreview: renderPreview } = options;
|
|
21
|
-
let isDraggable = !!getItems;
|
|
22
|
-
let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onRootDrop);
|
|
23
|
-
let hooks = {};
|
|
24
|
-
if (isDraggable) {
|
|
25
|
-
hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props) {
|
|
26
|
-
return (0, $ejrPO$useDraggableCollectionState)({
|
|
27
|
-
...props,
|
|
28
|
-
...options,
|
|
29
|
-
getItems: options.getItems
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
hooks.useDraggableCollection = (0, $ejrPO$useDraggableCollection);
|
|
33
|
-
hooks.useDraggableItem = (0, $ejrPO$useDraggableItem);
|
|
34
|
-
hooks.DragPreview = (0, $ejrPO$DragPreview);
|
|
35
|
-
hooks.renderPreview = renderPreview;
|
|
36
|
-
}
|
|
37
|
-
if (isDroppable) {
|
|
38
|
-
hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props) {
|
|
39
|
-
return (0, $ejrPO$useDroppableCollectionState)({
|
|
40
|
-
...props,
|
|
41
|
-
...options
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
hooks.useDroppableItem = (0, $ejrPO$useDroppableItem);
|
|
45
|
-
hooks.useDroppableCollection = function useDroppableCollectionOverride(props, state, ref) {
|
|
46
|
-
return (0, $ejrPO$useDroppableCollection)({
|
|
47
|
-
...props,
|
|
48
|
-
...options
|
|
49
|
-
}, state, ref);
|
|
50
|
-
};
|
|
51
|
-
hooks.useDropIndicator = (0, $ejrPO$useDropIndicator);
|
|
52
|
-
}
|
|
53
|
-
if (isDraggable || isDroppable) hooks.isVirtualDragging = (0, $ejrPO$isVirtualDragging);
|
|
54
|
-
return hooks;
|
|
55
|
-
}, [
|
|
56
|
-
options
|
|
57
|
-
]);
|
|
58
|
-
return {
|
|
59
|
-
dragAndDropHooks: dragAndDropHooks
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
export {$8d44a09a765f4c9c$export$2cfc5be7a55829f6 as useDragAndDrop};
|
|
65
|
-
//# sourceMappingURL=useDragAndDrop.module.js.map
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import {useDraggableCollection as $ejrPO$useDraggableCollection, useDraggableItem as $ejrPO$useDraggableItem, DragPreview as $ejrPO$DragPreview, useDroppableItem as $ejrPO$useDroppableItem, useDroppableCollection as $ejrPO$useDroppableCollection, useDropIndicator as $ejrPO$useDropIndicator, isVirtualDragging as $ejrPO$isVirtualDragging} from "@react-aria/dnd";
|
|
2
|
-
import {useDraggableCollectionState as $ejrPO$useDraggableCollectionState, useDroppableCollectionState as $ejrPO$useDroppableCollectionState} from "@react-stately/dnd";
|
|
3
|
-
import {useMemo as $ejrPO$useMemo} from "react";
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright 2022 Adobe. All rights reserved.
|
|
7
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
-
* governing permissions and limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function $8d44a09a765f4c9c$export$2cfc5be7a55829f6(options) {
|
|
19
|
-
let dragAndDropHooks = (0, $ejrPO$useMemo)(()=>{
|
|
20
|
-
let { onDrop: onDrop, onInsert: onInsert, onItemDrop: onItemDrop, onReorder: onReorder, onRootDrop: onRootDrop, getItems: getItems, renderPreview: renderPreview } = options;
|
|
21
|
-
let isDraggable = !!getItems;
|
|
22
|
-
let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onRootDrop);
|
|
23
|
-
let hooks = {};
|
|
24
|
-
if (isDraggable) {
|
|
25
|
-
hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props) {
|
|
26
|
-
return (0, $ejrPO$useDraggableCollectionState)({
|
|
27
|
-
...props,
|
|
28
|
-
...options,
|
|
29
|
-
getItems: options.getItems
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
hooks.useDraggableCollection = (0, $ejrPO$useDraggableCollection);
|
|
33
|
-
hooks.useDraggableItem = (0, $ejrPO$useDraggableItem);
|
|
34
|
-
hooks.DragPreview = (0, $ejrPO$DragPreview);
|
|
35
|
-
hooks.renderPreview = renderPreview;
|
|
36
|
-
}
|
|
37
|
-
if (isDroppable) {
|
|
38
|
-
hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props) {
|
|
39
|
-
return (0, $ejrPO$useDroppableCollectionState)({
|
|
40
|
-
...props,
|
|
41
|
-
...options
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
hooks.useDroppableItem = (0, $ejrPO$useDroppableItem);
|
|
45
|
-
hooks.useDroppableCollection = function useDroppableCollectionOverride(props, state, ref) {
|
|
46
|
-
return (0, $ejrPO$useDroppableCollection)({
|
|
47
|
-
...props,
|
|
48
|
-
...options
|
|
49
|
-
}, state, ref);
|
|
50
|
-
};
|
|
51
|
-
hooks.useDropIndicator = (0, $ejrPO$useDropIndicator);
|
|
52
|
-
}
|
|
53
|
-
if (isDraggable || isDroppable) hooks.isVirtualDragging = (0, $ejrPO$isVirtualDragging);
|
|
54
|
-
return hooks;
|
|
55
|
-
}, [
|
|
56
|
-
options
|
|
57
|
-
]);
|
|
58
|
-
return {
|
|
59
|
-
dragAndDropHooks: dragAndDropHooks
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
export {$8d44a09a765f4c9c$export$2cfc5be7a55829f6 as useDragAndDrop};
|
|
65
|
-
//# sourceMappingURL=useDragAndDrop.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAiEM,SAAS,0CAA2B,OAA8B;IACvE,IAAI,mBAAmB,CAAA,GAAA,cAAM,EAAE;QAC7B,IAAI,UACF,MAAM,YACN,QAAQ,cACR,UAAU,aACV,SAAS,cACT,UAAU,YACV,QAAQ,iBACR,aAAa,EACb,GAAG;QAEL,IAAI,cAAc,CAAC,CAAC;QACpB,IAAI,cAAc,CAAC,CAAE,CAAA,UAAU,YAAY,cAAc,aAAa,UAAS;QAE/E,IAAI,QAAQ,CAAC;QACb,IAAI,aAAa;YACf,MAAM,2BAA2B,GAAG,SAAS,oCAAoC,KAAsC;gBACrH,OAAO,CAAA,GAAA,kCAA0B,EAAE;oBAAC,GAAG,KAAK;oBAAE,GAAG,OAAO;oBAAE,UAAU,QAAQ,QAAQ;gBAAC;YACvF;YACA,MAAM,sBAAsB,GAAG,CAAA,GAAA,6BAAqB;YACpD,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;YACxC,MAAM,WAAW,GAAG,CAAA,GAAA,kBAAU;YAC9B,MAAM,aAAa,GAAG;QACxB;QAEA,IAAI,aAAa;YACf,MAAM,2BAA2B,GAAG,SAAS,oCAAoC,KAAsC;gBACrH,OAAO,CAAA,GAAA,kCAA0B,EAAE;oBAAC,GAAG,KAAK;oBAAE,GAAG,OAAO;gBAAA;YAC1D;YACA,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;YACxC,MAAM,sBAAsB,GAAG,SAAS,+BAA+B,KAAiC,EAAE,KAA+B,EAAE,GAAkC;gBAC3K,OAAO,CAAA,GAAA,6BAAqB,EAAE;oBAAC,GAAG,KAAK;oBAAE,GAAG,OAAO;gBAAA,GAAG,OAAO;YAC/D;YACA,MAAM,gBAAgB,GAAG,CAAA,GAAA,uBAAe;QAC1C;QAEA,IAAI,eAAe,aACjB,MAAM,iBAAiB,GAAG,CAAA,GAAA,wBAAgB;QAG5C,OAAO;IACT,GAAG;QAAC;KAAQ;IAEZ,OAAO;QACL,kBAAkB;IACpB;AACF","sources":["packages/@react-spectrum/dnd/src/useDragAndDrop.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n DraggableCollectionOptions,\n DraggableItemProps,\n DraggableItemResult,\n DragPreview,\n DropIndicatorAria,\n DropIndicatorProps,\n DroppableCollectionOptions,\n DroppableCollectionResult,\n DroppableItemOptions,\n DroppableItemResult,\n isVirtualDragging,\n useDraggableCollection,\n useDraggableItem,\n useDropIndicator,\n useDroppableCollection,\n useDroppableItem\n} from '@react-aria/dnd';\nimport {DraggableCollectionProps, DragItem, DroppableCollectionProps, Key, RefObject} from '@react-types/shared';\nimport {\n DraggableCollectionState,\n DraggableCollectionStateOptions,\n DroppableCollectionState,\n DroppableCollectionStateOptions,\n useDraggableCollectionState,\n useDroppableCollectionState\n} from '@react-stately/dnd';\nimport {JSX, useMemo} from 'react';\n\ninterface DraggableCollectionStateOpts<T> extends Omit<DraggableCollectionStateOptions<T>, 'getItems'> {}\n\ninterface DragHooks<T = object> {\n useDraggableCollectionState?: (props: DraggableCollectionStateOpts<T>) => DraggableCollectionState,\n useDraggableCollection?: (props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement | null>) => void,\n useDraggableItem?: (props: DraggableItemProps, state: DraggableCollectionState) => DraggableItemResult,\n DragPreview?: typeof DragPreview\n}\n\ninterface DropHooks {\n useDroppableCollectionState?: (props: DroppableCollectionStateOptions) => DroppableCollectionState,\n useDroppableCollection?: (props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DroppableCollectionResult,\n useDroppableItem?: (options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DroppableItemResult,\n useDropIndicator?: (props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DropIndicatorAria\n}\n\nexport interface DragAndDropHooks<T = object> {\n /** Drag and drop hooks for the collection element. */\n dragAndDropHooks: DragHooks<T> & DropHooks & {isVirtualDragging?: () => boolean, renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element}\n}\n\nexport interface DragAndDropOptions<T = object> extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, Omit<DroppableCollectionProps, 'onMove'> {\n /**\n * A function that returns the items being dragged. If not specified, we assume that the collection is not draggable.\n * @default () => []\n */\n getItems?: (keys: Set<Key>, items: T[]) => DragItem[],\n /** Provide a custom drag preview. `draggedKey` represents the key of the item the user actually dragged. */\n renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element\n}\n\n/**\n * Provides the hooks required to enable drag and drop behavior for a drag and drop compatible React Spectrum component.\n */\nexport function useDragAndDrop<T = object>(options: DragAndDropOptions<T>): DragAndDropHooks {\n let dragAndDropHooks = useMemo(() => {\n let {\n onDrop,\n onInsert,\n onItemDrop,\n onReorder,\n onRootDrop,\n getItems,\n renderPreview\n } = options;\n\n let isDraggable = !!getItems;\n let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onRootDrop);\n\n let hooks = {} as DragHooks & DropHooks & {isVirtualDragging?: () => boolean, renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element};\n if (isDraggable) {\n hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props: DraggableCollectionStateOpts<T>) {\n return useDraggableCollectionState({...props, ...options, getItems: options.getItems!});\n };\n hooks.useDraggableCollection = useDraggableCollection;\n hooks.useDraggableItem = useDraggableItem;\n hooks.DragPreview = DragPreview;\n hooks.renderPreview = renderPreview;\n }\n\n if (isDroppable) {\n hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props: DroppableCollectionStateOptions) {\n return useDroppableCollectionState({...props, ...options});\n };\n hooks.useDroppableItem = useDroppableItem;\n hooks.useDroppableCollection = function useDroppableCollectionOverride(props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) {\n return useDroppableCollection({...props, ...options}, state, ref);\n };\n hooks.useDropIndicator = useDropIndicator;\n }\n\n if (isDraggable || isDroppable) {\n hooks.isVirtualDragging = isVirtualDragging;\n }\n\n return hooks;\n }, [options]);\n\n return {\n dragAndDropHooks: dragAndDropHooks\n };\n}\n"],"names":[],"version":3,"file":"useDragAndDrop.module.js.map"}
|
package/src/useDragAndDrop.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2022 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
DraggableCollectionOptions,
|
|
15
|
-
DraggableItemProps,
|
|
16
|
-
DraggableItemResult,
|
|
17
|
-
DragPreview,
|
|
18
|
-
DropIndicatorAria,
|
|
19
|
-
DropIndicatorProps,
|
|
20
|
-
DroppableCollectionOptions,
|
|
21
|
-
DroppableCollectionResult,
|
|
22
|
-
DroppableItemOptions,
|
|
23
|
-
DroppableItemResult,
|
|
24
|
-
isVirtualDragging,
|
|
25
|
-
useDraggableCollection,
|
|
26
|
-
useDraggableItem,
|
|
27
|
-
useDropIndicator,
|
|
28
|
-
useDroppableCollection,
|
|
29
|
-
useDroppableItem
|
|
30
|
-
} from '@react-aria/dnd';
|
|
31
|
-
import {DraggableCollectionProps, DragItem, DroppableCollectionProps, Key, RefObject} from '@react-types/shared';
|
|
32
|
-
import {
|
|
33
|
-
DraggableCollectionState,
|
|
34
|
-
DraggableCollectionStateOptions,
|
|
35
|
-
DroppableCollectionState,
|
|
36
|
-
DroppableCollectionStateOptions,
|
|
37
|
-
useDraggableCollectionState,
|
|
38
|
-
useDroppableCollectionState
|
|
39
|
-
} from '@react-stately/dnd';
|
|
40
|
-
import {JSX, useMemo} from 'react';
|
|
41
|
-
|
|
42
|
-
interface DraggableCollectionStateOpts<T> extends Omit<DraggableCollectionStateOptions<T>, 'getItems'> {}
|
|
43
|
-
|
|
44
|
-
interface DragHooks<T = object> {
|
|
45
|
-
useDraggableCollectionState?: (props: DraggableCollectionStateOpts<T>) => DraggableCollectionState,
|
|
46
|
-
useDraggableCollection?: (props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement | null>) => void,
|
|
47
|
-
useDraggableItem?: (props: DraggableItemProps, state: DraggableCollectionState) => DraggableItemResult,
|
|
48
|
-
DragPreview?: typeof DragPreview
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
interface DropHooks {
|
|
52
|
-
useDroppableCollectionState?: (props: DroppableCollectionStateOptions) => DroppableCollectionState,
|
|
53
|
-
useDroppableCollection?: (props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DroppableCollectionResult,
|
|
54
|
-
useDroppableItem?: (options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DroppableItemResult,
|
|
55
|
-
useDropIndicator?: (props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) => DropIndicatorAria
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface DragAndDropHooks<T = object> {
|
|
59
|
-
/** Drag and drop hooks for the collection element. */
|
|
60
|
-
dragAndDropHooks: DragHooks<T> & DropHooks & {isVirtualDragging?: () => boolean, renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface DragAndDropOptions<T = object> extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, Omit<DroppableCollectionProps, 'onMove'> {
|
|
64
|
-
/**
|
|
65
|
-
* A function that returns the items being dragged. If not specified, we assume that the collection is not draggable.
|
|
66
|
-
* @default () => []
|
|
67
|
-
*/
|
|
68
|
-
getItems?: (keys: Set<Key>, items: T[]) => DragItem[],
|
|
69
|
-
/** Provide a custom drag preview. `draggedKey` represents the key of the item the user actually dragged. */
|
|
70
|
-
renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Provides the hooks required to enable drag and drop behavior for a drag and drop compatible React Spectrum component.
|
|
75
|
-
*/
|
|
76
|
-
export function useDragAndDrop<T = object>(options: DragAndDropOptions<T>): DragAndDropHooks {
|
|
77
|
-
let dragAndDropHooks = useMemo(() => {
|
|
78
|
-
let {
|
|
79
|
-
onDrop,
|
|
80
|
-
onInsert,
|
|
81
|
-
onItemDrop,
|
|
82
|
-
onReorder,
|
|
83
|
-
onRootDrop,
|
|
84
|
-
getItems,
|
|
85
|
-
renderPreview
|
|
86
|
-
} = options;
|
|
87
|
-
|
|
88
|
-
let isDraggable = !!getItems;
|
|
89
|
-
let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onRootDrop);
|
|
90
|
-
|
|
91
|
-
let hooks = {} as DragHooks & DropHooks & {isVirtualDragging?: () => boolean, renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element};
|
|
92
|
-
if (isDraggable) {
|
|
93
|
-
hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props: DraggableCollectionStateOpts<T>) {
|
|
94
|
-
return useDraggableCollectionState({...props, ...options, getItems: options.getItems!});
|
|
95
|
-
};
|
|
96
|
-
hooks.useDraggableCollection = useDraggableCollection;
|
|
97
|
-
hooks.useDraggableItem = useDraggableItem;
|
|
98
|
-
hooks.DragPreview = DragPreview;
|
|
99
|
-
hooks.renderPreview = renderPreview;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (isDroppable) {
|
|
103
|
-
hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props: DroppableCollectionStateOptions) {
|
|
104
|
-
return useDroppableCollectionState({...props, ...options});
|
|
105
|
-
};
|
|
106
|
-
hooks.useDroppableItem = useDroppableItem;
|
|
107
|
-
hooks.useDroppableCollection = function useDroppableCollectionOverride(props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement | null>) {
|
|
108
|
-
return useDroppableCollection({...props, ...options}, state, ref);
|
|
109
|
-
};
|
|
110
|
-
hooks.useDropIndicator = useDropIndicator;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (isDraggable || isDroppable) {
|
|
114
|
-
hooks.isVirtualDragging = isVirtualDragging;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return hooks;
|
|
118
|
-
}, [options]);
|
|
119
|
-
|
|
120
|
-
return {
|
|
121
|
-
dragAndDropHooks: dragAndDropHooks
|
|
122
|
-
};
|
|
123
|
-
}
|