@react-types/shared 3.12.0 → 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-types/shared",
3
- "version": "3.12.0",
3
+ "version": "3.13.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "types": "src/index.d.ts",
@@ -9,10 +9,10 @@
9
9
  "url": "https://github.com/adobe/react-spectrum"
10
10
  },
11
11
  "peerDependencies": {
12
- "react": "^16.8.0 || ^17.0.0-rc.1"
12
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
13
13
  },
14
14
  "publishConfig": {
15
15
  "access": "public"
16
16
  },
17
- "gitHead": "6a503b715e0dbbf92038cd7f08b1bcdde4c78e82"
17
+ "gitHead": "8f921ec5094e7c2b3c301bcb6133372e35a2052b"
18
18
  }
package/src/dnd.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import {Key} from 'react';
13
+ import {Key, RefObject} from 'react';
14
14
 
15
15
  export interface DragDropEvent {
16
16
  // Relative to the target element's position
@@ -139,12 +139,13 @@ interface DraggableCollectionEndEvent extends DragEndEvent {
139
139
  keys: Set<Key>
140
140
  }
141
141
 
142
+ export type DragPreviewRenderer = (items: DragItem[], callback: (node: HTMLElement) => void) => void;
143
+
142
144
  export interface DraggableCollectionProps {
143
145
  onDragStart?: (e: DraggableCollectionStartEvent) => void,
144
146
  onDragMove?: (e: DraggableCollectionMoveEvent) => void,
145
147
  onDragEnd?: (e: DraggableCollectionEndEvent) => void,
146
148
  getItems: (keys: Set<Key>) => DragItem[],
147
- renderPreview?: (selectedKeys: Set<Key>, draggedKey: Key) => JSX.Element,
148
- getAllowedDropOperations?: () => DropOperation[],
149
- allowsDraggingItem?: (key: Key) => boolean
149
+ preview?: RefObject<DragPreviewRenderer>,
150
+ getAllowedDropOperations?: () => DropOperation[]
150
151
  }
@@ -47,3 +47,4 @@ export interface SpectrumSelectionProps {
47
47
  }
48
48
 
49
49
  export type FocusStrategy = 'first' | 'last';
50
+ export type DisabledBehavior = 'selection' | 'all';