@react-types/shared 3.0.0-nightly.2034 → 3.0.0-nightly.2041

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-types/shared",
3
- "version": "3.0.0-nightly.2034+05fb9aa6b",
3
+ "version": "3.0.0-nightly.2041+fc5f846f2",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "types": "src/index.d.ts",
@@ -14,5 +14,5 @@
14
14
  "publishConfig": {
15
15
  "access": "public"
16
16
  },
17
- "gitHead": "05fb9aa6bcc04fb0104d7b991ac30d03f33613fa"
17
+ "gitHead": "fc5f846f2fd30bb2f7074211275d81be5b64c123"
18
18
  }
@@ -62,6 +62,11 @@ export interface CollectionBase<T> {
62
62
  disabledKeys?: Iterable<Key>
63
63
  }
64
64
 
65
+ export interface CollectionStateBase<T, C extends Collection<Node<T>> = Collection<Node<T>>> extends Partial<CollectionBase<T>> {
66
+ /** A pre-constructed collection to use instead of building one from items and children. */
67
+ collection?: C
68
+ }
69
+
65
70
  export interface Expandable {
66
71
  /** The currently expanded keys in the collection (controlled). */
67
72
  expandedKeys?: Iterable<Key>,
@@ -143,7 +148,10 @@ export interface Collection<T> extends Iterable<T> {
143
148
  getFirstKey(): Key | null,
144
149
 
145
150
  /** Get the last key in the collection. */
146
- getLastKey(): Key | null
151
+ getLastKey(): Key | null,
152
+
153
+ /** Iterate over the child items of the given key. */
154
+ getChildren?(key: Key): Iterable<T>
147
155
  }
148
156
 
149
157
  export interface Node<T> {
@@ -157,7 +165,10 @@ export interface Node<T> {
157
165
  level: number,
158
166
  /** Whether this item has children, even if not loaded yet. */
159
167
  hasChildNodes: boolean,
160
- /** The loaded children of this node. */
168
+ /**
169
+ * The loaded children of this node.
170
+ * @deprecated Use `collection.getChildren(node.key)` instead.
171
+ */
161
172
  childNodes: Iterable<Node<T>>,
162
173
  /** The rendered contents of this node (e.g. JSX). */
163
174
  rendered: ReactNode,