@react-spectrum/dnd 3.0.0-alpha.2 → 3.0.0-alpha.3

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,17 +30,42 @@ $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
  },
43
- useDraggableItem: $9OUiQ$reactariadnd.useDraggableItem
38
+ useDraggableItem: $9OUiQ$reactariadnd.useDraggableItem,
39
+ DragPreview: $9OUiQ$reactariadnd.DragPreview
40
+ })
41
+ , [
42
+ options
43
+ ]);
44
+ }
45
+
46
+
47
+ var $eb31ce34e8964bed$exports = {};
48
+
49
+ $parcel$export($eb31ce34e8964bed$exports, "useDropHooks", () => $eb31ce34e8964bed$export$c9cc1cdafc7aa18a);
50
+
51
+
52
+
53
+ function $eb31ce34e8964bed$export$c9cc1cdafc7aa18a(options) {
54
+ return $9OUiQ$react.useMemo(()=>({
55
+ useDroppableCollectionState (props) {
56
+ return $9OUiQ$reactstatelydnd.useDroppableCollectionState({
57
+ ...props,
58
+ ...options
59
+ });
60
+ },
61
+ useDroppableItem: $9OUiQ$reactariadnd.useDroppableItem,
62
+ useDroppableCollection (props, state, ref) {
63
+ return $9OUiQ$reactariadnd.useDroppableCollection({
64
+ ...props,
65
+ ...options
66
+ }, state, ref);
67
+ },
68
+ useDropIndicator: $9OUiQ$reactariadnd.useDropIndicator
44
69
  })
45
70
  , [
46
71
  options
@@ -49,6 +74,7 @@ function $bb595e9145c20bae$export$ca50582736fec395(options) {
49
74
 
50
75
 
51
76
  $parcel$exportWildcard(module.exports, $bb595e9145c20bae$exports);
77
+ $parcel$exportWildcard(module.exports, $eb31ce34e8964bed$exports);
52
78
 
53
79
 
54
80
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;SCWgB,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;yBAChB,+BAAW;QACb,CAAC;MAAG,CAAC;QAAA,OAAO;IAAA,CAAC;AACf,CAAC;;;;;;;;;SCGe,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, DragPreview, 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 DragPreview: typeof DragPreview\n}\n\nexport function useDragHooks(options: DraggableCollectionProps): DragHooks {\n return useMemo(() => ({\n useDraggableCollectionState(props: DraggableCollectionOptions) {\n return useDraggableCollectionState({...props, ...options});\n },\n useDraggableItem,\n DragPreview\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, DragPreview as $6PX7k$DragPreview, 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,17 +14,13 @@ $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
  },
27
- useDraggableItem: $6PX7k$useDraggableItem
22
+ useDraggableItem: $6PX7k$useDraggableItem,
23
+ DragPreview: $6PX7k$DragPreview
28
24
  })
29
25
  , [
30
26
  options
@@ -32,7 +28,36 @@ function $1d9ad6c92ef06635$export$ca50582736fec395(options) {
32
28
  }
33
29
 
34
30
 
31
+ var $d9620cb8af727810$exports = {};
35
32
 
33
+ $parcel$export($d9620cb8af727810$exports, "useDropHooks", () => $d9620cb8af727810$export$c9cc1cdafc7aa18a);
36
34
 
37
- export {$1d9ad6c92ef06635$export$ca50582736fec395 as useDragHooks};
35
+
36
+
37
+ function $d9620cb8af727810$export$c9cc1cdafc7aa18a(options) {
38
+ return $6PX7k$useMemo(()=>({
39
+ useDroppableCollectionState (props) {
40
+ return $6PX7k$useDroppableCollectionState({
41
+ ...props,
42
+ ...options
43
+ });
44
+ },
45
+ useDroppableItem: $6PX7k$useDroppableItem,
46
+ useDroppableCollection (props, state, ref) {
47
+ return $6PX7k$useDroppableCollection({
48
+ ...props,
49
+ ...options
50
+ }, state, ref);
51
+ },
52
+ useDropIndicator: $6PX7k$useDropIndicator
53
+ })
54
+ , [
55
+ options
56
+ ]);
57
+ }
58
+
59
+
60
+
61
+
62
+ export {$1d9ad6c92ef06635$export$ca50582736fec395 as useDragHooks, $d9620cb8af727810$export$c9cc1cdafc7aa18a as useDropHooks};
38
63
  //# 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":";;;;;;;;;;;;;SCWgB,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;yBAChB,kBAAW;QACb,CAAC;MAAG,CAAC;QAAA,OAAO;IAAA,CAAC;AACf,CAAC;;;;;;;;;SCGe,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, DragPreview, 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 DragPreview: typeof DragPreview\n}\n\nexport function useDragHooks(options: DraggableCollectionProps): DragHooks {\n return useMemo(() => ({\n useDraggableCollectionState(props: DraggableCollectionOptions) {\n return useDraggableCollectionState({...props, ...options});\n },\n useDraggableItem,\n DragPreview\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,19 @@
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, DragPreview, 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;
8
+ DragPreview: typeof DragPreview;
6
9
  }
7
- export type DragHookOptions = Omit<DraggableCollectionOptions, 'collection' | 'selectionManager' | 'isDragging' | 'getKeysForDrag'>;
8
- export function useDragHooks(options: DragHookOptions): DragHooks;
10
+ export function useDragHooks(options: DraggableCollectionProps): DragHooks;
11
+ export interface DropHooks {
12
+ useDroppableCollectionState(props: DroppableCollectionStateOptions): DroppableCollectionState;
13
+ useDroppableCollection(props: DroppableCollectionOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement>): DroppableCollectionResult;
14
+ useDroppableItem(options: DroppableItemOptions, state: DroppableCollectionState, ref: RefObject<HTMLElement>): DroppableItemResult;
15
+ useDropIndicator(props: DropIndicatorProps, state: DroppableCollectionState, ref: RefObject<HTMLElement>): DropIndicatorAria;
16
+ }
17
+ export function useDropHooks(options: DroppableCollectionProps): DropHooks;
9
18
 
10
19
  //# 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;IACE,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,CAAC;IAClG,aAAa,kBAAkB,CAAA;CAChC;AAED,6BAA6B,OAAO,EAAE,wBAAwB,GAAG,SAAS,CAQzE;ACJD;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-alpha.2",
3
+ "version": "3.0.0-alpha.3",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -32,18 +32,19 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.6.2",
35
- "@react-aria/dnd": "3.0.0-alpha.8",
36
- "@react-stately/dnd": "3.0.0-alpha.6"
35
+ "@react-aria/dnd": "3.0.0-alpha.9",
36
+ "@react-stately/dnd": "3.0.0-alpha.7",
37
+ "@react-types/shared": "^3.13.0"
37
38
  },
38
39
  "devDependencies": {
39
40
  "@adobe/spectrum-css-temp": "3.0.0-alpha.1"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "@react-spectrum/provider": "^3.0.0",
43
- "react": "^16.8.0 || ^17.0.0-rc.1"
44
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
44
45
  },
45
46
  "publishConfig": {
46
47
  "access": "public"
47
48
  },
48
- "gitHead": "6a503b715e0dbbf92038cd7f08b1bcdde4c78e82"
49
+ "gitHead": "8f921ec5094e7c2b3c301bcb6133372e35a2052b"
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,34 +1,20 @@
1
1
  import {DraggableCollectionOptions, DraggableCollectionState, useDraggableCollectionState} from '@react-stately/dnd';
2
- import {DraggableItemProps, DraggableItemResult, useDraggableItem} from '@react-aria/dnd';
2
+ import {DraggableCollectionProps} from '@react-types/shared';
3
+ import {DraggableItemProps, DraggableItemResult, DragPreview, useDraggableItem} from '@react-aria/dnd';
3
4
  import {useMemo} from 'react';
4
5
 
5
6
  export interface DragHooks {
6
- useDraggableCollectionState(props: Omit<DraggableCollectionOptions, 'getItems'>): DraggableCollectionState,
7
- useDraggableItem(props: DraggableItemProps, state: DraggableCollectionState): DraggableItemResult
7
+ useDraggableCollectionState(props: Omit<DraggableCollectionOptions, 'getItems'>): DraggableCollectionState,
8
+ useDraggableItem(props: DraggableItemProps, state: DraggableCollectionState): DraggableItemResult,
9
+ DragPreview: typeof DragPreview
8
10
  }
9
11
 
10
- export type DragHookOptions = Omit<DraggableCollectionOptions, 'collection' | 'selectionManager' | 'isDragging' | 'getKeysForDrag'>
11
-
12
- export function useDragHooks(options: DragHookOptions): DragHooks {
12
+ export function useDragHooks(options: DraggableCollectionProps): DragHooks {
13
13
  return useMemo(() => ({
14
14
  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
- });
15
+ return useDraggableCollectionState({...props, ...options});
31
16
  },
32
- useDraggableItem
17
+ useDraggableItem,
18
+ DragPreview
33
19
  }), [options]);
34
20
  }
@@ -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
+ }