@react-stately/list
Advanced tools
Comparing version 3.0.0-nightly-8ab4f20de-240913 to 3.0.0-nightly-9e79420c1-240918
@@ -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"; | ||
@@ -21,2 +21,7 @@ export class ListCollection<T> implements Collection<Node<T>> { | ||
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; | ||
} | ||
@@ -23,0 +28,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-8ab4f20de-240913", | ||
"version": "3.0.0-nightly-9e79420c1-240918", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,6 +25,6 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-stately/collections": "^3.0.0-nightly-8ab4f20de-240913", | ||
"@react-stately/selection": "^3.0.0-nightly-8ab4f20de-240913", | ||
"@react-stately/utils": "^3.0.0-nightly-8ab4f20de-240913", | ||
"@react-types/shared": "^3.0.0-nightly-8ab4f20de-240913", | ||
"@react-stately/collections": "^3.0.0-nightly-9e79420c1-240918", | ||
"@react-stately/selection": "^3.0.0-nightly-9e79420c1-240918", | ||
"@react-stately/utils": "^3.0.0-nightly-9e79420c1-240918", | ||
"@react-types/shared": "^3.0.0-nightly-9e79420c1-240918", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -31,0 +31,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
90638
1077