@react-spectrum/dnd 3.3.9-nightly.4555 → 3.3.9-nightly.4560

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 CHANGED
@@ -1,6 +1,5 @@
1
- import {DIRECTORY_DRAG_TYPE as $bd7af2e3e7bb229d$re_export$DIRECTORY_DRAG_TYPE, useDraggableCollection as $6PX7k$useDraggableCollection, useDraggableItem as $6PX7k$useDraggableItem, DragPreview as $6PX7k$DragPreview, useDroppableItem as $6PX7k$useDroppableItem, useDroppableCollection as $6PX7k$useDroppableCollection, useDropIndicator as $6PX7k$useDropIndicator, isVirtualDragging as $6PX7k$isVirtualDragging} from "@react-aria/dnd";
2
- import {useDraggableCollectionState as $6PX7k$useDraggableCollectionState, useDroppableCollectionState as $6PX7k$useDroppableCollectionState} from "@react-stately/dnd";
3
- import {useMemo as $6PX7k$useMemo} from "react";
1
+ import {useDragAndDrop as $8d44a09a765f4c9c$export$2cfc5be7a55829f6} from "./useDragAndDrop.mjs";
2
+ import {DIRECTORY_DRAG_TYPE as $bd7af2e3e7bb229d$re_export$DIRECTORY_DRAG_TYPE} from "@react-aria/dnd";
4
3
 
5
4
  /*
6
5
  * Copyright 2022 Adobe. All rights reserved.
@@ -13,63 +12,6 @@ import {useMemo as $6PX7k$useMemo} from "react";
13
12
  * OF ANY KIND, either express or implied. See the License for the specific language
14
13
  * governing permissions and limitations under the License.
15
14
  */ /// <reference types="css-module-types" />
16
- /*
17
- * Copyright 2022 Adobe. All rights reserved.
18
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
- * you may not use this file except in compliance with the License. You may obtain a copy
20
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
21
- *
22
- * Unless required by applicable law or agreed to in writing, software distributed under
23
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
24
- * OF ANY KIND, either express or implied. See the License for the specific language
25
- * governing permissions and limitations under the License.
26
- */
27
-
28
-
29
- function $8d44a09a765f4c9c$export$2cfc5be7a55829f6(options) {
30
- let dragAndDropHooks = (0, $6PX7k$useMemo)(()=>{
31
- let { onDrop: onDrop, onInsert: onInsert, onItemDrop: onItemDrop, onReorder: onReorder, onRootDrop: onRootDrop, getItems: getItems, renderPreview: renderPreview } = options;
32
- let isDraggable = !!getItems;
33
- let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onRootDrop);
34
- let hooks = {};
35
- if (isDraggable) {
36
- hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props) {
37
- return (0, $6PX7k$useDraggableCollectionState)({
38
- ...props,
39
- ...options
40
- });
41
- };
42
- hooks.useDraggableCollection = (0, $6PX7k$useDraggableCollection);
43
- hooks.useDraggableItem = (0, $6PX7k$useDraggableItem);
44
- hooks.DragPreview = (0, $6PX7k$DragPreview);
45
- hooks.renderPreview = renderPreview;
46
- }
47
- if (isDroppable) {
48
- hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props) {
49
- return (0, $6PX7k$useDroppableCollectionState)({
50
- ...props,
51
- ...options
52
- });
53
- };
54
- hooks.useDroppableItem = (0, $6PX7k$useDroppableItem);
55
- hooks.useDroppableCollection = function useDroppableCollectionOverride(props, state, ref) {
56
- return (0, $6PX7k$useDroppableCollection)({
57
- ...props,
58
- ...options
59
- }, state, ref);
60
- };
61
- hooks.useDropIndicator = (0, $6PX7k$useDropIndicator);
62
- }
63
- if (isDraggable || isDroppable) hooks.isVirtualDragging = (0, $6PX7k$isVirtualDragging);
64
- return hooks;
65
- }, [
66
- options
67
- ]);
68
- return {
69
- dragAndDropHooks: dragAndDropHooks
70
- };
71
- }
72
-
73
15
 
74
16
 
75
17
 
package/dist/main.js CHANGED
@@ -1,13 +1,12 @@
1
+ var $e96ca2229d77f411$exports = require("./useDragAndDrop.main.js");
1
2
  var $9OUiQ$reactariadnd = require("@react-aria/dnd");
2
- var $9OUiQ$reactstatelydnd = require("@react-stately/dnd");
3
- var $9OUiQ$react = require("react");
4
3
 
5
4
 
6
5
  function $parcel$export(e, n, v, s) {
7
6
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
7
  }
9
8
 
10
- $parcel$export(module.exports, "useDragAndDrop", () => $e96ca2229d77f411$export$2cfc5be7a55829f6);
9
+ $parcel$export(module.exports, "useDragAndDrop", () => $e96ca2229d77f411$exports.useDragAndDrop);
11
10
  $parcel$export(module.exports, "DIRECTORY_DRAG_TYPE", () => $9OUiQ$reactariadnd.DIRECTORY_DRAG_TYPE);
12
11
  /*
13
12
  * Copyright 2022 Adobe. All rights reserved.
@@ -20,63 +19,6 @@ $parcel$export(module.exports, "DIRECTORY_DRAG_TYPE", () => $9OUiQ$reactariadnd.
20
19
  * OF ANY KIND, either express or implied. See the License for the specific language
21
20
  * governing permissions and limitations under the License.
22
21
  */ /// <reference types="css-module-types" />
23
- /*
24
- * Copyright 2022 Adobe. All rights reserved.
25
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
26
- * you may not use this file except in compliance with the License. You may obtain a copy
27
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
28
- *
29
- * Unless required by applicable law or agreed to in writing, software distributed under
30
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
31
- * OF ANY KIND, either express or implied. See the License for the specific language
32
- * governing permissions and limitations under the License.
33
- */
34
-
35
-
36
- function $e96ca2229d77f411$export$2cfc5be7a55829f6(options) {
37
- let dragAndDropHooks = (0, $9OUiQ$react.useMemo)(()=>{
38
- let { onDrop: onDrop, onInsert: onInsert, onItemDrop: onItemDrop, onReorder: onReorder, onRootDrop: onRootDrop, getItems: getItems, renderPreview: renderPreview } = options;
39
- let isDraggable = !!getItems;
40
- let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onRootDrop);
41
- let hooks = {};
42
- if (isDraggable) {
43
- hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props) {
44
- return (0, $9OUiQ$reactstatelydnd.useDraggableCollectionState)({
45
- ...props,
46
- ...options
47
- });
48
- };
49
- hooks.useDraggableCollection = (0, $9OUiQ$reactariadnd.useDraggableCollection);
50
- hooks.useDraggableItem = (0, $9OUiQ$reactariadnd.useDraggableItem);
51
- hooks.DragPreview = (0, $9OUiQ$reactariadnd.DragPreview);
52
- hooks.renderPreview = renderPreview;
53
- }
54
- if (isDroppable) {
55
- hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props) {
56
- return (0, $9OUiQ$reactstatelydnd.useDroppableCollectionState)({
57
- ...props,
58
- ...options
59
- });
60
- };
61
- hooks.useDroppableItem = (0, $9OUiQ$reactariadnd.useDroppableItem);
62
- hooks.useDroppableCollection = function useDroppableCollectionOverride(props, state, ref) {
63
- return (0, $9OUiQ$reactariadnd.useDroppableCollection)({
64
- ...props,
65
- ...options
66
- }, state, ref);
67
- };
68
- hooks.useDropIndicator = (0, $9OUiQ$reactariadnd.useDropIndicator);
69
- }
70
- if (isDraggable || isDroppable) hooks.isVirtualDragging = (0, $9OUiQ$reactariadnd.isVirtualDragging);
71
- return hooks;
72
- }, [
73
- options
74
- ]);
75
- return {
76
- dragAndDropHooks: dragAndDropHooks
77
- };
78
- }
79
-
80
22
 
81
23
 
82
24
 
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C;ACZ1C;;;;;;;;;;CAUC;;;AAiEM,SAAS,0CAAe,OAA2B;IACxD,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;gBAAA;YAC1D;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,GAA2B;gBACpK,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/index.ts","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\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","/*\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} from '@react-types/shared';\nimport {\n DraggableCollectionState,\n DraggableCollectionStateOptions,\n DroppableCollectionState,\n DroppableCollectionStateOptions,\n useDraggableCollectionState,\n useDroppableCollectionState\n} from '@react-stately/dnd';\nimport {JSX, RefObject, useMemo} from 'react';\n\ninterface DraggableCollectionStateOpts extends Omit<DraggableCollectionStateOptions, 'getItems'> {}\n\ninterface DragHooks {\n useDraggableCollectionState?: (props: DraggableCollectionStateOpts) => DraggableCollectionState,\n useDraggableCollection?: (props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement>) => 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>) => DroppableCollectionResult,\n useDroppableItem?: (options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement>) => DroppableItemResult,\n useDropIndicator?: (props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement>) => DropIndicatorAria\n}\n\nexport interface DragAndDropHooks {\n /** Drag and drop hooks for the collection element. */\n dragAndDropHooks: DragHooks & DropHooks & {isVirtualDragging?: () => boolean, renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element}\n}\n\nexport interface DragAndDropOptions extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, DroppableCollectionProps {\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>) => 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(options: DragAndDropOptions): 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: DraggableCollectionStateOptions) {\n return useDraggableCollectionState({...props, ...options});\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>) {\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":"main.js.map"}
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 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":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,6 +1,5 @@
1
- import {DIRECTORY_DRAG_TYPE as $bd7af2e3e7bb229d$re_export$DIRECTORY_DRAG_TYPE, useDraggableCollection as $6PX7k$useDraggableCollection, useDraggableItem as $6PX7k$useDraggableItem, DragPreview as $6PX7k$DragPreview, useDroppableItem as $6PX7k$useDroppableItem, useDroppableCollection as $6PX7k$useDroppableCollection, useDropIndicator as $6PX7k$useDropIndicator, isVirtualDragging as $6PX7k$isVirtualDragging} from "@react-aria/dnd";
2
- import {useDraggableCollectionState as $6PX7k$useDraggableCollectionState, useDroppableCollectionState as $6PX7k$useDroppableCollectionState} from "@react-stately/dnd";
3
- import {useMemo as $6PX7k$useMemo} from "react";
1
+ import {useDragAndDrop as $8d44a09a765f4c9c$export$2cfc5be7a55829f6} from "./useDragAndDrop.module.js";
2
+ import {DIRECTORY_DRAG_TYPE as $bd7af2e3e7bb229d$re_export$DIRECTORY_DRAG_TYPE} from "@react-aria/dnd";
4
3
 
5
4
  /*
6
5
  * Copyright 2022 Adobe. All rights reserved.
@@ -13,63 +12,6 @@ import {useMemo as $6PX7k$useMemo} from "react";
13
12
  * OF ANY KIND, either express or implied. See the License for the specific language
14
13
  * governing permissions and limitations under the License.
15
14
  */ /// <reference types="css-module-types" />
16
- /*
17
- * Copyright 2022 Adobe. All rights reserved.
18
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
- * you may not use this file except in compliance with the License. You may obtain a copy
20
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
21
- *
22
- * Unless required by applicable law or agreed to in writing, software distributed under
23
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
24
- * OF ANY KIND, either express or implied. See the License for the specific language
25
- * governing permissions and limitations under the License.
26
- */
27
-
28
-
29
- function $8d44a09a765f4c9c$export$2cfc5be7a55829f6(options) {
30
- let dragAndDropHooks = (0, $6PX7k$useMemo)(()=>{
31
- let { onDrop: onDrop, onInsert: onInsert, onItemDrop: onItemDrop, onReorder: onReorder, onRootDrop: onRootDrop, getItems: getItems, renderPreview: renderPreview } = options;
32
- let isDraggable = !!getItems;
33
- let isDroppable = !!(onDrop || onInsert || onItemDrop || onReorder || onRootDrop);
34
- let hooks = {};
35
- if (isDraggable) {
36
- hooks.useDraggableCollectionState = function useDraggableCollectionStateOverride(props) {
37
- return (0, $6PX7k$useDraggableCollectionState)({
38
- ...props,
39
- ...options
40
- });
41
- };
42
- hooks.useDraggableCollection = (0, $6PX7k$useDraggableCollection);
43
- hooks.useDraggableItem = (0, $6PX7k$useDraggableItem);
44
- hooks.DragPreview = (0, $6PX7k$DragPreview);
45
- hooks.renderPreview = renderPreview;
46
- }
47
- if (isDroppable) {
48
- hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props) {
49
- return (0, $6PX7k$useDroppableCollectionState)({
50
- ...props,
51
- ...options
52
- });
53
- };
54
- hooks.useDroppableItem = (0, $6PX7k$useDroppableItem);
55
- hooks.useDroppableCollection = function useDroppableCollectionOverride(props, state, ref) {
56
- return (0, $6PX7k$useDroppableCollection)({
57
- ...props,
58
- ...options
59
- }, state, ref);
60
- };
61
- hooks.useDropIndicator = (0, $6PX7k$useDropIndicator);
62
- }
63
- if (isDraggable || isDroppable) hooks.isVirtualDragging = (0, $6PX7k$isVirtualDragging);
64
- return hooks;
65
- }, [
66
- options
67
- ]);
68
- return {
69
- dragAndDropHooks: dragAndDropHooks
70
- };
71
- }
72
-
73
15
 
74
16
 
75
17
 
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C;ACZ1C;;;;;;;;;;CAUC;;;AAiEM,SAAS,0CAAe,OAA2B;IACxD,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;gBAAA;YAC1D;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,GAA2B;gBACpK,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/index.ts","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\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","/*\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} from '@react-types/shared';\nimport {\n DraggableCollectionState,\n DraggableCollectionStateOptions,\n DroppableCollectionState,\n DroppableCollectionStateOptions,\n useDraggableCollectionState,\n useDroppableCollectionState\n} from '@react-stately/dnd';\nimport {JSX, RefObject, useMemo} from 'react';\n\ninterface DraggableCollectionStateOpts extends Omit<DraggableCollectionStateOptions, 'getItems'> {}\n\ninterface DragHooks {\n useDraggableCollectionState?: (props: DraggableCollectionStateOpts) => DraggableCollectionState,\n useDraggableCollection?: (props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement>) => 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>) => DroppableCollectionResult,\n useDroppableItem?: (options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement>) => DroppableItemResult,\n useDropIndicator?: (props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement>) => DropIndicatorAria\n}\n\nexport interface DragAndDropHooks {\n /** Drag and drop hooks for the collection element. */\n dragAndDropHooks: DragHooks & DropHooks & {isVirtualDragging?: () => boolean, renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element}\n}\n\nexport interface DragAndDropOptions extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, DroppableCollectionProps {\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>) => 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(options: DragAndDropOptions): 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: DraggableCollectionStateOptions) {\n return useDraggableCollectionState({...props, ...options});\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>) {\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":"module.js.map"}
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 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":"module.js.map"}
@@ -0,0 +1,69 @@
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
+ });
36
+ };
37
+ hooks.useDraggableCollection = (0, $9NCiI$reactariadnd.useDraggableCollection);
38
+ hooks.useDraggableItem = (0, $9NCiI$reactariadnd.useDraggableItem);
39
+ hooks.DragPreview = (0, $9NCiI$reactariadnd.DragPreview);
40
+ hooks.renderPreview = renderPreview;
41
+ }
42
+ if (isDroppable) {
43
+ hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props) {
44
+ return (0, $9NCiI$reactstatelydnd.useDroppableCollectionState)({
45
+ ...props,
46
+ ...options
47
+ });
48
+ };
49
+ hooks.useDroppableItem = (0, $9NCiI$reactariadnd.useDroppableItem);
50
+ hooks.useDroppableCollection = function useDroppableCollectionOverride(props, state, ref) {
51
+ return (0, $9NCiI$reactariadnd.useDroppableCollection)({
52
+ ...props,
53
+ ...options
54
+ }, state, ref);
55
+ };
56
+ hooks.useDropIndicator = (0, $9NCiI$reactariadnd.useDropIndicator);
57
+ }
58
+ if (isDraggable || isDroppable) hooks.isVirtualDragging = (0, $9NCiI$reactariadnd.isVirtualDragging);
59
+ return hooks;
60
+ }, [
61
+ options
62
+ ]);
63
+ return {
64
+ dragAndDropHooks: dragAndDropHooks
65
+ };
66
+ }
67
+
68
+
69
+ //# sourceMappingURL=useDragAndDrop.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAiEM,SAAS,0CAAe,OAA2B;IACxD,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;gBAAA;YAC1D;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,GAA2B;gBACpK,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} from '@react-types/shared';\nimport {\n DraggableCollectionState,\n DraggableCollectionStateOptions,\n DroppableCollectionState,\n DroppableCollectionStateOptions,\n useDraggableCollectionState,\n useDroppableCollectionState\n} from '@react-stately/dnd';\nimport {JSX, RefObject, useMemo} from 'react';\n\ninterface DraggableCollectionStateOpts extends Omit<DraggableCollectionStateOptions, 'getItems'> {}\n\ninterface DragHooks {\n useDraggableCollectionState?: (props: DraggableCollectionStateOpts) => DraggableCollectionState,\n useDraggableCollection?: (props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement>) => 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>) => DroppableCollectionResult,\n useDroppableItem?: (options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement>) => DroppableItemResult,\n useDropIndicator?: (props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement>) => DropIndicatorAria\n}\n\nexport interface DragAndDropHooks {\n /** Drag and drop hooks for the collection element. */\n dragAndDropHooks: DragHooks & DropHooks & {isVirtualDragging?: () => boolean, renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element}\n}\n\nexport interface DragAndDropOptions extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, DroppableCollectionProps {\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>) => 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(options: DragAndDropOptions): 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: DraggableCollectionStateOptions) {\n return useDraggableCollectionState({...props, ...options});\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>) {\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"}
@@ -0,0 +1,64 @@
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
+ });
30
+ };
31
+ hooks.useDraggableCollection = (0, $ejrPO$useDraggableCollection);
32
+ hooks.useDraggableItem = (0, $ejrPO$useDraggableItem);
33
+ hooks.DragPreview = (0, $ejrPO$DragPreview);
34
+ hooks.renderPreview = renderPreview;
35
+ }
36
+ if (isDroppable) {
37
+ hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props) {
38
+ return (0, $ejrPO$useDroppableCollectionState)({
39
+ ...props,
40
+ ...options
41
+ });
42
+ };
43
+ hooks.useDroppableItem = (0, $ejrPO$useDroppableItem);
44
+ hooks.useDroppableCollection = function useDroppableCollectionOverride(props, state, ref) {
45
+ return (0, $ejrPO$useDroppableCollection)({
46
+ ...props,
47
+ ...options
48
+ }, state, ref);
49
+ };
50
+ hooks.useDropIndicator = (0, $ejrPO$useDropIndicator);
51
+ }
52
+ if (isDraggable || isDroppable) hooks.isVirtualDragging = (0, $ejrPO$isVirtualDragging);
53
+ return hooks;
54
+ }, [
55
+ options
56
+ ]);
57
+ return {
58
+ dragAndDropHooks: dragAndDropHooks
59
+ };
60
+ }
61
+
62
+
63
+ export {$8d44a09a765f4c9c$export$2cfc5be7a55829f6 as useDragAndDrop};
64
+ //# sourceMappingURL=useDragAndDrop.mjs.map
@@ -0,0 +1,64 @@
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
+ });
30
+ };
31
+ hooks.useDraggableCollection = (0, $ejrPO$useDraggableCollection);
32
+ hooks.useDraggableItem = (0, $ejrPO$useDraggableItem);
33
+ hooks.DragPreview = (0, $ejrPO$DragPreview);
34
+ hooks.renderPreview = renderPreview;
35
+ }
36
+ if (isDroppable) {
37
+ hooks.useDroppableCollectionState = function useDroppableCollectionStateOverride(props) {
38
+ return (0, $ejrPO$useDroppableCollectionState)({
39
+ ...props,
40
+ ...options
41
+ });
42
+ };
43
+ hooks.useDroppableItem = (0, $ejrPO$useDroppableItem);
44
+ hooks.useDroppableCollection = function useDroppableCollectionOverride(props, state, ref) {
45
+ return (0, $ejrPO$useDroppableCollection)({
46
+ ...props,
47
+ ...options
48
+ }, state, ref);
49
+ };
50
+ hooks.useDropIndicator = (0, $ejrPO$useDropIndicator);
51
+ }
52
+ if (isDraggable || isDroppable) hooks.isVirtualDragging = (0, $ejrPO$isVirtualDragging);
53
+ return hooks;
54
+ }, [
55
+ options
56
+ ]);
57
+ return {
58
+ dragAndDropHooks: dragAndDropHooks
59
+ };
60
+ }
61
+
62
+
63
+ export {$8d44a09a765f4c9c$export$2cfc5be7a55829f6 as useDragAndDrop};
64
+ //# sourceMappingURL=useDragAndDrop.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAiEM,SAAS,0CAAe,OAA2B;IACxD,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;gBAAA;YAC1D;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,GAA2B;gBACpK,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} from '@react-types/shared';\nimport {\n DraggableCollectionState,\n DraggableCollectionStateOptions,\n DroppableCollectionState,\n DroppableCollectionStateOptions,\n useDraggableCollectionState,\n useDroppableCollectionState\n} from '@react-stately/dnd';\nimport {JSX, RefObject, useMemo} from 'react';\n\ninterface DraggableCollectionStateOpts extends Omit<DraggableCollectionStateOptions, 'getItems'> {}\n\ninterface DragHooks {\n useDraggableCollectionState?: (props: DraggableCollectionStateOpts) => DraggableCollectionState,\n useDraggableCollection?: (props: DraggableCollectionOptions, state: DraggableCollectionState, ref: RefObject<HTMLElement>) => 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>) => DroppableCollectionResult,\n useDroppableItem?: (options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement>) => DroppableItemResult,\n useDropIndicator?: (props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement>) => DropIndicatorAria\n}\n\nexport interface DragAndDropHooks {\n /** Drag and drop hooks for the collection element. */\n dragAndDropHooks: DragHooks & DropHooks & {isVirtualDragging?: () => boolean, renderPreview?: (keys: Set<Key>, draggedKey: Key) => JSX.Element}\n}\n\nexport interface DragAndDropOptions extends Omit<DraggableCollectionProps, 'preview' | 'getItems'>, DroppableCollectionProps {\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>) => 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(options: DragAndDropOptions): 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: DraggableCollectionStateOptions) {\n return useDraggableCollectionState({...props, ...options});\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>) {\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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/dnd",
3
- "version": "3.3.9-nightly.4555+81162ea39",
3
+ "version": "3.3.9-nightly.4560+72775d272",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -36,13 +36,13 @@
36
36
  "url": "https://github.com/adobe/react-spectrum"
37
37
  },
38
38
  "dependencies": {
39
- "@react-aria/dnd": "3.5.4-nightly.4555+81162ea39",
40
- "@react-stately/dnd": "3.2.9-nightly.4555+81162ea39",
41
- "@react-types/shared": "3.0.0-nightly.2843+81162ea39",
39
+ "@react-aria/dnd": "3.5.4-nightly.4560+72775d272",
40
+ "@react-stately/dnd": "3.2.9-nightly.4560+72775d272",
41
+ "@react-types/shared": "3.0.0-nightly.2848+72775d272",
42
42
  "@swc/helpers": "^0.5.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@adobe/spectrum-css-temp": "3.0.0-nightly.2843+81162ea39"
45
+ "@adobe/spectrum-css-temp": "3.0.0-nightly.2848+72775d272"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@react-spectrum/provider": "^3.0.0",
@@ -52,5 +52,5 @@
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  },
55
- "gitHead": "81162ea392926d06ec3d25c228e6f9b6b5479d59"
55
+ "gitHead": "72775d272be04cfa32d26ec821bc68513d92a72b"
56
56
  }