@react-spectrum/card 3.0.0-alpha.1 → 3.0.0-alpha.10
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/main.css +1 -2
- package/dist/main.js +1393 -1600
- package/dist/main.js.map +1 -1
- package/dist/module.js +1383 -1506
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +13 -18
- package/dist/types.d.ts.map +1 -1
- package/package.json +22 -22
- package/src/Card.tsx +5 -8
- package/src/CardBase.tsx +17 -59
- package/src/CardView.tsx +23 -4
- package/src/GalleryLayout.tsx +90 -88
- package/src/WaterfallLayout.tsx +5 -14
- package/src/index.ts +10 -5
- package/dist/main.css.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, { Key } from "react";
|
|
3
|
-
import { SpectrumCardViewProps } from "@react-types/card";
|
|
1
|
+
import { Direction, KeyboardDelegate, Node, Orientation, DOMRef, DOMRefValue, ItemProps } from "@react-types/shared";
|
|
4
2
|
import { GridCollection } from "@react-stately/grid";
|
|
5
3
|
import { InvalidationContext, Layout, LayoutInfo, Rect, Size } from "@react-stately/virtualizer";
|
|
4
|
+
import React, { Key, ReactElement } from "react";
|
|
6
5
|
import { Scale } from "@react-types/provider";
|
|
7
|
-
|
|
8
|
-
* TODO: Add description of component here.
|
|
9
|
-
*/
|
|
10
|
-
export const CardView: <T>(props: SpectrumCardViewProps<T> & {
|
|
11
|
-
ref?: React.Ref<DOMRefValue<HTMLDivElement>>;
|
|
12
|
-
}) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>;
|
|
6
|
+
import { SpectrumCardViewProps, SpectrumCardProps } from "@react-types/card";
|
|
13
7
|
interface BaseLayoutOptions {
|
|
14
8
|
collator?: Intl.Collator;
|
|
15
9
|
scale?: Scale;
|
|
@@ -49,7 +43,7 @@ declare class BaseLayout<T> extends Layout<Node<T>> implements KeyboardDelegate
|
|
|
49
43
|
getLastKey(): any;
|
|
50
44
|
getKeyPageAbove(key: Key): any;
|
|
51
45
|
getKeyPageBelow(key: Key): any;
|
|
52
|
-
getKeyForSearch(search: string, fromKey?: Key):
|
|
46
|
+
getKeyForSearch(search: string, fromKey?: Key): Key;
|
|
53
47
|
}
|
|
54
48
|
export interface GalleryLayoutOptions extends BaseLayoutOptions {
|
|
55
49
|
/**
|
|
@@ -64,7 +58,7 @@ export interface GalleryLayoutOptions extends BaseLayoutOptions {
|
|
|
64
58
|
itemSpacing?: Size;
|
|
65
59
|
/**
|
|
66
60
|
* The vertical padding for an item.
|
|
67
|
-
* @default
|
|
61
|
+
* @default 78
|
|
68
62
|
*/
|
|
69
63
|
itemPadding?: number;
|
|
70
64
|
/**
|
|
@@ -168,18 +162,12 @@ export interface WaterfallLayoutOptions extends BaseLayoutOptions {
|
|
|
168
162
|
* @default Infinity
|
|
169
163
|
*/
|
|
170
164
|
maxColumns?: number;
|
|
171
|
-
/**
|
|
172
|
-
* The vertical padding for an item.
|
|
173
|
-
* @default 56
|
|
174
|
-
*/
|
|
175
|
-
itemPadding?: number;
|
|
176
165
|
}
|
|
177
166
|
export class WaterfallLayout<T> extends BaseLayout<T> implements KeyboardDelegate {
|
|
178
167
|
protected minItemSize: Size;
|
|
179
168
|
protected maxItemSize: Size;
|
|
180
169
|
protected minSpace: Size;
|
|
181
170
|
protected maxColumns: number;
|
|
182
|
-
itemPadding: number;
|
|
183
171
|
protected numColumns: number;
|
|
184
172
|
protected itemWidth: number;
|
|
185
173
|
protected horizontalSpacing: number;
|
|
@@ -193,6 +181,13 @@ export class WaterfallLayout<T> extends BaseLayout<T> implements KeyboardDelegat
|
|
|
193
181
|
getKeyRightOf(key: Key): any;
|
|
194
182
|
getKeyLeftOf(key: Key): any;
|
|
195
183
|
}
|
|
196
|
-
|
|
184
|
+
/**
|
|
185
|
+
* TODO: Add description of component here.
|
|
186
|
+
*/
|
|
187
|
+
export const CardView: <T>(props: SpectrumCardViewProps<T> & {
|
|
188
|
+
ref?: DOMRef<HTMLDivElement>;
|
|
189
|
+
}) => ReactElement;
|
|
190
|
+
export let Card: React.ForwardRefExoticComponent<ItemProps<SpectrumCardProps> & SpectrumCardProps & React.RefAttributes<DOMRefValue<HTMLDivElement>>>;
|
|
191
|
+
export type { SpectrumCardViewProps } from '@react-types/card';
|
|
197
192
|
|
|
198
193
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;AAkBA;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,eAAe,CAAC,mBAAmB,CAAC,EAAE,oBAAoB,KAAK,CAAC,CAA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/@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-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.10",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -32,35 +32,35 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.6.2",
|
|
35
|
-
"@react-aria/focus": "^3.
|
|
36
|
-
"@react-aria/grid": "^3.
|
|
37
|
-
"@react-aria/i18n": "^3.
|
|
38
|
-
"@react-aria/interactions": "^3.
|
|
39
|
-
"@react-aria/utils": "^3.
|
|
40
|
-
"@react-aria/virtualizer": "^3.
|
|
41
|
-
"@react-spectrum/checkbox": "^3.
|
|
42
|
-
"@react-spectrum/divider": "^3.
|
|
43
|
-
"@react-spectrum/layout": "^3.
|
|
44
|
-
"@react-spectrum/progress": "^3.
|
|
45
|
-
"@react-spectrum/utils": "^3.
|
|
46
|
-
"@react-stately/collections": "^3.
|
|
47
|
-
"@react-stately/grid": "^3.
|
|
48
|
-
"@react-stately/list": "^3.
|
|
49
|
-
"@react-stately/utils": "^3.
|
|
50
|
-
"@react-stately/virtualizer": "^3.
|
|
51
|
-
"@react-types/card": "3.0.0-alpha.
|
|
52
|
-
"@react-types/provider": "^3.
|
|
53
|
-
"@react-types/shared": "^3.
|
|
35
|
+
"@react-aria/focus": "^3.7.0",
|
|
36
|
+
"@react-aria/grid": "^3.4.0",
|
|
37
|
+
"@react-aria/i18n": "^3.5.0",
|
|
38
|
+
"@react-aria/interactions": "^3.10.0",
|
|
39
|
+
"@react-aria/utils": "^3.13.2",
|
|
40
|
+
"@react-aria/virtualizer": "^3.4.2",
|
|
41
|
+
"@react-spectrum/checkbox": "^3.5.0",
|
|
42
|
+
"@react-spectrum/divider": "^3.4.0",
|
|
43
|
+
"@react-spectrum/layout": "^3.4.0",
|
|
44
|
+
"@react-spectrum/progress": "^3.3.0",
|
|
45
|
+
"@react-spectrum/utils": "^3.7.2",
|
|
46
|
+
"@react-stately/collections": "^3.4.2",
|
|
47
|
+
"@react-stately/grid": "^3.3.0",
|
|
48
|
+
"@react-stately/list": "^3.5.2",
|
|
49
|
+
"@react-stately/utils": "^3.5.1",
|
|
50
|
+
"@react-stately/virtualizer": "^3.2.2",
|
|
51
|
+
"@react-types/card": "3.0.0-alpha.8",
|
|
52
|
+
"@react-types/provider": "^3.5.2",
|
|
53
|
+
"@react-types/shared": "^3.14.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@adobe/spectrum-css-temp": "3.0.0-alpha.1"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@react-spectrum/provider": "^3.0.0",
|
|
60
|
-
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
60
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "cd7c0ec917122c7612f653c22f8ed558f8b66ecd"
|
|
66
66
|
}
|
package/src/Card.tsx
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
14
13
|
import {CardBase} from './CardBase';
|
|
15
|
-
import {DOMRef} from '@react-types/shared';
|
|
14
|
+
import {DOMRef, DOMRefValue, ItemProps} from '@react-types/shared';
|
|
16
15
|
import {PartialNode} from '@react-stately/collections';
|
|
17
|
-
import React, {forwardRef} from 'react';
|
|
16
|
+
import React, {forwardRef, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes} from 'react';
|
|
18
17
|
import {SpectrumCardProps} from '@react-types/card';
|
|
19
18
|
import {useCardViewContext} from './CardViewContext';
|
|
20
19
|
|
|
20
|
+
|
|
21
21
|
let Card = forwardRef((props: SpectrumCardProps, ref: DOMRef<HTMLDivElement>) => {
|
|
22
22
|
let context = useCardViewContext();
|
|
23
23
|
if (context !== null) {
|
|
@@ -29,10 +29,8 @@ let Card = forwardRef((props: SpectrumCardProps, ref: DOMRef<HTMLDivElement>) =>
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
// TODO: Update the typescript for the below and the export
|
|
33
32
|
// @ts-ignore
|
|
34
|
-
|
|
35
|
-
Card.getCollectionNode = function* getCollectionNode<T>(props, context: any): Generator<PartialNode<T>> {
|
|
33
|
+
Card.getCollectionNode = function* getCollectionNode<T>(props: any): Generator<PartialNode<T>> {
|
|
36
34
|
let {children, textValue} = props;
|
|
37
35
|
|
|
38
36
|
yield {
|
|
@@ -45,6 +43,5 @@ Card.getCollectionNode = function* getCollectionNode<T>(props, context: any): Ge
|
|
|
45
43
|
};
|
|
46
44
|
};
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
let _Card = Card as <T>(props, ref) => JSX.Element;
|
|
46
|
+
let _Card = Card as ForwardRefExoticComponent<ItemProps<SpectrumCardProps> & PropsWithoutRef<SpectrumCardProps> & RefAttributes<DOMRefValue<HTMLDivElement>>>;
|
|
50
47
|
export {_Card as Card};
|
package/src/CardBase.tsx
CHANGED
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
import {AriaCardProps, SpectrumCardProps} from '@react-types/card';
|
|
14
14
|
import {Checkbox} from '@react-spectrum/checkbox';
|
|
15
15
|
import {classNames, SlotProvider, useDOMRef, useHasChild, useStyleProps} from '@react-spectrum/utils';
|
|
16
|
-
import {Divider} from '@react-spectrum/divider';
|
|
17
16
|
import {DOMRef, Node} from '@react-types/shared';
|
|
18
17
|
import {filterDOMProps, mergeProps, useLayoutEffect, useResizeObserver, useSlotId} from '@react-aria/utils';
|
|
19
18
|
import {FocusRing} from '@react-aria/focus';
|
|
19
|
+
import {getFocusableTreeWalker} from '@react-aria/focus';
|
|
20
20
|
import React, {HTMLAttributes, useCallback, useMemo, useRef, useState} from 'react';
|
|
21
21
|
import styles from '@adobe/spectrum-css-temp/components/card/vars.css';
|
|
22
22
|
import {useCardViewContext} from './CardViewContext';
|
|
@@ -38,7 +38,8 @@ function CardBase<T extends object>(props: CardBaseProps<T>, ref: DOMRef<HTMLDiv
|
|
|
38
38
|
orientation = 'vertical',
|
|
39
39
|
articleProps = {},
|
|
40
40
|
item,
|
|
41
|
-
layout
|
|
41
|
+
layout,
|
|
42
|
+
children
|
|
42
43
|
} = props;
|
|
43
44
|
|
|
44
45
|
let key = item?.key;
|
|
@@ -50,6 +51,7 @@ function CardBase<T extends object>(props: CardBaseProps<T>, ref: DOMRef<HTMLDiv
|
|
|
50
51
|
let {cardProps, titleProps, contentProps} = useCard(props);
|
|
51
52
|
let domRef = useDOMRef(ref);
|
|
52
53
|
let gridRef = useRef<HTMLDivElement>();
|
|
54
|
+
let checkboxRef = useRef(null);
|
|
53
55
|
|
|
54
56
|
// cards are only interactive if there is a selection manager and it allows selection
|
|
55
57
|
let {hoverProps, isHovered} = useHover({isDisabled: manager === undefined || manager?.selectionMode === 'none' || isDisabled});
|
|
@@ -59,8 +61,6 @@ function CardBase<T extends object>(props: CardBaseProps<T>, ref: DOMRef<HTMLDiv
|
|
|
59
61
|
isDisabled
|
|
60
62
|
});
|
|
61
63
|
|
|
62
|
-
let hasFooter = useHasChild(`.${styles['spectrum-Card-footer']}`, gridRef);
|
|
63
|
-
|
|
64
64
|
// ToDo: see css for comment about avatar under selector .spectrum-Card--noLayout.spectrum-Card--default
|
|
65
65
|
let hasPreviewImage = useHasChild(`.${styles['spectrum-Card-image']}`, gridRef);
|
|
66
66
|
let hasPreviewIllustration = useHasChild(`.${styles['spectrum-Card-illustration']}`, gridRef);
|
|
@@ -92,63 +92,22 @@ function CardBase<T extends object>(props: CardBaseProps<T>, ref: DOMRef<HTMLDiv
|
|
|
92
92
|
avatar: {UNSAFE_className: classNames(styles, 'spectrum-Card-avatar'), size: 'avatar-size-400'},
|
|
93
93
|
heading: {UNSAFE_className: classNames(styles, 'spectrum-Card-heading'), ...titleProps},
|
|
94
94
|
content: {UNSAFE_className: classNames(styles, 'spectrum-Card-content'), ...contentProps},
|
|
95
|
-
detail: {UNSAFE_className: classNames(styles, 'spectrum-Card-detail')}
|
|
96
|
-
actionmenu: {UNSAFE_className: classNames(styles, 'spectrum-Card-actions'), align: 'end', isQuiet: true},
|
|
97
|
-
footer: {UNSAFE_className: classNames(styles, 'spectrum-Card-footer'), isHidden: isQuiet},
|
|
98
|
-
divider: {UNSAFE_className: classNames(styles, 'spectrum-Card-divider'), size: 'S'}
|
|
95
|
+
detail: {UNSAFE_className: classNames(styles, 'spectrum-Card-detail')}
|
|
99
96
|
}), [titleProps, contentProps, height, isQuiet, orientation]);
|
|
100
97
|
|
|
101
|
-
// This is only for quiet grid cards
|
|
102
|
-
let [isCloseToSquare, setIsCloseToSquare] = useState(false);
|
|
103
98
|
useLayoutEffect(() => {
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
let height = image.naturalHeight;
|
|
114
|
-
let width = image.naturalWidth;
|
|
115
|
-
/*
|
|
116
|
-
* ToDo: Choose between min-padding and plain ratio
|
|
117
|
-
* Do we want to just do a ratio measurement when it's close to being a square?
|
|
118
|
-
* or do we want to actually figure out min-padding?
|
|
119
|
-
* Min Padding would require us to check that the padding is not less than the min in both Vertical and Horizontal
|
|
120
|
-
* Unfortunately img contain doesn't actually create padding, which is what this math below can figure out
|
|
121
|
-
* Vs the commented out straight ratio check
|
|
122
|
-
* */
|
|
123
|
-
let imgTagHeight = image.clientHeight;
|
|
124
|
-
let imgTagWidth = image.clientWidth;
|
|
125
|
-
let ratio = Math.min(imgTagWidth / width, imgTagHeight / height);
|
|
126
|
-
let trueHeight = ratio * height;
|
|
127
|
-
let trueWidth = ratio * width;
|
|
128
|
-
let paddingVertical = imgTagHeight - trueHeight;
|
|
129
|
-
let paddingHorizontal = imgTagWidth - trueWidth;
|
|
130
|
-
if (paddingVertical < 16 && paddingHorizontal < 16) { // ToDo: does this need to be different per scale?
|
|
131
|
-
setIsCloseToSquare(true);
|
|
132
|
-
} else {
|
|
133
|
-
setIsCloseToSquare(false);
|
|
99
|
+
if (gridRef?.current) {
|
|
100
|
+
let walker = getFocusableTreeWalker(gridRef.current);
|
|
101
|
+
let nextNode = walker.nextNode();
|
|
102
|
+
while (nextNode != null) {
|
|
103
|
+
if (checkboxRef.current && !checkboxRef.current.UNSAFE_getDOMNode().contains(nextNode)) {
|
|
104
|
+
console.warn('Card does not support focusable elements, please contact the team regarding your use case.');
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
nextNode = walker.nextNode();
|
|
134
108
|
}
|
|
135
|
-
|
|
136
|
-
// let ratio = height / width;
|
|
137
|
-
// if (ratio > 0.9 && ratio < 1.1) {
|
|
138
|
-
// setIsCloseToSquare(true);
|
|
139
|
-
// }
|
|
140
|
-
};
|
|
141
|
-
if (image.complete) {
|
|
142
|
-
measure();
|
|
143
|
-
} else {
|
|
144
|
-
image.addEventListener('load', measure);
|
|
145
|
-
return () => {
|
|
146
|
-
image.removeEventListener('load', measure);
|
|
147
|
-
};
|
|
148
109
|
}
|
|
149
|
-
|
|
150
|
-
}, [props.children, setIsCloseToSquare, isQuiet, layout]);
|
|
151
|
-
|
|
110
|
+
}, [children]);
|
|
152
111
|
|
|
153
112
|
return (
|
|
154
113
|
<FocusRing focusRingClass={classNames(styles, 'focus-ring')}>
|
|
@@ -160,7 +119,6 @@ function CardBase<T extends object>(props: CardBaseProps<T>, ref: DOMRef<HTMLDiv
|
|
|
160
119
|
'spectrum-Card--default': !isQuiet && orientation !== 'horizontal',
|
|
161
120
|
'spectrum-Card--isQuiet': isQuiet && orientation !== 'horizontal',
|
|
162
121
|
'spectrum-Card--horizontal': orientation === 'horizontal',
|
|
163
|
-
'spectrum-Card--closeToSquare': isCloseToSquare,
|
|
164
122
|
'spectrum-Card--noPreview': !hasPreview,
|
|
165
123
|
'is-hovered': isHovered,
|
|
166
124
|
'is-focused': isFocused,
|
|
@@ -174,6 +132,7 @@ function CardBase<T extends object>(props: CardBaseProps<T>, ref: DOMRef<HTMLDiv
|
|
|
174
132
|
{manager && manager.selectionMode !== 'none' && (
|
|
175
133
|
<div className={classNames(styles, 'spectrum-Card-checkboxWrapper')}>
|
|
176
134
|
<Checkbox
|
|
135
|
+
ref={checkboxRef}
|
|
177
136
|
isDisabled={isDisabled}
|
|
178
137
|
excludeFromTabOrder
|
|
179
138
|
isSelected={isSelected}
|
|
@@ -184,8 +143,7 @@ function CardBase<T extends object>(props: CardBaseProps<T>, ref: DOMRef<HTMLDiv
|
|
|
184
143
|
</div>
|
|
185
144
|
)}
|
|
186
145
|
<SlotProvider slots={slots}>
|
|
187
|
-
{
|
|
188
|
-
{hasFooter && <Divider />}
|
|
146
|
+
{children}
|
|
189
147
|
</SlotProvider>
|
|
190
148
|
<div className={classNames(styles, 'spectrum-Card-decoration')} />
|
|
191
149
|
</div>
|
package/src/CardView.tsx
CHANGED
|
@@ -17,12 +17,13 @@ import {DOMRef, DOMRefValue, Node} from '@react-types/shared';
|
|
|
17
17
|
import {GridCollection, useGridState} from '@react-stately/grid';
|
|
18
18
|
// @ts-ignore
|
|
19
19
|
import intlMessages from '../intl/*.json';
|
|
20
|
+
import {mergeProps} from '@react-aria/utils';
|
|
20
21
|
import {ProgressCircle} from '@react-spectrum/progress';
|
|
21
22
|
import React, {ReactElement, useCallback, useMemo, useRef} from 'react';
|
|
22
23
|
import {ReusableView} from '@react-stately/virtualizer';
|
|
23
24
|
import {SpectrumCardViewProps} from '@react-types/card';
|
|
24
25
|
import styles from '@adobe/spectrum-css-temp/components/card/vars.css';
|
|
25
|
-
import {useCollator, useLocale,
|
|
26
|
+
import {useCollator, useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
|
|
26
27
|
import {useGrid, useGridCell, useGridRow} from '@react-aria/grid';
|
|
27
28
|
import {useListState} from '@react-stately/list';
|
|
28
29
|
import {useProvider} from '@react-spectrum/provider';
|
|
@@ -46,7 +47,7 @@ function CardView<T extends object>(props: SpectrumCardViewProps<T>, ref: DOMRef
|
|
|
46
47
|
let cardViewLayout = useMemo(() => typeof layout === 'function' ? new layout({collator, cardOrientation, scale}) : layout, [layout, collator, cardOrientation, scale]);
|
|
47
48
|
let layoutType = cardViewLayout.layoutType;
|
|
48
49
|
|
|
49
|
-
let
|
|
50
|
+
let stringFormatter = useLocalizedStringFormatter(intlMessages);
|
|
50
51
|
let {direction} = useLocale();
|
|
51
52
|
let {collection} = useListState(props);
|
|
52
53
|
|
|
@@ -137,7 +138,7 @@ function CardView<T extends object>(props: SpectrumCardViewProps<T>, ref: DOMRef
|
|
|
137
138
|
<CenteredWrapper>
|
|
138
139
|
<ProgressCircle
|
|
139
140
|
isIndeterminate
|
|
140
|
-
aria-label={state.collection.size > 0 ?
|
|
141
|
+
aria-label={state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')} />
|
|
141
142
|
</CenteredWrapper>
|
|
142
143
|
);
|
|
143
144
|
} else if (type === 'placeholder') {
|
|
@@ -185,7 +186,7 @@ function InternalCard(props) {
|
|
|
185
186
|
let cellRef = useRef<DOMRefValue<HTMLDivElement>>();
|
|
186
187
|
let unwrappedRef = useUnwrapDOMRef(cellRef);
|
|
187
188
|
|
|
188
|
-
let {rowProps} = useGridRow({
|
|
189
|
+
let {rowProps: gridRowProps} = useGridRow({
|
|
189
190
|
node: item,
|
|
190
191
|
isVirtualized: true
|
|
191
192
|
}, state, rowRef);
|
|
@@ -195,6 +196,20 @@ function InternalCard(props) {
|
|
|
195
196
|
focusMode: 'cell'
|
|
196
197
|
}, state, unwrappedRef);
|
|
197
198
|
|
|
199
|
+
// Prevent space key from scrolling the CardView if triggered on a disabled item or on a Card in a selectionMode="none" CardView.
|
|
200
|
+
let allowsInteraction = state.selectionManager.selectionMode !== 'none';
|
|
201
|
+
let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
|
|
202
|
+
|
|
203
|
+
let onKeyDown = (e) => {
|
|
204
|
+
if (e.key === ' ' && isDisabled) {
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
let rowProps = mergeProps(
|
|
210
|
+
gridRowProps,
|
|
211
|
+
{onKeyDown}
|
|
212
|
+
);
|
|
198
213
|
|
|
199
214
|
if (layoutType === 'grid' || layoutType === 'gallery') {
|
|
200
215
|
isQuiet = true;
|
|
@@ -204,6 +219,10 @@ function InternalCard(props) {
|
|
|
204
219
|
cardOrientation = 'vertical';
|
|
205
220
|
}
|
|
206
221
|
|
|
222
|
+
// We don't want to focus the checkbox (or any other focusable elements) within the Card
|
|
223
|
+
// when pressing the arrow keys so we delete the key down handler here. Arrow key navigation between
|
|
224
|
+
// the cards in the CardView is handled by useGrid => useSelectableCollection instead.
|
|
225
|
+
delete gridCellProps.onKeyDownCapture;
|
|
207
226
|
return (
|
|
208
227
|
<div {...rowProps} ref={rowRef} className={classNames(styles, 'spectrum-CardView-row')}>
|
|
209
228
|
<CardBase
|
package/src/GalleryLayout.tsx
CHANGED
|
@@ -30,7 +30,7 @@ export interface GalleryLayoutOptions extends BaseLayoutOptions {
|
|
|
30
30
|
itemSpacing?: Size,
|
|
31
31
|
/**
|
|
32
32
|
* The vertical padding for an item.
|
|
33
|
-
* @default
|
|
33
|
+
* @default 78
|
|
34
34
|
*/
|
|
35
35
|
itemPadding?: number,
|
|
36
36
|
/**
|
|
@@ -60,8 +60,8 @@ const DEFAULT_OPTIONS = {
|
|
|
60
60
|
minItemSize: new Size(136, 136),
|
|
61
61
|
itemSpacing: new Size(18, 18),
|
|
62
62
|
itemPadding: {
|
|
63
|
-
'medium':
|
|
64
|
-
'large':
|
|
63
|
+
'medium': 78,
|
|
64
|
+
'large': 99
|
|
65
65
|
},
|
|
66
66
|
dropSpacing: 100,
|
|
67
67
|
margin: 24
|
|
@@ -138,105 +138,107 @@ export class GalleryLayout<T> extends BaseLayout<T> {
|
|
|
138
138
|
let y = this.margin;
|
|
139
139
|
let availableWidth = visibleWidth - this.margin * 2;
|
|
140
140
|
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
ratio =
|
|
151
|
-
|
|
152
|
-
|
|
141
|
+
// If avaliable width is not greater than 0, skip node layout calculations
|
|
142
|
+
if (availableWidth > 0) {
|
|
143
|
+
// Compute aspect ratios for all of the items, and the total width if all items were on in a single row.
|
|
144
|
+
let ratios = [];
|
|
145
|
+
let totalWidth = 0;
|
|
146
|
+
let minRatio = this.minItemSize.width / this.minItemSize.height;
|
|
147
|
+
let maxRatio = availableWidth / this.minItemSize.height;
|
|
148
|
+
|
|
149
|
+
for (let node of this.collection) {
|
|
150
|
+
let ratio = node.props.width / node.props.height;
|
|
151
|
+
if (ratio < minRatio) {
|
|
152
|
+
ratio = minRatio;
|
|
153
|
+
} else if (ratio > maxRatio && ratio !== minRatio) {
|
|
154
|
+
ratio = maxRatio;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
let itemWidth = ratio * this.minItemSize.height;
|
|
158
|
+
ratios.push(ratio);
|
|
159
|
+
totalWidth += itemWidth;
|
|
153
160
|
}
|
|
154
161
|
|
|
155
|
-
|
|
156
|
-
ratios.push(ratio);
|
|
157
|
-
totalWidth += itemWidth;
|
|
158
|
-
}
|
|
162
|
+
totalWidth += this.itemSpacing.width * (this.collection.size - 1);
|
|
159
163
|
|
|
160
|
-
|
|
164
|
+
// Determine how many rows we'll need, and partition the items into rows
|
|
165
|
+
// using the aspect ratios as weights.
|
|
166
|
+
let rows = Math.max(1, Math.ceil(totalWidth / availableWidth));
|
|
167
|
+
// if the available width can't hold two items, then every item will get its own row
|
|
168
|
+
// this leads to a faster run through linear partition and more dependable output for small row widths
|
|
169
|
+
if (availableWidth <= (this.minItemSize.width * 2) + (this.itemPadding * 2)) {
|
|
170
|
+
rows = this.collection.size;
|
|
171
|
+
}
|
|
161
172
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
let rows = Math.max(1, Math.ceil(totalWidth / availableWidth));
|
|
165
|
-
// if the available width can't hold two items, then every item will get its own row
|
|
166
|
-
// this leads to a faster run through linear partition and more dependable output for small row widths
|
|
167
|
-
if (availableWidth <= (this.minItemSize.width * 2) + (this.itemPadding * 2)) {
|
|
168
|
-
rows = this.collection.size;
|
|
169
|
-
}
|
|
173
|
+
let weightedRatios = ratios.map(ratio => ratio < this.threshold ? ratio + (0.5 * (1 / ratio)) : ratio);
|
|
174
|
+
let partition = linearPartition(weightedRatios, rows);
|
|
170
175
|
|
|
171
|
-
|
|
172
|
-
|
|
176
|
+
let index = 0;
|
|
177
|
+
for (let row of partition) {
|
|
178
|
+
// Compute the total weight for this row
|
|
179
|
+
let totalWeight = 0;
|
|
180
|
+
for (let j = index; j < index + row.length; j++) {
|
|
181
|
+
totalWeight += ratios[j];
|
|
182
|
+
}
|
|
173
183
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
// Compute the total weight for this row
|
|
177
|
-
let totalWeight = 0;
|
|
178
|
-
for (let j = index; j < index + row.length; j++) {
|
|
179
|
-
totalWeight += ratios[j];
|
|
180
|
-
}
|
|
184
|
+
// Determine the row height based on the total available width and weight of this row.
|
|
185
|
+
let bestRowHeight = (availableWidth - (row.length - 1) * this.itemSpacing.width) / totalWeight;
|
|
181
186
|
|
|
182
|
-
|
|
183
|
-
|
|
187
|
+
// if this is the last row and the row height is >2x the ideal row height, then cap to the ideal height
|
|
188
|
+
// probably doing this because if the last row has one extremely tall image, then the row becomes huge
|
|
189
|
+
// though that can happen anywhere if a row has lots of tall images... so i'm not sure why this one matters
|
|
190
|
+
if (row === partition[partition.length - 1] && bestRowHeight > this.idealRowHeight * 2) {
|
|
191
|
+
bestRowHeight = this.idealRowHeight;
|
|
192
|
+
}
|
|
193
|
+
let itemHeight = Math.round(bestRowHeight) + this.itemPadding;
|
|
194
|
+
let x = this.margin;
|
|
195
|
+
|
|
196
|
+
// if any items are going to end up too small, add a bit of width to them and subtract it from wider objects
|
|
197
|
+
let widths = [];
|
|
198
|
+
for (let j = index; j < index + row.length; j++) {
|
|
199
|
+
let width = Math.round(bestRowHeight * ratios[j]);
|
|
200
|
+
widths.push([j - index, width]);
|
|
201
|
+
}
|
|
202
|
+
this._distributeWidths(widths);
|
|
203
|
+
|
|
204
|
+
// Create items for this row.
|
|
205
|
+
for (let j = index; j < index + row.length; j++) {
|
|
206
|
+
let node = this.collection.rows[j];
|
|
207
|
+
let itemWidth = Math.max(widths[j - index][1], this.minItemSize.width);
|
|
208
|
+
let rect = new Rect(x, y, itemWidth, itemHeight);
|
|
209
|
+
let layoutInfo = new LayoutInfo(node.type, node.key, rect);
|
|
210
|
+
layoutInfo.allowOverflow = true;
|
|
211
|
+
this.layoutInfos.set(node.key, layoutInfo);
|
|
212
|
+
x += itemWidth + this.itemSpacing.width;
|
|
213
|
+
}
|
|
184
214
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
// though that can happen anywhere if a row has lots of tall images... so i'm not sure why this one matters
|
|
188
|
-
if (row === partition[partition.length - 1] && bestRowHeight > this.idealRowHeight * 2) {
|
|
189
|
-
bestRowHeight = this.idealRowHeight;
|
|
190
|
-
}
|
|
191
|
-
let itemHeight = Math.round(bestRowHeight) + this.itemPadding;
|
|
192
|
-
let x = this.margin;
|
|
193
|
-
|
|
194
|
-
// if any items are going to end up too small, add a bit of width to them and subtract it from wider objects
|
|
195
|
-
let widths = [];
|
|
196
|
-
for (let j = index; j < index + row.length; j++) {
|
|
197
|
-
let width = Math.round(bestRowHeight * ratios[j]);
|
|
198
|
-
widths.push([j - index, width]);
|
|
199
|
-
}
|
|
200
|
-
this._distributeWidths(widths);
|
|
201
|
-
|
|
202
|
-
// Create items for this row.
|
|
203
|
-
for (let j = index; j < index + row.length; j++) {
|
|
204
|
-
let node = this.collection.rows[j];
|
|
205
|
-
let itemWidth = Math.max(widths[j - index][1], this.minItemSize.width);
|
|
206
|
-
let rect = new Rect(x, y, itemWidth, itemHeight);
|
|
207
|
-
let layoutInfo = new LayoutInfo(node.type, node.key, rect);
|
|
208
|
-
layoutInfo.allowOverflow = true;
|
|
209
|
-
this.layoutInfos.set(node.key, layoutInfo);
|
|
210
|
-
x += itemWidth + this.itemSpacing.width;
|
|
215
|
+
y += itemHeight + this.itemSpacing.height;
|
|
216
|
+
index += row.length;
|
|
211
217
|
}
|
|
212
218
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
219
|
+
if (this.isLoading) {
|
|
220
|
+
let loaderY = y;
|
|
221
|
+
let loaderHeight = 60;
|
|
222
|
+
// If there aren't any items, make loader take all avaliable room and remove margin from y calculation
|
|
223
|
+
// so it doesn't scroll
|
|
224
|
+
if (this.collection.size === 0) {
|
|
225
|
+
loaderY = 0;
|
|
226
|
+
loaderHeight = visibleHeight || 60;
|
|
227
|
+
}
|
|
216
228
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
// so it doesn't scroll
|
|
222
|
-
if (this.collection.size === 0) {
|
|
223
|
-
loaderY = 0;
|
|
224
|
-
loaderHeight = visibleHeight || 60;
|
|
229
|
+
let rect = new Rect(0, loaderY, visibleWidth, loaderHeight);
|
|
230
|
+
let loader = new LayoutInfo('loader', 'loader', rect);
|
|
231
|
+
this.layoutInfos.set('loader', loader);
|
|
232
|
+
y = loader.rect.maxY;
|
|
225
233
|
}
|
|
226
234
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (this.collection.size === 0 && !this.isLoading) {
|
|
234
|
-
let rect = new Rect(0, 0, visibleWidth, visibleHeight);
|
|
235
|
-
let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);
|
|
236
|
-
this.layoutInfos.set('placeholder', placeholder);
|
|
237
|
-
y = placeholder.rect.maxY;
|
|
235
|
+
if (this.collection.size === 0 && !this.isLoading) {
|
|
236
|
+
let rect = new Rect(0, 0, visibleWidth, visibleHeight);
|
|
237
|
+
let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);
|
|
238
|
+
this.layoutInfos.set('placeholder', placeholder);
|
|
239
|
+
y = placeholder.rect.maxY;
|
|
240
|
+
}
|
|
238
241
|
}
|
|
239
|
-
|
|
240
242
|
this.contentSize = new Size(visibleWidth, y);
|
|
241
243
|
}
|
|
242
244
|
}
|