@react-spectrum/card 3.0.0-nightly.3734 → 3.0.0-nightly.3737
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/dist/import.mjs +38 -25
- package/dist/main.js +38 -25
- package/dist/main.js.map +1 -1
- package/dist/module.js +38 -25
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +14 -14
- package/dist/types.d.ts.map +1 -1
- package/package.json +22 -22
- package/src/BaseLayout.tsx +12 -11
- package/src/GridLayout.tsx +5 -2
- package/src/WaterfallLayout.tsx +5 -2
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;
|
|
1
|
+
{"mappings":";;;;;;AAmBA;IACE,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC;IAEzB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,yBAAwB,CAAC,CAAE,SAAQ,OAAO,KAAK,CAAC,CAAC,CAAE,YAAW,gBAAgB;IAC5E,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC;IAC5B,SAAS,CAAC,WAAW,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAC5C,SAAS,CAAC,QAAQ,EAAE,KAAK,QAAQ,CAAC;IAClC,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC;IAC5C,UAAU,EAAG,eAAe,CAAC,CAAC,CAAC;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,CAAa;IACnC,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;gBAEH,OAAO,GAAE,iBAAsB;IAS3C,QAAQ,CAAC,mBAAmB,EAAE,oBAAoB,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC;IAyBnE,eA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,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/BaseLayout.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/GalleryLayout.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/GridLayout.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/WaterfallLayout.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/CardViewContext.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/CardBase.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/CardView.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/Card.tsx","packages/@react-spectrum/card/src/packages/@react-spectrum/card/src/index.ts","packages/@react-spectrum/card/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2021 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\n/// <reference types=\"css-module-types\" />\n\nexport type {GalleryLayoutOptions} from './GalleryLayout';\nexport type {GridLayoutOptions} from './GridLayout';\nexport type {WaterfallLayoutOptions} from './WaterfallLayout';\n\nexport {CardView} from './CardView';\nexport {GalleryLayout} from './GalleryLayout';\nexport {GridLayout} from './GridLayout';\nexport {WaterfallLayout} from './WaterfallLayout';\nexport {Card} from './Card';\nexport type {SpectrumCardViewProps} from '@react-types/card';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/card",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.3737+b64e64f28",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -36,29 +36,29 @@
|
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@react-aria/focus": "3.0.0-nightly.
|
|
40
|
-
"@react-aria/grid": "3.6.2-nightly.
|
|
41
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
42
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
43
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
44
|
-
"@react-aria/virtualizer": "3.7.1-nightly.
|
|
45
|
-
"@react-spectrum/checkbox": "3.0.0-nightly.
|
|
46
|
-
"@react-spectrum/divider": "3.0.0-nightly.
|
|
47
|
-
"@react-spectrum/layout": "3.5.1-nightly.
|
|
48
|
-
"@react-spectrum/progress": "3.0.0-nightly.
|
|
49
|
-
"@react-spectrum/utils": "3.0.0-nightly.
|
|
50
|
-
"@react-stately/collections": "3.0.0-nightly.
|
|
51
|
-
"@react-stately/grid": "3.5.1-nightly.
|
|
52
|
-
"@react-stately/list": "3.7.1-nightly.
|
|
53
|
-
"@react-stately/utils": "3.0.0-nightly.
|
|
54
|
-
"@react-stately/virtualizer": "3.5.1-nightly.
|
|
55
|
-
"@react-types/card": "3.0.0-nightly.
|
|
56
|
-
"@react-types/provider": "3.6.1-nightly.
|
|
57
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
39
|
+
"@react-aria/focus": "3.0.0-nightly.2037+b64e64f28",
|
|
40
|
+
"@react-aria/grid": "3.6.2-nightly.3737+b64e64f28",
|
|
41
|
+
"@react-aria/i18n": "3.0.0-nightly.2037+b64e64f28",
|
|
42
|
+
"@react-aria/interactions": "3.0.0-nightly.2037+b64e64f28",
|
|
43
|
+
"@react-aria/utils": "3.0.0-nightly.2037+b64e64f28",
|
|
44
|
+
"@react-aria/virtualizer": "3.7.1-nightly.3737+b64e64f28",
|
|
45
|
+
"@react-spectrum/checkbox": "3.0.0-nightly.2037+b64e64f28",
|
|
46
|
+
"@react-spectrum/divider": "3.0.0-nightly.2037+b64e64f28",
|
|
47
|
+
"@react-spectrum/layout": "3.5.1-nightly.3737+b64e64f28",
|
|
48
|
+
"@react-spectrum/progress": "3.0.0-nightly.2037+b64e64f28",
|
|
49
|
+
"@react-spectrum/utils": "3.0.0-nightly.2037+b64e64f28",
|
|
50
|
+
"@react-stately/collections": "3.0.0-nightly.2037+b64e64f28",
|
|
51
|
+
"@react-stately/grid": "3.5.1-nightly.3737+b64e64f28",
|
|
52
|
+
"@react-stately/list": "3.7.1-nightly.3737+b64e64f28",
|
|
53
|
+
"@react-stately/utils": "3.0.0-nightly.2037+b64e64f28",
|
|
54
|
+
"@react-stately/virtualizer": "3.5.1-nightly.3737+b64e64f28",
|
|
55
|
+
"@react-types/card": "3.0.0-nightly.3737+b64e64f28",
|
|
56
|
+
"@react-types/provider": "3.6.1-nightly.3737+b64e64f28",
|
|
57
|
+
"@react-types/shared": "3.0.0-nightly.2037+b64e64f28",
|
|
58
58
|
"@swc/helpers": "^0.4.14"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@adobe/spectrum-css-temp": "3.0.0-nightly.
|
|
61
|
+
"@adobe/spectrum-css-temp": "3.0.0-nightly.2037+b64e64f28"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@react-spectrum/provider": "^3.0.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "b64e64f28b3d06a69ad2c5ae0dd994c3a07d4099"
|
|
71
71
|
}
|
package/src/BaseLayout.tsx
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {Direction, KeyboardDelegate, Node} from '@react-types/shared';
|
|
14
|
+
import {getChildNodes, getFirstItem} from '@react-stately/collections';
|
|
14
15
|
import {GridCollection} from '@react-stately/grid';
|
|
15
16
|
import {InvalidationContext, Layout, LayoutInfo, Rect, Size} from '@react-stately/virtualizer';
|
|
16
17
|
import {Key} from 'react';
|
|
@@ -146,7 +147,7 @@ export class BaseLayout<T> extends Layout<Node<T>> implements KeyboardDelegate {
|
|
|
146
147
|
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
147
148
|
let rect = new Rect(layoutInfo.rect.x, layoutInfo.rect.maxY + 1, layoutInfo.rect.width, this.virtualizer.visibleRect.height);
|
|
148
149
|
let closestRow = this.collection.getItem(this._findClosest(layoutInfo.rect, rect)?.key);
|
|
149
|
-
return closestRow?.
|
|
150
|
+
return getFirstItem(getChildNodes(closestRow, this.collection))?.key;
|
|
150
151
|
}
|
|
151
152
|
|
|
152
153
|
getKeyAbove(key: Key) {
|
|
@@ -155,7 +156,7 @@ export class BaseLayout<T> extends Layout<Node<T>> implements KeyboardDelegate {
|
|
|
155
156
|
let layoutInfo = this.getLayoutInfo(parentRowKey);
|
|
156
157
|
let rect = new Rect(layoutInfo.rect.x, 0, layoutInfo.rect.width, layoutInfo.rect.y - 1);
|
|
157
158
|
let closestRow = this.collection.getItem(this._findClosest(layoutInfo.rect, rect)?.key);
|
|
158
|
-
return closestRow?.
|
|
159
|
+
return getFirstItem(getChildNodes(closestRow, this.collection))?.key;
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
getKeyRightOf(key: Key) {
|
|
@@ -167,7 +168,7 @@ export class BaseLayout<T> extends Layout<Node<T>> implements KeyboardDelegate {
|
|
|
167
168
|
let item = this.collection.getItem(key);
|
|
168
169
|
// Don't check if item is disabled because we want to be able to focus disabled items in a grid (double check this)
|
|
169
170
|
if (item.type === 'item') {
|
|
170
|
-
return item.
|
|
171
|
+
return getFirstItem(getChildNodes(item, this.collection))?.key;
|
|
171
172
|
}
|
|
172
173
|
key = this.direction === 'rtl' ? this.collection.getKeyBefore(key) : this.collection.getKeyAfter(key);
|
|
173
174
|
}
|
|
@@ -181,7 +182,7 @@ export class BaseLayout<T> extends Layout<Node<T>> implements KeyboardDelegate {
|
|
|
181
182
|
let item = this.collection.getItem(key);
|
|
182
183
|
// Don't check if item is disabled because we want to be able to focus disabled items in a grid (double check this)
|
|
183
184
|
if (item.type === 'item') {
|
|
184
|
-
return item.
|
|
185
|
+
return getFirstItem(getChildNodes(item, this.collection))?.key;
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
key = this.direction === 'rtl' ? this.collection.getKeyAfter(key) : this.collection.getKeyBefore(key);
|
|
@@ -190,12 +191,12 @@ export class BaseLayout<T> extends Layout<Node<T>> implements KeyboardDelegate {
|
|
|
190
191
|
|
|
191
192
|
getFirstKey() {
|
|
192
193
|
let firstRow = this.collection.getItem(this.collection.getFirstKey());
|
|
193
|
-
return firstRow.
|
|
194
|
+
return getFirstItem(getChildNodes(firstRow, this.collection))?.key;
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
getLastKey() {
|
|
197
198
|
let lastRow = this.collection.getItem(this.collection.getLastKey());
|
|
198
|
-
return lastRow.
|
|
199
|
+
return getFirstItem(getChildNodes(lastRow, this.collection))?.key;
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
// TODO: pretty unwieldy because it needs to bounce back and forth between the parent key and the child key
|
|
@@ -214,14 +215,14 @@ export class BaseLayout<T> extends Layout<Node<T>> implements KeyboardDelegate {
|
|
|
214
215
|
|
|
215
216
|
if (layoutInfo && layoutInfo.rect.y > pageY) {
|
|
216
217
|
while (layoutInfo && layoutInfo.rect.y > pageY) {
|
|
217
|
-
let childKey = this.collection.getItem(layoutInfo.key).
|
|
218
|
+
let childKey = getFirstItem(getChildNodes(this.collection.getItem(layoutInfo.key), this.collection))?.key;
|
|
218
219
|
let keyAbove = this.collection.getItem(this.getKeyAbove(childKey))?.parentKey;
|
|
219
220
|
layoutInfo = this.getLayoutInfo(keyAbove);
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
223
|
|
|
223
224
|
if (layoutInfo) {
|
|
224
|
-
let childKey = this.collection.getItem(layoutInfo.key).
|
|
225
|
+
let childKey = getFirstItem(getChildNodes(this.collection.getItem(layoutInfo.key), this.collection))?.key;
|
|
225
226
|
return childKey;
|
|
226
227
|
}
|
|
227
228
|
}
|
|
@@ -243,14 +244,14 @@ export class BaseLayout<T> extends Layout<Node<T>> implements KeyboardDelegate {
|
|
|
243
244
|
layoutInfo = this.getLayoutInfo(keyBelow);
|
|
244
245
|
if (layoutInfo && layoutInfo.rect.y < pageY) {
|
|
245
246
|
while (layoutInfo && layoutInfo.rect.y < pageY) {
|
|
246
|
-
let childKey = this.collection.getItem(layoutInfo.key).
|
|
247
|
+
let childKey = getFirstItem(getChildNodes(this.collection.getItem(layoutInfo.key), this.collection))?.key;
|
|
247
248
|
let keyBelow = this.collection.getItem(this.getKeyBelow(childKey))?.parentKey;
|
|
248
249
|
layoutInfo = this.getLayoutInfo(keyBelow);
|
|
249
250
|
}
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
if (layoutInfo) {
|
|
253
|
-
let childKey = this.collection.getItem(layoutInfo.key).
|
|
254
|
+
let childKey = getFirstItem(getChildNodes(this.collection.getItem(layoutInfo.key), this.collection))?.key;
|
|
254
255
|
return childKey;
|
|
255
256
|
}
|
|
256
257
|
}
|
|
@@ -274,7 +275,7 @@ export class BaseLayout<T> extends Layout<Node<T>> implements KeyboardDelegate {
|
|
|
274
275
|
if (item.textValue) {
|
|
275
276
|
let substring = item.textValue.slice(0, search.length);
|
|
276
277
|
if (this.collator.compare(substring, search) === 0) {
|
|
277
|
-
return
|
|
278
|
+
return getFirstItem(getChildNodes(item, this.collection))?.key;
|
|
278
279
|
}
|
|
279
280
|
}
|
|
280
281
|
|
package/src/GridLayout.tsx
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {BaseLayout, BaseLayoutOptions} from './BaseLayout';
|
|
14
|
+
import {getChildNodes, getFirstItem} from '@react-stately/collections';
|
|
14
15
|
import {Key} from 'react';
|
|
15
16
|
import {LayoutInfo, Rect, Size} from '@react-stately/virtualizer';
|
|
16
17
|
import {Node, Orientation} from '@react-types/shared';
|
|
@@ -255,7 +256,8 @@ export class GridLayout<T> extends BaseLayout<T> {
|
|
|
255
256
|
return null;
|
|
256
257
|
}
|
|
257
258
|
|
|
258
|
-
|
|
259
|
+
let row = this.collection.rows[indexRowBelow];
|
|
260
|
+
return getFirstItem(getChildNodes(row, this.collection))?.key;
|
|
259
261
|
}
|
|
260
262
|
|
|
261
263
|
getKeyAbove(key: Key) {
|
|
@@ -269,6 +271,7 @@ export class GridLayout<T> extends BaseLayout<T> {
|
|
|
269
271
|
return null;
|
|
270
272
|
}
|
|
271
273
|
|
|
272
|
-
|
|
274
|
+
let row = this.collection.rows[indexRowAbove];
|
|
275
|
+
return getFirstItem(getChildNodes(row, this.collection))?.key;
|
|
273
276
|
}
|
|
274
277
|
}
|
package/src/WaterfallLayout.tsx
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {BaseLayout, BaseLayoutOptions} from './BaseLayout';
|
|
14
|
+
import {getChildNodes, getFirstItem} from '@react-stately/collections';
|
|
14
15
|
import {InvalidationContext, LayoutInfo, Rect, Size} from '@react-stately/virtualizer';
|
|
15
16
|
import {Key} from 'react';
|
|
16
17
|
import {KeyboardDelegate, Node} from '@react-types/shared';
|
|
@@ -207,7 +208,8 @@ export class WaterfallLayout<T> extends BaseLayout<T> implements KeyboardDelegat
|
|
|
207
208
|
key = this._findClosest(layoutInfo.rect, rect)?.key;
|
|
208
209
|
}
|
|
209
210
|
|
|
210
|
-
|
|
211
|
+
let item = this.collection.getItem(key);
|
|
212
|
+
return getFirstItem(getChildNodes(item, this.collection))?.key;
|
|
211
213
|
}
|
|
212
214
|
|
|
213
215
|
getClosestLeft(key: Key) {
|
|
@@ -221,7 +223,8 @@ export class WaterfallLayout<T> extends BaseLayout<T> implements KeyboardDelegat
|
|
|
221
223
|
key = this._findClosest(layoutInfo.rect, rect)?.key;
|
|
222
224
|
}
|
|
223
225
|
|
|
224
|
-
|
|
226
|
+
let item = this.collection.getItem(key);
|
|
227
|
+
return getFirstItem(getChildNodes(item, this.collection))?.key;
|
|
225
228
|
}
|
|
226
229
|
|
|
227
230
|
getKeyRightOf(key: Key) {
|