@react-types/shared 3.12.0 → 3.14.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 +3 -3
- package/src/collections.d.ts +9 -9
- package/src/dnd.d.ts +20 -4
- package/src/dom.d.ts +15 -0
- package/src/events.d.ts +1 -1
- package/src/selection.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-types/shared",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.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": "
|
|
17
|
+
"gitHead": "cd7c0ec917122c7612f653c22f8ed558f8b66ecd"
|
|
18
18
|
}
|
package/src/collections.d.ts
CHANGED
|
@@ -89,31 +89,31 @@ export type SortDirection = 'ascending' | 'descending';
|
|
|
89
89
|
|
|
90
90
|
export interface KeyboardDelegate {
|
|
91
91
|
/** Returns the key visually below the given one, or `null` for none. */
|
|
92
|
-
getKeyBelow?(key: Key): Key,
|
|
92
|
+
getKeyBelow?(key: Key): Key | null,
|
|
93
93
|
|
|
94
94
|
/** Returns the key visually above the given one, or `null` for none. */
|
|
95
|
-
getKeyAbove?(key: Key): Key,
|
|
95
|
+
getKeyAbove?(key: Key): Key | null,
|
|
96
96
|
|
|
97
97
|
/** Returns the key visually to the left of the given one, or `null` for none. */
|
|
98
|
-
getKeyLeftOf?(key: Key): Key,
|
|
98
|
+
getKeyLeftOf?(key: Key): Key | null,
|
|
99
99
|
|
|
100
100
|
/** Returns the key visually to the right of the given one, or `null` for none. */
|
|
101
|
-
getKeyRightOf?(key: Key): Key,
|
|
101
|
+
getKeyRightOf?(key: Key): Key | null,
|
|
102
102
|
|
|
103
103
|
/** Returns the key visually one page below the given one, or `null` for none. */
|
|
104
|
-
getKeyPageBelow?(key: Key): Key,
|
|
104
|
+
getKeyPageBelow?(key: Key): Key | null,
|
|
105
105
|
|
|
106
106
|
/** Returns the key visually one page above the given one, or `null` for none. */
|
|
107
|
-
getKeyPageAbove?(key: Key): Key,
|
|
107
|
+
getKeyPageAbove?(key: Key): Key | null,
|
|
108
108
|
|
|
109
109
|
/** Returns the first key, or `null` for none. */
|
|
110
|
-
getFirstKey?(key?: Key, global?: boolean): Key,
|
|
110
|
+
getFirstKey?(key?: Key, global?: boolean): Key | null,
|
|
111
111
|
|
|
112
112
|
/** Returns the last key, or `null` for none. */
|
|
113
|
-
getLastKey?(key?: Key, global?: boolean): Key,
|
|
113
|
+
getLastKey?(key?: Key, global?: boolean): Key | null,
|
|
114
114
|
|
|
115
115
|
/** Returns the next key after `fromKey` that matches the given search string, or `null` for none. */
|
|
116
|
-
getKeyForSearch?(search: string, fromKey?: Key): Key
|
|
116
|
+
getKeyForSearch?(search: string, fromKey?: Key): Key | null
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/**
|
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
|
|
@@ -119,11 +119,20 @@ export interface DragTypes {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
export interface DroppableCollectionProps {
|
|
122
|
+
/**
|
|
123
|
+
* A function returning the drop operation to be performed when items matching the given types are dropped
|
|
124
|
+
* on the drop target.
|
|
125
|
+
*/
|
|
122
126
|
getDropOperation?: (target: DropTarget, types: DragTypes, allowedOperations: DropOperation[]) => DropOperation,
|
|
127
|
+
/** Handler that is called when a valid drag element enters the drop target. */
|
|
123
128
|
onDropEnter?: (e: DroppableCollectionEnterEvent) => void,
|
|
129
|
+
/** Handler that is called when a valid drag element is moved within the drop target. */
|
|
124
130
|
onDropMove?: (e: DroppableCollectionMoveEvent) => void,
|
|
131
|
+
/** Handler that is called after a valid drag element is held over the drop target for a period of time. */
|
|
125
132
|
onDropActivate?: (e: DroppableCollectionActivateEvent) => void,
|
|
133
|
+
/** Handler that is called when a valid drag element exits the drop target. */
|
|
126
134
|
onDropExit?: (e: DroppableCollectionExitEvent) => void,
|
|
135
|
+
/** Handler that is called when a valid drag element is dropped on the drop target. */
|
|
127
136
|
onDrop?: (e: DroppableCollectionDropEvent) => void
|
|
128
137
|
}
|
|
129
138
|
|
|
@@ -139,12 +148,19 @@ interface DraggableCollectionEndEvent extends DragEndEvent {
|
|
|
139
148
|
keys: Set<Key>
|
|
140
149
|
}
|
|
141
150
|
|
|
151
|
+
export type DragPreviewRenderer = (items: DragItem[], callback: (node: HTMLElement) => void) => void;
|
|
152
|
+
|
|
142
153
|
export interface DraggableCollectionProps {
|
|
154
|
+
/** Handler that is called when a drag operation is started. */
|
|
143
155
|
onDragStart?: (e: DraggableCollectionStartEvent) => void,
|
|
156
|
+
/** Handler that is called when the dragged element is moved. */
|
|
144
157
|
onDragMove?: (e: DraggableCollectionMoveEvent) => void,
|
|
158
|
+
/** Handler that is called when the drag operation is ended, either as a result of a drop or a cancellation. */
|
|
145
159
|
onDragEnd?: (e: DraggableCollectionEndEvent) => void,
|
|
160
|
+
/** A function that returns the items being dragged. */
|
|
146
161
|
getItems: (keys: Set<Key>) => DragItem[],
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
162
|
+
/** The ref of the element that will be rendered as the drag preview while dragging. */
|
|
163
|
+
preview?: RefObject<DragPreviewRenderer>,
|
|
164
|
+
/** Function that returns the drop operations that are allowed for the dragged items. If not provided, all drop operations are allowed. */
|
|
165
|
+
getAllowedDropOperations?: () => DropOperation[]
|
|
150
166
|
}
|
package/src/dom.d.ts
CHANGED
|
@@ -11,9 +11,13 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
|
+
AriaAttributes,
|
|
15
|
+
AriaRole,
|
|
14
16
|
ClipboardEventHandler,
|
|
15
17
|
CompositionEventHandler,
|
|
18
|
+
CSSProperties,
|
|
16
19
|
FormEventHandler,
|
|
20
|
+
DOMAttributes as ReactDOMAttributes,
|
|
17
21
|
ReactEventHandler
|
|
18
22
|
} from 'react';
|
|
19
23
|
|
|
@@ -160,3 +164,14 @@ export interface TextInputDOMProps extends DOMProps, TextInputDOMEvents {
|
|
|
160
164
|
*/
|
|
161
165
|
inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search'
|
|
162
166
|
}
|
|
167
|
+
|
|
168
|
+
/** Any focusable element, including both HTML and SVG elements. */
|
|
169
|
+
export interface FocusableElement extends Element, HTMLOrSVGElement {}
|
|
170
|
+
|
|
171
|
+
/** All DOM attributes supported across both HTML and SVG elements. */
|
|
172
|
+
export interface DOMAttributes<T = FocusableElement> extends AriaAttributes, ReactDOMAttributes<T> {
|
|
173
|
+
id?: string | undefined,
|
|
174
|
+
role?: AriaRole | undefined,
|
|
175
|
+
tabIndex?: number | undefined,
|
|
176
|
+
style?: CSSProperties | undefined
|
|
177
|
+
}
|
package/src/events.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export interface PressEvent {
|
|
|
34
34
|
/** The pointer type that triggered the press event. */
|
|
35
35
|
pointerType: PointerType,
|
|
36
36
|
/** The target element of the press event. */
|
|
37
|
-
target:
|
|
37
|
+
target: Element,
|
|
38
38
|
/** Whether the shift keyboard modifier was held during the press event. */
|
|
39
39
|
shiftKey: boolean,
|
|
40
40
|
/** Whether the ctrl keyboard modifier was held during the press event. */
|
package/src/selection.d.ts
CHANGED