@react-stately/selection
Advanced tools
Comparing version
{ | ||
"name": "@react-stately/selection", | ||
"version": "3.0.0-nightly-90b6fd4f7-250221", | ||
"version": "3.0.0-nightly-9349d12e3-250813", | ||
"description": "Spectrum UI components in React", | ||
@@ -9,3 +9,7 @@ "license": "Apache-2.0", | ||
"exports": { | ||
"types": "./dist/types.d.ts", | ||
"source": "./src/index.ts", | ||
"types": [ | ||
"./dist/types.d.ts", | ||
"./src/index.ts" | ||
], | ||
"import": "./dist/import.mjs", | ||
@@ -26,5 +30,5 @@ "require": "./dist/main.js" | ||
"dependencies": { | ||
"@react-stately/collections": "3.0.0-nightly-90b6fd4f7-250221", | ||
"@react-stately/utils": "3.0.0-nightly-90b6fd4f7-250221", | ||
"@react-types/shared": "3.0.0-nightly-90b6fd4f7-250221", | ||
"@react-stately/collections": "3.0.0-nightly-9349d12e3-250813", | ||
"@react-stately/utils": "3.0.0-nightly-9349d12e3-250813", | ||
"@react-types/shared": "3.0.0-nightly-9349d12e3-250813", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -31,0 +35,0 @@ }, |
@@ -76,3 +76,3 @@ /* | ||
*/ | ||
setSelectionBehavior(selectionBehavior: SelectionBehavior) { | ||
setSelectionBehavior(selectionBehavior: SelectionBehavior): void { | ||
this.state.setSelectionBehavior(selectionBehavior); | ||
@@ -91,3 +91,3 @@ } | ||
*/ | ||
setFocused(isFocused: boolean) { | ||
setFocused(isFocused: boolean): void { | ||
this.state.setFocused(isFocused); | ||
@@ -111,3 +111,3 @@ } | ||
*/ | ||
setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy) { | ||
setFocusedKey(key: Key | null, childFocusStrategy?: FocusStrategy): void { | ||
if (key == null || this.collection.getItem(key)) { | ||
@@ -138,3 +138,3 @@ this.state.setFocusedKey(key, childFocusStrategy); | ||
*/ | ||
isSelected(key: Key) { | ||
isSelected(key: Key): boolean { | ||
if (this.state.selectionMode === 'none') { | ||
@@ -217,3 +217,3 @@ return false; | ||
*/ | ||
extendSelection(toKey: Key) { | ||
extendSelection(toKey: Key): void { | ||
if (this.selectionMode === 'none') { | ||
@@ -320,3 +320,3 @@ return; | ||
*/ | ||
toggleSelection(key: Key) { | ||
toggleSelection(key: Key): void { | ||
if (this.selectionMode === 'none') { | ||
@@ -357,3 +357,3 @@ return; | ||
*/ | ||
replaceSelection(key: Key) { | ||
replaceSelection(key: Key): void { | ||
if (this.selectionMode === 'none') { | ||
@@ -378,3 +378,3 @@ return; | ||
*/ | ||
setSelectedKeys(keys: Iterable<Key>) { | ||
setSelectedKeys(keys: Iterable<Key>): void { | ||
if (this.selectionMode === 'none') { | ||
@@ -425,3 +425,3 @@ return; | ||
*/ | ||
selectAll() { | ||
selectAll(): void { | ||
if (!this.isSelectAll && this.selectionMode === 'multiple') { | ||
@@ -435,3 +435,3 @@ this.state.setSelectedKeys('all'); | ||
*/ | ||
clearSelection() { | ||
clearSelection(): void { | ||
if (!this.disallowEmptySelection && (this.state.selectedKeys === 'all' || this.state.selectedKeys.size > 0)) { | ||
@@ -445,3 +445,3 @@ this.state.setSelectedKeys(new Selection()); | ||
*/ | ||
toggleSelectAll() { | ||
toggleSelectAll(): void { | ||
if (this.isSelectAll) { | ||
@@ -454,3 +454,3 @@ this.clearSelection(); | ||
select(key: Key, e?: PressEvent | LongPressEvent | PointerEvent) { | ||
select(key: Key, e?: PressEvent | LongPressEvent | PointerEvent): void { | ||
if (this.selectionMode === 'none') { | ||
@@ -477,3 +477,3 @@ return; | ||
*/ | ||
isSelectionEqual(selection: Set<Key>) { | ||
isSelectionEqual(selection: Set<Key>): boolean { | ||
if (selection === this.state.selectedKeys) { | ||
@@ -504,3 +504,3 @@ return true; | ||
canSelectItem(key: Key) { | ||
canSelectItem(key: Key): boolean { | ||
if (this.state.selectionMode === 'none' || this.state.disabledKeys.has(key)) { | ||
@@ -518,15 +518,15 @@ return false; | ||
isDisabled(key: Key) { | ||
isDisabled(key: Key): boolean { | ||
return this.state.disabledBehavior === 'all' && (this.state.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled); | ||
} | ||
isLink(key: Key) { | ||
isLink(key: Key): boolean { | ||
return !!this.collection.getItem(key)?.props?.href; | ||
} | ||
getItemProps(key: Key) { | ||
getItemProps(key: Key): any { | ||
return this.collection.getItem(key)?.props; | ||
} | ||
withCollection(collection: Collection<Node<unknown>>) { | ||
withCollection(collection: Collection<Node<unknown>>): SelectionManager { | ||
return new SelectionManager(collection, this.state, { | ||
@@ -533,0 +533,0 @@ allowsCellSelection: this.allowsCellSelection, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
174642
0.39%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated