@react-stately/layout 4.1.1 → 4.2.1

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.
@@ -0,0 +1,207 @@
1
+ import {LayoutInfo as $lFzwI$LayoutInfo, Size as $lFzwI$Size, Rect as $lFzwI$Rect, Point as $lFzwI$Point, Layout as $lFzwI$Layout} from "@react-stately/virtualizer";
2
+
3
+ /*
4
+ * Copyright 2024 Adobe. All rights reserved.
5
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License. You may obtain a copy
7
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under
10
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
+ * OF ANY KIND, either express or implied. See the License for the specific language
12
+ * governing permissions and limitations under the License.
13
+ */
14
+ class $f483179558aa907f$var$WaterfallLayoutInfo extends (0, $lFzwI$LayoutInfo) {
15
+ copy() {
16
+ let res = super.copy();
17
+ res.column = this.column;
18
+ return res;
19
+ }
20
+ constructor(...args){
21
+ super(...args), this.column = 0;
22
+ }
23
+ }
24
+ const $f483179558aa907f$var$DEFAULT_OPTIONS = {
25
+ minItemSize: new (0, $lFzwI$Size)(200, 200),
26
+ maxItemSize: new (0, $lFzwI$Size)(Infinity, Infinity),
27
+ minSpace: new (0, $lFzwI$Size)(18, 18),
28
+ maxColumns: Infinity,
29
+ dropIndicatorThickness: 2
30
+ };
31
+ class $f483179558aa907f$export$e9f7cda058ba8df8 extends (0, $lFzwI$Layout) {
32
+ shouldInvalidateLayoutOptions(newOptions, oldOptions) {
33
+ return newOptions.maxColumns !== oldOptions.maxColumns || newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness || !(newOptions.minItemSize || $f483179558aa907f$var$DEFAULT_OPTIONS.minItemSize).equals(oldOptions.minItemSize || $f483179558aa907f$var$DEFAULT_OPTIONS.minItemSize) || !(newOptions.maxItemSize || $f483179558aa907f$var$DEFAULT_OPTIONS.maxItemSize).equals(oldOptions.maxItemSize || $f483179558aa907f$var$DEFAULT_OPTIONS.maxItemSize) || !(newOptions.minSpace || $f483179558aa907f$var$DEFAULT_OPTIONS.minSpace).equals(oldOptions.minSpace || $f483179558aa907f$var$DEFAULT_OPTIONS.minSpace);
34
+ }
35
+ update(invalidationContext) {
36
+ let { minItemSize: minItemSize = $f483179558aa907f$var$DEFAULT_OPTIONS.minItemSize, maxItemSize: maxItemSize = $f483179558aa907f$var$DEFAULT_OPTIONS.maxItemSize, minSpace: minSpace = $f483179558aa907f$var$DEFAULT_OPTIONS.minSpace, maxColumns: maxColumns = $f483179558aa907f$var$DEFAULT_OPTIONS.maxColumns, dropIndicatorThickness: dropIndicatorThickness = $f483179558aa907f$var$DEFAULT_OPTIONS.dropIndicatorThickness } = invalidationContext.layoutOptions || {};
37
+ this.dropIndicatorThickness = dropIndicatorThickness;
38
+ let visibleWidth = this.virtualizer.visibleRect.width;
39
+ // The max item width is always the entire viewport.
40
+ // If the max item height is infinity, scale in proportion to the max width.
41
+ let maxItemWidth = Math.min(maxItemSize.width, visibleWidth);
42
+ let maxItemHeight = Number.isFinite(maxItemSize.height) ? maxItemSize.height : Math.floor(minItemSize.height / minItemSize.width * maxItemWidth);
43
+ // Compute the number of rows and columns needed to display the content
44
+ let columns = Math.floor(visibleWidth / (minItemSize.width + minSpace.width));
45
+ let numColumns = Math.max(1, Math.min(maxColumns, columns));
46
+ // Compute the available width (minus the space between items)
47
+ let width = visibleWidth - minSpace.width * Math.max(0, numColumns);
48
+ // Compute the item width based on the space available
49
+ let itemWidth = Math.floor(width / numColumns);
50
+ itemWidth = Math.max(minItemSize.width, Math.min(maxItemWidth, itemWidth));
51
+ // Compute the item height, which is proportional to the item width
52
+ let t = (itemWidth - minItemSize.width) / Math.max(1, maxItemWidth - minItemSize.width);
53
+ let itemHeight = minItemSize.height + Math.floor((maxItemHeight - minItemSize.height) * t);
54
+ itemHeight = Math.max(minItemSize.height, Math.min(maxItemHeight, itemHeight));
55
+ // Compute the horizontal spacing and content height
56
+ let horizontalSpacing = Math.floor((visibleWidth - numColumns * itemWidth) / (numColumns + 1));
57
+ // Setup an array of column heights
58
+ let columnHeights = Array(numColumns).fill(minSpace.height);
59
+ let newLayoutInfos = new Map();
60
+ let addNode = (key, node)=>{
61
+ let oldLayoutInfo = this.layoutInfos.get(key);
62
+ let height = itemHeight;
63
+ let estimatedSize = true;
64
+ if (oldLayoutInfo) {
65
+ height = oldLayoutInfo.rect.height;
66
+ estimatedSize = invalidationContext.sizeChanged || oldLayoutInfo.estimatedSize || oldLayoutInfo.content !== node;
67
+ }
68
+ // Figure out which column to place the item in, and compute its position.
69
+ // Preserve the previous column index so items don't jump around during resizing unless the number of columns changed.
70
+ let prevColumn = numColumns === this.numColumns && oldLayoutInfo && oldLayoutInfo.rect.y < this.virtualizer.visibleRect.maxY ? oldLayoutInfo.column : undefined;
71
+ let column = prevColumn !== null && prevColumn !== void 0 ? prevColumn : columnHeights.reduce((minIndex, h, i)=>h < columnHeights[minIndex] ? i : minIndex, 0);
72
+ let x = horizontalSpacing + column * (itemWidth + horizontalSpacing);
73
+ let y = columnHeights[column];
74
+ let rect = new (0, $lFzwI$Rect)(x, y, itemWidth, height);
75
+ let layoutInfo = new $f483179558aa907f$var$WaterfallLayoutInfo(node.type, key, rect);
76
+ layoutInfo.estimatedSize = estimatedSize;
77
+ layoutInfo.allowOverflow = true;
78
+ layoutInfo.content = node;
79
+ layoutInfo.column = column;
80
+ newLayoutInfos.set(key, layoutInfo);
81
+ columnHeights[column] += layoutInfo.rect.height + minSpace.height;
82
+ };
83
+ let skeletonCount = 0;
84
+ for (let node of this.virtualizer.collection)if (node.type === 'skeleton') {
85
+ // Add skeleton cards until every column has at least one, and we fill the viewport.
86
+ let startingHeights = [
87
+ ...columnHeights
88
+ ];
89
+ while(!columnHeights.every((h, i)=>h !== startingHeights[i]) || Math.min(...columnHeights) < this.virtualizer.visibleRect.height){
90
+ var _this_layoutInfos_get;
91
+ let key = `${node.key}-${skeletonCount++}`;
92
+ let content = ((_this_layoutInfos_get = this.layoutInfos.get(key)) === null || _this_layoutInfos_get === void 0 ? void 0 : _this_layoutInfos_get.content) || {
93
+ ...node
94
+ };
95
+ addNode(key, content);
96
+ }
97
+ break;
98
+ } else addNode(node.key, node);
99
+ // Reset all columns to the maximum for the next section
100
+ let maxHeight = Math.max(...columnHeights);
101
+ this.contentSize = new (0, $lFzwI$Size)(this.virtualizer.visibleRect.width, maxHeight);
102
+ this.layoutInfos = newLayoutInfos;
103
+ this.numColumns = numColumns;
104
+ }
105
+ getLayoutInfo(key) {
106
+ return this.layoutInfos.get(key);
107
+ }
108
+ getContentSize() {
109
+ return this.contentSize;
110
+ }
111
+ getVisibleLayoutInfos(rect) {
112
+ let layoutInfos = [];
113
+ for (let layoutInfo of this.layoutInfos.values())if (layoutInfo.rect.intersects(rect) || this.virtualizer.isPersistedKey(layoutInfo.key)) layoutInfos.push(layoutInfo);
114
+ return layoutInfos;
115
+ }
116
+ updateItemSize(key, size) {
117
+ let layoutInfo = this.layoutInfos.get(key);
118
+ if (!size || !layoutInfo) return false;
119
+ if (size.height !== layoutInfo.rect.height) {
120
+ let newLayoutInfo = layoutInfo.copy();
121
+ newLayoutInfo.rect.height = size.height;
122
+ newLayoutInfo.estimatedSize = false;
123
+ this.layoutInfos.set(key, newLayoutInfo);
124
+ return true;
125
+ }
126
+ return false;
127
+ }
128
+ // Override keyboard navigation to work spatially.
129
+ getKeyRightOf(key) {
130
+ let layoutInfo = this.getLayoutInfo(key);
131
+ if (!layoutInfo) return null;
132
+ let rect = new (0, $lFzwI$Rect)(layoutInfo.rect.maxX, layoutInfo.rect.y, this.virtualizer.visibleRect.maxX - layoutInfo.rect.maxX, layoutInfo.rect.height);
133
+ let layoutInfos = this.getVisibleLayoutInfos(rect);
134
+ let bestKey = null;
135
+ let bestDistance = Infinity;
136
+ for (let candidate of layoutInfos){
137
+ if (candidate.key === key) continue;
138
+ // Find the closest item in the x direction with the most overlap in the y direction.
139
+ let deltaX = candidate.rect.x - rect.x;
140
+ let overlapY = Math.min(candidate.rect.maxY, rect.maxY) - Math.max(candidate.rect.y, rect.y);
141
+ let distance = deltaX - overlapY;
142
+ if (distance < bestDistance) {
143
+ bestDistance = distance;
144
+ bestKey = candidate.key;
145
+ }
146
+ }
147
+ return bestKey;
148
+ }
149
+ getKeyLeftOf(key) {
150
+ let layoutInfo = this.getLayoutInfo(key);
151
+ if (!layoutInfo) return null;
152
+ let rect = new (0, $lFzwI$Rect)(0, layoutInfo.rect.y, layoutInfo.rect.x, layoutInfo.rect.height);
153
+ let layoutInfos = this.getVisibleLayoutInfos(rect);
154
+ let bestKey = null;
155
+ let bestDistance = Infinity;
156
+ for (let candidate of layoutInfos){
157
+ if (candidate.key === key) continue;
158
+ // Find the closest item in the x direction with the most overlap in the y direction.
159
+ let deltaX = rect.maxX - candidate.rect.maxX;
160
+ let overlapY = Math.min(candidate.rect.maxY, rect.maxY) - Math.max(candidate.rect.y, rect.y);
161
+ let distance = deltaX - overlapY;
162
+ if (distance < bestDistance) {
163
+ bestDistance = distance;
164
+ bestKey = candidate.key;
165
+ }
166
+ }
167
+ return bestKey;
168
+ }
169
+ // This overrides the default behavior of shift selection to work spatially
170
+ // rather than following the order of the items in the collection (which may appear unpredictable).
171
+ getKeyRange(from, to) {
172
+ let fromLayoutInfo = this.getLayoutInfo(from);
173
+ let toLayoutInfo = this.getLayoutInfo(to);
174
+ if (!fromLayoutInfo || !toLayoutInfo) return [];
175
+ // Find items where half of the area intersects the rectangle
176
+ // formed from the first item to the last item in the range.
177
+ let rect = fromLayoutInfo.rect.union(toLayoutInfo.rect);
178
+ let keys = [];
179
+ for (let layoutInfo of this.layoutInfos.values())if (rect.intersection(layoutInfo.rect).area > layoutInfo.rect.area / 2) keys.push(layoutInfo.key);
180
+ return keys;
181
+ }
182
+ getDropTargetFromPoint(x, y) {
183
+ if (this.layoutInfos.size === 0) return {
184
+ type: 'root'
185
+ };
186
+ x += this.virtualizer.visibleRect.x;
187
+ y += this.virtualizer.visibleRect.y;
188
+ let key = this.virtualizer.keyAtPoint(new (0, $lFzwI$Point)(x, y));
189
+ if (key == null) return {
190
+ type: 'root'
191
+ };
192
+ // Only support "on" drop position in waterfall layout.
193
+ // Reordering doesn't make sense because the items don't have a deterministic order.
194
+ return {
195
+ type: 'item',
196
+ key: key,
197
+ dropPosition: 'on'
198
+ };
199
+ }
200
+ constructor(...args){
201
+ super(...args), this.contentSize = new (0, $lFzwI$Size)(), this.layoutInfos = new Map(), this.numColumns = 0, this.dropIndicatorThickness = 2;
202
+ }
203
+ }
204
+
205
+
206
+ export {$f483179558aa907f$export$e9f7cda058ba8df8 as WaterfallLayout};
207
+ //# sourceMappingURL=WaterfallLayout.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAiCD,MAAM,kDAA4B,CAAA,GAAA,iBAAS;IAGzC,OAA4B;QAC1B,IAAI,MAAM,KAAK,CAAC;QAChB,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM;QACxB,OAAO;IACT;;QAPF,qBACE,SAAS;;AAOX;AAEA,MAAM,wCAAkB;IACtB,aAAa,IAAI,CAAA,GAAA,WAAG,EAAE,KAAK;IAC3B,aAAa,IAAI,CAAA,GAAA,WAAG,EAAE,UAAU;IAChC,UAAU,IAAI,CAAA,GAAA,WAAG,EAAE,IAAI;IACvB,YAAY;IACZ,wBAAwB;AAC1B;AAEO,MAAM,kDAAqG,CAAA,GAAA,aAAK;IAMrH,8BAA8B,UAAa,EAAE,UAAa,EAAW;QACnE,OAAO,WAAW,UAAU,KAAK,WAAW,UAAU,IACjD,WAAW,sBAAsB,KAAK,WAAW,sBAAsB,IACtE,CAAC,AAAC,CAAA,WAAW,WAAW,IAAI,sCAAgB,WAAW,AAAD,EAAG,MAAM,CAAC,WAAW,WAAW,IAAI,sCAAgB,WAAW,KACrH,CAAC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GAAG,WAAW,IAAI,CAAC,IAAI,GAAG,GACnE,KAAK,IAAI,CAAC,WAAW,GAAG;QAG5B,OAAO;IACT;IAEA,uBAAuB,CAAS,EAAE,CAAS,EAAc;QACvD,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,GAC5B,OAAO;YAAC,MAAM;QAAM;QAGtB,KAAK,IAAI,CAAC,WAAW,CAAE,WAAW,CAAC,CAAC;QACpC,KAAK,IAAI,CAAC,WAAW,CAAE,WAAW,CAAC,CAAC;QACpC,IAAI,MAAM,IAAI,CAAC,WAAW,CAAE,UAAU,CAAC,IAAI,CAAA,GAAA,YAAI,EAAE,GAAG;QACpD,IAAI,OAAO,MACT,OAAO;YAAC,MAAM;QAAM;QAGtB,uDAAuD;QACvD,oFAAoF;QACpF,OAAO;YACL,MAAM;iBACN;YACA,cAAc;QAChB;IACF;;QA/OK,qBACG,cAAoB,IAAI,CAAA,GAAA,WAAG,UAC3B,cAA6C,IAAI,YAC/C,aAAa,QACb,yBAAyB;;AA4OrC","sources":["packages/@react-stately/layout/src/WaterfallLayout.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DropTarget, DropTargetDelegate, Key, LayoutDelegate, Node} from '@react-types/shared';\nimport {InvalidationContext, Layout, LayoutInfo, Point, Rect, Size} from '@react-stately/virtualizer';\n\nexport interface WaterfallLayoutOptions {\n /**\n * The minimum item size.\n * @default 200 x 200\n */\n minItemSize?: Size,\n /**\n * The maximum item size.\n * @default Infinity\n */\n maxItemSize?: Size,\n /**\n * The minimum space required between items.\n * @default 18 x 18\n */\n minSpace?: Size,\n /**\n * The maximum number of columns.\n * @default Infinity\n */\n maxColumns?: number,\n /**\n * The thickness of the drop indicator.\n * @default 2\n */\n dropIndicatorThickness?: number\n}\n\nclass WaterfallLayoutInfo extends LayoutInfo {\n column = 0;\n\n copy(): WaterfallLayoutInfo {\n let res = super.copy() as WaterfallLayoutInfo;\n res.column = this.column;\n return res;\n }\n}\n\nconst DEFAULT_OPTIONS = {\n minItemSize: new Size(200, 200),\n maxItemSize: new Size(Infinity, Infinity),\n minSpace: new Size(18, 18),\n maxColumns: Infinity,\n dropIndicatorThickness: 2\n};\n\nexport class WaterfallLayout<T extends object, O extends WaterfallLayoutOptions = WaterfallLayoutOptions> extends Layout<Node<T>, O> implements LayoutDelegate, DropTargetDelegate {\n private contentSize: Size = new Size();\n private layoutInfos: Map<Key, WaterfallLayoutInfo> = new Map();\n protected numColumns = 0;\n protected dropIndicatorThickness = 2;\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions.maxColumns !== oldOptions.maxColumns\n || newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness\n || (!(newOptions.minItemSize || DEFAULT_OPTIONS.minItemSize).equals(oldOptions.minItemSize || DEFAULT_OPTIONS.minItemSize))\n || (!(newOptions.maxItemSize || DEFAULT_OPTIONS.maxItemSize).equals(oldOptions.maxItemSize || DEFAULT_OPTIONS.maxItemSize))\n || (!(newOptions.minSpace || DEFAULT_OPTIONS.minSpace).equals(oldOptions.minSpace || DEFAULT_OPTIONS.minSpace));\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let {\n minItemSize = DEFAULT_OPTIONS.minItemSize,\n maxItemSize = DEFAULT_OPTIONS.maxItemSize,\n minSpace = DEFAULT_OPTIONS.minSpace,\n maxColumns = DEFAULT_OPTIONS.maxColumns,\n dropIndicatorThickness = DEFAULT_OPTIONS.dropIndicatorThickness\n } = invalidationContext.layoutOptions || {};\n this.dropIndicatorThickness = dropIndicatorThickness;\n let visibleWidth = this.virtualizer!.visibleRect.width;\n\n // The max item width is always the entire viewport.\n // If the max item height is infinity, scale in proportion to the max width.\n let maxItemWidth = Math.min(maxItemSize.width, visibleWidth);\n let maxItemHeight = Number.isFinite(maxItemSize.height)\n ? maxItemSize.height\n : Math.floor((minItemSize.height / minItemSize.width) * maxItemWidth);\n\n // Compute the number of rows and columns needed to display the content\n let columns = Math.floor(visibleWidth / (minItemSize.width + minSpace.width));\n let numColumns = Math.max(1, Math.min(maxColumns, columns));\n\n // Compute the available width (minus the space between items)\n let width = visibleWidth - (minSpace.width * Math.max(0, numColumns));\n\n // Compute the item width based on the space available\n let itemWidth = Math.floor(width / numColumns);\n itemWidth = Math.max(minItemSize.width, Math.min(maxItemWidth, itemWidth));\n\n // Compute the item height, which is proportional to the item width\n let t = ((itemWidth - minItemSize.width) / Math.max(1, maxItemWidth - minItemSize.width));\n let itemHeight = minItemSize.height + Math.floor((maxItemHeight - minItemSize.height) * t);\n itemHeight = Math.max(minItemSize.height, Math.min(maxItemHeight, itemHeight));\n\n // Compute the horizontal spacing and content height\n let horizontalSpacing = Math.floor((visibleWidth - numColumns * itemWidth) / (numColumns + 1));\n\n // Setup an array of column heights\n let columnHeights = Array(numColumns).fill(minSpace.height);\n let newLayoutInfos = new Map();\n let addNode = (key: Key, node: Node<T>) => {\n let oldLayoutInfo = this.layoutInfos.get(key);\n let height = itemHeight;\n let estimatedSize = true;\n if (oldLayoutInfo) {\n height = oldLayoutInfo.rect.height;\n estimatedSize = invalidationContext.sizeChanged || oldLayoutInfo.estimatedSize || oldLayoutInfo.content !== node;\n }\n\n // Figure out which column to place the item in, and compute its position.\n // Preserve the previous column index so items don't jump around during resizing unless the number of columns changed.\n let prevColumn = numColumns === this.numColumns && oldLayoutInfo && oldLayoutInfo.rect.y < this.virtualizer!.visibleRect.maxY ? oldLayoutInfo.column : undefined;\n let column = prevColumn ?? columnHeights.reduce((minIndex, h, i) => h < columnHeights[minIndex] ? i : minIndex, 0);\n let x = horizontalSpacing + column * (itemWidth + horizontalSpacing);\n let y = columnHeights[column];\n\n let rect = new Rect(x, y, itemWidth, height);\n let layoutInfo = new WaterfallLayoutInfo(node.type, key, rect);\n layoutInfo.estimatedSize = estimatedSize;\n layoutInfo.allowOverflow = true;\n layoutInfo.content = node;\n layoutInfo.column = column;\n newLayoutInfos.set(key, layoutInfo);\n\n columnHeights[column] += layoutInfo.rect.height + minSpace.height;\n };\n\n let skeletonCount = 0;\n for (let node of this.virtualizer!.collection) {\n if (node.type === 'skeleton') {\n // Add skeleton cards until every column has at least one, and we fill the viewport.\n let startingHeights = [...columnHeights];\n while (\n !columnHeights.every((h, i) => h !== startingHeights[i]) ||\n Math.min(...columnHeights) < this.virtualizer!.visibleRect.height\n ) {\n let key = `${node.key}-${skeletonCount++}`;\n let content = this.layoutInfos.get(key)?.content || {...node};\n addNode(key, content);\n }\n break;\n } else {\n addNode(node.key, node);\n }\n }\n\n // Reset all columns to the maximum for the next section\n let maxHeight = Math.max(...columnHeights);\n this.contentSize = new Size(this.virtualizer!.visibleRect.width, maxHeight);\n this.layoutInfos = newLayoutInfos;\n this.numColumns = numColumns;\n }\n\n getLayoutInfo(key: Key): LayoutInfo {\n return this.layoutInfos.get(key)!;\n }\n\n getContentSize(): Size {\n return this.contentSize;\n }\n\n getVisibleLayoutInfos(rect: Rect): LayoutInfo[] {\n let layoutInfos: LayoutInfo[] = [];\n for (let layoutInfo of this.layoutInfos.values()) {\n if (layoutInfo.rect.intersects(rect) || this.virtualizer!.isPersistedKey(layoutInfo.key)) {\n layoutInfos.push(layoutInfo);\n }\n }\n return layoutInfos;\n }\n\n updateItemSize(key: Key, size: Size) {\n let layoutInfo = this.layoutInfos.get(key);\n if (!size || !layoutInfo) {\n return false;\n }\n\n if (size.height !== layoutInfo.rect.height) {\n let newLayoutInfo = layoutInfo.copy();\n newLayoutInfo.rect.height = size.height;\n newLayoutInfo.estimatedSize = false;\n this.layoutInfos.set(key, newLayoutInfo);\n return true;\n }\n\n return false;\n }\n\n // Override keyboard navigation to work spatially.\n getKeyRightOf(key: Key): Key | null {\n let layoutInfo = this.getLayoutInfo(key);\n if (!layoutInfo) {\n return null;\n }\n\n let rect = new Rect(layoutInfo.rect.maxX, layoutInfo.rect.y, this.virtualizer!.visibleRect.maxX - layoutInfo.rect.maxX, layoutInfo.rect.height);\n let layoutInfos = this.getVisibleLayoutInfos(rect);\n let bestKey: Key | null = null;\n let bestDistance = Infinity;\n for (let candidate of layoutInfos) {\n if (candidate.key === key) {\n continue;\n }\n\n // Find the closest item in the x direction with the most overlap in the y direction.\n let deltaX = candidate.rect.x - rect.x;\n let overlapY = Math.min(candidate.rect.maxY, rect.maxY) - Math.max(candidate.rect.y, rect.y);\n let distance = deltaX - overlapY;\n if (distance < bestDistance) {\n bestDistance = distance;\n bestKey = candidate.key;\n }\n }\n\n return bestKey;\n }\n\n getKeyLeftOf(key: Key): Key | null {\n let layoutInfo = this.getLayoutInfo(key);\n if (!layoutInfo) {\n return null;\n }\n\n let rect = new Rect(0, layoutInfo.rect.y, layoutInfo.rect.x, layoutInfo.rect.height);\n let layoutInfos = this.getVisibleLayoutInfos(rect);\n let bestKey: Key | null = null;\n let bestDistance = Infinity;\n for (let candidate of layoutInfos) {\n if (candidate.key === key) {\n continue;\n }\n\n // Find the closest item in the x direction with the most overlap in the y direction.\n let deltaX = rect.maxX - candidate.rect.maxX;\n let overlapY = Math.min(candidate.rect.maxY, rect.maxY) - Math.max(candidate.rect.y, rect.y);\n let distance = deltaX - overlapY;\n if (distance < bestDistance) {\n bestDistance = distance;\n bestKey = candidate.key;\n }\n }\n\n return bestKey;\n }\n\n // This overrides the default behavior of shift selection to work spatially\n // rather than following the order of the items in the collection (which may appear unpredictable).\n getKeyRange(from: Key, to: Key): Key[] {\n let fromLayoutInfo = this.getLayoutInfo(from);\n let toLayoutInfo = this.getLayoutInfo(to);\n if (!fromLayoutInfo || !toLayoutInfo) {\n return [];\n }\n\n // Find items where half of the area intersects the rectangle\n // formed from the first item to the last item in the range.\n let rect = fromLayoutInfo.rect.union(toLayoutInfo.rect);\n let keys: Key[] = [];\n for (let layoutInfo of this.layoutInfos.values()) {\n if (rect.intersection(layoutInfo.rect).area > layoutInfo.rect.area / 2) {\n keys.push(layoutInfo.key);\n }\n }\n return keys;\n }\n\n getDropTargetFromPoint(x: number, y: number): DropTarget {\n if (this.layoutInfos.size === 0) {\n return {type: 'root'};\n }\n\n x += this.virtualizer!.visibleRect.x;\n y += this.virtualizer!.visibleRect.y;\n let key = this.virtualizer!.keyAtPoint(new Point(x, y));\n if (key == null) {\n return {type: 'root'};\n }\n\n // Only support \"on\" drop position in waterfall layout.\n // Reordering doesn't make sense because the items don't have a deterministic order.\n return {\n type: 'item',\n key,\n dropPosition: 'on'\n };\n }\n}\n"],"names":[],"version":3,"file":"WaterfallLayout.module.js.map"}
package/dist/import.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import {GridLayout as $a58592d295a170a4$export$7d2b12578154a735} from "./GridLayout.mjs";
2
2
  import {ListLayout as $61ef60fc9b1041f4$export$cacbb3924155d68e} from "./ListLayout.mjs";
3
3
  import {TableLayout as $a152112e902709bf$export$62444c3c724b1b20} from "./TableLayout.mjs";
4
+ import {WaterfallLayout as $f483179558aa907f$export$e9f7cda058ba8df8} from "./WaterfallLayout.mjs";
4
5
 
5
6
  /*
6
7
  * Copyright 2020 Adobe. All rights reserved.
@@ -17,5 +18,6 @@ import {TableLayout as $a152112e902709bf$export$62444c3c724b1b20} from "./TableL
17
18
 
18
19
 
19
20
 
20
- export {$a58592d295a170a4$export$7d2b12578154a735 as GridLayout, $61ef60fc9b1041f4$export$cacbb3924155d68e as ListLayout, $a152112e902709bf$export$62444c3c724b1b20 as TableLayout};
21
+
22
+ export {$a58592d295a170a4$export$7d2b12578154a735 as GridLayout, $61ef60fc9b1041f4$export$cacbb3924155d68e as ListLayout, $a152112e902709bf$export$62444c3c724b1b20 as TableLayout, $f483179558aa907f$export$e9f7cda058ba8df8 as WaterfallLayout};
21
23
  //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -1,6 +1,7 @@
1
1
  var $1f7773ceb2a3b9a6$exports = require("./GridLayout.main.js");
2
2
  var $fe69e47e38ed0ac4$exports = require("./ListLayout.main.js");
3
3
  var $67c493497dcda343$exports = require("./TableLayout.main.js");
4
+ var $f2cd6b90da09fa37$exports = require("./WaterfallLayout.main.js");
4
5
 
5
6
 
6
7
  function $parcel$export(e, n, v, s) {
@@ -10,6 +11,7 @@ function $parcel$export(e, n, v, s) {
10
11
  $parcel$export(module.exports, "GridLayout", () => $1f7773ceb2a3b9a6$exports.GridLayout);
11
12
  $parcel$export(module.exports, "ListLayout", () => $fe69e47e38ed0ac4$exports.ListLayout);
12
13
  $parcel$export(module.exports, "TableLayout", () => $67c493497dcda343$exports.TableLayout);
14
+ $parcel$export(module.exports, "WaterfallLayout", () => $f2cd6b90da09fa37$exports.WaterfallLayout);
13
15
  /*
14
16
  * Copyright 2020 Adobe. All rights reserved.
15
17
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -25,4 +27,5 @@ $parcel$export(module.exports, "TableLayout", () => $67c493497dcda343$exports.Ta
25
27
 
26
28
 
27
29
 
30
+
28
31
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-stately/layout/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport type {GridLayoutOptions} from './GridLayout';\nexport type {ListLayoutOptions, LayoutNode} from './ListLayout';\nexport type {TableLayoutProps} from './TableLayout';\nexport {GridLayout} from './GridLayout';\nexport {ListLayout} from './ListLayout';\nexport {TableLayout} from './TableLayout';\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-stately/layout/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport type {GridLayoutOptions} from './GridLayout';\nexport type {ListLayoutOptions, LayoutNode} from './ListLayout';\nexport type {TableLayoutProps} from './TableLayout';\nexport type {WaterfallLayoutOptions} from './WaterfallLayout';\nexport {GridLayout} from './GridLayout';\nexport {ListLayout} from './ListLayout';\nexport {TableLayout} from './TableLayout';\nexport {WaterfallLayout} from './WaterfallLayout';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {GridLayout as $a58592d295a170a4$export$7d2b12578154a735} from "./GridLayout.module.js";
2
2
  import {ListLayout as $61ef60fc9b1041f4$export$cacbb3924155d68e} from "./ListLayout.module.js";
3
3
  import {TableLayout as $a152112e902709bf$export$62444c3c724b1b20} from "./TableLayout.module.js";
4
+ import {WaterfallLayout as $f483179558aa907f$export$e9f7cda058ba8df8} from "./WaterfallLayout.module.js";
4
5
 
5
6
  /*
6
7
  * Copyright 2020 Adobe. All rights reserved.
@@ -17,5 +18,6 @@ import {TableLayout as $a152112e902709bf$export$62444c3c724b1b20} from "./TableL
17
18
 
18
19
 
19
20
 
20
- export {$a58592d295a170a4$export$7d2b12578154a735 as GridLayout, $61ef60fc9b1041f4$export$cacbb3924155d68e as ListLayout, $a152112e902709bf$export$62444c3c724b1b20 as TableLayout};
21
+
22
+ export {$a58592d295a170a4$export$7d2b12578154a735 as GridLayout, $61ef60fc9b1041f4$export$cacbb3924155d68e as ListLayout, $a152112e902709bf$export$62444c3c724b1b20 as TableLayout, $f483179558aa907f$export$e9f7cda058ba8df8 as WaterfallLayout};
21
23
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-stately/layout/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport type {GridLayoutOptions} from './GridLayout';\nexport type {ListLayoutOptions, LayoutNode} from './ListLayout';\nexport type {TableLayoutProps} from './TableLayout';\nexport {GridLayout} from './GridLayout';\nexport {ListLayout} from './ListLayout';\nexport {TableLayout} from './TableLayout';\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-stately/layout/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport type {GridLayoutOptions} from './GridLayout';\nexport type {ListLayoutOptions, LayoutNode} from './ListLayout';\nexport type {TableLayoutProps} from './TableLayout';\nexport type {WaterfallLayoutOptions} from './WaterfallLayout';\nexport {GridLayout} from './GridLayout';\nexport {ListLayout} from './ListLayout';\nexport {TableLayout} from './TableLayout';\nexport {WaterfallLayout} from './WaterfallLayout';\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { DropTarget, DropTargetDelegate, ItemDropTarget, Key, Node, Collection } from "@react-types/shared";
2
- import { Layout, LayoutInfo, Rect, Size, InvalidationContext } from "@react-stately/virtualizer";
1
+ import { DropTarget, DropTargetDelegate, ItemDropTarget, Key, Node, Collection, LayoutDelegate } from "@react-types/shared";
2
+ import { InvalidationContext, Layout, LayoutInfo, Rect, Size } from "@react-stately/virtualizer";
3
3
  import { GridNode } from "@react-types/grid";
4
4
  import { TableCollection } from "@react-types/table";
5
5
  export interface GridLayoutOptions {
@@ -13,6 +13,13 @@ export interface GridLayoutOptions {
13
13
  * @default Infinity
14
14
  */
15
15
  maxItemSize?: Size;
16
+ /**
17
+ * Whether to preserve the aspect ratio of the `minItemSize`.
18
+ * By default, grid rows may have variable heights. When `preserveAspectRatio`
19
+ * is true, all rows will have equal heights.
20
+ * @default false
21
+ */
22
+ preserveAspectRatio?: boolean;
16
23
  /**
17
24
  * The minimum space required between items.
18
25
  * @default 18 x 18
@@ -29,41 +36,61 @@ export interface GridLayoutOptions {
29
36
  */
30
37
  dropIndicatorThickness?: number;
31
38
  }
32
- export class GridLayout<T, O = any> extends Layout<Node<T>, O> implements DropTargetDelegate {
33
- protected minItemSize: Size;
34
- protected maxItemSize: Size;
35
- protected minSpace: Size;
36
- protected maxColumns: number;
39
+ /**
40
+ * GridLayout is a virtualizer Layout implementation
41
+ * that arranges its items in a grid.
42
+ * The items are sized between a minimum and maximum size
43
+ * depending on the width of the container.
44
+ */
45
+ export class GridLayout<T, O extends GridLayoutOptions = GridLayoutOptions> extends Layout<Node<T>, O> implements DropTargetDelegate {
46
+ protected gap: Size;
37
47
  protected dropIndicatorThickness: number;
38
- protected itemSize: Size;
39
48
  protected numColumns: number;
40
- protected horizontalSpacing: number;
41
- protected layoutInfos: LayoutInfo[];
42
- constructor(options: GridLayoutOptions);
43
- update(): void;
44
- getVisibleLayoutInfos(rect: Rect): LayoutInfo[];
45
- protected getIndexAtPoint(x: number, y: number): number;
46
- getLayoutInfo(key: Key): LayoutInfo | null;
47
- protected getLayoutInfoForNode(node: Node<T>): LayoutInfo;
49
+ shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean;
50
+ update(invalidationContext: InvalidationContext<O>): void;
51
+ getLayoutInfo(key: Key): LayoutInfo;
48
52
  getContentSize(): Size;
53
+ getVisibleLayoutInfos(rect: Rect): LayoutInfo[];
54
+ updateItemSize(key: Key, size: Size): boolean;
49
55
  getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget;
50
56
  getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo;
51
57
  }
52
58
  export interface ListLayoutOptions {
53
- /** The fixed height of a row in px. */
59
+ /**
60
+ * The fixed height of a row in px.
61
+ * @default 48
62
+ */
54
63
  rowHeight?: number;
55
64
  /** The estimated height of a row, when row heights are variable. */
56
65
  estimatedRowHeight?: number;
57
- /** The fixed height of a section header in px. */
66
+ /**
67
+ * The fixed height of a section header in px.
68
+ * @default 48
69
+ */
58
70
  headingHeight?: number;
59
71
  /** The estimated height of a section header, when the height is variable. */
60
72
  estimatedHeadingHeight?: number;
61
- /** The fixed height of a loader element in px. This loader is specifically for
73
+ /**
74
+ * The fixed height of a loader element in px. This loader is specifically for
62
75
  * "load more" elements rendered when loading more rows at the root level or inside nested row/sections.
76
+ * @default 48
63
77
  */
64
78
  loaderHeight?: number;
65
- /** The thickness of the drop indicator. */
79
+ /**
80
+ * The thickness of the drop indicator.
81
+ * @default 2
82
+ */
66
83
  dropIndicatorThickness?: number;
84
+ /**
85
+ * The gap between items.
86
+ * @default 0
87
+ */
88
+ gap?: number;
89
+ /**
90
+ * The padding around the list.
91
+ * @default 0
92
+ */
93
+ padding?: number;
67
94
  }
68
95
  export interface LayoutNode {
69
96
  node?: Node<unknown>;
@@ -73,20 +100,19 @@ export interface LayoutNode {
73
100
  index?: number;
74
101
  }
75
102
  /**
76
- * The ListLayout class is an implementation of a virtualizer {@link Layout}.
77
- * To configure a ListLayout, you can use the properties to define the
78
- * layouts and/or use the method for defining indentation.
79
- * The {@link ListKeyboardDelegate} extends the existing virtualizer
80
- * delegate with an additional method to do this (it uses the same delegate object as
81
- * the virtualizer itself).
103
+ * ListLayout is a virtualizer Layout implementation
104
+ * that arranges its items in a vertical stack. It supports both fixed
105
+ * and variable height items.
82
106
  */
83
- export class ListLayout<T, O = any> extends Layout<Node<T>, O> implements DropTargetDelegate {
107
+ export class ListLayout<T, O extends ListLayoutOptions = ListLayoutOptions> extends Layout<Node<T>, O> implements DropTargetDelegate {
84
108
  protected rowHeight: number | null;
85
109
  protected estimatedRowHeight: number | null;
86
110
  protected headingHeight: number | null;
87
111
  protected estimatedHeadingHeight: number | null;
88
112
  protected loaderHeight: number | null;
89
113
  protected dropIndicatorThickness: number;
114
+ protected gap: number;
115
+ protected padding: number;
90
116
  protected layoutNodes: Map<Key, LayoutNode>;
91
117
  protected contentSize: Size;
92
118
  protected lastCollection: Collection<Node<T>> | null;
@@ -106,6 +132,7 @@ export class ListLayout<T, O = any> extends Layout<Node<T>, O> implements DropTa
106
132
  protected layoutIfNeeded(rect: Rect): void;
107
133
  protected isVisible(node: LayoutNode, rect: Rect): boolean;
108
134
  protected shouldInvalidateEverything(invalidationContext: InvalidationContext<O>): boolean;
135
+ shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean;
109
136
  update(invalidationContext: InvalidationContext<O>): void;
110
137
  protected buildCollection(y?: number): LayoutNode[];
111
138
  protected isValid(node: Node<T>, y: number): boolean | undefined;
@@ -120,13 +147,18 @@ export class ListLayout<T, O = any> extends Layout<Node<T>, O> implements DropTa
120
147
  getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null;
121
148
  getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo;
122
149
  }
123
- export interface TableLayoutProps {
150
+ export interface TableLayoutProps extends ListLayoutOptions {
124
151
  columnWidths?: Map<Key, number>;
125
152
  }
153
+ /**
154
+ * TableLayout is a virtualizer Layout implementation that arranges
155
+ * items in rows and columns.
156
+ */
126
157
  export class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> extends ListLayout<T, O> {
127
158
  protected lastCollection: TableCollection<T> | null;
128
- constructor(options: ListLayoutOptions);
159
+ constructor(options?: ListLayoutOptions);
129
160
  protected get collection(): TableCollection<T>;
161
+ shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean;
130
162
  update(invalidationContext: InvalidationContext<O>): void;
131
163
  protected buildCollection(): LayoutNode[];
132
164
  protected buildTableHeader(): LayoutNode;
@@ -142,5 +174,46 @@ export class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> exten
142
174
  getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null;
143
175
  getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo;
144
176
  }
177
+ export interface WaterfallLayoutOptions {
178
+ /**
179
+ * The minimum item size.
180
+ * @default 200 x 200
181
+ */
182
+ minItemSize?: Size;
183
+ /**
184
+ * The maximum item size.
185
+ * @default Infinity
186
+ */
187
+ maxItemSize?: Size;
188
+ /**
189
+ * The minimum space required between items.
190
+ * @default 18 x 18
191
+ */
192
+ minSpace?: Size;
193
+ /**
194
+ * The maximum number of columns.
195
+ * @default Infinity
196
+ */
197
+ maxColumns?: number;
198
+ /**
199
+ * The thickness of the drop indicator.
200
+ * @default 2
201
+ */
202
+ dropIndicatorThickness?: number;
203
+ }
204
+ export class WaterfallLayout<T extends object, O extends WaterfallLayoutOptions = WaterfallLayoutOptions> extends Layout<Node<T>, O> implements LayoutDelegate, DropTargetDelegate {
205
+ protected numColumns: number;
206
+ protected dropIndicatorThickness: number;
207
+ shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean;
208
+ update(invalidationContext: InvalidationContext<O>): void;
209
+ getLayoutInfo(key: Key): LayoutInfo;
210
+ getContentSize(): Size;
211
+ getVisibleLayoutInfos(rect: Rect): LayoutInfo[];
212
+ updateItemSize(key: Key, size: Size): boolean;
213
+ getKeyRightOf(key: Key): Key | null;
214
+ getKeyLeftOf(key: Key): Key | null;
215
+ getKeyRange(from: Key, to: Key): Key[];
216
+ getDropTargetFromPoint(x: number, y: number): DropTarget;
217
+ }
145
218
 
146
219
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"mappings":";;;;AAeA;IACE;;;OAGG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC;AAED,wBAAwB,CAAC,EAAE,CAAC,GAAG,GAAG,CAAE,SAAQ,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAE,YAAW,kBAAkB;IAC1F,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC;IAC5B,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC;IAC5B,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC;IACzB,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACzC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAc;IACtC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAK;IACjC,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAK;IACxC,SAA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iB,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,GAAG,UAAU,GAAG,IAAI;IAoDnH,uBAAuB,CAAC,MAAM,EAAE,cAAc,GAAG,UAAU;CAK5D","sources":["packages/@react-stately/layout/src/packages/@react-stately/layout/src/GridLayout.ts","packages/@react-stately/layout/src/packages/@react-stately/layout/src/ListLayout.ts","packages/@react-stately/layout/src/packages/@react-stately/layout/src/TableLayout.ts","packages/@react-stately/layout/src/packages/@react-stately/layout/src/index.ts","packages/@react-stately/layout/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport type {GridLayoutOptions} from './GridLayout';\nexport type {ListLayoutOptions, LayoutNode} from './ListLayout';\nexport type {TableLayoutProps} from './TableLayout';\nexport {GridLayout} from './GridLayout';\nexport {ListLayout} from './ListLayout';\nexport {TableLayout} from './TableLayout';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;AAeA;IACE;;;OAGG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC;AAWD;;;;;GAKG;AACH,wBAAwB,CAAC,EAAE,CAAC,SAAS,iBAAiB,GA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,OAAO;IAQpE,MAAM,CAAC,mBAAmB,EAAE,oBAAoB,CAAC,CAAC,GAAG,IAAI;IA6FzD,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU;IAInC,cAAc,IAAI,IAAI;IAItB,qBAAqB,CAAC,IAAI,EAAE,IAAI,GAAG,UAAU,EAAE;IAU/C,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI;IAkBnC,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,IAAI;IA4BnC,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,IAAI;IA8BlC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,GAAG,GAAG,EAAE;IAmBtC,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU;CAoBzD","sources":["packages/@react-stately/layout/src/packages/@react-stately/layout/src/GridLayout.ts","packages/@react-stately/layout/src/packages/@react-stately/layout/src/ListLayout.ts","packages/@react-stately/layout/src/packages/@react-stately/layout/src/TableLayout.ts","packages/@react-stately/layout/src/packages/@react-stately/layout/src/WaterfallLayout.ts","packages/@react-stately/layout/src/packages/@react-stately/layout/src/index.ts","packages/@react-stately/layout/src/index.ts"],"sourcesContent":[null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport type {GridLayoutOptions} from './GridLayout';\nexport type {ListLayoutOptions, LayoutNode} from './ListLayout';\nexport type {TableLayoutProps} from './TableLayout';\nexport type {WaterfallLayoutOptions} from './WaterfallLayout';\nexport {GridLayout} from './GridLayout';\nexport {ListLayout} from './ListLayout';\nexport {TableLayout} from './TableLayout';\nexport {WaterfallLayout} from './WaterfallLayout';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-stately/layout",
3
- "version": "4.1.1",
3
+ "version": "4.2.1",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,19 +22,20 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-stately/collections": "^3.12.1",
26
- "@react-stately/table": "^3.13.1",
27
- "@react-stately/virtualizer": "^4.2.1",
28
- "@react-types/grid": "^3.2.11",
29
- "@react-types/shared": "^3.27.0",
30
- "@react-types/table": "^3.10.4",
25
+ "@react-stately/collections": "^3.12.2",
26
+ "@react-stately/table": "^3.14.0",
27
+ "@react-stately/virtualizer": "^4.3.1",
28
+ "@react-types/grid": "^3.3.0",
29
+ "@react-types/shared": "^3.28.0",
30
+ "@react-types/table": "^3.11.0",
31
31
  "@swc/helpers": "^0.5.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
34
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
35
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
35
36
  },
36
37
  "publishConfig": {
37
38
  "access": "public"
38
39
  },
39
- "gitHead": "09e7f44bebdc9d89122926b2b439a0a38a2814ea"
40
+ "gitHead": "9c4ebbc0c1972cc880febc29de995ca58caa3ba4"
40
41
  }