@react-types/shared 3.30.0 → 3.32.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 +2 -2
- package/src/collections.d.ts +1 -1
- package/src/dnd.d.ts +3 -3
- package/src/dom.d.ts +119 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-types/shared",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.32.0",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "2c58ed3ddd9be9100af9b1d0cfd137fcdc95ba2d"
|
|
18
18
|
}
|
package/src/collections.d.ts
CHANGED
|
@@ -183,7 +183,7 @@ export interface Collection<T> extends Iterable<T> {
|
|
|
183
183
|
getTextValue?(key: Key): string,
|
|
184
184
|
|
|
185
185
|
/** Filters the collection using the given function. */
|
|
186
|
-
|
|
186
|
+
filter?(filterFn: (nodeValue: string, node: T) => boolean): Collection<T>
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
export interface Node<T> {
|
package/src/dnd.d.ts
CHANGED
|
@@ -275,9 +275,9 @@ export interface DraggableCollectionEndEvent extends DragEndEvent {
|
|
|
275
275
|
isInternal: boolean
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
-
export type DragPreviewRenderer = (items: DragItem[], callback: (node: HTMLElement | null) => void) => void;
|
|
278
|
+
export type DragPreviewRenderer = (items: DragItem[], callback: (node: HTMLElement | null, x?: number, y?: number) => void) => void;
|
|
279
279
|
|
|
280
|
-
export interface DraggableCollectionProps {
|
|
280
|
+
export interface DraggableCollectionProps<T = object> {
|
|
281
281
|
/** Handler that is called when a drag operation is started. */
|
|
282
282
|
onDragStart?: (e: DraggableCollectionStartEvent) => void,
|
|
283
283
|
/** Handler that is called when the drag is moved. */
|
|
@@ -285,7 +285,7 @@ export interface DraggableCollectionProps {
|
|
|
285
285
|
/** Handler that is called when the drag operation is ended, either as a result of a drop or a cancellation. */
|
|
286
286
|
onDragEnd?: (e: DraggableCollectionEndEvent) => void,
|
|
287
287
|
/** A function that returns the items being dragged. */
|
|
288
|
-
getItems: (keys: Set<Key
|
|
288
|
+
getItems: (keys: Set<Key>, items: T[]) => DragItem[],
|
|
289
289
|
/** The ref of the element that will be rendered as the drag preview while dragging. */
|
|
290
290
|
preview?: RefObject<DragPreviewRenderer | null>,
|
|
291
291
|
/** Function that returns the drop operations that are allowed for the dragged items. If not provided, all drop operations are allowed. */
|
package/src/dom.d.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
|
+
AnimationEventHandler,
|
|
14
15
|
AriaAttributes,
|
|
15
16
|
AriaRole,
|
|
16
17
|
ClipboardEventHandler,
|
|
@@ -19,8 +20,14 @@ import {
|
|
|
19
20
|
FormEventHandler,
|
|
20
21
|
HTMLAttributeAnchorTarget,
|
|
21
22
|
HTMLAttributeReferrerPolicy,
|
|
23
|
+
MouseEventHandler,
|
|
24
|
+
PointerEventHandler,
|
|
22
25
|
DOMAttributes as ReactDOMAttributes,
|
|
23
|
-
ReactEventHandler
|
|
26
|
+
ReactEventHandler,
|
|
27
|
+
TouchEventHandler,
|
|
28
|
+
TransitionEventHandler,
|
|
29
|
+
UIEventHandler,
|
|
30
|
+
WheelEventHandler
|
|
24
31
|
} from 'react';
|
|
25
32
|
|
|
26
33
|
export interface AriaLabelingProps {
|
|
@@ -127,7 +134,13 @@ export interface InputDOMProps {
|
|
|
127
134
|
/**
|
|
128
135
|
* The name of the input element, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname).
|
|
129
136
|
*/
|
|
130
|
-
name?: string
|
|
137
|
+
name?: string,
|
|
138
|
+
/**
|
|
139
|
+
* The `<form>` element to associate the input with.
|
|
140
|
+
* The value of this attribute must be the id of a `<form>` in the same document.
|
|
141
|
+
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#form).
|
|
142
|
+
*/
|
|
143
|
+
form?: string
|
|
131
144
|
}
|
|
132
145
|
|
|
133
146
|
// DOM props that apply to all text inputs
|
|
@@ -223,3 +236,107 @@ export interface DOMAttributes<T = FocusableElement> extends AriaAttributes, Rea
|
|
|
223
236
|
export interface GroupDOMAttributes extends Omit<DOMAttributes<HTMLElement>, 'role'> {
|
|
224
237
|
role?: 'group' | 'region' | 'presentation'
|
|
225
238
|
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Global attributes that can be applied to any DOM element.
|
|
242
|
+
* @private
|
|
243
|
+
*/
|
|
244
|
+
// NOTE: id is handled elsewhere (DOMProps).
|
|
245
|
+
export interface GlobalDOMAttributes<T = Element> extends GlobalDOMEvents<T> {
|
|
246
|
+
dir?: string | undefined,
|
|
247
|
+
lang?: string | undefined,
|
|
248
|
+
hidden?: boolean | undefined,
|
|
249
|
+
inert?: boolean | undefined,
|
|
250
|
+
translate?: 'yes' | 'no' | undefined
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Global DOM events that are supported on all DOM elements.
|
|
255
|
+
* @private
|
|
256
|
+
*/
|
|
257
|
+
// NOTES:
|
|
258
|
+
// - Drag and drop events are omitted for now.
|
|
259
|
+
// - Keyboard and focus events are supported directly on focusable elements (FocusableProps).
|
|
260
|
+
// - Text input events (e.g. onInput, onCompositionStart, onCopy) are
|
|
261
|
+
// supported only directly on input elements (TextInputDOMProps).
|
|
262
|
+
// We don't support contentEditable on our components.
|
|
263
|
+
// - Media events should be handled directly on the <video>/<audio><img> element.
|
|
264
|
+
export interface GlobalDOMEvents<T = Element> {
|
|
265
|
+
// MouseEvents
|
|
266
|
+
onClick?: MouseEventHandler<T> | undefined,
|
|
267
|
+
onClickCapture?: MouseEventHandler<T> | undefined,
|
|
268
|
+
onAuxClick?: MouseEventHandler<T> | undefined,
|
|
269
|
+
onAuxClickCapture?: MouseEventHandler<T> | undefined,
|
|
270
|
+
onContextMenu?: MouseEventHandler<T> | undefined,
|
|
271
|
+
onContextMenuCapture?: MouseEventHandler<T> | undefined,
|
|
272
|
+
onDoubleClick?: MouseEventHandler<T> | undefined,
|
|
273
|
+
onDoubleClickCapture?: MouseEventHandler<T> | undefined,
|
|
274
|
+
onMouseDown?: MouseEventHandler<T> | undefined,
|
|
275
|
+
onMouseDownCapture?: MouseEventHandler<T> | undefined,
|
|
276
|
+
onMouseEnter?: MouseEventHandler<T> | undefined,
|
|
277
|
+
onMouseLeave?: MouseEventHandler<T> | undefined,
|
|
278
|
+
onMouseMove?: MouseEventHandler<T> | undefined,
|
|
279
|
+
onMouseMoveCapture?: MouseEventHandler<T> | undefined,
|
|
280
|
+
onMouseOut?: MouseEventHandler<T> | undefined,
|
|
281
|
+
onMouseOutCapture?: MouseEventHandler<T> | undefined,
|
|
282
|
+
onMouseOver?: MouseEventHandler<T> | undefined,
|
|
283
|
+
onMouseOverCapture?: MouseEventHandler<T> | undefined,
|
|
284
|
+
onMouseUp?: MouseEventHandler<T> | undefined,
|
|
285
|
+
onMouseUpCapture?: MouseEventHandler<T> | undefined,
|
|
286
|
+
|
|
287
|
+
// Touch Events
|
|
288
|
+
onTouchCancel?: TouchEventHandler<T> | undefined,
|
|
289
|
+
onTouchCancelCapture?: TouchEventHandler<T> | undefined,
|
|
290
|
+
onTouchEnd?: TouchEventHandler<T> | undefined,
|
|
291
|
+
onTouchEndCapture?: TouchEventHandler<T> | undefined,
|
|
292
|
+
onTouchMove?: TouchEventHandler<T> | undefined,
|
|
293
|
+
onTouchMoveCapture?: TouchEventHandler<T> | undefined,
|
|
294
|
+
onTouchStart?: TouchEventHandler<T> | undefined,
|
|
295
|
+
onTouchStartCapture?: TouchEventHandler<T> | undefined,
|
|
296
|
+
|
|
297
|
+
// Pointer Events
|
|
298
|
+
onPointerDown?: PointerEventHandler<T> | undefined,
|
|
299
|
+
onPointerDownCapture?: PointerEventHandler<T> | undefined,
|
|
300
|
+
onPointerMove?: PointerEventHandler<T> | undefined,
|
|
301
|
+
onPointerMoveCapture?: PointerEventHandler<T> | undefined,
|
|
302
|
+
onPointerUp?: PointerEventHandler<T> | undefined,
|
|
303
|
+
onPointerUpCapture?: PointerEventHandler<T> | undefined,
|
|
304
|
+
onPointerCancel?: PointerEventHandler<T> | undefined,
|
|
305
|
+
onPointerCancelCapture?: PointerEventHandler<T> | undefined,
|
|
306
|
+
onPointerEnter?: PointerEventHandler<T> | undefined,
|
|
307
|
+
onPointerLeave?: PointerEventHandler<T> | undefined,
|
|
308
|
+
onPointerOver?: PointerEventHandler<T> | undefined,
|
|
309
|
+
onPointerOverCapture?: PointerEventHandler<T> | undefined,
|
|
310
|
+
onPointerOut?: PointerEventHandler<T> | undefined,
|
|
311
|
+
onPointerOutCapture?: PointerEventHandler<T> | undefined,
|
|
312
|
+
onGotPointerCapture?: PointerEventHandler<T> | undefined,
|
|
313
|
+
onGotPointerCaptureCapture?: PointerEventHandler<T> | undefined,
|
|
314
|
+
onLostPointerCapture?: PointerEventHandler<T> | undefined,
|
|
315
|
+
onLostPointerCaptureCapture?: PointerEventHandler<T> | undefined,
|
|
316
|
+
|
|
317
|
+
// UI Events
|
|
318
|
+
onScroll?: UIEventHandler<T> | undefined,
|
|
319
|
+
onScrollCapture?: UIEventHandler<T> | undefined,
|
|
320
|
+
|
|
321
|
+
// Wheel Events
|
|
322
|
+
onWheel?: WheelEventHandler<T> | undefined,
|
|
323
|
+
onWheelCapture?: WheelEventHandler<T> | undefined,
|
|
324
|
+
|
|
325
|
+
// Animation Events
|
|
326
|
+
onAnimationStart?: AnimationEventHandler<T> | undefined,
|
|
327
|
+
onAnimationStartCapture?: AnimationEventHandler<T> | undefined,
|
|
328
|
+
onAnimationEnd?: AnimationEventHandler<T> | undefined,
|
|
329
|
+
onAnimationEndCapture?: AnimationEventHandler<T> | undefined,
|
|
330
|
+
onAnimationIteration?: AnimationEventHandler<T> | undefined,
|
|
331
|
+
onAnimationIterationCapture?: AnimationEventHandler<T> | undefined,
|
|
332
|
+
|
|
333
|
+
// Transition Events
|
|
334
|
+
onTransitionCancel?: TransitionEventHandler<T> | undefined,
|
|
335
|
+
onTransitionCancelCapture?: TransitionEventHandler<T> | undefined,
|
|
336
|
+
onTransitionEnd?: TransitionEventHandler<T> | undefined,
|
|
337
|
+
onTransitionEndCapture?: TransitionEventHandler<T> | undefined,
|
|
338
|
+
onTransitionRun?: TransitionEventHandler<T> | undefined,
|
|
339
|
+
onTransitionRunCapture?: TransitionEventHandler<T> | undefined,
|
|
340
|
+
onTransitionStart?: TransitionEventHandler<T> | undefined,
|
|
341
|
+
onTransitionStartCapture?: TransitionEventHandler<T> | undefined
|
|
342
|
+
}
|