@react-stately/list
Advanced tools
Comparing version 3.2.2-nightly.2445 to 3.2.2-nightly.2448
@@ -39,3 +39,3 @@ var { | ||
*/ | ||
class $b42f1d5166481a4c34c86bbfb4215e1$export$ListCollection { | ||
class ListCollection { | ||
constructor(nodes) { | ||
@@ -125,2 +125,4 @@ var _last; | ||
exports.ListCollection = ListCollection; | ||
/** | ||
@@ -137,3 +139,3 @@ * Provides state management for list-like components. Handles building a collection | ||
let factory = nodes => filter ? new $b42f1d5166481a4c34c86bbfb4215e1$export$ListCollection(filter(nodes)) : new $b42f1d5166481a4c34c86bbfb4215e1$export$ListCollection(nodes); | ||
let factory = nodes => filter ? new ListCollection(filter(nodes)) : new ListCollection(nodes); | ||
@@ -161,3 +163,5 @@ let collection = useCollection(props, factory, null, [filter]); // Reset focused key if that item is deleted from the collection. | ||
function useSingleSelectListState(props) { | ||
let [selectedKey, setSelectedKey] = useControlledState(props.selectedKey, props.defaultSelectedKey, props.onSelectionChange); | ||
var _props$defaultSelecte; | ||
let [selectedKey, setSelectedKey] = useControlledState(props.selectedKey, (_props$defaultSelecte = props.defaultSelectedKey) != null ? _props$defaultSelecte : null, props.onSelectionChange); | ||
let selectedKeys = useMemo(() => selectedKey != null ? [selectedKey] : [], [selectedKey]); | ||
@@ -164,0 +168,0 @@ let { |
@@ -20,3 +20,3 @@ import { useControlledState } from "@react-stately/utils"; | ||
*/ | ||
class $ed5d55e571caf578a4f08babbaa26be$export$ListCollection { | ||
export class ListCollection { | ||
constructor(nodes) { | ||
@@ -117,3 +117,3 @@ var _last; | ||
let factory = nodes => filter ? new $ed5d55e571caf578a4f08babbaa26be$export$ListCollection(filter(nodes)) : new $ed5d55e571caf578a4f08babbaa26be$export$ListCollection(nodes); | ||
let factory = nodes => filter ? new ListCollection(filter(nodes)) : new ListCollection(nodes); | ||
@@ -139,3 +139,5 @@ let collection = useCollection(props, factory, null, [filter]); // Reset focused key if that item is deleted from the collection. | ||
export function useSingleSelectListState(props) { | ||
let [selectedKey, setSelectedKey] = useControlledState(props.selectedKey, props.defaultSelectedKey, props.onSelectionChange); | ||
var _props$defaultSelecte; | ||
let [selectedKey, setSelectedKey] = useControlledState(props.selectedKey, (_props$defaultSelecte = props.defaultSelectedKey) != null ? _props$defaultSelecte : null, props.onSelectionChange); | ||
let selectedKeys = useMemo(() => selectedKey != null ? [selectedKey] : [], [selectedKey]); | ||
@@ -142,0 +144,0 @@ let { |
@@ -1,4 +0,15 @@ | ||
import { Collection, CollectionBase, MultipleSelection, Node, SingleSelection } from "@react-types/shared"; | ||
import { Collection, Node, CollectionBase, MultipleSelection, SingleSelection } from "@react-types/shared"; | ||
import { Key } from "react"; | ||
import { SelectionManager } from "@react-stately/selection"; | ||
export class ListCollection<T> implements Collection<Node<T>> { | ||
constructor(nodes: Iterable<Node<T>>); | ||
[Symbol.iterator](): Generator<Node<T>, void, undefined>; | ||
get size(): number; | ||
getKeys(): IterableIterator<string | number>; | ||
getKeyBefore(key: Key): string | number; | ||
getKeyAfter(key: Key): string | number; | ||
getFirstKey(): string | number; | ||
getLastKey(): string | number; | ||
getItem(key: Key): Node<T>; | ||
} | ||
export interface ListProps<T> extends CollectionBase<T>, MultipleSelection { | ||
@@ -5,0 +16,0 @@ /** Filter function to generate a filtered list of nodes. */ |
{ | ||
"name": "@react-stately/list", | ||
"version": "3.2.2-nightly.2445+df4650ba", | ||
"version": "3.2.2-nightly.2448+28ceccbf", | ||
"description": "Spectrum UI components in React", | ||
@@ -21,6 +21,6 @@ "license": "Apache-2.0", | ||
"@babel/runtime": "^7.6.2", | ||
"@react-stately/collections": "3.0.0-nightly.767+df4650ba", | ||
"@react-stately/selection": "3.0.0-nightly.767+df4650ba", | ||
"@react-stately/utils": "3.0.0-nightly.767+df4650ba", | ||
"@react-types/shared": "3.0.0-nightly.767+df4650ba" | ||
"@react-stately/collections": "3.0.0-nightly.770+28ceccbf", | ||
"@react-stately/selection": "3.0.0-nightly.770+28ceccbf", | ||
"@react-stately/utils": "3.0.0-nightly.770+28ceccbf", | ||
"@react-types/shared": "3.0.0-nightly.770+28ceccbf" | ||
}, | ||
@@ -33,3 +33,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "df4650ba218034780d86a0ce0459bbe7f88cc1ce" | ||
"gitHead": "28ceccbf05637e9fb256794a16c0152e52be179e" | ||
} |
@@ -15,1 +15,2 @@ /* | ||
export * from './useSingleSelectListState'; | ||
export * from './ListCollection'; |
@@ -39,3 +39,3 @@ /* | ||
export function useSingleSelectListState<T extends object>(props: SingleSelectListProps<T>): SingleSelectListState<T> { | ||
let [selectedKey, setSelectedKey] = useControlledState(props.selectedKey, props.defaultSelectedKey, props.onSelectionChange); | ||
let [selectedKey, setSelectedKey] = useControlledState(props.selectedKey, props.defaultSelectedKey ?? null, props.onSelectionChange); | ||
let selectedKeys = useMemo(() => selectedKey != null ? [selectedKey] : [], [selectedKey]); | ||
@@ -42,0 +42,0 @@ let {collection, disabledKeys, selectionManager} = useListState({ |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
60861
557