@react-spectrum/dnd 3.0.0-nightly.3236 → 3.0.0-nightly.3246

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/main.js CHANGED
@@ -30,13 +30,8 @@ $parcel$export($bb595e9145c20bae$exports, "useDragHooks", () => $bb595e9145c20ba
30
30
  function $bb595e9145c20bae$export$ca50582736fec395(options) {
31
31
  return $9OUiQ$react.useMemo(()=>({
32
32
  useDraggableCollectionState (props) {
33
- let { collection: collection , selectionManager: selectionManager , allowsDraggingItem: allowsDraggingItem , getItems: getItems , renderPreview: renderPreview } = props;
34
33
  return $9OUiQ$reactstatelydnd.useDraggableCollectionState({
35
- collection: collection,
36
- selectionManager: selectionManager,
37
- allowsDraggingItem: allowsDraggingItem,
38
- getItems: getItems,
39
- renderPreview: renderPreview,
34
+ ...props,
40
35
  ...options
41
36
  });
42
37
  },
@@ -48,7 +43,37 @@ function $bb595e9145c20bae$export$ca50582736fec395(options) {
48
43
  }
49
44
 
50
45
 
46
+ var $eb31ce34e8964bed$exports = {};
47
+
48
+ $parcel$export($eb31ce34e8964bed$exports, "useDropHooks", () => $eb31ce34e8964bed$export$c9cc1cdafc7aa18a);
49
+
50
+
51
+
52
+ function $eb31ce34e8964bed$export$c9cc1cdafc7aa18a(options) {
53
+ return $9OUiQ$react.useMemo(()=>({
54
+ useDroppableCollectionState (props) {
55
+ return $9OUiQ$reactstatelydnd.useDroppableCollectionState({
56
+ ...props,
57
+ ...options
58
+ });
59
+ },
60
+ useDroppableItem: $9OUiQ$reactariadnd.useDroppableItem,
61
+ useDroppableCollection (props, state, ref) {
62
+ return $9OUiQ$reactariadnd.useDroppableCollection({
63
+ ...props,
64
+ ...options
65
+ }, state, ref);
66
+ },
67
+ useDropIndicator: $9OUiQ$reactariadnd.useDropIndicator
68
+ })
69
+ , [
70
+ options
71
+ ]);
72
+ }
73
+
74
+
51
75
  $parcel$exportWildcard(module.exports, $bb595e9145c20bae$exports);
76
+ $parcel$exportWildcard(module.exports, $eb31ce34e8964bed$exports);
52
77
 
53
78
 
54
79
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;SCWgB,yCAAY,CAAC,OAAwB,EAAa,CAAC;IACjE,MAAM,CAAC,oBAAO,MAAQ,CAAC;YACrB,2BAA2B,EAAC,KAAiC,EAAE,CAAC;gBAC9D,GAAG,CAAC,CAAC,aACH,UAAU,qBACV,gBAAgB,uBAChB,kBAAkB,aAClB,QAAQ,kBACR,aAAa,EACf,CAAC,GAAG,KAAK;gBAET,MAAM,CAAC,kDAA2B,CAAC,CAAC;gCAClC,UAAU;sCACV,gBAAgB;wCAChB,kBAAkB;8BAClB,QAAQ;mCACR,aAAa;uBACV,OAAO;gBACZ,CAAC;YACH,CAAC;8BACD,oCAAgB;QAClB,CAAC;MAAG,CAAC;QAAA,OAAO;IAAA,CAAC;AACf,CAAC","sources":["packages/@react-spectrum/dnd/src/index.ts","packages/@react-spectrum/dnd/src/useDragHooks.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 * from './useDragHooks';\n","import {DraggableCollectionOptions, DraggableCollectionState, useDraggableCollectionState} from '@react-stately/dnd';\nimport {DraggableItemProps, DraggableItemResult, useDraggableItem} from '@react-aria/dnd';\nimport {useMemo} from 'react';\n\nexport interface DragHooks {\n useDraggableCollectionState(props: Omit<DraggableCollectionOptions, 'getItems'>): DraggableCollectionState,\n useDraggableItem(props: DraggableItemProps, state: DraggableCollectionState): DraggableItemResult\n}\n\nexport type DragHookOptions = Omit<DraggableCollectionOptions, 'collection' | 'selectionManager' | 'isDragging' | 'getKeysForDrag'>\n\nexport function useDragHooks(options: DragHookOptions): DragHooks {\n return useMemo(() => ({\n useDraggableCollectionState(props: DraggableCollectionOptions) {\n let {\n collection,\n selectionManager,\n allowsDraggingItem,\n getItems,\n renderPreview\n } = props;\n \n return useDraggableCollectionState({\n collection,\n selectionManager,\n allowsDraggingItem,\n getItems,\n renderPreview,\n ...options\n });\n },\n useDraggableItem\n }), [options]);\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;SCUgB,yCAAY,CAAC,OAAiC,EAAa,CAAC;IAC1E,MAAM,CAAC,oBAAO,MAAQ,CAAC;YACrB,2BAA2B,EAAC,KAAiC,EAAE,CAAC;gBAC9D,MAAM,CAAC,kDAA2B,CAAC,CAAC;uBAAG,KAAK;uBAAK,OAAO;gBAAA,CAAC;YAC3D,CAAC;8BACD,oCAAgB;QAClB,CAAC;MAAG,CAAC;QAAA,OAAO;IAAA,CAAC;AACf,CAAC;;;;;;;;;SCKe,yCAAY,CAAC,OAAiC,EAAa,CAAC;IAC1E,MAAM,CAAC,oBAAO,MAAQ,CAAC;YACrB,2BAA2B,EAAC,KAAK,EAAE,CAAC;gBAClC,MAAM,CAAC,kDAA2B,CAAC,CAAC;uBAAG,KAAK;uBAAK,OAAO;gBAAA,CAAC;YAC3D,CAAC;8BACD,oCAAgB;YAChB,sBAAsB,EAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;gBACzC,MAAM,CAAC,0CAAsB,CAAC,CAAC;uBAAG,KAAK;uBAAK,OAAO;gBAAA,CAAC,EAAE,KAAK,EAAE,GAAG;YAClE,CAAC;8BACD,oCAAgB;QAClB,CAAC;MAAG,CAAC;QAAA,OAAO;IAAA,CAAC;AACf,CAAC;;","sources":["packages/@react-spectrum/dnd/src/index.ts","packages/@react-spectrum/dnd/src/useDragHooks.ts","packages/@react-spectrum/dnd/src/useDropHooks.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 * from './useDragHooks';\nexport * from './useDropHooks';\n","import {DraggableCollectionOptions, DraggableCollectionState, useDraggableCollectionState} from '@react-stately/dnd';\nimport {DraggableCollectionProps} from '@react-types/shared';\nimport {DraggableItemProps, DraggableItemResult, useDraggableItem} from '@react-aria/dnd';\nimport {useMemo} from 'react';\n\nexport interface DragHooks {\n useDraggableCollectionState(props: Omit<DraggableCollectionOptions, 'getItems'>): DraggableCollectionState,\n useDraggableItem(props: DraggableItemProps, state: DraggableCollectionState): DraggableItemResult\n}\n\nexport function useDragHooks(options: DraggableCollectionProps): DragHooks {\n return useMemo(() => ({\n useDraggableCollectionState(props: DraggableCollectionOptions) {\n return useDraggableCollectionState({...props, ...options});\n },\n useDraggableItem\n }), [options]);\n}\n","import {\n DropIndicatorAria,\n DropIndicatorProps,\n DroppableCollectionOptions,\n DroppableCollectionResult,\n DroppableItemOptions,\n DroppableItemResult,\n useDropIndicator,\n useDroppableCollection,\n useDroppableItem\n} from '@react-aria/dnd';\nimport {DroppableCollectionProps} from '@react-types/shared';\nimport {DroppableCollectionState, DroppableCollectionStateOptions, useDroppableCollectionState} from '@react-stately/dnd';\nimport {RefObject, useMemo} from 'react';\n\nexport interface 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 function useDropHooks(options: DroppableCollectionProps): DropHooks {\n return useMemo(() => ({\n useDroppableCollectionState(props) {\n return useDroppableCollectionState({...props, ...options});\n },\n useDroppableItem,\n useDroppableCollection(props, state, ref) {\n return useDroppableCollection({...props, ...options}, state, ref);\n },\n useDropIndicator\n }), [options]);\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,5 +1,5 @@
1
- import {useDraggableCollectionState as $6PX7k$useDraggableCollectionState} from "@react-stately/dnd";
2
- import {useDraggableItem as $6PX7k$useDraggableItem} from "@react-aria/dnd";
1
+ import {useDraggableCollectionState as $6PX7k$useDraggableCollectionState, useDroppableCollectionState as $6PX7k$useDroppableCollectionState} from "@react-stately/dnd";
2
+ import {useDraggableItem as $6PX7k$useDraggableItem, useDroppableItem as $6PX7k$useDroppableItem, useDroppableCollection as $6PX7k$useDroppableCollection, useDropIndicator as $6PX7k$useDropIndicator} from "@react-aria/dnd";
3
3
  import {useMemo as $6PX7k$useMemo} from "react";
4
4
 
5
5
  function $parcel$export(e, n, v, s) {
@@ -14,13 +14,8 @@ $parcel$export($1d9ad6c92ef06635$exports, "useDragHooks", () => $1d9ad6c92ef0663
14
14
  function $1d9ad6c92ef06635$export$ca50582736fec395(options) {
15
15
  return $6PX7k$useMemo(()=>({
16
16
  useDraggableCollectionState (props) {
17
- let { collection: collection , selectionManager: selectionManager , allowsDraggingItem: allowsDraggingItem , getItems: getItems , renderPreview: renderPreview } = props;
18
17
  return $6PX7k$useDraggableCollectionState({
19
- collection: collection,
20
- selectionManager: selectionManager,
21
- allowsDraggingItem: allowsDraggingItem,
22
- getItems: getItems,
23
- renderPreview: renderPreview,
18
+ ...props,
24
19
  ...options
25
20
  });
26
21
  },
@@ -32,7 +27,36 @@ function $1d9ad6c92ef06635$export$ca50582736fec395(options) {
32
27
  }
33
28
 
34
29
 
30
+ var $d9620cb8af727810$exports = {};
35
31
 
32
+ $parcel$export($d9620cb8af727810$exports, "useDropHooks", () => $d9620cb8af727810$export$c9cc1cdafc7aa18a);
36
33
 
37
- export {$1d9ad6c92ef06635$export$ca50582736fec395 as useDragHooks};
34
+
35
+
36
+ function $d9620cb8af727810$export$c9cc1cdafc7aa18a(options) {
37
+ return $6PX7k$useMemo(()=>({
38
+ useDroppableCollectionState (props) {
39
+ return $6PX7k$useDroppableCollectionState({
40
+ ...props,
41
+ ...options
42
+ });
43
+ },
44
+ useDroppableItem: $6PX7k$useDroppableItem,
45
+ useDroppableCollection (props, state, ref) {
46
+ return $6PX7k$useDroppableCollection({
47
+ ...props,
48
+ ...options
49
+ }, state, ref);
50
+ },
51
+ useDropIndicator: $6PX7k$useDropIndicator
52
+ })
53
+ , [
54
+ options
55
+ ]);
56
+ }
57
+
58
+
59
+
60
+
61
+ export {$1d9ad6c92ef06635$export$ca50582736fec395 as useDragHooks, $d9620cb8af727810$export$c9cc1cdafc7aa18a as useDropHooks};
38
62
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;SCWgB,yCAAY,CAAC,OAAwB,EAAa,CAAC;IACjE,MAAM,CAAC,cAAO,MAAQ,CAAC;YACrB,2BAA2B,EAAC,KAAiC,EAAE,CAAC;gBAC9D,GAAG,CAAC,CAAC,aACH,UAAU,qBACV,gBAAgB,uBAChB,kBAAkB,aAClB,QAAQ,kBACR,aAAa,EACf,CAAC,GAAG,KAAK;gBAET,MAAM,CAAC,kCAA2B,CAAC,CAAC;gCAClC,UAAU;sCACV,gBAAgB;wCAChB,kBAAkB;8BAClB,QAAQ;mCACR,aAAa;uBACV,OAAO;gBACZ,CAAC;YACH,CAAC;8BACD,uBAAgB;QAClB,CAAC;MAAG,CAAC;QAAA,OAAO;IAAA,CAAC;AACf,CAAC","sources":["packages/@react-spectrum/dnd/src/index.ts","packages/@react-spectrum/dnd/src/useDragHooks.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 * from './useDragHooks';\n","import {DraggableCollectionOptions, DraggableCollectionState, useDraggableCollectionState} from '@react-stately/dnd';\nimport {DraggableItemProps, DraggableItemResult, useDraggableItem} from '@react-aria/dnd';\nimport {useMemo} from 'react';\n\nexport interface DragHooks {\n useDraggableCollectionState(props: Omit<DraggableCollectionOptions, 'getItems'>): DraggableCollectionState,\n useDraggableItem(props: DraggableItemProps, state: DraggableCollectionState): DraggableItemResult\n}\n\nexport type DragHookOptions = Omit<DraggableCollectionOptions, 'collection' | 'selectionManager' | 'isDragging' | 'getKeysForDrag'>\n\nexport function useDragHooks(options: DragHookOptions): DragHooks {\n return useMemo(() => ({\n useDraggableCollectionState(props: DraggableCollectionOptions) {\n let {\n collection,\n selectionManager,\n allowsDraggingItem,\n getItems,\n renderPreview\n } = props;\n \n return useDraggableCollectionState({\n collection,\n selectionManager,\n allowsDraggingItem,\n getItems,\n renderPreview,\n ...options\n });\n },\n useDraggableItem\n }), [options]);\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;SCUgB,yCAAY,CAAC,OAAiC,EAAa,CAAC;IAC1E,MAAM,CAAC,cAAO,MAAQ,CAAC;YACrB,2BAA2B,EAAC,KAAiC,EAAE,CAAC;gBAC9D,MAAM,CAAC,kCAA2B,CAAC,CAAC;uBAAG,KAAK;uBAAK,OAAO;gBAAA,CAAC;YAC3D,CAAC;8BACD,uBAAgB;QAClB,CAAC;MAAG,CAAC;QAAA,OAAO;IAAA,CAAC;AACf,CAAC;;;;;;;;;SCKe,yCAAY,CAAC,OAAiC,EAAa,CAAC;IAC1E,MAAM,CAAC,cAAO,MAAQ,CAAC;YACrB,2BAA2B,EAAC,KAAK,EAAE,CAAC;gBAClC,MAAM,CAAC,kCAA2B,CAAC,CAAC;uBAAG,KAAK;uBAAK,OAAO;gBAAA,CAAC;YAC3D,CAAC;8BACD,uBAAgB;YAChB,sBAAsB,EAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;gBACzC,MAAM,CAAC,6BAAsB,CAAC,CAAC;uBAAG,KAAK;uBAAK,OAAO;gBAAA,CAAC,EAAE,KAAK,EAAE,GAAG;YAClE,CAAC;8BACD,uBAAgB;QAClB,CAAC;MAAG,CAAC;QAAA,OAAO;IAAA,CAAC;AACf,CAAC;;","sources":["packages/@react-spectrum/dnd/src/index.ts","packages/@react-spectrum/dnd/src/useDragHooks.ts","packages/@react-spectrum/dnd/src/useDropHooks.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 * from './useDragHooks';\nexport * from './useDropHooks';\n","import {DraggableCollectionOptions, DraggableCollectionState, useDraggableCollectionState} from '@react-stately/dnd';\nimport {DraggableCollectionProps} from '@react-types/shared';\nimport {DraggableItemProps, DraggableItemResult, useDraggableItem} from '@react-aria/dnd';\nimport {useMemo} from 'react';\n\nexport interface DragHooks {\n useDraggableCollectionState(props: Omit<DraggableCollectionOptions, 'getItems'>): DraggableCollectionState,\n useDraggableItem(props: DraggableItemProps, state: DraggableCollectionState): DraggableItemResult\n}\n\nexport function useDragHooks(options: DraggableCollectionProps): DragHooks {\n return useMemo(() => ({\n useDraggableCollectionState(props: DraggableCollectionOptions) {\n return useDraggableCollectionState({...props, ...options});\n },\n useDraggableItem\n }), [options]);\n}\n","import {\n DropIndicatorAria,\n DropIndicatorProps,\n DroppableCollectionOptions,\n DroppableCollectionResult,\n DroppableItemOptions,\n DroppableItemResult,\n useDropIndicator,\n useDroppableCollection,\n useDroppableItem\n} from '@react-aria/dnd';\nimport {DroppableCollectionProps} from '@react-types/shared';\nimport {DroppableCollectionState, DroppableCollectionStateOptions, useDroppableCollectionState} from '@react-stately/dnd';\nimport {RefObject, useMemo} from 'react';\n\nexport interface 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 function useDropHooks(options: DroppableCollectionProps): DropHooks {\n return useMemo(() => ({\n useDroppableCollectionState(props) {\n return useDroppableCollectionState({...props, ...options});\n },\n useDroppableItem,\n useDroppableCollection(props, state, ref) {\n return useDroppableCollection({...props, ...options}, state, ref);\n },\n useDropIndicator\n }), [options]);\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,10 +1,18 @@
1
- import { DraggableCollectionOptions, DraggableCollectionState } from "@react-stately/dnd";
2
- import { DraggableItemProps, DraggableItemResult } from "@react-aria/dnd";
1
+ import { DraggableCollectionOptions, DraggableCollectionState, DroppableCollectionState, DroppableCollectionStateOptions } from "@react-stately/dnd";
2
+ import { DraggableCollectionProps, DroppableCollectionProps } from "@react-types/shared";
3
+ import { DraggableItemProps, DraggableItemResult, DropIndicatorAria, DropIndicatorProps, DroppableCollectionOptions, DroppableCollectionResult, DroppableItemOptions, DroppableItemResult } from "@react-aria/dnd";
4
+ import { RefObject } from "react";
3
5
  export interface DragHooks {
4
6
  useDraggableCollectionState(props: Omit<DraggableCollectionOptions, 'getItems'>): DraggableCollectionState;
5
7
  useDraggableItem(props: DraggableItemProps, state: DraggableCollectionState): DraggableItemResult;
6
8
  }
7
- export type DragHookOptions = Omit<DraggableCollectionOptions, 'collection' | 'selectionManager' | 'isDragging' | 'getKeysForDrag'>;
8
- export function useDragHooks(options: DragHookOptions): DragHooks;
9
+ export function useDragHooks(options: DraggableCollectionProps): DragHooks;
10
+ export interface DropHooks {
11
+ useDroppableCollectionState(props: DroppableCollectionStateOptions): DroppableCollectionState;
12
+ useDroppableCollection(props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement>): DroppableCollectionResult;
13
+ useDroppableItem(options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement>): DroppableItemResult;
14
+ useDropIndicator(props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement>): DropIndicatorAria;
15
+ }
16
+ export function useDropHooks(options: DroppableCollectionProps): DropHooks;
9
17
 
10
18
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"mappings":";;AAIA;IACI,2BAA2B,CAAC,KAAK,EAAE,IAAI,CAAC,0BAA0B,EAAE,UAAU,CAAC,GAAG,wBAAwB,CAAC;IAC3G,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,wBAAwB,GAAG,mBAAmB,CAAA;CACpG;AAED,8BAA8B,IAAI,CAAC,0BAA0B,EAAE,YAAY,GAAG,kBAAkB,GAAG,YAAY,GAAG,gBAAgB,CAAC,CAAA;AAEnI,6BAA6B,OAAO,EAAE,eAAe,GAAG,SAAS,CAsBhE","sources":["packages/@react-spectrum/dnd/src/packages/@react-spectrum/dnd/src/useDragHooks.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 * from './useDragHooks';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;AAKA;IACI,2BAA2B,CAAC,KAAK,EAAE,IAAI,CAAC,0BAA0B,EAAE,UAAU,CAAC,GAAG,wBAAwB,CAAC;IAC3G,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,wBAAwB,GAAG,mBAAmB,CAAA;CACpG;AAED,6BAA6B,OAAO,EAAE,wBAAwB,GAAG,SAAS,CAOzE;ACFD;IACE,2BAA2B,CAAC,KAAK,EAAE,+BAA+B,GAAG,wBAAwB,CAAC;IAC9F,sBAAsB,CAAC,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC,GAAG,yBAAyB,CAAC;IACnJ,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC,GAAG,mBAAmB,CAAC;IACnI,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC,GAAG,iBAAiB,CAAA;CAC7H;AAED,6BAA6B,OAAO,EAAE,wBAAwB,GAAG,SAAS,CAWzE","sources":["packages/@react-spectrum/dnd/src/packages/@react-spectrum/dnd/src/useDragHooks.ts","packages/@react-spectrum/dnd/src/packages/@react-spectrum/dnd/src/useDropHooks.ts","packages/@react-spectrum/dnd/src/packages/@react-spectrum/dnd/src/index.ts","packages/@react-spectrum/dnd/src/index.ts"],"sourcesContent":[null,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 * from './useDragHooks';\nexport * from './useDropHooks';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/dnd",
3
- "version": "3.0.0-nightly.3236+7f7748bc1",
3
+ "version": "3.0.0-nightly.3246+04d9c3dc2",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -32,11 +32,12 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.6.2",
35
- "@react-aria/dnd": "3.0.0-nightly.3236+7f7748bc1",
36
- "@react-stately/dnd": "3.0.0-nightly.3236+7f7748bc1"
35
+ "@react-aria/dnd": "3.0.0-nightly.3246+04d9c3dc2",
36
+ "@react-stately/dnd": "3.0.0-nightly.3246+04d9c3dc2",
37
+ "@react-types/shared": "3.0.0-nightly.1547+04d9c3dc2"
37
38
  },
38
39
  "devDependencies": {
39
- "@adobe/spectrum-css-temp": "3.0.0-nightly.1537+7f7748bc1"
40
+ "@adobe/spectrum-css-temp": "3.0.0-nightly.1547+04d9c3dc2"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "@react-spectrum/provider": "^3.0.0",
@@ -45,5 +46,5 @@
45
46
  "publishConfig": {
46
47
  "access": "public"
47
48
  },
48
- "gitHead": "7f7748bc15d18751d98c485789752ef4e1256930"
49
+ "gitHead": "04d9c3dc2dacb916c79e496f0655ea6cf5137539"
49
50
  }
package/src/index.ts CHANGED
@@ -13,3 +13,4 @@
13
13
  /// <reference types="css-module-types" />
14
14
 
15
15
  export * from './useDragHooks';
16
+ export * from './useDropHooks';
@@ -1,4 +1,5 @@
1
1
  import {DraggableCollectionOptions, DraggableCollectionState, useDraggableCollectionState} from '@react-stately/dnd';
2
+ import {DraggableCollectionProps} from '@react-types/shared';
2
3
  import {DraggableItemProps, DraggableItemResult, useDraggableItem} from '@react-aria/dnd';
3
4
  import {useMemo} from 'react';
4
5
 
@@ -7,27 +8,10 @@ export interface DragHooks {
7
8
  useDraggableItem(props: DraggableItemProps, state: DraggableCollectionState): DraggableItemResult
8
9
  }
9
10
 
10
- export type DragHookOptions = Omit<DraggableCollectionOptions, 'collection' | 'selectionManager' | 'isDragging' | 'getKeysForDrag'>
11
-
12
- export function useDragHooks(options: DragHookOptions): DragHooks {
11
+ export function useDragHooks(options: DraggableCollectionProps): DragHooks {
13
12
  return useMemo(() => ({
14
13
  useDraggableCollectionState(props: DraggableCollectionOptions) {
15
- let {
16
- collection,
17
- selectionManager,
18
- allowsDraggingItem,
19
- getItems,
20
- renderPreview
21
- } = props;
22
-
23
- return useDraggableCollectionState({
24
- collection,
25
- selectionManager,
26
- allowsDraggingItem,
27
- getItems,
28
- renderPreview,
29
- ...options
30
- });
14
+ return useDraggableCollectionState({...props, ...options});
31
15
  },
32
16
  useDraggableItem
33
17
  }), [options]);
@@ -0,0 +1,34 @@
1
+ import {
2
+ DropIndicatorAria,
3
+ DropIndicatorProps,
4
+ DroppableCollectionOptions,
5
+ DroppableCollectionResult,
6
+ DroppableItemOptions,
7
+ DroppableItemResult,
8
+ useDropIndicator,
9
+ useDroppableCollection,
10
+ useDroppableItem
11
+ } from '@react-aria/dnd';
12
+ import {DroppableCollectionProps} from '@react-types/shared';
13
+ import {DroppableCollectionState, DroppableCollectionStateOptions, useDroppableCollectionState} from '@react-stately/dnd';
14
+ import {RefObject, useMemo} from 'react';
15
+
16
+ export interface DropHooks {
17
+ useDroppableCollectionState(props: DroppableCollectionStateOptions): DroppableCollectionState,
18
+ useDroppableCollection(props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement>): DroppableCollectionResult,
19
+ useDroppableItem(options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement>): DroppableItemResult,
20
+ useDropIndicator(props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement>): DropIndicatorAria
21
+ }
22
+
23
+ export function useDropHooks(options: DroppableCollectionProps): DropHooks {
24
+ return useMemo(() => ({
25
+ useDroppableCollectionState(props) {
26
+ return useDroppableCollectionState({...props, ...options});
27
+ },
28
+ useDroppableItem,
29
+ useDroppableCollection(props, state, ref) {
30
+ return useDroppableCollection({...props, ...options}, state, ref);
31
+ },
32
+ useDropIndicator
33
+ }), [options]);
34
+ }