@react-stately/list
Advanced tools
Comparing version 3.0.0-nightly-641446f65-240905 to 3.0.0-nightly-65e3a52a3-241120
@@ -1,2 +0,2 @@ | ||
import { Collection, Key, Node, CollectionStateBase, SingleSelection } from "@react-types/shared"; | ||
import { Collection, Key, Node, CollectionStateBase, LayoutDelegate, SingleSelection } from "@react-types/shared"; | ||
import { MultipleSelectionStateProps, SelectionManager } from "@react-stately/selection"; | ||
@@ -8,8 +8,8 @@ export class ListCollection<T> implements Collection<Node<T>> { | ||
getKeys(): IterableIterator<Key>; | ||
getKeyBefore(key: Key): Key; | ||
getKeyAfter(key: Key): Key; | ||
getFirstKey(): Key; | ||
getLastKey(): Key; | ||
getItem(key: Key): Node<T>; | ||
at(idx: number): Node<T>; | ||
getKeyBefore(key: Key): Key | null; | ||
getKeyAfter(key: Key): Key | null; | ||
getFirstKey(): Key | null; | ||
getLastKey(): Key | null; | ||
getItem(key: Key): Node<T> | null; | ||
at(idx: number): Node<T> | null; | ||
getChildren(key: Key): Iterable<Node<T>>; | ||
@@ -22,2 +22,7 @@ } | ||
suppressTextValueWarning?: boolean; | ||
/** | ||
* A delegate object that provides layout information for items in the collection. | ||
* This can be used to override the behavior of shift selection. | ||
*/ | ||
layoutDelegate?: LayoutDelegate; | ||
} | ||
@@ -24,0 +29,0 @@ export interface ListState<T> { |
@@ -27,3 +27,3 @@ var $c9aa5a224613c979$exports = require("./ListCollection.main.js"); | ||
function $5450691d3629f6ea$export$2f645645f7bca764(props) { | ||
let { filter: filter } = props; | ||
let { filter: filter, layoutDelegate: layoutDelegate } = props; | ||
let selectionState = (0, $5RsKl$reactstatelyselection.useMultipleSelectionState)(props); | ||
@@ -42,5 +42,8 @@ let disabledKeys = (0, $5RsKl$react.useMemo)(()=>props.disabledKeys ? new Set(props.disabledKeys) : new Set(), [ | ||
let collection = (0, $5RsKl$reactstatelycollections.useCollection)(props, factory, context); | ||
let selectionManager = (0, $5RsKl$react.useMemo)(()=>new (0, $5RsKl$reactstatelyselection.SelectionManager)(collection, selectionState), [ | ||
let selectionManager = (0, $5RsKl$react.useMemo)(()=>new (0, $5RsKl$reactstatelyselection.SelectionManager)(collection, selectionState, { | ||
layoutDelegate: layoutDelegate | ||
}), [ | ||
collection, | ||
selectionState | ||
selectionState, | ||
layoutDelegate | ||
]); | ||
@@ -47,0 +50,0 @@ // Reset focused key if that item is deleted from the collection. |
@@ -21,3 +21,3 @@ import {ListCollection as $a02d57049d202695$export$d085fb9e920b5ca7} from "./ListCollection.module.js"; | ||
function $e72dd72e1c76a225$export$2f645645f7bca764(props) { | ||
let { filter: filter } = props; | ||
let { filter: filter, layoutDelegate: layoutDelegate } = props; | ||
let selectionState = (0, $d5vlZ$useMultipleSelectionState)(props); | ||
@@ -36,5 +36,8 @@ let disabledKeys = (0, $d5vlZ$useMemo)(()=>props.disabledKeys ? new Set(props.disabledKeys) : new Set(), [ | ||
let collection = (0, $d5vlZ$useCollection)(props, factory, context); | ||
let selectionManager = (0, $d5vlZ$useMemo)(()=>new (0, $d5vlZ$SelectionManager)(collection, selectionState), [ | ||
let selectionManager = (0, $d5vlZ$useMemo)(()=>new (0, $d5vlZ$SelectionManager)(collection, selectionState, { | ||
layoutDelegate: layoutDelegate | ||
}), [ | ||
collection, | ||
selectionState | ||
selectionState, | ||
layoutDelegate | ||
]); | ||
@@ -41,0 +44,0 @@ // Reset focused key if that item is deleted from the collection. |
{ | ||
"name": "@react-stately/list", | ||
"version": "3.0.0-nightly-641446f65-240905", | ||
"version": "3.0.0-nightly-65e3a52a3-241120", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,10 +25,10 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-stately/collections": "^3.0.0-nightly-641446f65-240905", | ||
"@react-stately/selection": "^3.0.0-nightly-641446f65-240905", | ||
"@react-stately/utils": "^3.0.0-nightly-641446f65-240905", | ||
"@react-types/shared": "^3.0.0-nightly-641446f65-240905", | ||
"@react-stately/collections": "^3.0.0-nightly-65e3a52a3-241120", | ||
"@react-stately/selection": "^3.0.0-nightly-65e3a52a3-241120", | ||
"@react-stately/utils": "^3.0.0-nightly-65e3a52a3-241120", | ||
"@react-types/shared": "^3.0.0-nightly-65e3a52a3-241120", | ||
"@swc/helpers": "^0.5.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" | ||
}, | ||
@@ -38,3 +38,3 @@ "publishConfig": { | ||
}, | ||
"stableVersion": "3.10.8" | ||
"stableVersion": "3.11.0" | ||
} |
@@ -13,3 +13,3 @@ /* | ||
import {Collection, CollectionStateBase, Key, Node} from '@react-types/shared'; | ||
import {Collection, CollectionStateBase, Key, LayoutDelegate, Node} from '@react-types/shared'; | ||
import {ListCollection} from './ListCollection'; | ||
@@ -24,3 +24,8 @@ import {MultipleSelectionStateProps, SelectionManager, useMultipleSelectionState} from '@react-stately/selection'; | ||
/** @private */ | ||
suppressTextValueWarning?: boolean | ||
suppressTextValueWarning?: boolean, | ||
/** | ||
* A delegate object that provides layout information for items in the collection. | ||
* This can be used to override the behavior of shift selection. | ||
*/ | ||
layoutDelegate?: LayoutDelegate | ||
} | ||
@@ -44,3 +49,3 @@ | ||
export function useListState<T extends object>(props: ListProps<T>): ListState<T> { | ||
let {filter} = props; | ||
let {filter, layoutDelegate} = props; | ||
@@ -58,4 +63,4 @@ let selectionState = useMultipleSelectionState(props); | ||
let selectionManager = useMemo(() => | ||
new SelectionManager(collection, selectionState) | ||
, [collection, selectionState] | ||
new SelectionManager(collection, selectionState, {layoutDelegate}) | ||
, [collection, selectionState, layoutDelegate] | ||
); | ||
@@ -62,0 +67,0 @@ |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
90685
1077
0
+ Addedreact@19.0.0-rc-fb9a90fa48-20240614(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedreact@18.3.1(transitive)
Updated@react-stately/collections@^3.0.0-nightly-65e3a52a3-241120
Updated@react-stately/selection@^3.0.0-nightly-65e3a52a3-241120