@react-spectrum/list 3.0.1-nightly.3491 → 3.0.1-nightly.3506

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-spectrum/list",
3
- "version": "3.0.1-nightly.3491+25a36b7d4",
3
+ "version": "3.0.1-nightly.3506+5c9db40f1",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -32,34 +32,34 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.6.2",
35
- "@react-aria/button": "3.0.0-nightly.1791+25a36b7d4",
36
- "@react-aria/focus": "3.0.0-nightly.1791+25a36b7d4",
37
- "@react-aria/gridlist": "3.0.1-nightly.3491+25a36b7d4",
38
- "@react-aria/i18n": "3.0.0-nightly.1791+25a36b7d4",
39
- "@react-aria/interactions": "3.0.0-nightly.1791+25a36b7d4",
40
- "@react-aria/utils": "3.0.0-nightly.1791+25a36b7d4",
41
- "@react-aria/virtualizer": "3.5.1-nightly.3491+25a36b7d4",
42
- "@react-aria/visually-hidden": "3.0.0-nightly.1791+25a36b7d4",
43
- "@react-spectrum/checkbox": "3.0.0-nightly.1791+25a36b7d4",
44
- "@react-spectrum/layout": "3.4.2-nightly.3491+25a36b7d4",
45
- "@react-spectrum/progress": "3.0.0-nightly.1791+25a36b7d4",
46
- "@react-spectrum/text": "3.3.2-nightly.3491+25a36b7d4",
47
- "@react-spectrum/utils": "3.0.0-nightly.1791+25a36b7d4",
48
- "@react-stately/collections": "3.0.0-nightly.1791+25a36b7d4",
49
- "@react-stately/layout": "3.7.2-nightly.3491+25a36b7d4",
50
- "@react-stately/list": "3.5.4-nightly.3491+25a36b7d4",
51
- "@react-stately/virtualizer": "3.3.1-nightly.3491+25a36b7d4",
52
- "@react-types/grid": "3.1.4-nightly.3491+25a36b7d4",
53
- "@react-types/shared": "3.0.0-nightly.1791+25a36b7d4",
54
- "@spectrum-icons/ui": "3.0.0-nightly.1791+25a36b7d4",
35
+ "@react-aria/button": "3.0.0-nightly.1806+5c9db40f1",
36
+ "@react-aria/focus": "3.0.0-nightly.1806+5c9db40f1",
37
+ "@react-aria/gridlist": "3.0.1-nightly.3506+5c9db40f1",
38
+ "@react-aria/i18n": "3.0.0-nightly.1806+5c9db40f1",
39
+ "@react-aria/interactions": "3.0.0-nightly.1806+5c9db40f1",
40
+ "@react-aria/utils": "3.0.0-nightly.1806+5c9db40f1",
41
+ "@react-aria/virtualizer": "3.5.1-nightly.3506+5c9db40f1",
42
+ "@react-aria/visually-hidden": "3.0.0-nightly.1806+5c9db40f1",
43
+ "@react-spectrum/checkbox": "3.0.0-nightly.1806+5c9db40f1",
44
+ "@react-spectrum/layout": "3.4.2-nightly.3506+5c9db40f1",
45
+ "@react-spectrum/progress": "3.0.0-nightly.1806+5c9db40f1",
46
+ "@react-spectrum/text": "3.3.2-nightly.3506+5c9db40f1",
47
+ "@react-spectrum/utils": "3.0.0-nightly.1806+5c9db40f1",
48
+ "@react-stately/collections": "3.0.0-nightly.1806+5c9db40f1",
49
+ "@react-stately/layout": "3.7.2-nightly.3506+5c9db40f1",
50
+ "@react-stately/list": "3.5.4-nightly.3506+5c9db40f1",
51
+ "@react-stately/virtualizer": "3.3.1-nightly.3506+5c9db40f1",
52
+ "@react-types/grid": "3.1.4-nightly.3506+5c9db40f1",
53
+ "@react-types/shared": "3.0.0-nightly.1806+5c9db40f1",
54
+ "@spectrum-icons/ui": "3.0.0-nightly.1806+5c9db40f1",
55
55
  "react-transition-group": "^2.2.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@adobe/spectrum-css-temp": "3.0.0-nightly.1791+25a36b7d4",
59
- "@react-aria/dnd": "3.0.0-nightly.3491+25a36b7d4",
60
- "@react-spectrum/button": "3.0.0-nightly.1791+25a36b7d4",
61
- "@react-spectrum/dnd": "3.0.0-nightly.3491+25a36b7d4",
62
- "@react-stately/dnd": "3.0.0-nightly.3491+25a36b7d4"
58
+ "@adobe/spectrum-css-temp": "3.0.0-nightly.1806+5c9db40f1",
59
+ "@react-aria/dnd": "3.0.0-nightly.3506+5c9db40f1",
60
+ "@react-spectrum/button": "3.0.0-nightly.1806+5c9db40f1",
61
+ "@react-spectrum/dnd": "3.0.0-nightly.3506+5c9db40f1",
62
+ "@react-stately/dnd": "3.0.0-nightly.3506+5c9db40f1"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "@react-spectrum/provider": "^3.2.0",
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "25a36b7d40a7b20ff9ea67850c456119788c64d6"
72
+ "gitHead": "5c9db40f10b9e68d4eab0268b9775baf2a840987"
73
73
  }
@@ -11,11 +11,11 @@ interface InsertionIndicatorProps {
11
11
  }
12
12
 
13
13
  export default function InsertionIndicator(props: InsertionIndicatorProps) {
14
- let {dropState, dndHooks} = useContext(ListViewContext);
14
+ let {dropState, dragAndDropHooks} = useContext(ListViewContext);
15
15
  const {target, isPresentationOnly} = props;
16
16
 
17
17
  let ref = useRef();
18
- let {dropIndicatorProps} = dndHooks.useDropIndicator(props, dropState, ref);
18
+ let {dropIndicatorProps} = dragAndDropHooks.useDropIndicator(props, dropState, ref);
19
19
  let {visuallyHiddenProps} = useVisuallyHidden();
20
20
 
21
21
  let isDropTarget = dropState.isDropTarget(target);
package/src/ListView.tsx CHANGED
@@ -13,7 +13,7 @@
13
13
  import {AriaGridListProps, useGridList} from '@react-aria/gridlist';
14
14
  import {AsyncLoadable, DOMRef, LoadingState, SpectrumSelectionProps, StyleProps} from '@react-types/shared';
15
15
  import {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';
16
- import type {DnDHooks} from '@react-spectrum/dnd';
16
+ import type {DragAndDropHooks} from '@react-spectrum/dnd';
17
17
  import type {DraggableCollectionState, DroppableCollectionState} from '@react-stately/dnd';
18
18
  import type {DroppableCollectionResult} from '@react-aria/dnd';
19
19
  import {filterDOMProps, mergeProps, useLayoutEffect} from '@react-aria/utils';
@@ -56,17 +56,16 @@ export interface SpectrumListViewProps<T> extends AriaGridListProps<T>, StylePro
56
56
  */
57
57
  onAction?: (key: Key) => void,
58
58
  /**
59
- * The drag and drop hooks returned by `useDnDHooks` used to enable drag and drop behavior for the ListView.
60
- * @private
59
+ * The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the ListView.
61
60
  */
62
- dndHooks?: DnDHooks['dndHooks']
61
+ dragAndDropHooks?: DragAndDropHooks['dragAndDropHooks']
63
62
  }
64
63
 
65
64
  interface ListViewContextValue<T> {
66
65
  state: ListState<T>,
67
66
  dragState: DraggableCollectionState,
68
67
  dropState: DroppableCollectionState,
69
- dndHooks: DnDHooks['dndHooks'],
68
+ dragAndDropHooks: DragAndDropHooks['dragAndDropHooks'],
70
69
  onAction:(key: Key) => void,
71
70
  isListDraggable: boolean,
72
71
  isListDroppable: boolean,
@@ -118,11 +117,11 @@ function ListView<T extends object>(props: SpectrumListViewProps<T>, ref: DOMRef
118
117
  isQuiet,
119
118
  overflowMode = 'truncate',
120
119
  onAction,
121
- dndHooks,
120
+ dragAndDropHooks,
122
121
  ...otherProps
123
122
  } = props;
124
- let isListDraggable = !!dndHooks?.useDraggableCollectionState;
125
- let isListDroppable = !!dndHooks?.useDroppableCollectionState;
123
+ let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;
124
+ let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;
126
125
  let dragHooksProvided = useRef(isListDraggable);
127
126
  let dropHooksProvided = useRef(isListDroppable);
128
127
  if (dragHooksProvided.current !== isListDraggable) {
@@ -144,12 +143,12 @@ function ListView<T extends object>(props: SpectrumListViewProps<T>, ref: DOMRef
144
143
  let dragState: DraggableCollectionState;
145
144
  let preview = useRef(null);
146
145
  if (isListDraggable) {
147
- dragState = dndHooks.useDraggableCollectionState({
146
+ dragState = dragAndDropHooks.useDraggableCollectionState({
148
147
  collection,
149
148
  selectionManager,
150
149
  preview
151
150
  });
152
- dndHooks.useDraggableCollection({}, dragState, domRef);
151
+ dragAndDropHooks.useDraggableCollection({}, dragState, domRef);
153
152
  }
154
153
  let layout = useListLayout(
155
154
  state,
@@ -160,16 +159,16 @@ function ListView<T extends object>(props: SpectrumListViewProps<T>, ref: DOMRef
160
159
  layout.allowDisabledKeyFocus = state.selectionManager.disabledBehavior === 'selection' || !!dragState?.draggingKeys.size;
161
160
 
162
161
 
163
- let DragPreview = dndHooks?.DragPreview;
162
+ let DragPreview = dragAndDropHooks?.DragPreview;
164
163
  let dropState: DroppableCollectionState;
165
164
  let droppableCollection: DroppableCollectionResult;
166
165
  let isRootDropTarget: boolean;
167
166
  if (isListDroppable) {
168
- dropState = dndHooks.useDroppableCollectionState({
167
+ dropState = dragAndDropHooks.useDroppableCollectionState({
169
168
  collection,
170
169
  selectionManager
171
170
  });
172
- droppableCollection = dndHooks.useDroppableCollection({
171
+ droppableCollection = dragAndDropHooks.useDroppableCollection({
173
172
  keyboardDelegate: layout,
174
173
  dropTargetDelegate: layout
175
174
  }, dropState, domRef);
@@ -206,7 +205,7 @@ function ListView<T extends object>(props: SpectrumListViewProps<T>, ref: DOMRef
206
205
  let hasAnyChildren = useMemo(() => [...collection].some(item => item.hasChildNodes), [collection]);
207
206
 
208
207
  return (
209
- <ListViewContext.Provider value={{state, dragState, dropState, dndHooks, onAction, isListDraggable, isListDroppable, layout, loadingState}}>
208
+ <ListViewContext.Provider value={{state, dragState, dropState, dragAndDropHooks, onAction, isListDraggable, isListDroppable, layout, loadingState}}>
210
209
  <FocusScope>
211
210
  <FocusRing focusRingClass={classNames(listStyles, 'focus-ring')}>
212
211
  <Virtualizer
@@ -49,7 +49,7 @@ export function ListViewItem<T>(props: ListViewItemProps<T>) {
49
49
  isListDraggable,
50
50
  isListDroppable,
51
51
  layout,
52
- dndHooks,
52
+ dragAndDropHooks,
53
53
  loadingState
54
54
  } = useContext(ListViewContext);
55
55
  let {direction} = useLocale();
@@ -82,7 +82,7 @@ export function ListViewItem<T>(props: ListViewItemProps<T>) {
82
82
  let draggableItem: DraggableItemResult;
83
83
  if (isListDraggable) {
84
84
  // eslint-disable-next-line react-hooks/rules-of-hooks
85
- draggableItem = dndHooks.useDraggableItem({key: item.key, hasDragButton: true}, dragState);
85
+ draggableItem = dragAndDropHooks.useDraggableItem({key: item.key, hasDragButton: true}, dragState);
86
86
  if (isDisabled) {
87
87
  draggableItem = null;
88
88
  }
@@ -95,7 +95,7 @@ export function ListViewItem<T>(props: ListViewItemProps<T>) {
95
95
  let target = {type: 'item', key: item.key, dropPosition: 'on'} as DropTarget;
96
96
  isDropTarget = dropState.isDropTarget(target);
97
97
  // eslint-disable-next-line react-hooks/rules-of-hooks
98
- dropIndicator = dndHooks.useDropIndicator({target}, dropState, dropIndicatorRef);
98
+ dropIndicator = dragAndDropHooks.useDropIndicator({target}, dropState, dropIndicatorRef);
99
99
  }
100
100
 
101
101
  let dragButtonRef = React.useRef();
@@ -147,7 +147,7 @@ export function ListViewItem<T>(props: ListViewItemProps<T>) {
147
147
  focusProps,
148
148
  // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
149
149
  // allowing for single swipe navigation between row drop indicator
150
- dndHooks?.isVirtualDragging() && {tabIndex: null}
150
+ dragAndDropHooks?.isVirtualDragging() && {tabIndex: null}
151
151
  );
152
152
 
153
153
  let isFirstRow = item.prevKey == null;
@@ -3,9 +3,9 @@ import React, {useContext, useRef} from 'react';
3
3
  import {useVisuallyHidden} from '@react-aria/visually-hidden';
4
4
 
5
5
  export default function RootDropIndicator() {
6
- let {dropState, dndHooks} = useContext(ListViewContext);
6
+ let {dropState, dragAndDropHooks} = useContext(ListViewContext);
7
7
  let ref = useRef();
8
- let {dropIndicatorProps} = dndHooks.useDropIndicator({
8
+ let {dropIndicatorProps} = dragAndDropHooks.useDropIndicator({
9
9
  target: {type: 'root'}
10
10
  }, dropState, ref);
11
11
  let isDropTarget = dropState.isDropTarget({type: 'root'});
@@ -19,9 +19,8 @@ export default function RootDropIndicator() {
19
19
  <div role="row" aria-hidden={dropIndicatorProps['aria-hidden']}>
20
20
  <div
21
21
  role="gridcell"
22
- aria-selected="false"
23
- {...visuallyHiddenProps}>
24
- <div role="button" {...dropIndicatorProps} ref={ref} />
22
+ aria-selected="false">
23
+ <div role="button" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />
25
24
  </div>
26
25
  </div>
27
26
  );