@react-types/shared
Advanced tools
Comparing version
{ | ||
"name": "@react-types/shared", | ||
"version": "3.0.0-nightly-fee532d6a-241217", | ||
"version": "3.0.0-nightly-ff456f38c-250716", | ||
"description": "Spectrum UI components in React", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -183,3 +183,6 @@ /* | ||
/** Returns a string representation of the item's contents. */ | ||
getTextValue?(key: Key): string | ||
getTextValue?(key: Key): string, | ||
/** Filters the collection using the given function. */ | ||
UNSTABLE_filter?(filterFn: (nodeValue: string) => boolean): Collection<T> | ||
} | ||
@@ -186,0 +189,0 @@ |
@@ -221,6 +221,14 @@ /* | ||
/** | ||
* Handler that is called when items are reordered via drag in the source collection. | ||
* Handler that is called when items are reordered within the collection. | ||
* This handler only allows dropping between items, not on items. | ||
* It does not allow moving items to a different parent item within a tree. | ||
*/ | ||
onReorder?: (e: DroppableCollectionReorderEvent) => void, | ||
/** | ||
* Handler that is called when items are moved within the source collection. | ||
* This handler allows dropping both on or between items, and items may be | ||
* moved to a different parent item within a tree. | ||
*/ | ||
onMove?: (e: DroppableCollectionReorderEvent) => void, | ||
/** | ||
* A function returning whether a given target in the droppable collection is a valid "on" drop target for the current drag types. | ||
@@ -236,3 +244,2 @@ */ | ||
* Handler that is called after a valid drag is held over a drop target for a period of time. | ||
* @private | ||
*/ | ||
@@ -273,3 +280,3 @@ onDropActivate?: (e: DroppableCollectionActivateEvent) => void, | ||
export type DragPreviewRenderer = (items: DragItem[], callback: (node: HTMLElement | null) => void) => void; | ||
export type DragPreviewRenderer = (items: DragItem[], callback: (node: HTMLElement | null, x?: number, y?: number) => void) => void; | ||
@@ -276,0 +283,0 @@ export interface DraggableCollectionProps { |
133
src/dom.d.ts
@@ -14,2 +14,3 @@ /* | ||
import { | ||
AnimationEventHandler, | ||
AriaAttributes, | ||
@@ -23,4 +24,10 @@ AriaRole, | ||
HTMLAttributeReferrerPolicy, | ||
MouseEventHandler, | ||
PointerEventHandler, | ||
DOMAttributes as ReactDOMAttributes, | ||
ReactEventHandler | ||
ReactEventHandler, | ||
TouchEventHandler, | ||
TransitionEventHandler, | ||
UIEventHandler, | ||
WheelEventHandler | ||
} from 'react'; | ||
@@ -132,3 +139,9 @@ | ||
*/ | ||
name?: string | ||
name?: string, | ||
/** | ||
* The `<form>` element to associate the input with. | ||
* The value of this attribute must be the id of a `<form>` in the same document. | ||
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#form). | ||
*/ | ||
form?: string | ||
} | ||
@@ -172,3 +185,13 @@ | ||
*/ | ||
inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' | ||
inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search', | ||
/** | ||
* An attribute that takes as its value a space-separated string that describes what, if any, type of autocomplete functionality the input should provide. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autocomplete). | ||
*/ | ||
autoCorrect?: string, | ||
/** | ||
* An enumerated attribute that defines whether the element may be checked for spelling errors. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck). | ||
*/ | ||
spellCheck?: string | ||
} | ||
@@ -220,1 +243,105 @@ | ||
} | ||
/** | ||
* Global attributes that can be applied to any DOM element. | ||
* @private | ||
*/ | ||
// NOTE: id is handled elsewhere (DOMProps). | ||
export interface GlobalDOMAttributes<T = Element> extends GlobalDOMEvents<T> { | ||
dir?: string | undefined, | ||
lang?: string | undefined, | ||
hidden?: boolean | undefined, | ||
inert?: boolean | undefined, | ||
translate?: 'yes' | 'no' | undefined | ||
} | ||
/** | ||
* Global DOM events that are supported on all DOM elements. | ||
* @private | ||
*/ | ||
// NOTES: | ||
// - Drag and drop events are omitted for now. | ||
// - Keyboard and focus events are supported directly on focusable elements (FocusableProps). | ||
// - Text input events (e.g. onInput, onCompositionStart, onCopy) are | ||
// supported only directly on input elements (TextInputDOMProps). | ||
// We don't support contentEditable on our components. | ||
// - Media events should be handled directly on the <video>/<audio><img> element. | ||
export interface GlobalDOMEvents<T = Element> { | ||
// MouseEvents | ||
onClick?: MouseEventHandler<T> | undefined, | ||
onClickCapture?: MouseEventHandler<T> | undefined, | ||
onAuxClick?: MouseEventHandler<T> | undefined, | ||
onAuxClickCapture?: MouseEventHandler<T> | undefined, | ||
onContextMenu?: MouseEventHandler<T> | undefined, | ||
onContextMenuCapture?: MouseEventHandler<T> | undefined, | ||
onDoubleClick?: MouseEventHandler<T> | undefined, | ||
onDoubleClickCapture?: MouseEventHandler<T> | undefined, | ||
onMouseDown?: MouseEventHandler<T> | undefined, | ||
onMouseDownCapture?: MouseEventHandler<T> | undefined, | ||
onMouseEnter?: MouseEventHandler<T> | undefined, | ||
onMouseLeave?: MouseEventHandler<T> | undefined, | ||
onMouseMove?: MouseEventHandler<T> | undefined, | ||
onMouseMoveCapture?: MouseEventHandler<T> | undefined, | ||
onMouseOut?: MouseEventHandler<T> | undefined, | ||
onMouseOutCapture?: MouseEventHandler<T> | undefined, | ||
onMouseOver?: MouseEventHandler<T> | undefined, | ||
onMouseOverCapture?: MouseEventHandler<T> | undefined, | ||
onMouseUp?: MouseEventHandler<T> | undefined, | ||
onMouseUpCapture?: MouseEventHandler<T> | undefined, | ||
// Touch Events | ||
onTouchCancel?: TouchEventHandler<T> | undefined, | ||
onTouchCancelCapture?: TouchEventHandler<T> | undefined, | ||
onTouchEnd?: TouchEventHandler<T> | undefined, | ||
onTouchEndCapture?: TouchEventHandler<T> | undefined, | ||
onTouchMove?: TouchEventHandler<T> | undefined, | ||
onTouchMoveCapture?: TouchEventHandler<T> | undefined, | ||
onTouchStart?: TouchEventHandler<T> | undefined, | ||
onTouchStartCapture?: TouchEventHandler<T> | undefined, | ||
// Pointer Events | ||
onPointerDown?: PointerEventHandler<T> | undefined, | ||
onPointerDownCapture?: PointerEventHandler<T> | undefined, | ||
onPointerMove?: PointerEventHandler<T> | undefined, | ||
onPointerMoveCapture?: PointerEventHandler<T> | undefined, | ||
onPointerUp?: PointerEventHandler<T> | undefined, | ||
onPointerUpCapture?: PointerEventHandler<T> | undefined, | ||
onPointerCancel?: PointerEventHandler<T> | undefined, | ||
onPointerCancelCapture?: PointerEventHandler<T> | undefined, | ||
onPointerEnter?: PointerEventHandler<T> | undefined, | ||
onPointerLeave?: PointerEventHandler<T> | undefined, | ||
onPointerOver?: PointerEventHandler<T> | undefined, | ||
onPointerOverCapture?: PointerEventHandler<T> | undefined, | ||
onPointerOut?: PointerEventHandler<T> | undefined, | ||
onPointerOutCapture?: PointerEventHandler<T> | undefined, | ||
onGotPointerCapture?: PointerEventHandler<T> | undefined, | ||
onGotPointerCaptureCapture?: PointerEventHandler<T> | undefined, | ||
onLostPointerCapture?: PointerEventHandler<T> | undefined, | ||
onLostPointerCaptureCapture?: PointerEventHandler<T> | undefined, | ||
// UI Events | ||
onScroll?: UIEventHandler<T> | undefined, | ||
onScrollCapture?: UIEventHandler<T> | undefined, | ||
// Wheel Events | ||
onWheel?: WheelEventHandler<T> | undefined, | ||
onWheelCapture?: WheelEventHandler<T> | undefined, | ||
// Animation Events | ||
onAnimationStart?: AnimationEventHandler<T> | undefined, | ||
onAnimationStartCapture?: AnimationEventHandler<T> | undefined, | ||
onAnimationEnd?: AnimationEventHandler<T> | undefined, | ||
onAnimationEndCapture?: AnimationEventHandler<T> | undefined, | ||
onAnimationIteration?: AnimationEventHandler<T> | undefined, | ||
onAnimationIterationCapture?: AnimationEventHandler<T> | undefined, | ||
// Transition Events | ||
onTransitionCancel?: TransitionEventHandler<T> | undefined, | ||
onTransitionCancelCapture?: TransitionEventHandler<T> | undefined, | ||
onTransitionEnd?: TransitionEventHandler<T> | undefined, | ||
onTransitionEndCapture?: TransitionEventHandler<T> | undefined, | ||
onTransitionRun?: TransitionEventHandler<T> | undefined, | ||
onTransitionRunCapture?: TransitionEventHandler<T> | undefined, | ||
onTransitionStart?: TransitionEventHandler<T> | undefined, | ||
onTransitionStartCapture?: TransitionEventHandler<T> | undefined | ||
} |
@@ -13,4 +13,6 @@ /* | ||
import {FocusableElement} from './dom'; | ||
import { | ||
FocusEvent, | ||
MouseEvent, | ||
KeyboardEvent as ReactKeyboardEvent, | ||
@@ -116,3 +118,9 @@ SyntheticEvent | ||
*/ | ||
onPressUp?: (e: PressEvent) => void | ||
onPressUp?: (e: PressEvent) => void, | ||
/** | ||
* **Not recommended – use `onPress` instead.** `onClick` is an alias for `onPress` | ||
* provided for compatibility with other libraries. `onPress` provides | ||
* additional event details for non-mouse interactions. | ||
*/ | ||
onClick?: (e: MouseEvent<FocusableElement>) => void | ||
} | ||
@@ -119,0 +127,0 @@ |
@@ -23,3 +23,3 @@ /* | ||
/** Handler that is called when the selection changes. */ | ||
onSelectionChange?: (key: Key) => void | ||
onSelectionChange?: (key: Key | null) => void | ||
} | ||
@@ -26,0 +26,0 @@ |
@@ -212,16 +212,7 @@ /* | ||
export interface BoxAlignmentStyleProps { | ||
/** | ||
* The distribution of space around items along the main axis. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content). | ||
* @default 'stretch' | ||
*/ | ||
/** The distribution of space around items along the main axis. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content). */ | ||
justifyContent?: Responsive<'start' | 'end' | 'center' | 'left' | 'right' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch' | 'baseline' | 'first baseline' | 'last baseline' | 'safe center' | 'unsafe center'>, | ||
/** | ||
* The distribution of space around child items along the cross axis. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/align-content). | ||
* @default 'start' | ||
*/ | ||
/** The distribution of space around child items along the cross axis. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/align-content).*/ | ||
alignContent?: Responsive<'start' | 'end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch' | 'baseline' | 'first baseline' | 'last baseline' | 'safe center' | 'unsafe center'>, | ||
/** | ||
* The alignment of children within their container. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items). | ||
* @default 'stretch' | ||
*/ | ||
/** The alignment of children within their container. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items). */ | ||
alignItems?: Responsive<'start' | 'end' | 'center' | 'stretch' | 'self-start' | 'self-end' | 'baseline' | 'first baseline' | 'last baseline' | 'safe center' | 'unsafe center'>, | ||
@@ -228,0 +219,0 @@ /** The space to display between both rows and columns. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/gap). */ |
81434
8.59%1930
6.93%