@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.js CHANGED
@@ -1,1750 +1,1543 @@
1
- var {
2
- Layout,
3
- Rect,
4
- LayoutInfo,
5
- Size
6
- } = require("@react-stately/virtualizer");
7
-
8
- var {
9
- Virtualizer,
10
- VirtualizerItem
11
- } = require("@react-aria/virtualizer");
12
-
13
- var {
14
- useListState
15
- } = require("@react-stately/list");
16
-
17
- var {
18
- useGrid,
19
- useGridCell,
20
- useGridRow
21
- } = require("@react-aria/grid");
22
-
23
- var {
24
- useCollator,
25
- useLocale,
26
- useMessageFormatter
27
- } = require("@react-aria/i18n");
28
-
29
- var {
30
- ProgressCircle
31
- } = require("@react-spectrum/progress");
32
-
33
- var {
34
- GridCollection,
35
- useGridState
36
- } = require("@react-stately/grid");
37
-
38
- var {
39
- useProviderProps,
40
- useProvider
41
- } = require("@react-spectrum/provider");
42
-
43
- var {
44
- useFocusWithin,
45
- useHover
46
- } = require("@react-aria/interactions");
47
-
48
- var _react2 = require("react");
49
-
50
- var _react = $parcel$interopDefault(_react2);
51
-
52
- var {
53
- useCallback,
54
- useMemo,
55
- useRef,
56
- useState,
57
- useContext,
58
- forwardRef
59
- } = _react2;
60
-
61
- var {
62
- FocusRing
63
- } = require("@react-aria/focus");
64
-
65
- var {
66
- filterDOMProps,
67
- mergeProps,
68
- useLayoutEffect,
69
- useResizeObserver,
70
- useSlotId
71
- } = require("@react-aria/utils");
72
-
73
- var {
74
- Divider
75
- } = require("@react-spectrum/divider");
76
-
77
- var {
78
- classNames,
79
- SlotProvider,
80
- useDOMRef,
81
- useHasChild,
82
- useStyleProps,
83
- useUnwrapDOMRef
84
- } = require("@react-spectrum/utils");
85
-
86
- var {
87
- Checkbox
88
- } = require("@react-spectrum/checkbox");
89
-
90
- var _babelRuntimeHelpersInteropRequireDefault = $parcel$interopDefault(require("@babel/runtime/helpers/interopRequireDefault"));
91
-
92
- var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
93
-
94
1
  require("./main.css");
95
-
2
+ var $jpY3B$reactspectrumutils = require("@react-spectrum/utils");
3
+ var $jpY3B$reactstatelygrid = require("@react-stately/grid");
4
+ var $jpY3B$reactariautils = require("@react-aria/utils");
5
+ var $jpY3B$reactspectrumprogress = require("@react-spectrum/progress");
6
+ var $jpY3B$react = require("react");
7
+ var $jpY3B$reactariai18n = require("@react-aria/i18n");
8
+ var $jpY3B$reactariagrid = require("@react-aria/grid");
9
+ var $jpY3B$reactstatelylist = require("@react-stately/list");
10
+ var $jpY3B$reactspectrumprovider = require("@react-spectrum/provider");
11
+ var $jpY3B$reactariavirtualizer = require("@react-aria/virtualizer");
12
+ var $jpY3B$reactspectrumcheckbox = require("@react-spectrum/checkbox");
13
+ var $jpY3B$reactariafocus = require("@react-aria/focus");
14
+ var $jpY3B$reactariainteractions = require("@react-aria/interactions");
15
+ var $jpY3B$reactstatelyvirtualizer = require("@react-stately/virtualizer");
16
+
17
+ function $parcel$export(e, n, v, s) {
18
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
19
+ }
96
20
  function $parcel$interopDefault(a) {
97
21
  return a && a.__esModule ? a.default : a;
98
22
  }
99
23
 
100
- // ASSET: /Users/govett/dev/react-spectrum-v3/node_modules/@adobe/spectrum-css-temp/components/card/vars.css
101
- var $e80f3e549a26f7869571c50d85a$exports = {};
102
- $e80f3e549a26f7869571c50d85a$exports = {
103
- "spectrum-Card": "_spectrum-Card_dd040",
104
- "spectrum-Card-heading": "_spectrum-Card-heading_dd040",
105
- "spectrum-Card-checkboxWrapper": "_spectrum-Card-checkboxWrapper_dd040",
106
- "spectrum-Card-checkbox": "_spectrum-Card-checkbox_dd040",
107
- "is-focused": "_is-focused_dd040",
108
- "is-selected": "_is-selected_dd040",
109
- "focus-ring": "_focus-ring_dd040",
110
- "is-hovered": "_is-hovered_dd040",
111
- "spectrum-Card-grid": "_spectrum-Card-grid_dd040",
112
- "spectrum-Card-decoration": "_spectrum-Card-decoration_dd040",
113
- "spectrum-Card-image": "_spectrum-Card-image_dd040",
114
- "spectrum-Card-illustration": "_spectrum-Card-illustration_dd040",
115
- "spectrum-Card-avatar": "_spectrum-Card-avatar_dd040",
116
- "spectrum-Card-detail": "_spectrum-Card-detail_dd040",
117
- "spectrum-Card-actions": "_spectrum-Card-actions_dd040",
118
- "spectrum-Card-content": "_spectrum-Card-content_dd040",
119
- "spectrum-Card-divider": "_spectrum-Card-divider_dd040",
120
- "spectrum-Card-footer": "_spectrum-Card-footer_dd040",
121
- "spectrum-Card--waterfall": "_spectrum-Card--waterfall_dd040",
122
- "spectrum-Card--default": "_spectrum-Card--default_dd040",
123
- "spectrum-Card--noPreview": "_spectrum-Card--noPreview_dd040",
124
- "spectrum-Card--grid": "_spectrum-Card--grid_dd040",
125
- "spectrum-Card--noLayout": "_spectrum-Card--noLayout_dd040",
126
- "spectrum-Card--isQuiet": "_spectrum-Card--isQuiet_dd040",
127
- "spectrum-Card--gallery": "_spectrum-Card--gallery_dd040",
128
- "spectrum-Card--closeToSquare": "_spectrum-Card--closeToSquare_dd040",
129
- "spectrum-Card--horizontal": "_spectrum-Card--horizontal_dd040",
130
- "spectrum-CardView": "_spectrum-CardView_dd040",
131
- "spectrum-CardView-centeredWrapper": "_spectrum-CardView-centeredWrapper_dd040",
132
- "spectrum-CardView-row": "_spectrum-CardView-row_dd040",
133
- "is-drop-target": "_is-drop-target_dd040"
134
- };
135
-
136
- const $d2268ebff01b30dc8701260db9de8b73$export$CardViewContext = /*#__PURE__*/_react.createContext(null);
137
-
138
- function $d2268ebff01b30dc8701260db9de8b73$export$useCardViewContext() {
139
- return useContext($d2268ebff01b30dc8701260db9de8b73$export$CardViewContext);
24
+ $parcel$export(module.exports, "CardView", () => $514a55f6d91f25ef$export$7e52c821f7b6f422);
25
+ $parcel$export(module.exports, "GalleryLayout", () => $8019a3d2c7d098ea$export$8e52095834484b61);
26
+ $parcel$export(module.exports, "GridLayout", () => $71b727f94b595b1a$export$7d2b12578154a735);
27
+ $parcel$export(module.exports, "WaterfallLayout", () => $632abf8fbf0ad57b$export$e9f7cda058ba8df8);
28
+ $parcel$export(module.exports, "Card", () => $6b630ac4b78ba7f3$export$60332b2344f7fe41);
29
+
30
+
31
+
32
+
33
+
34
+
35
+ var $71570f0038472fa2$exports = {};
36
+
37
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card", () => $71570f0038472fa2$export$4e5e9f191b1edb8, (v) => $71570f0038472fa2$export$4e5e9f191b1edb8 = v);
38
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card-heading", () => $71570f0038472fa2$export$92758a4a0e8d19e4, (v) => $71570f0038472fa2$export$92758a4a0e8d19e4 = v);
39
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card-checkboxWrapper", () => $71570f0038472fa2$export$33977546b63e0df9, (v) => $71570f0038472fa2$export$33977546b63e0df9 = v);
40
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card-checkbox", () => $71570f0038472fa2$export$842da5d48b8f6db2, (v) => $71570f0038472fa2$export$842da5d48b8f6db2 = v);
41
+ $parcel$export($71570f0038472fa2$exports, "is-selected", () => $71570f0038472fa2$export$1e0fb04f31d3c22a, (v) => $71570f0038472fa2$export$1e0fb04f31d3c22a = v);
42
+ $parcel$export($71570f0038472fa2$exports, "focus-ring", () => $71570f0038472fa2$export$f39a09f249340e2a, (v) => $71570f0038472fa2$export$f39a09f249340e2a = v);
43
+ $parcel$export($71570f0038472fa2$exports, "is-hovered", () => $71570f0038472fa2$export$b8813cd5d7824ce7, (v) => $71570f0038472fa2$export$b8813cd5d7824ce7 = v);
44
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card-grid", () => $71570f0038472fa2$export$b3dd760d2dfde29e, (v) => $71570f0038472fa2$export$b3dd760d2dfde29e = v);
45
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card-decoration", () => $71570f0038472fa2$export$48252dc130b62514, (v) => $71570f0038472fa2$export$48252dc130b62514 = v);
46
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card-image", () => $71570f0038472fa2$export$8d5fea71dc66db80, (v) => $71570f0038472fa2$export$8d5fea71dc66db80 = v);
47
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card-illustration", () => $71570f0038472fa2$export$13dd3510ae7a8399, (v) => $71570f0038472fa2$export$13dd3510ae7a8399 = v);
48
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card-avatar", () => $71570f0038472fa2$export$159930c59efb6273, (v) => $71570f0038472fa2$export$159930c59efb6273 = v);
49
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card-detail", () => $71570f0038472fa2$export$16715af38fbd9819, (v) => $71570f0038472fa2$export$16715af38fbd9819 = v);
50
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card-content", () => $71570f0038472fa2$export$d946625b97e8aa17, (v) => $71570f0038472fa2$export$d946625b97e8aa17 = v);
51
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card--waterfall", () => $71570f0038472fa2$export$d9c7209e0e4f7e4d, (v) => $71570f0038472fa2$export$d9c7209e0e4f7e4d = v);
52
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card--default", () => $71570f0038472fa2$export$c7a022df9e10a238, (v) => $71570f0038472fa2$export$c7a022df9e10a238 = v);
53
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card--noPreview", () => $71570f0038472fa2$export$b77922bc0320c9e4, (v) => $71570f0038472fa2$export$b77922bc0320c9e4 = v);
54
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card--grid", () => $71570f0038472fa2$export$59739ab951d2dcc7, (v) => $71570f0038472fa2$export$59739ab951d2dcc7 = v);
55
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card--noLayout", () => $71570f0038472fa2$export$a03d836e6ef3e749, (v) => $71570f0038472fa2$export$a03d836e6ef3e749 = v);
56
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card--isQuiet", () => $71570f0038472fa2$export$92ad04b5ac9296ea, (v) => $71570f0038472fa2$export$92ad04b5ac9296ea = v);
57
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card--gallery", () => $71570f0038472fa2$export$ccd8ffc36bd10cc, (v) => $71570f0038472fa2$export$ccd8ffc36bd10cc = v);
58
+ $parcel$export($71570f0038472fa2$exports, "spectrum-Card--horizontal", () => $71570f0038472fa2$export$1c52334407225704, (v) => $71570f0038472fa2$export$1c52334407225704 = v);
59
+ $parcel$export($71570f0038472fa2$exports, "is-focused", () => $71570f0038472fa2$export$e7dc768d35940237, (v) => $71570f0038472fa2$export$e7dc768d35940237 = v);
60
+ $parcel$export($71570f0038472fa2$exports, "spectrum-CardView", () => $71570f0038472fa2$export$2f34e9e3e0b89d95, (v) => $71570f0038472fa2$export$2f34e9e3e0b89d95 = v);
61
+ $parcel$export($71570f0038472fa2$exports, "spectrum-CardView-centeredWrapper", () => $71570f0038472fa2$export$7fc89689fcfab196, (v) => $71570f0038472fa2$export$7fc89689fcfab196 = v);
62
+ $parcel$export($71570f0038472fa2$exports, "spectrum-CardView-row", () => $71570f0038472fa2$export$4746ac09daa215ae, (v) => $71570f0038472fa2$export$4746ac09daa215ae = v);
63
+ $parcel$export($71570f0038472fa2$exports, "is-drop-target", () => $71570f0038472fa2$export$d8467f38d2d00bd0, (v) => $71570f0038472fa2$export$d8467f38d2d00bd0 = v);
64
+ var $71570f0038472fa2$export$4e5e9f191b1edb8;
65
+ var $71570f0038472fa2$export$92758a4a0e8d19e4;
66
+ var $71570f0038472fa2$export$33977546b63e0df9;
67
+ var $71570f0038472fa2$export$842da5d48b8f6db2;
68
+ var $71570f0038472fa2$export$1e0fb04f31d3c22a;
69
+ var $71570f0038472fa2$export$f39a09f249340e2a;
70
+ var $71570f0038472fa2$export$b8813cd5d7824ce7;
71
+ var $71570f0038472fa2$export$b3dd760d2dfde29e;
72
+ var $71570f0038472fa2$export$48252dc130b62514;
73
+ var $71570f0038472fa2$export$8d5fea71dc66db80;
74
+ var $71570f0038472fa2$export$13dd3510ae7a8399;
75
+ var $71570f0038472fa2$export$159930c59efb6273;
76
+ var $71570f0038472fa2$export$16715af38fbd9819;
77
+ var $71570f0038472fa2$export$d946625b97e8aa17;
78
+ var $71570f0038472fa2$export$d9c7209e0e4f7e4d;
79
+ var $71570f0038472fa2$export$c7a022df9e10a238;
80
+ var $71570f0038472fa2$export$b77922bc0320c9e4;
81
+ var $71570f0038472fa2$export$59739ab951d2dcc7;
82
+ var $71570f0038472fa2$export$a03d836e6ef3e749;
83
+ var $71570f0038472fa2$export$92ad04b5ac9296ea;
84
+ var $71570f0038472fa2$export$ccd8ffc36bd10cc;
85
+ var $71570f0038472fa2$export$1c52334407225704;
86
+ var $71570f0038472fa2$export$e7dc768d35940237;
87
+ var $71570f0038472fa2$export$2f34e9e3e0b89d95;
88
+ var $71570f0038472fa2$export$7fc89689fcfab196;
89
+ var $71570f0038472fa2$export$4746ac09daa215ae;
90
+ var $71570f0038472fa2$export$d8467f38d2d00bd0;
91
+ $71570f0038472fa2$export$4e5e9f191b1edb8 = "spectrum-Card_6fdf9f";
92
+ $71570f0038472fa2$export$92758a4a0e8d19e4 = "spectrum-Card-heading_6fdf9f";
93
+ $71570f0038472fa2$export$33977546b63e0df9 = "spectrum-Card-checkboxWrapper_6fdf9f";
94
+ $71570f0038472fa2$export$842da5d48b8f6db2 = "spectrum-Card-checkbox_6fdf9f";
95
+ $71570f0038472fa2$export$1e0fb04f31d3c22a = "is-selected_6fdf9f";
96
+ $71570f0038472fa2$export$f39a09f249340e2a = "focus-ring_6fdf9f";
97
+ $71570f0038472fa2$export$b8813cd5d7824ce7 = "is-hovered_6fdf9f";
98
+ $71570f0038472fa2$export$b3dd760d2dfde29e = "spectrum-Card-grid_6fdf9f";
99
+ $71570f0038472fa2$export$48252dc130b62514 = "spectrum-Card-decoration_6fdf9f";
100
+ $71570f0038472fa2$export$8d5fea71dc66db80 = "spectrum-Card-image_6fdf9f";
101
+ $71570f0038472fa2$export$13dd3510ae7a8399 = "spectrum-Card-illustration_6fdf9f";
102
+ $71570f0038472fa2$export$159930c59efb6273 = "spectrum-Card-avatar_6fdf9f";
103
+ $71570f0038472fa2$export$16715af38fbd9819 = "spectrum-Card-detail_6fdf9f";
104
+ $71570f0038472fa2$export$d946625b97e8aa17 = "spectrum-Card-content_6fdf9f";
105
+ $71570f0038472fa2$export$d9c7209e0e4f7e4d = "spectrum-Card--waterfall_6fdf9f";
106
+ $71570f0038472fa2$export$c7a022df9e10a238 = "spectrum-Card--default_6fdf9f";
107
+ $71570f0038472fa2$export$b77922bc0320c9e4 = "spectrum-Card--noPreview_6fdf9f";
108
+ $71570f0038472fa2$export$59739ab951d2dcc7 = "spectrum-Card--grid_6fdf9f";
109
+ $71570f0038472fa2$export$a03d836e6ef3e749 = "spectrum-Card--noLayout_6fdf9f";
110
+ $71570f0038472fa2$export$92ad04b5ac9296ea = "spectrum-Card--isQuiet_6fdf9f";
111
+ $71570f0038472fa2$export$ccd8ffc36bd10cc = "spectrum-Card--gallery_6fdf9f";
112
+ $71570f0038472fa2$export$1c52334407225704 = "spectrum-Card--horizontal_6fdf9f";
113
+ $71570f0038472fa2$export$e7dc768d35940237 = "is-focused_6fdf9f";
114
+ $71570f0038472fa2$export$2f34e9e3e0b89d95 = "spectrum-CardView_6fdf9f";
115
+ $71570f0038472fa2$export$7fc89689fcfab196 = "spectrum-CardView-centeredWrapper_6fdf9f";
116
+ $71570f0038472fa2$export$4746ac09daa215ae = "spectrum-CardView-row_6fdf9f";
117
+ $71570f0038472fa2$export$d8467f38d2d00bd0 = "is-drop-target_6fdf9f";
118
+
119
+
120
+
121
+ const $e57ab98cef2f01a5$export$64992ac69f286e5c = /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createContext(null);
122
+ function $e57ab98cef2f01a5$export$fea0b38586ec8f13() {
123
+ return $jpY3B$react.useContext($e57ab98cef2f01a5$export$64992ac69f286e5c);
140
124
  }
141
125
 
142
- var $e80f3e549a26f7869571c50d85a$$interop$default = $parcel$interopDefault($e80f3e549a26f7869571c50d85a$exports);
143
-
144
- function $c05a01cf76428c47b3d1dc747d32$var$CardBase(props, ref) {
145
- props = useProviderProps(props);
146
- let context = $d2268ebff01b30dc8701260db9de8b73$export$useCardViewContext() || {}; // we can call again here, won't change from Card.tsx
147
-
148
- let {
149
- state
150
- } = context;
151
- let manager = state == null ? void 0 : state.selectionManager;
152
- let {
153
- isQuiet,
154
- orientation = 'vertical',
155
- articleProps = {},
156
- item,
157
- layout
158
- } = props;
159
- let key = item == null ? void 0 : item.key;
160
- let isSelected = manager == null ? void 0 : manager.isSelected(key);
161
- let isDisabled = state == null ? void 0 : state.disabledKeys.has(key);
162
-
163
- let onChange = () => manager == null ? void 0 : manager.select(key);
164
-
165
- let {
166
- styleProps
167
- } = useStyleProps(props);
168
- let {
169
- cardProps,
170
- titleProps,
171
- contentProps
172
- } = $c05a01cf76428c47b3d1dc747d32$var$useCard(props);
173
- let domRef = useDOMRef(ref);
174
- let gridRef = useRef(); // cards are only interactive if there is a selection manager and it allows selection
175
-
176
- let {
177
- hoverProps,
178
- isHovered
179
- } = useHover({
180
- isDisabled: manager === undefined || (manager == null ? void 0 : manager.selectionMode) === 'none' || isDisabled
181
- });
182
- let [isFocused, setIsFocused] = useState(false);
183
- let {
184
- focusWithinProps
185
- } = useFocusWithin({
186
- onFocusWithinChange: setIsFocused,
187
- isDisabled
188
- });
189
- let hasFooter = useHasChild("." + $e80f3e549a26f7869571c50d85a$$interop$default['spectrum-Card-footer'], gridRef); // ToDo: see css for comment about avatar under selector .spectrum-Card--noLayout.spectrum-Card--default
190
-
191
- let hasPreviewImage = useHasChild("." + $e80f3e549a26f7869571c50d85a$$interop$default['spectrum-Card-image'], gridRef);
192
- let hasPreviewIllustration = useHasChild("." + $e80f3e549a26f7869571c50d85a$$interop$default['spectrum-Card-illustration'], gridRef);
193
- let hasPreview = hasPreviewImage || hasPreviewIllustration; // this is for horizontal cards
194
-
195
- let [height, setHeight] = useState(NaN);
196
- let updateHeight = useCallback(() => {
197
- if (orientation !== 'horizontal') {
198
- return;
199
- }
200
-
201
- let cardHeight = gridRef.current.getBoundingClientRect().height;
202
- setHeight(cardHeight);
203
- }, [orientation, gridRef, setHeight]);
204
- useResizeObserver({
205
- ref: gridRef,
206
- onResize: updateHeight
207
- });
208
- let aspectRatioEnforce = undefined;
209
-
210
- if (orientation === 'horizontal' && !isNaN(height)) {
211
- aspectRatioEnforce = {
212
- height: height + "px",
213
- width: height + "px"
214
- };
215
- }
216
-
217
- let slots = useMemo(() => ({
218
- image: _babelRuntimeHelpersExtends({
219
- UNSAFE_className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-image'),
220
- objectFit: orientation === 'horizontal' ? 'cover' : 'contain',
221
- alt: ''
222
- }, aspectRatioEnforce),
223
- illustration: _babelRuntimeHelpersExtends({
224
- UNSAFE_className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-illustration')
225
- }, aspectRatioEnforce),
226
- avatar: {
227
- UNSAFE_className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-avatar'),
228
- size: 'avatar-size-400'
229
- },
230
- heading: _babelRuntimeHelpersExtends({
231
- UNSAFE_className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-heading')
232
- }, titleProps),
233
- content: _babelRuntimeHelpersExtends({
234
- UNSAFE_className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-content')
235
- }, contentProps),
236
- detail: {
237
- UNSAFE_className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-detail')
238
- },
239
- actionmenu: {
240
- UNSAFE_className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-actions'),
241
- align: 'end',
242
- isQuiet: true
243
- },
244
- footer: {
245
- UNSAFE_className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-footer'),
246
- isHidden: isQuiet
247
- },
248
- divider: {
249
- UNSAFE_className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-divider'),
250
- size: 'S'
251
- }
252
- }), [titleProps, contentProps, height, isQuiet, orientation]); // This is only for quiet grid cards
253
-
254
- let [isCloseToSquare, setIsCloseToSquare] = useState(false);
255
- useLayoutEffect(() => {
256
- if (!(layout === 'grid' && isQuiet)) {
257
- return;
258
- } // ToDo: how to handle illustrations? what if the illustration looks like an image? What about swatches/fonts https://spectrum-contributions.corp.adobe.com/page/asset-card-beta/#File-type
259
-
260
-
261
- let image = gridRef.current.querySelector("." + $e80f3e549a26f7869571c50d85a$$interop$default['spectrum-Card-image'] + " img");
262
126
 
263
- if (!image) {
264
- return;
265
- }
266
127
 
267
- let measure = () => {
268
- let height = image.naturalHeight;
269
- let width = image.naturalWidth;
270
- /*
271
- * ToDo: Choose between min-padding and plain ratio
272
- * Do we want to just do a ratio measurement when it's close to being a square?
273
- * or do we want to actually figure out min-padding?
274
- * Min Padding would require us to check that the padding is not less than the min in both Vertical and Horizontal
275
- * Unfortunately img contain doesn't actually create padding, which is what this math below can figure out
276
- * Vs the commented out straight ratio check
277
- * */
278
-
279
- let imgTagHeight = image.clientHeight;
280
- let imgTagWidth = image.clientWidth;
281
- let ratio = Math.min(imgTagWidth / width, imgTagHeight / height);
282
- let trueHeight = ratio * height;
283
- let trueWidth = ratio * width;
284
- let paddingVertical = imgTagHeight - trueHeight;
285
- let paddingHorizontal = imgTagWidth - trueWidth;
286
-
287
- if (paddingVertical < 16 && paddingHorizontal < 16) {
288
- // ToDo: does this need to be different per scale?
289
- setIsCloseToSquare(true);
290
- } else {
291
- setIsCloseToSquare(false);
292
- } // let ratio = height / width;
293
- // if (ratio > 0.9 && ratio < 1.1) {
294
- // setIsCloseToSquare(true);
295
- // }
296
128
 
129
+ function $7888205ff7de382f$var$CardBase(props, ref) {
130
+ props = $jpY3B$reactspectrumprovider.useProviderProps(props);
131
+ let context = $e57ab98cef2f01a5$export$fea0b38586ec8f13() || {
132
+ }; // we can call again here, won't change from Card.tsx
133
+ let { state: state } = context;
134
+ let manager = state === null || state === void 0 ? void 0 : state.selectionManager;
135
+ let { isQuiet: isQuiet , orientation: orientation = 'vertical' , articleProps: articleProps = {
136
+ } , item: item , layout: layout , children: children } = props;
137
+ let key = item === null || item === void 0 ? void 0 : item.key;
138
+ let isSelected = manager === null || manager === void 0 ? void 0 : manager.isSelected(key);
139
+ let isDisabled = state === null || state === void 0 ? void 0 : state.disabledKeys.has(key);
140
+ let onChange = ()=>{
141
+ return manager === null || manager === void 0 ? void 0 : manager.select(key);
297
142
  };
298
-
299
- if (image.complete) {
300
- measure();
301
- } else {
302
- image.addEventListener('load', measure);
303
- return () => {
304
- image.removeEventListener('load', measure);
305
- };
306
- } // ToDo: how to re-run if image src changes?
307
-
308
- }, [props.children, setIsCloseToSquare, isQuiet, layout]);
309
- return /*#__PURE__*/_react.createElement(FocusRing, {
310
- focusRingClass: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'focus-ring')
311
- }, /*#__PURE__*/_react.createElement("article", _babelRuntimeHelpersExtends({}, styleProps, mergeProps(cardProps, focusWithinProps, hoverProps, filterDOMProps(props), articleProps), {
312
- ref: domRef,
313
- className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card', {
314
- 'spectrum-Card--default': !isQuiet && orientation !== 'horizontal',
315
- 'spectrum-Card--isQuiet': isQuiet && orientation !== 'horizontal',
316
- 'spectrum-Card--horizontal': orientation === 'horizontal',
317
- 'spectrum-Card--closeToSquare': isCloseToSquare,
318
- 'spectrum-Card--noPreview': !hasPreview,
319
- 'is-hovered': isHovered,
320
- 'is-focused': isFocused,
321
- 'is-selected': isSelected,
322
- 'spectrum-Card--waterfall': layout === 'waterfall',
323
- 'spectrum-Card--gallery': layout === 'gallery',
324
- 'spectrum-Card--grid': layout === 'grid',
325
- 'spectrum-Card--noLayout': layout !== 'waterfall' && layout !== 'gallery' && layout !== 'grid'
326
- }, styleProps.className)
327
- }), /*#__PURE__*/_react.createElement("div", {
328
- ref: gridRef,
329
- className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-grid')
330
- }, manager && manager.selectionMode !== 'none' && /*#__PURE__*/_react.createElement("div", {
331
- className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-checkboxWrapper')
332
- }, /*#__PURE__*/_react.createElement(Checkbox, {
333
- isDisabled: isDisabled,
334
- excludeFromTabOrder: true,
335
- isSelected: isSelected,
336
- onChange: onChange,
337
- UNSAFE_className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-checkbox'),
338
- isEmphasized: true,
339
- "aria-label": "select"
340
- })), /*#__PURE__*/_react.createElement(SlotProvider, {
341
- slots: slots
342
- }, props.children, hasFooter && /*#__PURE__*/_react.createElement(Divider, null)), /*#__PURE__*/_react.createElement("div", {
343
- className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-Card-decoration')
344
- }))));
345
- }
346
-
347
- function $c05a01cf76428c47b3d1dc747d32$var$useCard(props) {
348
- let titleId = useSlotId();
349
- let descriptionId = useSlotId();
350
- let titleProps = useMemo(() => ({
351
- id: titleId
352
- }), [titleId]);
353
- let contentProps = useMemo(() => ({
354
- id: descriptionId
355
- }), [descriptionId]);
356
- return {
357
- cardProps: _babelRuntimeHelpersExtends({}, filterDOMProps(props), {
358
- 'aria-labelledby': titleId,
359
- 'aria-describedby': descriptionId,
360
- tabIndex: 0
361
- }),
362
- titleProps,
363
- contentProps
364
- };
365
- }
366
- /**
367
- * TODO: Add description of component here.
368
- */
369
-
370
-
371
- const $c05a01cf76428c47b3d1dc747d32$export$CardBase = /*#__PURE__*/_react.forwardRef($c05a01cf76428c47b3d1dc747d32$var$CardBase);
372
-
373
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/ar-AE.json
374
- var $a73c2251b3d85c65b5e95b28f93c8042$exports = {};
375
- $a73c2251b3d85c65b5e95b28f93c8042$exports = JSON.parse("{\"loading\":\"جارٍ التحميل...\",\"loadingMore\":\"جارٍ تحميل المزيد...\"}");
376
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/bg-BG.json
377
- var $cd530dcba5c06fcc85025230ea1fa$exports = {};
378
- $cd530dcba5c06fcc85025230ea1fa$exports = JSON.parse("{\"loading\":\"Зареждане...\",\"loadingMore\":\"Зареждане на още...\"}");
379
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/cs-CZ.json
380
- var $d4e7ef95b9eb2258a723c198e08ce1$exports = {};
381
- $d4e7ef95b9eb2258a723c198e08ce1$exports = JSON.parse("{\"loading\":\"Načítání...\",\"loadingMore\":\"Načítání dalších...\"}");
382
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/da-DK.json
383
- var $e591e0ea92da820daf4525e271cb1091$exports = {};
384
- $e591e0ea92da820daf4525e271cb1091$exports = JSON.parse("{\"loading\":\"Indlæser ...\",\"loadingMore\":\"Indlæser flere ...\"}");
385
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/de-DE.json
386
- var $a79235d0b2a717d6e877d4196d9a700$exports = {};
387
- $a79235d0b2a717d6e877d4196d9a700$exports = JSON.parse("{\"loading\":\"Laden...\",\"loadingMore\":\"Mehr laden ...\"}");
388
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/el-GR.json
389
- var $b031a841d1713b81f37be7a3e54f62bc$exports = {};
390
- $b031a841d1713b81f37be7a3e54f62bc$exports = JSON.parse("{\"loading\":\"Φόρτωση...\",\"loadingMore\":\"Φόρτωση περισσότερων...\"}");
391
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/en-US.json
392
- var $fe3b01a31811de4315f58934cfe01d9f$exports = {};
393
- $fe3b01a31811de4315f58934cfe01d9f$exports = JSON.parse("{\"loading\":\"Loading…\",\"loadingMore\":\"Loading more…\"}");
394
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/es-ES.json
395
- var $dfccb4b840ac9a4f6372f30756231413$exports = {};
396
- $dfccb4b840ac9a4f6372f30756231413$exports = JSON.parse("{\"loading\":\"Cargando…\",\"loadingMore\":\"Cargando más…\"}");
397
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/et-EE.json
398
- var $c0afdcf18fcf36fd0acae74dbc5bddfb$exports = {};
399
- $c0afdcf18fcf36fd0acae74dbc5bddfb$exports = JSON.parse("{\"loading\":\"Laadimine...\",\"loadingMore\":\"Laadi rohkem...\"}");
400
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/fi-FI.json
401
- var $bda8be2b1a9fa47093f290fdcbc590$exports = {};
402
- $bda8be2b1a9fa47093f290fdcbc590$exports = JSON.parse("{\"loading\":\"Ladataan…\",\"loadingMore\":\"Ladataan lisää…\"}");
403
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/fr-FR.json
404
- var $b400752af39f40d53ff83e9d6ae1716f$exports = {};
405
- $b400752af39f40d53ff83e9d6ae1716f$exports = JSON.parse("{\"loading\":\"Chargement...\",\"loadingMore\":\"Chargement supplémentaire...\"}");
406
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/he-IL.json
407
- var $f52b9c77027a45c50447d15f211aee3c$exports = {};
408
- $f52b9c77027a45c50447d15f211aee3c$exports = JSON.parse("{\"loading\":\"טוען...\",\"loadingMore\":\"טוען עוד...\"}");
409
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/hr-HR.json
410
- var $c51bbbe61ab7dda3d07ff8b63a6656e$exports = {};
411
- $c51bbbe61ab7dda3d07ff8b63a6656e$exports = JSON.parse("{\"loading\":\"Učitavam...\",\"loadingMore\":\"Učitavam još...\"}");
412
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/hu-HU.json
413
- var $f835d20fb8524bab4bfa3011b2fe2$exports = {};
414
- $f835d20fb8524bab4bfa3011b2fe2$exports = JSON.parse("{\"loading\":\"Betöltés folyamatban…\",\"loadingMore\":\"Továbbiak betöltése folyamatban…\"}");
415
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/it-IT.json
416
- var $a049c9a68793a22cc3d3121b0b4a10$exports = {};
417
- $a049c9a68793a22cc3d3121b0b4a10$exports = JSON.parse("{\"loading\":\"Caricamento...\",\"loadingMore\":\"Caricamento altri...\"}");
418
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/ja-JP.json
419
- var $c90338eb448423751c80d6cf2fb8c8a1$exports = {};
420
- $c90338eb448423751c80d6cf2fb8c8a1$exports = JSON.parse("{\"loading\":\"読み込み中...\",\"loadingMore\":\"さらに読み込み中...\"}");
421
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/ko-KR.json
422
- var $b635e415ea191230d720f8a57bcfac4$exports = {};
423
- $b635e415ea191230d720f8a57bcfac4$exports = JSON.parse("{\"loading\":\"로드 중\",\"loadingMore\":\"추가 로드 중\"}");
424
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/lt-LT.json
425
- var $bf40374472802f152aae7e860cbfba$exports = {};
426
- $bf40374472802f152aae7e860cbfba$exports = JSON.parse("{\"loading\":\"Įkeliama...\",\"loadingMore\":\"Įkeliama daugiau...\"}");
427
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/lv-LV.json
428
- var $a5f0a1480f91d7acc8710521295c83e$exports = {};
429
- $a5f0a1480f91d7acc8710521295c83e$exports = JSON.parse("{\"loading\":\"Notiek ielāde...\",\"loadingMore\":\"Tiek ielādēts vēl...\"}");
430
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/nb-NO.json
431
- var $dc580345c46a3bd686da9e80ef533a94$exports = {};
432
- $dc580345c46a3bd686da9e80ef533a94$exports = JSON.parse("{\"loading\":\"Laster inn ...\",\"loadingMore\":\"Laster inn flere ...\"}");
433
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/nl-NL.json
434
- var $cf7646cd46b2513084100884bbfb5$exports = {};
435
- $cf7646cd46b2513084100884bbfb5$exports = JSON.parse("{\"loading\":\"Laden...\",\"loadingMore\":\"Meer laden...\"}");
436
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/pl-PL.json
437
- var $d45f9d44e7bb340675d3f3$exports = {};
438
- $d45f9d44e7bb340675d3f3$exports = JSON.parse("{\"loading\":\"Ładowanie...\",\"loadingMore\":\"Wczytywanie większej liczby...\"}");
439
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/pt-BR.json
440
- var $d7fc96a2256f525f33439570c5176b6$exports = {};
441
- $d7fc96a2256f525f33439570c5176b6$exports = JSON.parse("{\"loading\":\"Carregando...\",\"loadingMore\":\"Carregando mais...\"}");
442
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/pt-PT.json
443
- var $bce54762c8026412a8cc0b3c0e17$exports = {};
444
- $bce54762c8026412a8cc0b3c0e17$exports = JSON.parse("{\"loading\":\"A carregar...\",\"loadingMore\":\"A carregar mais...\"}");
445
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/ro-RO.json
446
- var $b1a5d948f23fd42b37cf4a62bc20fbc9$exports = {};
447
- $b1a5d948f23fd42b37cf4a62bc20fbc9$exports = JSON.parse("{\"loading\":\"Se încarcă...\",\"loadingMore\":\"Se încarcă mai multe...\"}");
448
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/ru-RU.json
449
- var $fd34d0ae6d3c2b124aa82bec518fdebc$exports = {};
450
- $fd34d0ae6d3c2b124aa82bec518fdebc$exports = JSON.parse("{\"loading\":\"Загрузка...\",\"loadingMore\":\"Дополнительная загрузка...\"}");
451
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/sk-SK.json
452
- var $f0d899f938fc0b4d2e0a803e77f73b6$exports = {};
453
- $f0d899f938fc0b4d2e0a803e77f73b6$exports = JSON.parse("{\"loading\":\"Načítava sa...\",\"loadingMore\":\"Načítava sa viac...\"}");
454
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/sl-SI.json
455
- var $fc6db5102b55f61b25dc1512b9307$exports = {};
456
- $fc6db5102b55f61b25dc1512b9307$exports = JSON.parse("{\"loading\":\"Nalaganje...\",\"loadingMore\":\"Nalaganje več vsebine...\"}");
457
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/sr-SP.json
458
- var $b5867f72618ad3ebdf24df3b2c0c64ad$exports = {};
459
- $b5867f72618ad3ebdf24df3b2c0c64ad$exports = JSON.parse("{\"loading\":\"Učitavam...\",\"loadingMore\":\"Učitavam još...\"}");
460
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/sv-SE.json
461
- var $e75d48658029b318f5477dc4b15713$exports = {};
462
- $e75d48658029b318f5477dc4b15713$exports = JSON.parse("{\"loading\":\"Läser in...\",\"loadingMore\":\"Läser in mer...\"}");
463
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/tr-TR.json
464
- var $a386b5db27abfbe3745c59576f$exports = {};
465
- $a386b5db27abfbe3745c59576f$exports = JSON.parse("{\"loading\":\"Yükleniyor...\",\"loadingMore\":\"Daha fazla yükleniyor...\"}");
466
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/uk-UA.json
467
- var $d04a11b64459844c9f6c167e5538da$exports = {};
468
- $d04a11b64459844c9f6c167e5538da$exports = JSON.parse("{\"loading\":\"Завантаження…\",\"loadingMore\":\"Завантаження інших об’єктів...\"}");
469
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/zh-CN.json
470
- var $b9216cdc8ad21d0c1b8e94822b8d13a3$exports = {};
471
- $b9216cdc8ad21d0c1b8e94822b8d13a3$exports = JSON.parse("{\"loading\":\"正在加载...\",\"loadingMore\":\"正在加载更多...\"}");
472
- // ASSET: /Users/govett/dev/react-spectrum-v3/packages/@react-spectrum/card/intl/zh-TW.json
473
- var $f9135827d71b7bceae5eb74e24cd6$exports = {};
474
- $f9135827d71b7bceae5eb74e24cd6$exports = JSON.parse("{\"loading\":\"正在載入\",\"loadingMore\":\"正在載入更多…\"}");
475
- // @ts-ignore
476
- const $e13c04c0c86a4119edea9d2f83b$var$intlMessages = {
477
- "ar-AE": _babelRuntimeHelpersInteropRequireDefault($a73c2251b3d85c65b5e95b28f93c8042$exports).default,
478
- "bg-BG": _babelRuntimeHelpersInteropRequireDefault($cd530dcba5c06fcc85025230ea1fa$exports).default,
479
- "cs-CZ": _babelRuntimeHelpersInteropRequireDefault($d4e7ef95b9eb2258a723c198e08ce1$exports).default,
480
- "da-DK": _babelRuntimeHelpersInteropRequireDefault($e591e0ea92da820daf4525e271cb1091$exports).default,
481
- "de-DE": _babelRuntimeHelpersInteropRequireDefault($a79235d0b2a717d6e877d4196d9a700$exports).default,
482
- "el-GR": _babelRuntimeHelpersInteropRequireDefault($b031a841d1713b81f37be7a3e54f62bc$exports).default,
483
- "en-US": _babelRuntimeHelpersInteropRequireDefault($fe3b01a31811de4315f58934cfe01d9f$exports).default,
484
- "es-ES": _babelRuntimeHelpersInteropRequireDefault($dfccb4b840ac9a4f6372f30756231413$exports).default,
485
- "et-EE": _babelRuntimeHelpersInteropRequireDefault($c0afdcf18fcf36fd0acae74dbc5bddfb$exports).default,
486
- "fi-FI": _babelRuntimeHelpersInteropRequireDefault($bda8be2b1a9fa47093f290fdcbc590$exports).default,
487
- "fr-FR": _babelRuntimeHelpersInteropRequireDefault($b400752af39f40d53ff83e9d6ae1716f$exports).default,
488
- "he-IL": _babelRuntimeHelpersInteropRequireDefault($f52b9c77027a45c50447d15f211aee3c$exports).default,
489
- "hr-HR": _babelRuntimeHelpersInteropRequireDefault($c51bbbe61ab7dda3d07ff8b63a6656e$exports).default,
490
- "hu-HU": _babelRuntimeHelpersInteropRequireDefault($f835d20fb8524bab4bfa3011b2fe2$exports).default,
491
- "it-IT": _babelRuntimeHelpersInteropRequireDefault($a049c9a68793a22cc3d3121b0b4a10$exports).default,
492
- "ja-JP": _babelRuntimeHelpersInteropRequireDefault($c90338eb448423751c80d6cf2fb8c8a1$exports).default,
493
- "ko-KR": _babelRuntimeHelpersInteropRequireDefault($b635e415ea191230d720f8a57bcfac4$exports).default,
494
- "lt-LT": _babelRuntimeHelpersInteropRequireDefault($bf40374472802f152aae7e860cbfba$exports).default,
495
- "lv-LV": _babelRuntimeHelpersInteropRequireDefault($a5f0a1480f91d7acc8710521295c83e$exports).default,
496
- "nb-NO": _babelRuntimeHelpersInteropRequireDefault($dc580345c46a3bd686da9e80ef533a94$exports).default,
497
- "nl-NL": _babelRuntimeHelpersInteropRequireDefault($cf7646cd46b2513084100884bbfb5$exports).default,
498
- "pl-PL": _babelRuntimeHelpersInteropRequireDefault($d45f9d44e7bb340675d3f3$exports).default,
499
- "pt-BR": _babelRuntimeHelpersInteropRequireDefault($d7fc96a2256f525f33439570c5176b6$exports).default,
500
- "pt-PT": _babelRuntimeHelpersInteropRequireDefault($bce54762c8026412a8cc0b3c0e17$exports).default,
501
- "ro-RO": _babelRuntimeHelpersInteropRequireDefault($b1a5d948f23fd42b37cf4a62bc20fbc9$exports).default,
502
- "ru-RU": _babelRuntimeHelpersInteropRequireDefault($fd34d0ae6d3c2b124aa82bec518fdebc$exports).default,
503
- "sk-SK": _babelRuntimeHelpersInteropRequireDefault($f0d899f938fc0b4d2e0a803e77f73b6$exports).default,
504
- "sl-SI": _babelRuntimeHelpersInteropRequireDefault($fc6db5102b55f61b25dc1512b9307$exports).default,
505
- "sr-SP": _babelRuntimeHelpersInteropRequireDefault($b5867f72618ad3ebdf24df3b2c0c64ad$exports).default,
506
- "sv-SE": _babelRuntimeHelpersInteropRequireDefault($e75d48658029b318f5477dc4b15713$exports).default,
507
- "tr-TR": _babelRuntimeHelpersInteropRequireDefault($a386b5db27abfbe3745c59576f$exports).default,
508
- "uk-UA": _babelRuntimeHelpersInteropRequireDefault($d04a11b64459844c9f6c167e5538da$exports).default,
509
- "zh-CN": _babelRuntimeHelpersInteropRequireDefault($b9216cdc8ad21d0c1b8e94822b8d13a3$exports).default,
510
- "zh-TW": _babelRuntimeHelpersInteropRequireDefault($f9135827d71b7bceae5eb74e24cd6$exports).default
511
- };
512
-
513
- function $e13c04c0c86a4119edea9d2f83b$var$CardView(props, ref) {
514
- let {
515
- scale
516
- } = useProvider();
517
- let {
518
- styleProps
519
- } = useStyleProps(props);
520
- let domRef = useDOMRef(ref);
521
- let {
522
- isQuiet,
523
- renderEmptyState,
524
- layout,
525
- loadingState,
526
- onLoadMore,
527
- cardOrientation = 'vertical'
528
- } = props;
529
- let collator = useCollator({
530
- usage: 'search',
531
- sensitivity: 'base'
532
- });
533
- let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
534
- let cardViewLayout = useMemo(() => typeof layout === 'function' ? new layout({
535
- collator,
536
- cardOrientation,
537
- scale
538
- }) : layout, [layout, collator, cardOrientation, scale]);
539
- let layoutType = cardViewLayout.layoutType;
540
- let formatMessage = useMessageFormatter($e13c04c0c86a4119edea9d2f83b$var$intlMessages);
541
- let {
542
- direction
543
- } = useLocale();
544
- let {
545
- collection
546
- } = useListState(props);
547
- let gridCollection = useMemo(() => new GridCollection({
548
- columnCount: 1,
549
- items: [...collection].map(item => _babelRuntimeHelpersExtends({}, item, {
550
- hasChildNodes: true,
551
- childNodes: [{
552
- key: "cell-" + item.key,
553
- type: 'cell',
554
- value: null,
555
- level: 0,
556
- rendered: null,
557
- textValue: item.textValue,
558
- hasChildNodes: false,
559
- childNodes: []
560
- }]
561
- }))
562
- }), [collection]);
563
- let state = useGridState(_babelRuntimeHelpersExtends({}, props, {
564
- selectionMode: cardOrientation === 'horizontal' && layoutType === 'grid' ? 'none' : props.selectionMode,
565
- collection: gridCollection,
566
- focusMode: 'cell'
567
- }));
568
- cardViewLayout.collection = gridCollection;
569
- cardViewLayout.disabledKeys = state.disabledKeys;
570
- cardViewLayout.isLoading = isLoading;
571
- cardViewLayout.direction = direction;
572
- let {
573
- gridProps
574
- } = useGrid(_babelRuntimeHelpersExtends({}, props, {
575
- isVirtualized: true,
576
- keyboardDelegate: cardViewLayout
577
- }), state, domRef);
578
-
579
- let renderWrapper = (parent, reusableView) => /*#__PURE__*/_react.createElement(VirtualizerItem, {
580
- key: reusableView.key,
581
- reusableView: reusableView,
582
- parent: parent
583
- });
584
-
585
- let focusedKey = state.selectionManager.focusedKey;
586
- let focusedItem = gridCollection.getItem(state.selectionManager.focusedKey);
587
-
588
- if ((focusedItem == null ? void 0 : focusedItem.parentKey) != null) {
589
- focusedKey = focusedItem.parentKey;
590
- }
591
-
592
- let margin = cardViewLayout.margin || 0;
593
- let virtualizer = cardViewLayout.virtualizer;
594
- let scrollToItem = useCallback(key => {
595
- virtualizer && virtualizer.scrollToItem(key, {
596
- duration: 0,
597
- offsetY: margin
143
+ let { styleProps: styleProps } = $jpY3B$reactspectrumutils.useStyleProps(props);
144
+ let { cardProps: cardProps , titleProps: titleProps , contentProps: contentProps } = $7888205ff7de382f$var$useCard(props);
145
+ let domRef = $jpY3B$reactspectrumutils.useDOMRef(ref);
146
+ let gridRef = $jpY3B$react.useRef();
147
+ let checkboxRef = $jpY3B$react.useRef(null);
148
+ // cards are only interactive if there is a selection manager and it allows selection
149
+ let { hoverProps: hoverProps , isHovered: isHovered } = $jpY3B$reactariainteractions.useHover({
150
+ isDisabled: manager === undefined || (manager === null || manager === void 0 ? void 0 : manager.selectionMode) === 'none' || isDisabled
598
151
  });
599
- }, [margin, virtualizer]); // TODO: does aria-row count and aria-col count need to be modified? Perhaps aria-col count needs to be omitted
600
-
601
- return /*#__PURE__*/_react.createElement($d2268ebff01b30dc8701260db9de8b73$export$CardViewContext.Provider, {
602
- value: {
603
- state,
604
- isQuiet,
605
- layout: cardViewLayout,
606
- cardOrientation
607
- }
608
- }, /*#__PURE__*/_react.createElement(Virtualizer, _babelRuntimeHelpersExtends({}, gridProps, styleProps, {
609
- className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-CardView'),
610
- ref: domRef,
611
- focusedKey: focusedKey,
612
- scrollDirection: "vertical",
613
- layout: cardViewLayout,
614
- collection: gridCollection,
615
- isLoading: isLoading,
616
- onLoadMore: onLoadMore,
617
- renderWrapper: renderWrapper,
618
- transitionDuration: isLoading ? 160 : 220,
619
- scrollToItem: scrollToItem
620
- }), (type, item) => {
621
- if (type === 'item') {
622
- return /*#__PURE__*/_react.createElement($e13c04c0c86a4119edea9d2f83b$var$InternalCard, {
623
- item: item
624
- });
625
- } else if (type === 'loader') {
626
- return /*#__PURE__*/_react.createElement($e13c04c0c86a4119edea9d2f83b$var$CenteredWrapper, null, /*#__PURE__*/_react.createElement(ProgressCircle, {
627
- isIndeterminate: true,
628
- "aria-label": state.collection.size > 0 ? formatMessage('loadingMore') : formatMessage('loading')
629
- }));
630
- } else if (type === 'placeholder') {
631
- let emptyState = renderEmptyState ? renderEmptyState() : null;
632
-
633
- if (emptyState == null) {
634
- return null;
635
- }
636
-
637
- return /*#__PURE__*/_react.createElement($e13c04c0c86a4119edea9d2f83b$var$CenteredWrapper, null, emptyState);
638
- }
639
- }));
640
- }
641
-
642
- function $e13c04c0c86a4119edea9d2f83b$var$CenteredWrapper(_ref) {
643
- let {
644
- children
645
- } = _ref;
646
- let {
647
- state
648
- } = $d2268ebff01b30dc8701260db9de8b73$export$useCardViewContext();
649
- return /*#__PURE__*/_react.createElement("div", {
650
- role: "row",
651
- "aria-rowindex": state.collection.size + 1,
652
- className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-CardView-centeredWrapper')
653
- }, /*#__PURE__*/_react.createElement("div", {
654
- role: "gridcell"
655
- }, children));
152
+ let [isFocused, setIsFocused] = $jpY3B$react.useState(false);
153
+ let { focusWithinProps: focusWithinProps } = $jpY3B$reactariainteractions.useFocusWithin({
154
+ onFocusWithinChange: setIsFocused,
155
+ isDisabled: isDisabled
156
+ });
157
+ // ToDo: see css for comment about avatar under selector .spectrum-Card--noLayout.spectrum-Card--default
158
+ let hasPreviewImage = $jpY3B$reactspectrumutils.useHasChild(`.${(/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports))['spectrum-Card-image']}`, gridRef);
159
+ let hasPreviewIllustration = $jpY3B$reactspectrumutils.useHasChild(`.${(/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports))['spectrum-Card-illustration']}`, gridRef);
160
+ let hasPreview = hasPreviewImage || hasPreviewIllustration;
161
+ // this is for horizontal cards
162
+ let [height, setHeight] = $jpY3B$react.useState(NaN);
163
+ let updateHeight = $jpY3B$react.useCallback(()=>{
164
+ if (orientation !== 'horizontal') return;
165
+ let cardHeight = gridRef.current.getBoundingClientRect().height;
166
+ setHeight(cardHeight);
167
+ }, [
168
+ orientation,
169
+ gridRef,
170
+ setHeight
171
+ ]);
172
+ $jpY3B$reactariautils.useResizeObserver({
173
+ ref: gridRef,
174
+ onResize: updateHeight
175
+ });
176
+ let aspectRatioEnforce = undefined;
177
+ if (orientation === 'horizontal' && !isNaN(height)) aspectRatioEnforce = {
178
+ height: `${height}px`,
179
+ width: `${height}px`
180
+ };
181
+ let slots = $jpY3B$react.useMemo(()=>({
182
+ image: {
183
+ UNSAFE_className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-Card-image'),
184
+ objectFit: orientation === 'horizontal' ? 'cover' : 'contain',
185
+ alt: '',
186
+ ...aspectRatioEnforce
187
+ },
188
+ illustration: {
189
+ UNSAFE_className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-Card-illustration'),
190
+ ...aspectRatioEnforce
191
+ },
192
+ avatar: {
193
+ UNSAFE_className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-Card-avatar'),
194
+ size: 'avatar-size-400'
195
+ },
196
+ heading: {
197
+ UNSAFE_className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-Card-heading'),
198
+ ...titleProps
199
+ },
200
+ content: {
201
+ UNSAFE_className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-Card-content'),
202
+ ...contentProps
203
+ },
204
+ detail: {
205
+ UNSAFE_className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-Card-detail')
206
+ }
207
+ })
208
+ , [
209
+ titleProps,
210
+ contentProps,
211
+ height,
212
+ isQuiet,
213
+ orientation
214
+ ]);
215
+ $jpY3B$reactariautils.useLayoutEffect(()=>{
216
+ if (gridRef === null || gridRef === void 0 ? void 0 : gridRef.current) {
217
+ let walker = $jpY3B$reactariafocus.getFocusableTreeWalker(gridRef.current);
218
+ let nextNode = walker.nextNode();
219
+ while(nextNode != null){
220
+ if (checkboxRef.current && !checkboxRef.current.UNSAFE_getDOMNode().contains(nextNode)) {
221
+ console.warn('Card does not support focusable elements, please contact the team regarding your use case.');
222
+ break;
223
+ }
224
+ nextNode = walker.nextNode();
225
+ }
226
+ }
227
+ }, [
228
+ children
229
+ ]);
230
+ return(/*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement($jpY3B$reactariafocus.FocusRing, {
231
+ focusRingClass: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'focus-ring')
232
+ }, /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement("article", {
233
+ ...styleProps,
234
+ ...$jpY3B$reactariautils.mergeProps(cardProps, focusWithinProps, hoverProps, $jpY3B$reactariautils.filterDOMProps(props), articleProps),
235
+ ref: domRef,
236
+ className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-Card', {
237
+ 'spectrum-Card--default': !isQuiet && orientation !== 'horizontal',
238
+ 'spectrum-Card--isQuiet': isQuiet && orientation !== 'horizontal',
239
+ 'spectrum-Card--horizontal': orientation === 'horizontal',
240
+ 'spectrum-Card--noPreview': !hasPreview,
241
+ 'is-hovered': isHovered,
242
+ 'is-focused': isFocused,
243
+ 'is-selected': isSelected,
244
+ 'spectrum-Card--waterfall': layout === 'waterfall',
245
+ 'spectrum-Card--gallery': layout === 'gallery',
246
+ 'spectrum-Card--grid': layout === 'grid',
247
+ 'spectrum-Card--noLayout': layout !== 'waterfall' && layout !== 'gallery' && layout !== 'grid'
248
+ }, styleProps.className)
249
+ }, /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement("div", {
250
+ ref: gridRef,
251
+ className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-Card-grid')
252
+ }, manager && manager.selectionMode !== 'none' && /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement("div", {
253
+ className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-Card-checkboxWrapper')
254
+ }, /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement($jpY3B$reactspectrumcheckbox.Checkbox, {
255
+ ref: checkboxRef,
256
+ isDisabled: isDisabled,
257
+ excludeFromTabOrder: true,
258
+ isSelected: isSelected,
259
+ onChange: onChange,
260
+ UNSAFE_className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-Card-checkbox'),
261
+ isEmphasized: true,
262
+ "aria-label": "select"
263
+ })), /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement($jpY3B$reactspectrumutils.SlotProvider, {
264
+ slots: slots
265
+ }, children), /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement("div", {
266
+ className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-Card-decoration')
267
+ })))));
656
268
  }
657
-
658
- function $e13c04c0c86a4119edea9d2f83b$var$InternalCard(props) {
659
- let {
660
- item
661
- } = props;
662
- let cellNode = [...item.childNodes][0];
663
- let {
664
- state,
665
- cardOrientation,
666
- isQuiet,
667
- layout
668
- } = $d2268ebff01b30dc8701260db9de8b73$export$useCardViewContext();
669
- let layoutType = layout.layoutType;
670
- let rowRef = useRef();
671
- let cellRef = useRef();
672
- let unwrappedRef = useUnwrapDOMRef(cellRef);
673
- let {
674
- rowProps
675
- } = useGridRow({
676
- node: item,
677
- isVirtualized: true
678
- }, state, rowRef);
679
- let {
680
- gridCellProps
681
- } = useGridCell({
682
- node: cellNode,
683
- focusMode: 'cell'
684
- }, state, unwrappedRef);
685
-
686
- if (layoutType === 'grid' || layoutType === 'gallery') {
687
- isQuiet = true;
688
- }
689
-
690
- if (layoutType !== 'grid') {
691
- cardOrientation = 'vertical';
692
- }
693
-
694
- return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersExtends({}, rowProps, {
695
- ref: rowRef,
696
- className: classNames($e80f3e549a26f7869571c50d85a$$interop$default, 'spectrum-CardView-row')
697
- }), /*#__PURE__*/_react.createElement($c05a01cf76428c47b3d1dc747d32$export$CardBase, {
698
- ref: cellRef,
699
- articleProps: gridCellProps,
700
- isQuiet: isQuiet,
701
- orientation: cardOrientation,
702
- item: item,
703
- layout: layoutType
704
- }, item.rendered));
269
+ function $7888205ff7de382f$var$useCard(props) {
270
+ let titleId = $jpY3B$reactariautils.useSlotId();
271
+ let descriptionId = $jpY3B$reactariautils.useSlotId();
272
+ let titleProps = $jpY3B$react.useMemo(()=>({
273
+ id: titleId
274
+ })
275
+ , [
276
+ titleId
277
+ ]);
278
+ let contentProps = $jpY3B$react.useMemo(()=>({
279
+ id: descriptionId
280
+ })
281
+ , [
282
+ descriptionId
283
+ ]);
284
+ return {
285
+ cardProps: {
286
+ ...$jpY3B$reactariautils.filterDOMProps(props),
287
+ 'aria-labelledby': titleId,
288
+ 'aria-describedby': descriptionId,
289
+ tabIndex: 0
290
+ },
291
+ titleProps: titleProps,
292
+ contentProps: contentProps
293
+ };
705
294
  }
706
295
  /**
707
296
  * TODO: Add description of component here.
708
- */
297
+ */ const $7888205ff7de382f$export$7a6ccaf429ad93a8 = /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).forwardRef($7888205ff7de382f$var$CardBase);
709
298
 
710
299
 
711
- const CardView = /*#__PURE__*/_react.forwardRef($e13c04c0c86a4119edea9d2f83b$var$CardView);
712
300
 
713
- exports.CardView = CardView;
714
301
 
715
- class $ae626509048548c15655cbbeb258411$export$BaseLayout extends Layout {
716
- constructor(options) {
717
- if (options === void 0) {
718
- options = {};
719
- }
720
302
 
721
- super();
722
- this.contentSize = void 0;
723
- this.layoutInfos = void 0;
724
- this.collator = void 0;
725
- this.lastCollection = void 0;
726
- this.collection = void 0;
727
- this.isLoading = void 0;
728
- this.disabledKeys = new Set();
729
- this.direction = void 0;
730
- this.scale = void 0;
731
- this.margin = void 0;
732
- this.layoutInfos = new Map();
733
- this.collator = options.collator;
734
- this.lastCollection = null;
735
- this.scale = options.scale || 'medium';
736
- this.margin = options.margin || 24;
737
- }
738
-
739
- validate(invalidationContext) {
740
- this.collection = this.virtualizer.collection;
741
- this.buildCollection(invalidationContext); // Remove layout info that doesn't exist in new collection
742
-
743
- if (this.lastCollection) {
744
- for (let key of this.lastCollection.getKeys()) {
745
- if (!this.collection.getItem(key)) {
746
- this.layoutInfos.delete(key);
747
- }
748
- }
749
-
750
- if (!this.isLoading) {
751
- this.layoutInfos.delete('loader');
752
- }
303
+ var $dc38f0b958ac5018$exports = {};
304
+ var $b0d49dbc72f937a2$exports = {};
305
+ $b0d49dbc72f937a2$exports = {
306
+ "loading": `جارٍ التحميل...`,
307
+ "loadingMore": `جارٍ تحميل المزيد...`
308
+ };
753
309
 
754
- if (this.collection.size > 0) {
755
- this.layoutInfos.delete('placeholder');
756
- }
757
- }
758
310
 
759
- this.lastCollection = this.collection;
760
- } // eslint-disable-next-line @typescript-eslint/no-unused-vars
311
+ var $ce0dd82398fba411$exports = {};
312
+ $ce0dd82398fba411$exports = {
313
+ "loading": `Зареждане...`,
314
+ "loadingMore": `Зареждане на още...`
315
+ };
761
316
 
762
317
 
763
- buildCollection(invalidationContext) {}
318
+ var $1086444b40892e5d$exports = {};
319
+ $1086444b40892e5d$exports = {
320
+ "loading": `Načítání...`,
321
+ "loadingMore": `Načítání dalších...`
322
+ };
764
323
 
765
- getContentSize() {
766
- return this.contentSize;
767
- }
768
324
 
769
- getLayoutInfo(key) {
770
- return this.layoutInfos.get(key);
771
- }
325
+ var $26f9bd87c0446842$exports = {};
326
+ $26f9bd87c0446842$exports = {
327
+ "loading": `Indlæser...`,
328
+ "loadingMore": `Indlæser flere...`
329
+ };
772
330
 
773
- getVisibleLayoutInfos(rect) {
774
- let res = [];
775
331
 
776
- for (let layoutInfo of this.layoutInfos.values()) {
777
- if (this.isVisible(layoutInfo, rect)) {
778
- res.push(layoutInfo);
779
- }
780
- }
781
-
782
- return res;
783
- }
784
-
785
- isVisible(layoutInfo, rect) {
786
- return layoutInfo.rect.intersects(rect);
787
- }
788
-
789
- getInitialLayoutInfo(layoutInfo) {
790
- layoutInfo.opacity = 0;
791
- layoutInfo.transform = 'scale3d(0.8, 0.8, 0.8)';
792
- return layoutInfo;
793
- }
794
-
795
- getFinalLayoutInfo(layoutInfo) {
796
- layoutInfo.opacity = 0;
797
- layoutInfo.transform = 'scale3d(0.8, 0.8, 0.8)';
798
- return layoutInfo;
799
- }
800
-
801
- _findClosestLayoutInfo(target, rect) {
802
- let layoutInfos = this.getVisibleLayoutInfos(rect);
803
- let best = null;
804
- let bestDistance = Infinity; // Calculates distance as the distance between the center of 2 rects.
805
-
806
- for (let cur of layoutInfos) {
807
- if (cur.type === 'item') {
808
- let curRect = cur.rect;
809
- let targetMidX = (target.x + target.maxX) / 2;
810
- let targetMidY = (target.y + target.maxY) / 2;
811
- let curMidX = (curRect.x + curRect.maxX) / 2;
812
- let curMidY = (curRect.y + curRect.maxY) / 2;
813
- let dist = Math.pow(targetMidX - curMidX, 2) + Math.pow(targetMidY - curMidY, 2);
814
-
815
- if (dist < bestDistance) {
816
- best = cur;
817
- bestDistance = dist;
818
- }
819
- }
820
- }
332
+ var $5922ace8d8eedc34$exports = {};
333
+ $5922ace8d8eedc34$exports = {
334
+ "loading": `Wird geladen...`,
335
+ "loadingMore": `Noch mehr wird geladen...`
336
+ };
821
337
 
822
- return best;
823
- }
824
338
 
825
- _findClosest(target, rect) {
826
- let best = this._findClosestLayoutInfo(target, rect);
339
+ var $0dff680a5aaa08a6$exports = {};
340
+ $0dff680a5aaa08a6$exports = {
341
+ "loading": `Φόρτωση...`,
342
+ "loadingMore": `Φόρτωση περισσότερων...`
343
+ };
827
344
 
828
- return best || null;
829
- }
830
345
 
831
- getKeyBelow(key) {
832
- var _this$_findClosest, _closestRow$childNode;
346
+ var $40f72ebe96160fe5$exports = {};
347
+ $40f72ebe96160fe5$exports = {
348
+ "loading": `Loading…`,
349
+ "loadingMore": `Loading more…`
350
+ };
833
351
 
834
- // Expected key is the currently focused cell so we need the parent row key
835
- let parentRowKey = this.collection.getItem(key).parentKey;
836
- let layoutInfo = this.getLayoutInfo(parentRowKey);
837
- let rect = new Rect(layoutInfo.rect.x, layoutInfo.rect.maxY + 1, layoutInfo.rect.width, this.virtualizer.visibleRect.height);
838
- let closestRow = this.collection.getItem((_this$_findClosest = this._findClosest(layoutInfo.rect, rect)) == null ? void 0 : _this$_findClosest.key);
839
- return closestRow == null ? void 0 : (_closestRow$childNode = closestRow.childNodes[0]) == null ? void 0 : _closestRow$childNode.key;
840
- }
841
352
 
842
- getKeyAbove(key) {
843
- var _this$_findClosest2, _closestRow$childNode2;
353
+ var $fd3d037364cca31d$exports = {};
354
+ $fd3d037364cca31d$exports = {
355
+ "loading": `Cargando…`,
356
+ "loadingMore": `Cargando más…`
357
+ };
844
358
 
845
- // Expected key is the currently focused cell so we need the parent row key
846
- let parentRowKey = this.collection.getItem(key).parentKey;
847
- let layoutInfo = this.getLayoutInfo(parentRowKey);
848
- let rect = new Rect(layoutInfo.rect.x, 0, layoutInfo.rect.width, layoutInfo.rect.y - 1);
849
- let closestRow = this.collection.getItem((_this$_findClosest2 = this._findClosest(layoutInfo.rect, rect)) == null ? void 0 : _this$_findClosest2.key);
850
- return closestRow == null ? void 0 : (_closestRow$childNode2 = closestRow.childNodes[0]) == null ? void 0 : _closestRow$childNode2.key;
851
- }
852
359
 
853
- getKeyRightOf(key) {
854
- // Expected key is the currently focused cell so we need the parent row key
855
- let parentRowKey = this.collection.getItem(key).parentKey;
856
- key = this.direction === 'rtl' ? this.collection.getKeyBefore(parentRowKey) : this.collection.getKeyAfter(parentRowKey);
360
+ var $aeb59a17c296301b$exports = {};
361
+ $aeb59a17c296301b$exports = {
362
+ "loading": `Laadimine...`,
363
+ "loadingMore": `Laadi rohkem...`
364
+ };
857
365
 
858
- while (key != null) {
859
- let item = this.collection.getItem(key); // Don't check if item is disabled because we want to be able to focus disabled items in a grid (double check this)
860
366
 
861
- if (item.type === 'item') {
862
- return item.childNodes[0].key;
863
- }
367
+ var $8725562d6e87d608$exports = {};
368
+ $8725562d6e87d608$exports = {
369
+ "loading": `Ladataan…`,
370
+ "loadingMore": `Ladataan lisää…`
371
+ };
864
372
 
865
- key = this.direction === 'rtl' ? this.collection.getKeyBefore(key) : this.collection.getKeyAfter(key);
866
- }
867
- }
868
373
 
869
- getKeyLeftOf(key) {
870
- // Expected key is the currently focused cell so we need the parent row key
871
- let parentRowKey = this.collection.getItem(key).parentKey;
872
- key = this.direction === 'rtl' ? this.collection.getKeyAfter(parentRowKey) : this.collection.getKeyBefore(parentRowKey);
374
+ var $5b8a7cd61bd67f0d$exports = {};
375
+ $5b8a7cd61bd67f0d$exports = {
376
+ "loading": `Chargement en cours…`,
377
+ "loadingMore": `Chargement d’autres d’éléments…`
378
+ };
873
379
 
874
- while (key != null) {
875
- let item = this.collection.getItem(key); // Don't check if item is disabled because we want to be able to focus disabled items in a grid (double check this)
876
380
 
877
- if (item.type === 'item') {
878
- return item.childNodes[0].key;
879
- }
381
+ var $904fdf1c66b8e1ae$exports = {};
382
+ $904fdf1c66b8e1ae$exports = {
383
+ "loading": `טוען...`,
384
+ "loadingMore": `טוען עוד...`
385
+ };
880
386
 
881
- key = this.direction === 'rtl' ? this.collection.getKeyAfter(key) : this.collection.getKeyBefore(key);
882
- }
883
- }
884
387
 
885
- getFirstKey() {
886
- let firstRow = this.collection.getItem(this.collection.getFirstKey());
887
- return firstRow.childNodes[0].key;
888
- }
388
+ var $e321e496e49645f3$exports = {};
389
+ $e321e496e49645f3$exports = {
390
+ "loading": `Učitavam...`,
391
+ "loadingMore": `Učitavam još...`
392
+ };
889
393
 
890
- getLastKey() {
891
- let lastRow = this.collection.getItem(this.collection.getLastKey());
892
- return lastRow.childNodes[0].key;
893
- } // TODO: pretty unwieldy because it needs to bounce back and forth between the parent key and the child key
894
- // Perhaps have layoutInfo store childKey as well so we don't need to do this? Or maybe make the layoutInfos be the cells instead of the rows?
895
394
 
395
+ var $5fb9f79f322fc149$exports = {};
396
+ $5fb9f79f322fc149$exports = {
397
+ "loading": `Betöltés folyamatban…`,
398
+ "loadingMore": `Továbbiak betöltése folyamatban…`
399
+ };
896
400
 
897
- getKeyPageAbove(key) {
898
- // Expected key is the currently focused cell so we need the parent row key
899
- let parentRowKey = this.collection.getItem(key).parentKey;
900
- let layoutInfo = this.getLayoutInfo(parentRowKey);
901
401
 
902
- if (layoutInfo) {
903
- var _this$collection$getI;
402
+ var $87d8922713b63bdb$exports = {};
403
+ $87d8922713b63bdb$exports = {
404
+ "loading": `Caricamento...`,
405
+ "loadingMore": `Caricamento altri...`
406
+ };
904
407
 
905
- let pageY = Math.max(0, layoutInfo.rect.y + layoutInfo.rect.height - this.virtualizer.visibleRect.height); // If the node is so large that it spans multiple page heights, return the key of the item immediately above
906
- // Otherwise keep going up until we exceed a single page height worth of nodes
907
408
 
908
- let keyAbove = (_this$collection$getI = this.collection.getItem(this.getKeyAbove(key))) == null ? void 0 : _this$collection$getI.parentKey;
909
- layoutInfo = this.getLayoutInfo(keyAbove);
409
+ var $57201e032f548603$exports = {};
410
+ $57201e032f548603$exports = {
411
+ "loading": `読み込み中...`,
412
+ "loadingMore": `さらに読み込み中...`
413
+ };
910
414
 
911
- if (layoutInfo && layoutInfo.rect.y > pageY) {
912
- while (layoutInfo && layoutInfo.rect.y > pageY) {
913
- var _this$collection$getI2;
914
415
 
915
- let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
916
- let keyAbove = (_this$collection$getI2 = this.collection.getItem(this.getKeyAbove(childKey))) == null ? void 0 : _this$collection$getI2.parentKey;
917
- layoutInfo = this.getLayoutInfo(keyAbove);
918
- }
919
- }
416
+ var $74aa6884e1ef4030$exports = {};
417
+ $74aa6884e1ef4030$exports = {
418
+ "loading": `로드 중…`,
419
+ "loadingMore": `추가 로드 중…`
420
+ };
920
421
 
921
- if (layoutInfo) {
922
- let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
923
- return childKey;
924
- }
925
- }
926
422
 
927
- return this.getFirstKey();
928
- } // TODO: pretty unwieldy because it needs to bounce back and forth between the parent key and the child key
929
- // Perhaps have layoutInfo store childKey as well so we don't need to do this?
423
+ var $50cefda6a03c058b$exports = {};
424
+ $50cefda6a03c058b$exports = {
425
+ "loading": `Įkeliama…`,
426
+ "loadingMore": `Įkeliama daugiau…`
427
+ };
930
428
 
931
429
 
932
- getKeyPageBelow(key) {
933
- // Expected key is the currently focused cell so we need the parent row key
934
- let parentRowKey = this.collection.getItem(key).parentKey;
935
- let layoutInfo = this.getLayoutInfo(parentRowKey);
430
+ var $3d08f75b6bbe5354$exports = {};
431
+ $3d08f75b6bbe5354$exports = {
432
+ "loading": `Notiek ielāde…`,
433
+ "loadingMore": `Tiek ielādēts vēl...`
434
+ };
936
435
 
937
- if (layoutInfo) {
938
- var _this$collection$getI3;
939
436
 
940
- let pageY = Math.min(this.virtualizer.contentSize.height, layoutInfo.rect.y - layoutInfo.rect.height + this.virtualizer.visibleRect.height); // If the node is so large that it spans multiple page heights, return the key of the item immediately below
941
- // Otherwise keep going up until we exceed a single page height worth of nodes
437
+ var $c59f7b2f9755472b$exports = {};
438
+ $c59f7b2f9755472b$exports = {
439
+ "loading": `Laster inn...`,
440
+ "loadingMore": `Laster inn flere...`
441
+ };
942
442
 
943
- let keyBelow = (_this$collection$getI3 = this.collection.getItem(this.getKeyBelow(key))) == null ? void 0 : _this$collection$getI3.parentKey;
944
- layoutInfo = this.getLayoutInfo(keyBelow);
945
443
 
946
- if (layoutInfo && layoutInfo.rect.y < pageY) {
947
- while (layoutInfo && layoutInfo.rect.y < pageY) {
948
- var _this$collection$getI4;
444
+ var $d81bf728da4b1c33$exports = {};
445
+ $d81bf728da4b1c33$exports = {
446
+ "loading": `Laden...`,
447
+ "loadingMore": `Meer laden...`
448
+ };
949
449
 
950
- let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
951
- let keyBelow = (_this$collection$getI4 = this.collection.getItem(this.getKeyBelow(childKey))) == null ? void 0 : _this$collection$getI4.parentKey;
952
- layoutInfo = this.getLayoutInfo(keyBelow);
953
- }
954
- }
955
450
 
956
- if (layoutInfo) {
957
- let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
958
- return childKey;
959
- }
960
- }
451
+ var $f323a42ea1486c2f$exports = {};
452
+ $f323a42ea1486c2f$exports = {
453
+ "loading": `Wczytywanie...`,
454
+ "loadingMore": `Wczytywanie większej liczby...`
455
+ };
961
456
 
962
- return this.getLastKey();
963
- }
964
457
 
965
- getKeyForSearch(search, fromKey) {
966
- if (!this.collator) {
967
- return null;
968
- }
458
+ var $2b2937248d390105$exports = {};
459
+ $2b2937248d390105$exports = {
460
+ "loading": `Carregando...`,
461
+ "loadingMore": `Carregando mais...`
462
+ };
969
463
 
970
- let collection = this.collection;
971
- let key = fromKey != null ? fromKey : this.getFirstKey();
972
- let startItem = collection.getItem(key);
973
- key = startItem.parentKey;
974
464
 
975
- while (key != null) {
976
- let item = collection.getItem(key);
465
+ var $156cd72030936350$exports = {};
466
+ $156cd72030936350$exports = {
467
+ "loading": `A carregar...`,
468
+ "loadingMore": `A carregar mais...`
469
+ };
977
470
 
978
- if (item.textValue) {
979
- let substring = item.textValue.slice(0, search.length);
980
471
 
981
- if (this.collator.compare(substring, search) === 0) {
982
- return [...item.childNodes][0].key;
983
- }
984
- }
472
+ var $5964cf64325251a3$exports = {};
473
+ $5964cf64325251a3$exports = {
474
+ "loading": `Se încarcă...`,
475
+ "loadingMore": `Se încarcă mai multe...`
476
+ };
985
477
 
986
- key = this.collection.getKeyAfter(key);
987
- }
988
478
 
989
- return null;
990
- }
479
+ var $71b3c908be47dc7e$exports = {};
480
+ $71b3c908be47dc7e$exports = {
481
+ "loading": `Загрузка...`,
482
+ "loadingMore": `Дополнительная загрузка...`
483
+ };
991
484
 
992
- }
993
485
 
994
- const $a23e32931be921d018d1ae1efeda8$var$DEFAULT_OPTIONS = {
995
- S: {
996
- idealRowHeight: 112,
997
- minItemSize: new Size(96, 96),
998
- itemSpacing: new Size(8, 16),
999
- itemPadding: 24,
1000
- dropSpacing: 50,
1001
- margin: 8
1002
- },
1003
- L: {
1004
- idealRowHeight: 208,
1005
- minItemSize: new Size(136, 136),
1006
- itemSpacing: new Size(18, 18),
1007
- itemPadding: {
1008
- 'medium': 114,
1009
- 'large': 143
1010
- },
1011
- dropSpacing: 100,
1012
- margin: 24
1013
- }
486
+ var $815155759d865560$exports = {};
487
+ $815155759d865560$exports = {
488
+ "loading": `Načítava sa...`,
489
+ "loadingMore": `Načítava sa viac...`
1014
490
  };
1015
491
 
1016
- class GalleryLayout extends $ae626509048548c15655cbbeb258411$export$BaseLayout {
1017
- constructor(options) {
1018
- if (options === void 0) {
1019
- options = {};
1020
- }
1021
492
 
1022
- super(options);
1023
- this.idealRowHeight = void 0;
1024
- this.itemSpacing = void 0;
1025
- this.itemPadding = void 0;
1026
- this.minItemSize = void 0;
1027
- this.threshold = void 0;
1028
- let cardSize = 'L';
1029
- this.idealRowHeight = options.idealRowHeight || $a23e32931be921d018d1ae1efeda8$var$DEFAULT_OPTIONS[cardSize].idealRowHeight;
1030
- this.itemSpacing = options.itemSpacing || $a23e32931be921d018d1ae1efeda8$var$DEFAULT_OPTIONS[cardSize].itemSpacing;
1031
- this.itemPadding = options.itemPadding != null ? options.itemPadding : $a23e32931be921d018d1ae1efeda8$var$DEFAULT_OPTIONS[cardSize].itemPadding[this.scale];
1032
- this.minItemSize = options.minItemSize || $a23e32931be921d018d1ae1efeda8$var$DEFAULT_OPTIONS[cardSize].minItemSize;
1033
- this.threshold = options.threshold || 1;
1034
- this.margin = options.margin != null ? options.margin : $a23e32931be921d018d1ae1efeda8$var$DEFAULT_OPTIONS[cardSize].margin;
1035
- }
1036
-
1037
- get layoutType() {
1038
- return 'gallery';
1039
- }
1040
- /**
1041
- * Takes a row of widths and if there are any widths smaller than the min-width, leech width starting from
1042
- * the widest in the row until it can't give anymore, then move to the second widest and so forth.
1043
- * Do this until all assets meet the min-width.
1044
- * */
1045
-
1046
-
1047
- _distributeWidths(widths) {
1048
- // create a copy of the widths array and sort it largest to smallest
1049
- let sortedWidths = widths.concat().sort((a, b) => a[1] > b[1] ? -1 : 1);
1050
-
1051
- for (let width of widths) {
1052
- // for each width, if it's smaller than the min width
1053
- if (width[1] < this.minItemSize.width) {
1054
- // then figure out how much smaller
1055
- let delta = this.minItemSize.width - width[1];
1056
-
1057
- for (let item of sortedWidths) {
1058
- // go from the largest width in the row to the smallest
1059
- // if the width is greater than the min width
1060
- if (widths[item[0]][1] > this.minItemSize.width) {
1061
- // subtract the delta from the width, if it's still greater than the min width
1062
- // then we have finished, subtract the delta permanently from that width
1063
- if (widths[item[0]][1] - delta > this.minItemSize.width) {
1064
- widths[item[0]][1] -= delta;
1065
- delta = 0;
1066
- break;
1067
- } else {
1068
- // otherwise, we take as much as we can from the current width and then move on to
1069
- // the next largest and take some width from it
1070
- let maxChange = widths[item[0]][1] - this.minItemSize.width;
1071
- delta -= maxChange;
1072
- widths[item[0]][1] -= maxChange;
1073
- }
1074
- }
1075
- }
493
+ var $d5deb2faae807da5$exports = {};
494
+ $d5deb2faae807da5$exports = {
495
+ "loading": `Nalaganje...`,
496
+ "loadingMore": `Nalaganje dodatne vsebine...`
497
+ };
1076
498
 
1077
- if (delta > 0) {
1078
- return false;
1079
- } // force the width to be the min width that we just rebalanced for
1080
499
 
500
+ var $42e52cb34b81b4af$exports = {};
501
+ $42e52cb34b81b4af$exports = {
502
+ "loading": `Učitavam...`,
503
+ "loadingMore": `Učitavam još...`
504
+ };
1081
505
 
1082
- width[1] = this.minItemSize.width;
1083
- }
1084
- }
1085
506
 
1086
- return true;
1087
- }
507
+ var $f278e5fd270ba60f$exports = {};
508
+ $f278e5fd270ba60f$exports = {
509
+ "loading": `Läser in...`,
510
+ "loadingMore": `Läser in mer...`
511
+ };
1088
512
 
1089
- buildCollection() {
1090
- let visibleWidth = this.virtualizer.visibleRect.width;
1091
- let visibleHeight = this.virtualizer.visibleRect.height;
1092
- let y = this.margin;
1093
- let availableWidth = visibleWidth - this.margin * 2; // Compute aspect ratios for all of the items, and the total width if all items were on in a single row.
1094
513
 
1095
- let ratios = [];
1096
- let totalWidth = 0;
1097
- let minRatio = this.minItemSize.width / this.minItemSize.height;
1098
- let maxRatio = availableWidth / this.minItemSize.height;
514
+ var $523e0ad61eab5c5d$exports = {};
515
+ $523e0ad61eab5c5d$exports = {
516
+ "loading": `Yükleniyor...`,
517
+ "loadingMore": `Daha fazla yükleniyor...`
518
+ };
1099
519
 
1100
- for (let node of this.collection) {
1101
- let ratio = node.props.width / node.props.height;
1102
520
 
1103
- if (ratio < minRatio) {
1104
- ratio = minRatio;
1105
- } else if (ratio > maxRatio && ratio !== minRatio) {
1106
- ratio = maxRatio;
1107
- }
521
+ var $a58cff5745fe89a6$exports = {};
522
+ $a58cff5745fe89a6$exports = {
523
+ "loading": `Завантаження…`,
524
+ "loadingMore": `Завантаження інших об’єктів...`
525
+ };
1108
526
 
1109
- let itemWidth = ratio * this.minItemSize.height;
1110
- ratios.push(ratio);
1111
- totalWidth += itemWidth;
1112
- }
1113
527
 
1114
- totalWidth += this.itemSpacing.width * (this.collection.size - 1); // Determine how many rows we'll need, and partition the items into rows
1115
- // using the aspect ratios as weights.
528
+ var $2c1c50c48e046fcb$exports = {};
529
+ $2c1c50c48e046fcb$exports = {
530
+ "loading": `正在加载...`,
531
+ "loadingMore": `正在加载更多...`
532
+ };
1116
533
 
1117
- let rows = Math.max(1, Math.ceil(totalWidth / availableWidth)); // if the available width can't hold two items, then every item will get its own row
1118
- // this leads to a faster run through linear partition and more dependable output for small row widths
1119
534
 
1120
- if (availableWidth <= this.minItemSize.width * 2 + this.itemPadding * 2) {
1121
- rows = this.collection.size;
1122
- }
535
+ var $d20ec5c21f83badd$exports = {};
536
+ $d20ec5c21f83badd$exports = {
537
+ "loading": `正在載入…`,
538
+ "loadingMore": `正在載入更多…`
539
+ };
1123
540
 
1124
- let weightedRatios = ratios.map(ratio => ratio < this.threshold ? ratio + 0.5 * (1 / ratio) : ratio);
1125
- let partition = $a23e32931be921d018d1ae1efeda8$var$linearPartition(weightedRatios, rows);
1126
- let index = 0;
1127
541
 
1128
- for (let row of partition) {
1129
- // Compute the total weight for this row
1130
- let totalWeight = 0;
542
+ $dc38f0b958ac5018$exports = {
543
+ "ar-AE": $b0d49dbc72f937a2$exports,
544
+ "bg-BG": $ce0dd82398fba411$exports,
545
+ "cs-CZ": $1086444b40892e5d$exports,
546
+ "da-DK": $26f9bd87c0446842$exports,
547
+ "de-DE": $5922ace8d8eedc34$exports,
548
+ "el-GR": $0dff680a5aaa08a6$exports,
549
+ "en-US": $40f72ebe96160fe5$exports,
550
+ "es-ES": $fd3d037364cca31d$exports,
551
+ "et-EE": $aeb59a17c296301b$exports,
552
+ "fi-FI": $8725562d6e87d608$exports,
553
+ "fr-FR": $5b8a7cd61bd67f0d$exports,
554
+ "he-IL": $904fdf1c66b8e1ae$exports,
555
+ "hr-HR": $e321e496e49645f3$exports,
556
+ "hu-HU": $5fb9f79f322fc149$exports,
557
+ "it-IT": $87d8922713b63bdb$exports,
558
+ "ja-JP": $57201e032f548603$exports,
559
+ "ko-KR": $74aa6884e1ef4030$exports,
560
+ "lt-LT": $50cefda6a03c058b$exports,
561
+ "lv-LV": $3d08f75b6bbe5354$exports,
562
+ "nb-NO": $c59f7b2f9755472b$exports,
563
+ "nl-NL": $d81bf728da4b1c33$exports,
564
+ "pl-PL": $f323a42ea1486c2f$exports,
565
+ "pt-BR": $2b2937248d390105$exports,
566
+ "pt-PT": $156cd72030936350$exports,
567
+ "ro-RO": $5964cf64325251a3$exports,
568
+ "ru-RU": $71b3c908be47dc7e$exports,
569
+ "sk-SK": $815155759d865560$exports,
570
+ "sl-SI": $d5deb2faae807da5$exports,
571
+ "sr-SP": $42e52cb34b81b4af$exports,
572
+ "sv-SE": $f278e5fd270ba60f$exports,
573
+ "tr-TR": $523e0ad61eab5c5d$exports,
574
+ "uk-UA": $a58cff5745fe89a6$exports,
575
+ "zh-CN": $2c1c50c48e046fcb$exports,
576
+ "zh-TW": $d20ec5c21f83badd$exports
577
+ };
1131
578
 
1132
- for (let j = index; j < index + row.length; j++) {
1133
- totalWeight += ratios[j];
1134
- } // Determine the row height based on the total available width and weight of this row.
1135
579
 
1136
580
 
1137
- let bestRowHeight = (availableWidth - (row.length - 1) * this.itemSpacing.width) / totalWeight; // if this is the last row and the row height is >2x the ideal row height, then cap to the ideal height
1138
- // probably doing this because if the last row has one extremely tall image, then the row becomes huge
1139
- // though that can happen anywhere if a row has lots of tall images... so i'm not sure why this one matters
1140
581
 
1141
- if (row === partition[partition.length - 1] && bestRowHeight > this.idealRowHeight * 2) {
1142
- bestRowHeight = this.idealRowHeight;
1143
- }
1144
582
 
1145
- let itemHeight = Math.round(bestRowHeight) + this.itemPadding;
1146
- let x = this.margin; // if any items are going to end up too small, add a bit of width to them and subtract it from wider objects
1147
583
 
1148
- let widths = [];
1149
584
 
1150
- for (let j = index; j < index + row.length; j++) {
1151
- let width = Math.round(bestRowHeight * ratios[j]);
1152
- widths.push([j - index, width]);
1153
- }
1154
585
 
1155
- this._distributeWidths(widths); // Create items for this row.
1156
586
 
1157
587
 
1158
- for (let j = index; j < index + row.length; j++) {
1159
- let node = this.collection.rows[j];
1160
- let itemWidth = Math.max(widths[j - index][1], this.minItemSize.width);
1161
- let rect = new Rect(x, y, itemWidth, itemHeight);
1162
- let layoutInfo = new LayoutInfo(node.type, node.key, rect);
1163
- layoutInfo.allowOverflow = true;
1164
- this.layoutInfos.set(node.key, layoutInfo);
1165
- x += itemWidth + this.itemSpacing.width;
1166
- }
1167
588
 
1168
- y += itemHeight + this.itemSpacing.height;
1169
- index += row.length;
1170
- }
589
+ function $514a55f6d91f25ef$var$CardView(props, ref) {
590
+ let { scale: scale } = $jpY3B$reactspectrumprovider.useProvider();
591
+ let { styleProps: styleProps } = $jpY3B$reactspectrumutils.useStyleProps(props);
592
+ let domRef = $jpY3B$reactspectrumutils.useDOMRef(ref);
593
+ let { isQuiet: isQuiet , renderEmptyState: renderEmptyState , layout: layout , loadingState: loadingState , onLoadMore: onLoadMore , cardOrientation: cardOrientation = 'vertical' } = props;
594
+ let collator = $jpY3B$reactariai18n.useCollator({
595
+ usage: 'search',
596
+ sensitivity: 'base'
597
+ });
598
+ let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
599
+ let cardViewLayout = $jpY3B$react.useMemo(()=>typeof layout === 'function' ? new layout({
600
+ collator: collator,
601
+ cardOrientation: cardOrientation,
602
+ scale: scale
603
+ }) : layout
604
+ , [
605
+ layout,
606
+ collator,
607
+ cardOrientation,
608
+ scale
609
+ ]);
610
+ let layoutType = cardViewLayout.layoutType;
611
+ let stringFormatter = $jpY3B$reactariai18n.useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($dc38f0b958ac5018$exports)));
612
+ let { direction: direction } = $jpY3B$reactariai18n.useLocale();
613
+ let { collection: collection } = $jpY3B$reactstatelylist.useListState(props);
614
+ let gridCollection = $jpY3B$react.useMemo(()=>new $jpY3B$reactstatelygrid.GridCollection({
615
+ columnCount: 1,
616
+ items: [
617
+ ...collection
618
+ ].map((item)=>({
619
+ // Makes the Grid row use the keys the user provides to the cards so that selection change via interactions returns the card keys
620
+ ...item,
621
+ hasChildNodes: true,
622
+ childNodes: [
623
+ {
624
+ key: `cell-${item.key}`,
625
+ type: 'cell',
626
+ value: null,
627
+ level: 0,
628
+ rendered: null,
629
+ textValue: item.textValue,
630
+ hasChildNodes: false,
631
+ childNodes: []
632
+ }
633
+ ]
634
+ })
635
+ )
636
+ })
637
+ , [
638
+ collection
639
+ ]);
640
+ let state = $jpY3B$reactstatelygrid.useGridState({
641
+ ...props,
642
+ selectionMode: cardOrientation === 'horizontal' && layoutType === 'grid' ? 'none' : props.selectionMode,
643
+ collection: gridCollection,
644
+ focusMode: 'cell'
645
+ });
646
+ cardViewLayout.collection = gridCollection;
647
+ cardViewLayout.disabledKeys = state.disabledKeys;
648
+ cardViewLayout.isLoading = isLoading;
649
+ cardViewLayout.direction = direction;
650
+ let { gridProps: gridProps } = $jpY3B$reactariagrid.useGrid({
651
+ ...props,
652
+ isVirtualized: true,
653
+ keyboardDelegate: cardViewLayout
654
+ }, state, domRef);
655
+ let renderWrapper = (parent, reusableView)=>/*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement($jpY3B$reactariavirtualizer.VirtualizerItem, {
656
+ key: reusableView.key,
657
+ reusableView: reusableView,
658
+ parent: parent
659
+ })
660
+ ;
661
+ let focusedKey = state.selectionManager.focusedKey;
662
+ let focusedItem = gridCollection.getItem(state.selectionManager.focusedKey);
663
+ if ((focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.parentKey) != null) focusedKey = focusedItem.parentKey;
664
+ let margin = cardViewLayout.margin || 0;
665
+ let virtualizer = cardViewLayout.virtualizer;
666
+ let scrollToItem = $jpY3B$react.useCallback((key)=>{
667
+ virtualizer && virtualizer.scrollToItem(key, {
668
+ duration: 0,
669
+ offsetY: margin
670
+ });
671
+ }, [
672
+ margin,
673
+ virtualizer
674
+ ]);
675
+ // TODO: does aria-row count and aria-col count need to be modified? Perhaps aria-col count needs to be omitted
676
+ return(/*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement($e57ab98cef2f01a5$export$64992ac69f286e5c.Provider, {
677
+ value: {
678
+ state: state,
679
+ isQuiet: isQuiet,
680
+ layout: cardViewLayout,
681
+ cardOrientation: cardOrientation
682
+ }
683
+ }, /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement($jpY3B$reactariavirtualizer.Virtualizer, {
684
+ ...gridProps,
685
+ ...styleProps,
686
+ className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-CardView'),
687
+ ref: domRef,
688
+ focusedKey: focusedKey,
689
+ scrollDirection: "vertical",
690
+ layout: cardViewLayout,
691
+ collection: gridCollection,
692
+ isLoading: isLoading,
693
+ onLoadMore: onLoadMore,
694
+ renderWrapper: renderWrapper,
695
+ transitionDuration: isLoading ? 160 : 220,
696
+ scrollToItem: scrollToItem
697
+ }, (type, item)=>{
698
+ if (type === 'item') return(/*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement($514a55f6d91f25ef$var$InternalCard, {
699
+ item: item
700
+ }));
701
+ else if (type === 'loader') return(/*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement($514a55f6d91f25ef$var$CenteredWrapper, null, /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement($jpY3B$reactspectrumprogress.ProgressCircle, {
702
+ isIndeterminate: true,
703
+ "aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')
704
+ })));
705
+ else if (type === 'placeholder') {
706
+ let emptyState = renderEmptyState ? renderEmptyState() : null;
707
+ if (emptyState == null) return null;
708
+ return(/*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement($514a55f6d91f25ef$var$CenteredWrapper, null, emptyState));
709
+ }
710
+ })));
711
+ }
712
+ function $514a55f6d91f25ef$var$CenteredWrapper({ children: children }) {
713
+ let { state: state } = $e57ab98cef2f01a5$export$fea0b38586ec8f13();
714
+ return(/*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement("div", {
715
+ role: "row",
716
+ "aria-rowindex": state.collection.size + 1,
717
+ className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-CardView-centeredWrapper')
718
+ }, /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement("div", {
719
+ role: "gridcell"
720
+ }, children)));
721
+ }
722
+ function $514a55f6d91f25ef$var$InternalCard(props) {
723
+ let { item: item } = props;
724
+ let cellNode = [
725
+ ...item.childNodes
726
+ ][0];
727
+ let { state: state , cardOrientation: cardOrientation , isQuiet: isQuiet , layout: layout } = $e57ab98cef2f01a5$export$fea0b38586ec8f13();
728
+ let layoutType = layout.layoutType;
729
+ let rowRef = $jpY3B$react.useRef();
730
+ let cellRef = $jpY3B$react.useRef();
731
+ let unwrappedRef = $jpY3B$reactspectrumutils.useUnwrapDOMRef(cellRef);
732
+ let { rowProps: gridRowProps } = $jpY3B$reactariagrid.useGridRow({
733
+ node: item,
734
+ isVirtualized: true
735
+ }, state, rowRef);
736
+ let { gridCellProps: gridCellProps } = $jpY3B$reactariagrid.useGridCell({
737
+ node: cellNode,
738
+ focusMode: 'cell'
739
+ }, state, unwrappedRef);
740
+ // Prevent space key from scrolling the CardView if triggered on a disabled item or on a Card in a selectionMode="none" CardView.
741
+ let allowsInteraction = state.selectionManager.selectionMode !== 'none';
742
+ let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
743
+ let onKeyDown = (e)=>{
744
+ if (e.key === ' ' && isDisabled) e.preventDefault();
745
+ };
746
+ let rowProps = $jpY3B$reactariautils.mergeProps(gridRowProps, {
747
+ onKeyDown: onKeyDown
748
+ });
749
+ if (layoutType === 'grid' || layoutType === 'gallery') isQuiet = true;
750
+ if (layoutType !== 'grid') cardOrientation = 'vertical';
751
+ // We don't want to focus the checkbox (or any other focusable elements) within the Card
752
+ // when pressing the arrow keys so we delete the key down handler here. Arrow key navigation between
753
+ // the cards in the CardView is handled by useGrid => useSelectableCollection instead.
754
+ delete gridCellProps.onKeyDownCapture;
755
+ return(/*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement("div", {
756
+ ...rowProps,
757
+ ref: rowRef,
758
+ className: $jpY3B$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($71570f0038472fa2$exports)), 'spectrum-CardView-row')
759
+ }, /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement($7888205ff7de382f$export$7a6ccaf429ad93a8, {
760
+ ref: cellRef,
761
+ articleProps: gridCellProps,
762
+ isQuiet: isQuiet,
763
+ orientation: cardOrientation,
764
+ item: item,
765
+ layout: layoutType
766
+ }, item.rendered)));
767
+ }
768
+ /**
769
+ * TODO: Add description of component here.
770
+ */ const $514a55f6d91f25ef$export$7e52c821f7b6f422 = /*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).forwardRef($514a55f6d91f25ef$var$CardView);
1171
771
 
1172
- if (this.isLoading) {
1173
- let loaderY = y;
1174
- let loaderHeight = 60; // If there aren't any items, make loader take all avaliable room and remove margin from y calculation
1175
- // so it doesn't scroll
1176
772
 
1177
- if (this.collection.size === 0) {
1178
- loaderY = 0;
1179
- loaderHeight = visibleHeight || 60;
1180
- }
1181
773
 
1182
- let rect = new Rect(0, loaderY, visibleWidth, loaderHeight);
1183
- let loader = new LayoutInfo('loader', 'loader', rect);
1184
- this.layoutInfos.set('loader', loader);
1185
- y = loader.rect.maxY;
774
+ class $5ee605f09afaa4de$export$64943d2e59d72a29 extends $jpY3B$reactstatelyvirtualizer.Layout {
775
+ validate(invalidationContext) {
776
+ this.collection = this.virtualizer.collection;
777
+ this.buildCollection(invalidationContext);
778
+ // Remove layout info that doesn't exist in new collection
779
+ if (this.lastCollection) {
780
+ for (let key of this.lastCollection.getKeys())if (!this.collection.getItem(key)) this.layoutInfos.delete(key);
781
+ if (!this.isLoading) this.layoutInfos.delete('loader');
782
+ if (this.collection.size > 0) this.layoutInfos.delete('placeholder');
783
+ }
784
+ this.lastCollection = this.collection;
1186
785
  }
1187
-
1188
- if (this.collection.size === 0 && !this.isLoading) {
1189
- let rect = new Rect(0, 0, visibleWidth, visibleHeight);
1190
- let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);
1191
- this.layoutInfos.set('placeholder', placeholder);
1192
- y = placeholder.rect.maxY;
786
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
787
+ buildCollection(invalidationContext) {
1193
788
  }
1194
-
1195
- this.contentSize = new Size(visibleWidth, y);
1196
- }
1197
-
1198
- } // https://www8.cs.umu.se/kurser/TDBA77/VT06/algorithms/BOOK/BOOK2/NODE45.HTM
1199
-
1200
-
1201
- exports.GalleryLayout = GalleryLayout;
1202
-
1203
- function $a23e32931be921d018d1ae1efeda8$var$linearPartition(seq, k) {
1204
- let n = seq.length;
1205
-
1206
- if (k <= 0) {
1207
- return [];
1208
- }
1209
-
1210
- if (k >= n) {
1211
- return seq.map(x => [x]);
1212
- }
1213
-
1214
- if (n === 1) {
1215
- return [seq];
1216
- }
1217
-
1218
- let table = Array(n).fill(0).map(() => Array(k).fill(0));
1219
- let solution = Array(n - 1).fill(0).map(() => Array(k - 1).fill(0));
1220
-
1221
- for (let i = 0; i < n; i++) {
1222
- table[i][0] = seq[i] + (i > 0 ? table[i - 1][0] : 0);
1223
- }
1224
-
1225
- for (let i = 0; i < k; i++) {
1226
- table[0][i] = seq[0];
1227
- }
1228
-
1229
- for (let i = 1; i < n; i++) {
1230
- for (let j = 1; j < k; j++) {
1231
- let currentMin = 0;
1232
- let minX = Infinity;
1233
-
1234
- for (let x = 0; x < i; x++) {
1235
- let c1 = table[x][j - 1];
1236
- let c2 = table[i][0] - table[x][0];
1237
- let cost = Math.max(c1, c2);
1238
-
1239
- if (!x || cost < currentMin) {
1240
- currentMin = cost;
1241
- minX = x;
789
+ getContentSize() {
790
+ return this.contentSize;
791
+ }
792
+ getLayoutInfo(key) {
793
+ return this.layoutInfos.get(key);
794
+ }
795
+ getVisibleLayoutInfos(rect) {
796
+ let res = [];
797
+ for (let layoutInfo of this.layoutInfos.values())if (this.isVisible(layoutInfo, rect)) res.push(layoutInfo);
798
+ return res;
799
+ }
800
+ isVisible(layoutInfo, rect) {
801
+ return layoutInfo.rect.intersects(rect);
802
+ }
803
+ getInitialLayoutInfo(layoutInfo) {
804
+ layoutInfo.opacity = 0;
805
+ layoutInfo.transform = 'scale3d(0.8, 0.8, 0.8)';
806
+ return layoutInfo;
807
+ }
808
+ getFinalLayoutInfo(layoutInfo) {
809
+ layoutInfo.opacity = 0;
810
+ layoutInfo.transform = 'scale3d(0.8, 0.8, 0.8)';
811
+ return layoutInfo;
812
+ }
813
+ _findClosestLayoutInfo(target, rect) {
814
+ let layoutInfos = this.getVisibleLayoutInfos(rect);
815
+ let best = null;
816
+ let bestDistance = Infinity;
817
+ // Calculates distance as the distance between the center of 2 rects.
818
+ for (let cur of layoutInfos)if (cur.type === 'item') {
819
+ let curRect = cur.rect;
820
+ let targetMidX = (target.x + target.maxX) / 2;
821
+ let targetMidY = (target.y + target.maxY) / 2;
822
+ let curMidX = (curRect.x + curRect.maxX) / 2;
823
+ let curMidY = (curRect.y + curRect.maxY) / 2;
824
+ let dist = Math.pow(targetMidX - curMidX, 2) + Math.pow(targetMidY - curMidY, 2);
825
+ if (dist < bestDistance) {
826
+ best = cur;
827
+ bestDistance = dist;
828
+ }
1242
829
  }
1243
- }
1244
-
1245
- table[i][j] = currentMin;
1246
- solution[i - 1][j - 1] = minX;
830
+ return best;
1247
831
  }
1248
- }
1249
-
1250
- n = n - 1;
1251
- k = k - 2;
1252
- let result = [];
1253
-
1254
- while (k >= 0) {
1255
- if (n >= 1) {
1256
- let row = [];
1257
-
1258
- for (let i = solution[n - 1][k] + 1; i < n + 1; i++) {
1259
- row.push(seq[i]);
1260
- }
1261
-
1262
- result.unshift(row);
1263
- n = solution[n - 1][k];
832
+ _findClosest(target, rect) {
833
+ let best = this._findClosestLayoutInfo(target, rect);
834
+ return best || null;
1264
835
  }
836
+ getKeyBelow(key) {
837
+ var ref, ref1;
838
+ // Expected key is the currently focused cell so we need the parent row key
839
+ let parentRowKey = this.collection.getItem(key).parentKey;
840
+ let layoutInfo = this.getLayoutInfo(parentRowKey);
841
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(layoutInfo.rect.x, layoutInfo.rect.maxY + 1, layoutInfo.rect.width, this.virtualizer.visibleRect.height);
842
+ let closestRow = this.collection.getItem((ref = this._findClosest(layoutInfo.rect, rect)) === null || ref === void 0 ? void 0 : ref.key);
843
+ return (ref1 = closestRow === null || closestRow === void 0 ? void 0 : closestRow.childNodes[0]) === null || ref1 === void 0 ? void 0 : ref1.key;
844
+ }
845
+ getKeyAbove(key) {
846
+ var ref, ref2;
847
+ // Expected key is the currently focused cell so we need the parent row key
848
+ let parentRowKey = this.collection.getItem(key).parentKey;
849
+ let layoutInfo = this.getLayoutInfo(parentRowKey);
850
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(layoutInfo.rect.x, 0, layoutInfo.rect.width, layoutInfo.rect.y - 1);
851
+ let closestRow = this.collection.getItem((ref = this._findClosest(layoutInfo.rect, rect)) === null || ref === void 0 ? void 0 : ref.key);
852
+ return (ref2 = closestRow === null || closestRow === void 0 ? void 0 : closestRow.childNodes[0]) === null || ref2 === void 0 ? void 0 : ref2.key;
853
+ }
854
+ getKeyRightOf(key) {
855
+ // Expected key is the currently focused cell so we need the parent row key
856
+ let parentRowKey = this.collection.getItem(key).parentKey;
857
+ key = this.direction === 'rtl' ? this.collection.getKeyBefore(parentRowKey) : this.collection.getKeyAfter(parentRowKey);
858
+ while(key != null){
859
+ let item = this.collection.getItem(key);
860
+ // Don't check if item is disabled because we want to be able to focus disabled items in a grid (double check this)
861
+ if (item.type === 'item') return item.childNodes[0].key;
862
+ key = this.direction === 'rtl' ? this.collection.getKeyBefore(key) : this.collection.getKeyAfter(key);
863
+ }
864
+ }
865
+ getKeyLeftOf(key) {
866
+ // Expected key is the currently focused cell so we need the parent row key
867
+ let parentRowKey = this.collection.getItem(key).parentKey;
868
+ key = this.direction === 'rtl' ? this.collection.getKeyAfter(parentRowKey) : this.collection.getKeyBefore(parentRowKey);
869
+ while(key != null){
870
+ let item = this.collection.getItem(key);
871
+ // Don't check if item is disabled because we want to be able to focus disabled items in a grid (double check this)
872
+ if (item.type === 'item') return item.childNodes[0].key;
873
+ key = this.direction === 'rtl' ? this.collection.getKeyAfter(key) : this.collection.getKeyBefore(key);
874
+ }
875
+ }
876
+ getFirstKey() {
877
+ let firstRow = this.collection.getItem(this.collection.getFirstKey());
878
+ return firstRow.childNodes[0].key;
879
+ }
880
+ getLastKey() {
881
+ let lastRow = this.collection.getItem(this.collection.getLastKey());
882
+ return lastRow.childNodes[0].key;
883
+ }
884
+ // TODO: pretty unwieldy because it needs to bounce back and forth between the parent key and the child key
885
+ // Perhaps have layoutInfo store childKey as well so we don't need to do this? Or maybe make the layoutInfos be the cells instead of the rows?
886
+ getKeyPageAbove(key) {
887
+ // Expected key is the currently focused cell so we need the parent row key
888
+ let parentRowKey = this.collection.getItem(key).parentKey;
889
+ let layoutInfo = this.getLayoutInfo(parentRowKey);
890
+ if (layoutInfo) {
891
+ var ref;
892
+ let pageY = Math.max(0, layoutInfo.rect.y + layoutInfo.rect.height - this.virtualizer.visibleRect.height);
893
+ // If the node is so large that it spans multiple page heights, return the key of the item immediately above
894
+ // Otherwise keep going up until we exceed a single page height worth of nodes
895
+ let keyAbove = (ref = this.collection.getItem(this.getKeyAbove(key))) === null || ref === void 0 ? void 0 : ref.parentKey;
896
+ layoutInfo = this.getLayoutInfo(keyAbove);
897
+ if (layoutInfo && layoutInfo.rect.y > pageY) while(layoutInfo && layoutInfo.rect.y > pageY){
898
+ var ref3;
899
+ let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
900
+ let keyAbove = (ref3 = this.collection.getItem(this.getKeyAbove(childKey))) === null || ref3 === void 0 ? void 0 : ref3.parentKey;
901
+ layoutInfo = this.getLayoutInfo(keyAbove);
902
+ }
903
+ if (layoutInfo) {
904
+ let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
905
+ return childKey;
906
+ }
907
+ }
908
+ return this.getFirstKey();
909
+ }
910
+ // TODO: pretty unwieldy because it needs to bounce back and forth between the parent key and the child key
911
+ // Perhaps have layoutInfo store childKey as well so we don't need to do this?
912
+ getKeyPageBelow(key) {
913
+ // Expected key is the currently focused cell so we need the parent row key
914
+ let parentRowKey = this.collection.getItem(key).parentKey;
915
+ let layoutInfo = this.getLayoutInfo(parentRowKey);
916
+ if (layoutInfo) {
917
+ var ref;
918
+ let pageY = Math.min(this.virtualizer.contentSize.height, layoutInfo.rect.y - layoutInfo.rect.height + this.virtualizer.visibleRect.height);
919
+ // If the node is so large that it spans multiple page heights, return the key of the item immediately below
920
+ // Otherwise keep going up until we exceed a single page height worth of nodes
921
+ let keyBelow = (ref = this.collection.getItem(this.getKeyBelow(key))) === null || ref === void 0 ? void 0 : ref.parentKey;
922
+ layoutInfo = this.getLayoutInfo(keyBelow);
923
+ if (layoutInfo && layoutInfo.rect.y < pageY) while(layoutInfo && layoutInfo.rect.y < pageY){
924
+ var ref4;
925
+ let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
926
+ let keyBelow = (ref4 = this.collection.getItem(this.getKeyBelow(childKey))) === null || ref4 === void 0 ? void 0 : ref4.parentKey;
927
+ layoutInfo = this.getLayoutInfo(keyBelow);
928
+ }
929
+ if (layoutInfo) {
930
+ let childKey = this.collection.getItem(layoutInfo.key).childNodes[0].key;
931
+ return childKey;
932
+ }
933
+ }
934
+ return this.getLastKey();
935
+ }
936
+ getKeyForSearch(search, fromKey) {
937
+ if (!this.collator) return null;
938
+ let collection = this.collection;
939
+ let key = fromKey !== null && fromKey !== void 0 ? fromKey : this.getFirstKey();
940
+ let startItem = collection.getItem(key);
941
+ key = startItem.parentKey;
942
+ while(key != null){
943
+ let item = collection.getItem(key);
944
+ if (item.textValue) {
945
+ let substring = item.textValue.slice(0, search.length);
946
+ if (this.collator.compare(substring, search) === 0) return [
947
+ ...item.childNodes
948
+ ][0].key;
949
+ }
950
+ key = this.collection.getKeyAfter(key);
951
+ }
952
+ return null;
953
+ }
954
+ constructor(options = {
955
+ }){
956
+ super();
957
+ this.disabledKeys = new Set();
958
+ this.layoutInfos = new Map();
959
+ this.collator = options.collator;
960
+ this.lastCollection = null;
961
+ this.scale = options.scale || 'medium';
962
+ this.margin = options.margin || 24;
963
+ }
964
+ }
1265
965
 
1266
- k--;
1267
- }
1268
-
1269
- let row = [];
1270
-
1271
- for (let i = 0; i < n + 1; i++) {
1272
- row.push(seq[i]);
1273
- }
1274
966
 
1275
- result.unshift(row);
1276
- return result;
1277
- }
1278
967
 
1279
- const $e0c00724bec6201efad9430accf8c3b1$var$DEFAULT_OPTIONS = {
1280
- S: {
1281
- itemPadding: 20,
1282
- minItemSize: {
1283
- 'vertical': new Size(96, 96)
1284
- },
1285
- maxItemSize: new Size(Infinity, Infinity),
1286
- margin: 8,
1287
- minSpace: new Size(6, 6),
1288
- maxColumns: Infinity,
1289
- dropSpacing: 50
1290
- },
1291
- L: {
1292
- itemPadding: {
1293
- 'vertical': {
1294
- 'medium': 78,
1295
- 'large': 98
1296
- },
1297
- 'horizontal': {
1298
- 'medium': 150,
1299
- 'large': 170
1300
- }
1301
- },
1302
- minItemSize: {
1303
- 'vertical': new Size(208, 208),
1304
- 'horizontal': new Size(102, 102)
968
+ const $8019a3d2c7d098ea$var$DEFAULT_OPTIONS = {
969
+ S: {
970
+ idealRowHeight: 112,
971
+ minItemSize: new $jpY3B$reactstatelyvirtualizer.Size(96, 96),
972
+ itemSpacing: new $jpY3B$reactstatelyvirtualizer.Size(8, 16),
973
+ itemPadding: 24,
974
+ dropSpacing: 50,
975
+ margin: 8
1305
976
  },
1306
- maxItemSize: new Size(Infinity, Infinity),
1307
- margin: 24,
1308
- minSpace: new Size(18, 18),
1309
- maxColumns: Infinity,
1310
- dropSpacing: 100
1311
- }
977
+ L: {
978
+ idealRowHeight: 208,
979
+ minItemSize: new $jpY3B$reactstatelyvirtualizer.Size(136, 136),
980
+ itemSpacing: new $jpY3B$reactstatelyvirtualizer.Size(18, 18),
981
+ itemPadding: {
982
+ 'medium': 78,
983
+ 'large': 99
984
+ },
985
+ dropSpacing: 100,
986
+ margin: 24
987
+ }
1312
988
  };
1313
-
1314
- class GridLayout extends $ae626509048548c15655cbbeb258411$export$BaseLayout {
1315
- constructor(options) {
1316
- if (options === void 0) {
1317
- options = {};
989
+ class $8019a3d2c7d098ea$export$8e52095834484b61 extends $5ee605f09afaa4de$export$64943d2e59d72a29 {
990
+ get layoutType() {
991
+ return 'gallery';
1318
992
  }
1319
-
1320
- super(options);
1321
- this.minItemSize = void 0;
1322
- this.maxItemSize = void 0;
1323
- this.minSpace = void 0;
1324
- this.maxColumns = void 0;
1325
- this.itemPadding = void 0;
1326
- this.cardOrientation = void 0;
1327
- this.itemSize = void 0;
1328
- this.numColumns = void 0;
1329
- this.numRows = void 0;
1330
- this.horizontalSpacing = void 0;
1331
- let cardSize = 'L';
1332
- this.cardOrientation = options.cardOrientation || 'vertical';
1333
- this.minItemSize = options.minItemSize || $e0c00724bec6201efad9430accf8c3b1$var$DEFAULT_OPTIONS[cardSize].minItemSize[this.cardOrientation];
1334
- this.maxItemSize = options.maxItemSize || $e0c00724bec6201efad9430accf8c3b1$var$DEFAULT_OPTIONS[cardSize].maxItemSize;
1335
- this.margin = options.margin != null ? options.margin : $e0c00724bec6201efad9430accf8c3b1$var$DEFAULT_OPTIONS[cardSize].margin;
1336
- this.minSpace = options.minSpace || $e0c00724bec6201efad9430accf8c3b1$var$DEFAULT_OPTIONS[cardSize].minSpace;
1337
- this.maxColumns = options.maxColumns || $e0c00724bec6201efad9430accf8c3b1$var$DEFAULT_OPTIONS[cardSize].maxColumns;
1338
- this.itemPadding = options.itemPadding != null ? options.itemPadding : $e0c00724bec6201efad9430accf8c3b1$var$DEFAULT_OPTIONS[cardSize].itemPadding[this.cardOrientation][this.scale];
1339
- this.itemSize = null;
1340
- this.numColumns = 0;
1341
- this.numRows = 0;
1342
- this.horizontalSpacing = 0;
1343
- }
1344
-
1345
- get layoutType() {
1346
- return 'grid';
1347
- }
1348
-
1349
- getIndexAtPoint(x, y, allowInsertingAtEnd) {
1350
- if (allowInsertingAtEnd === void 0) {
1351
- allowInsertingAtEnd = false;
993
+ /**
994
+ * Takes a row of widths and if there are any widths smaller than the min-width, leech width starting from
995
+ * the widest in the row until it can't give anymore, then move to the second widest and so forth.
996
+ * Do this until all assets meet the min-width.
997
+ * */ _distributeWidths(widths) {
998
+ // create a copy of the widths array and sort it largest to smallest
999
+ let sortedWidths = widths.concat().sort((a, b)=>a[1] > b[1] ? -1 : 1
1000
+ );
1001
+ for (let width of widths)// for each width, if it's smaller than the min width
1002
+ if (width[1] < this.minItemSize.width) {
1003
+ // then figure out how much smaller
1004
+ let delta = this.minItemSize.width - width[1];
1005
+ for (let item of sortedWidths)// go from the largest width in the row to the smallest
1006
+ // if the width is greater than the min width
1007
+ if (widths[item[0]][1] > this.minItemSize.width) {
1008
+ // subtract the delta from the width, if it's still greater than the min width
1009
+ // then we have finished, subtract the delta permanently from that width
1010
+ if (widths[item[0]][1] - delta > this.minItemSize.width) {
1011
+ widths[item[0]][1] -= delta;
1012
+ delta = 0;
1013
+ break;
1014
+ } else {
1015
+ // otherwise, we take as much as we can from the current width and then move on to
1016
+ // the next largest and take some width from it
1017
+ let maxChange = widths[item[0]][1] - this.minItemSize.width;
1018
+ delta -= maxChange;
1019
+ widths[item[0]][1] -= maxChange;
1020
+ }
1021
+ }
1022
+ if (delta > 0) return false;
1023
+ // force the width to be the min width that we just rebalanced for
1024
+ width[1] = this.minItemSize.width;
1025
+ }
1026
+ return true;
1352
1027
  }
1353
-
1354
- let itemHeight = this.itemSize.height + this.minSpace.height;
1355
- let itemWidth = this.itemSize.width + this.horizontalSpacing;
1356
- return Math.max(0, Math.min(this.collection.size - (allowInsertingAtEnd ? 0 : 1), Math.floor(y / itemHeight) * this.numColumns + Math.floor((x - this.horizontalSpacing) / itemWidth)));
1357
- }
1358
-
1359
- getVisibleLayoutInfos(rect) {
1360
- let res = [];
1361
- let numItems = this.collection.size;
1362
-
1363
- if (numItems <= 0 || !this.itemSize) {
1364
- // If there aren't any items in the collection, we are in a loader/placeholder state. Return those layoutInfos as
1365
- // the currently visible items
1366
- if (this.layoutInfos.size > 0) {
1367
- for (let layoutInfo of this.layoutInfos.values()) {
1368
- if (this.isVisible(layoutInfo, rect)) {
1369
- res.push(layoutInfo);
1370
- }
1028
+ buildCollection() {
1029
+ let visibleWidth = this.virtualizer.visibleRect.width;
1030
+ let visibleHeight = this.virtualizer.visibleRect.height;
1031
+ let y = this.margin;
1032
+ let availableWidth = visibleWidth - this.margin * 2;
1033
+ // If avaliable width is not greater than 0, skip node layout calculations
1034
+ if (availableWidth > 0) {
1035
+ // Compute aspect ratios for all of the items, and the total width if all items were on in a single row.
1036
+ let ratios = [];
1037
+ let totalWidth = 0;
1038
+ let minRatio = this.minItemSize.width / this.minItemSize.height;
1039
+ let maxRatio = availableWidth / this.minItemSize.height;
1040
+ for (let node of this.collection){
1041
+ let ratio = node.props.width / node.props.height;
1042
+ if (ratio < minRatio) ratio = minRatio;
1043
+ else if (ratio > maxRatio && ratio !== minRatio) ratio = maxRatio;
1044
+ let itemWidth = ratio * this.minItemSize.height;
1045
+ ratios.push(ratio);
1046
+ totalWidth += itemWidth;
1047
+ }
1048
+ totalWidth += this.itemSpacing.width * (this.collection.size - 1);
1049
+ // Determine how many rows we'll need, and partition the items into rows
1050
+ // using the aspect ratios as weights.
1051
+ let rows = Math.max(1, Math.ceil(totalWidth / availableWidth));
1052
+ // if the available width can't hold two items, then every item will get its own row
1053
+ // this leads to a faster run through linear partition and more dependable output for small row widths
1054
+ if (availableWidth <= this.minItemSize.width * 2 + this.itemPadding * 2) rows = this.collection.size;
1055
+ let weightedRatios = ratios.map((ratio)=>ratio < this.threshold ? ratio + 0.5 * (1 / ratio) : ratio
1056
+ );
1057
+ let partition = $8019a3d2c7d098ea$var$linearPartition(weightedRatios, rows);
1058
+ let index = 0;
1059
+ for (let row of partition){
1060
+ // Compute the total weight for this row
1061
+ let totalWeight = 0;
1062
+ for(let j = index; j < index + row.length; j++)totalWeight += ratios[j];
1063
+ // Determine the row height based on the total available width and weight of this row.
1064
+ let bestRowHeight = (availableWidth - (row.length - 1) * this.itemSpacing.width) / totalWeight;
1065
+ // if this is the last row and the row height is >2x the ideal row height, then cap to the ideal height
1066
+ // probably doing this because if the last row has one extremely tall image, then the row becomes huge
1067
+ // though that can happen anywhere if a row has lots of tall images... so i'm not sure why this one matters
1068
+ if (row === partition[partition.length - 1] && bestRowHeight > this.idealRowHeight * 2) bestRowHeight = this.idealRowHeight;
1069
+ let itemHeight = Math.round(bestRowHeight) + this.itemPadding;
1070
+ let x = this.margin;
1071
+ // if any items are going to end up too small, add a bit of width to them and subtract it from wider objects
1072
+ let widths = [];
1073
+ for(let j1 = index; j1 < index + row.length; j1++){
1074
+ let width = Math.round(bestRowHeight * ratios[j1]);
1075
+ widths.push([
1076
+ j1 - index,
1077
+ width
1078
+ ]);
1079
+ }
1080
+ this._distributeWidths(widths);
1081
+ // Create items for this row.
1082
+ for(let j2 = index; j2 < index + row.length; j2++){
1083
+ let node = this.collection.rows[j2];
1084
+ let itemWidth = Math.max(widths[j2 - index][1], this.minItemSize.width);
1085
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(x, y, itemWidth, itemHeight);
1086
+ let layoutInfo = new $jpY3B$reactstatelyvirtualizer.LayoutInfo(node.type, node.key, rect);
1087
+ layoutInfo.allowOverflow = true;
1088
+ this.layoutInfos.set(node.key, layoutInfo);
1089
+ x += itemWidth + this.itemSpacing.width;
1090
+ }
1091
+ y += itemHeight + this.itemSpacing.height;
1092
+ index += row.length;
1093
+ }
1094
+ if (this.isLoading) {
1095
+ let loaderY = y;
1096
+ let loaderHeight = 60;
1097
+ // If there aren't any items, make loader take all avaliable room and remove margin from y calculation
1098
+ // so it doesn't scroll
1099
+ if (this.collection.size === 0) {
1100
+ loaderY = 0;
1101
+ loaderHeight = visibleHeight || 60;
1102
+ }
1103
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(0, loaderY, visibleWidth, loaderHeight);
1104
+ let loader = new $jpY3B$reactstatelyvirtualizer.LayoutInfo('loader', 'loader', rect);
1105
+ this.layoutInfos.set('loader', loader);
1106
+ y = loader.rect.maxY;
1107
+ }
1108
+ if (this.collection.size === 0 && !this.isLoading) {
1109
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(0, 0, visibleWidth, visibleHeight);
1110
+ let placeholder = new $jpY3B$reactstatelyvirtualizer.LayoutInfo('placeholder', 'placeholder', rect);
1111
+ this.layoutInfos.set('placeholder', placeholder);
1112
+ y = placeholder.rect.maxY;
1113
+ }
1371
1114
  }
1372
- }
1373
- } else {
1374
- // The approach from v2 uses indexes where other v3 layouts iterate through every node/root node. This feels more efficient
1375
- let firstVisibleItem = this.getIndexAtPoint(rect.x, rect.y);
1376
- let lastVisibleItem = this.getIndexAtPoint(rect.maxX, rect.maxY);
1377
-
1378
- for (let index = firstVisibleItem; index <= lastVisibleItem; index++) {
1379
- let keyFromIndex = this.collection.rows[index].key;
1380
- let layoutInfo = this.layoutInfos.get(keyFromIndex);
1381
-
1382
- if (layoutInfo && this.isVisible(layoutInfo, rect)) {
1383
- res.push(layoutInfo);
1115
+ this.contentSize = new $jpY3B$reactstatelyvirtualizer.Size(visibleWidth, y);
1116
+ }
1117
+ constructor(options = {
1118
+ }){
1119
+ super(options);
1120
+ let cardSize = 'L';
1121
+ this.idealRowHeight = options.idealRowHeight || $8019a3d2c7d098ea$var$DEFAULT_OPTIONS[cardSize].idealRowHeight;
1122
+ this.itemSpacing = options.itemSpacing || $8019a3d2c7d098ea$var$DEFAULT_OPTIONS[cardSize].itemSpacing;
1123
+ this.itemPadding = options.itemPadding != null ? options.itemPadding : $8019a3d2c7d098ea$var$DEFAULT_OPTIONS[cardSize].itemPadding[this.scale];
1124
+ this.minItemSize = options.minItemSize || $8019a3d2c7d098ea$var$DEFAULT_OPTIONS[cardSize].minItemSize;
1125
+ this.threshold = options.threshold || 1;
1126
+ this.margin = options.margin != null ? options.margin : $8019a3d2c7d098ea$var$DEFAULT_OPTIONS[cardSize].margin;
1127
+ }
1128
+ }
1129
+ // https://www8.cs.umu.se/kurser/TDBA77/VT06/algorithms/BOOK/BOOK2/NODE45.HTM
1130
+ function $8019a3d2c7d098ea$var$linearPartition(seq, k) {
1131
+ let n = seq.length;
1132
+ if (k <= 0) return [];
1133
+ if (k >= n) return seq.map((x)=>[
1134
+ x
1135
+ ]
1136
+ );
1137
+ if (n === 1) return [
1138
+ seq
1139
+ ];
1140
+ let table = Array(n).fill(0).map(()=>Array(k).fill(0)
1141
+ );
1142
+ let solution = Array(n - 1).fill(0).map(()=>Array(k - 1).fill(0)
1143
+ );
1144
+ for(let i = 0; i < n; i++)table[i][0] = seq[i] + (i > 0 ? table[i - 1][0] : 0);
1145
+ for(let i1 = 0; i1 < k; i1++)table[0][i1] = seq[0];
1146
+ for(let i2 = 1; i2 < n; i2++)for(let j = 1; j < k; j++){
1147
+ let currentMin = 0;
1148
+ let minX = Infinity;
1149
+ for(let x = 0; x < i2; x++){
1150
+ let c1 = table[x][j - 1];
1151
+ let c2 = table[i2][0] - table[x][0];
1152
+ let cost = Math.max(c1, c2);
1153
+ if (!x || cost < currentMin) {
1154
+ currentMin = cost;
1155
+ minX = x;
1156
+ }
1384
1157
  }
1385
- } // Check if loader is in view and add to res if so
1386
-
1387
-
1388
- let loader = this.layoutInfos.get('loader');
1389
-
1390
- if (loader && this.isVisible(loader, rect)) {
1391
- res.push(loader);
1392
- }
1158
+ table[i2][j] = currentMin;
1159
+ solution[i2 - 1][j - 1] = minX;
1393
1160
  }
1161
+ n = n - 1;
1162
+ k = k - 2;
1163
+ let result = [];
1164
+ while(k >= 0){
1165
+ if (n >= 1) {
1166
+ let row = [];
1167
+ for(let i = solution[n - 1][k] + 1; i < n + 1; i++)row.push(seq[i]);
1168
+ result.unshift(row);
1169
+ n = solution[n - 1][k];
1170
+ }
1171
+ k--;
1172
+ }
1173
+ let row = [];
1174
+ for(let i3 = 0; i3 < n + 1; i3++)row.push(seq[i3]);
1175
+ result.unshift(row);
1176
+ return result;
1177
+ }
1394
1178
 
1395
- return res;
1396
- }
1397
-
1398
- buildCollection() {
1399
- let visibleWidth = this.virtualizer.visibleRect.width;
1400
- let visibleHeight = this.virtualizer.visibleRect.height;
1401
- let horizontalItemPadding = this.cardOrientation === 'horizontal' ? this.itemPadding : 0;
1402
- let verticalItemPadding = this.cardOrientation === 'vertical' ? this.itemPadding : 0;
1403
- let minCardWidth = this.minItemSize.width + horizontalItemPadding; // Compute the number of rows and columns needed to display the content
1404
-
1405
- let availableWidth = visibleWidth - this.margin * 2;
1406
- let columns = Math.floor((availableWidth + this.minSpace.width) / (minCardWidth + this.minSpace.width));
1407
- this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));
1408
- this.numRows = Math.ceil(this.collection.size / this.numColumns); // Compute the available width (minus the space between items)
1409
-
1410
- let width = availableWidth - this.minSpace.width * Math.max(0, this.numColumns - 1); // Compute the item width based on the space available
1411
-
1412
- let itemWidth = Math.floor(width / this.numColumns);
1413
- itemWidth = Math.max(minCardWidth, Math.min(this.maxItemSize.width, itemWidth)); // Compute the item height, which is proportional to the item width
1414
1179
 
1415
- let t = (itemWidth - minCardWidth) / minCardWidth;
1416
- let itemHeight = Math.floor(this.minItemSize.height + this.minItemSize.height * t);
1417
- itemHeight = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, itemHeight)) + verticalItemPadding;
1418
- this.itemSize = new Size(itemWidth, itemHeight); // Compute the horizontal spacing and content height
1419
1180
 
1420
- this.horizontalSpacing = this.numColumns < 2 ? 0 : Math.floor((availableWidth - this.numColumns * this.itemSize.width) / (this.numColumns - 1));
1421
- let y = this.margin;
1422
- let index = 0;
1423
1181
 
1424
- for (let node of this.collection) {
1425
- let layoutInfo = this.buildChild(node, y, index);
1426
- y = layoutInfo.rect.maxY;
1427
- index++;
1182
+ const $71b727f94b595b1a$var$DEFAULT_OPTIONS = {
1183
+ S: {
1184
+ itemPadding: 20,
1185
+ minItemSize: {
1186
+ 'vertical': new $jpY3B$reactstatelyvirtualizer.Size(96, 96)
1187
+ },
1188
+ maxItemSize: new $jpY3B$reactstatelyvirtualizer.Size(Infinity, Infinity),
1189
+ margin: 8,
1190
+ minSpace: new $jpY3B$reactstatelyvirtualizer.Size(6, 6),
1191
+ maxColumns: Infinity,
1192
+ dropSpacing: 50
1193
+ },
1194
+ L: {
1195
+ itemPadding: {
1196
+ 'vertical': {
1197
+ 'medium': 78,
1198
+ 'large': 98
1199
+ },
1200
+ 'horizontal': {
1201
+ 'medium': 150,
1202
+ 'large': 170
1203
+ }
1204
+ },
1205
+ minItemSize: {
1206
+ 'vertical': new $jpY3B$reactstatelyvirtualizer.Size(208, 208),
1207
+ 'horizontal': new $jpY3B$reactstatelyvirtualizer.Size(102, 102)
1208
+ },
1209
+ maxItemSize: new $jpY3B$reactstatelyvirtualizer.Size(Infinity, Infinity),
1210
+ margin: 24,
1211
+ minSpace: new $jpY3B$reactstatelyvirtualizer.Size(18, 18),
1212
+ maxColumns: Infinity,
1213
+ dropSpacing: 100
1428
1214
  }
1429
-
1430
- if (this.isLoading) {
1431
- let loaderY = y;
1432
- let loaderHeight = 60; // If there aren't any items, make loader take all avaliable room and remove margin from y calculation
1433
- // so it doesn't scroll
1434
-
1435
- if (this.collection.size === 0) {
1436
- loaderY = 0;
1437
- loaderHeight = visibleHeight || 60;
1438
- }
1439
-
1440
- let rect = new Rect(0, loaderY, visibleWidth, loaderHeight);
1441
- let loader = new LayoutInfo('loader', 'loader', rect);
1442
- this.layoutInfos.set('loader', loader);
1443
- y = loader.rect.maxY;
1215
+ };
1216
+ class $71b727f94b595b1a$export$7d2b12578154a735 extends $5ee605f09afaa4de$export$64943d2e59d72a29 {
1217
+ get layoutType() {
1218
+ return 'grid';
1444
1219
  }
1445
-
1446
- if (this.collection.size === 0 && !this.isLoading) {
1447
- let rect = new Rect(0, 0, visibleWidth, visibleHeight);
1448
- let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);
1449
- this.layoutInfos.set('placeholder', placeholder);
1450
- y = placeholder.rect.maxY;
1220
+ getIndexAtPoint(x, y, allowInsertingAtEnd = false) {
1221
+ let itemHeight = this.itemSize.height + this.minSpace.height;
1222
+ let itemWidth = this.itemSize.width + this.horizontalSpacing;
1223
+ return Math.max(0, Math.min(this.collection.size - (allowInsertingAtEnd ? 0 : 1), Math.floor(y / itemHeight) * this.numColumns + Math.floor((x - this.horizontalSpacing) / itemWidth)));
1451
1224
  }
1452
-
1453
- this.contentSize = new Size(visibleWidth, y);
1454
- }
1455
-
1456
- buildChild(node, y, index) {
1457
- let row = Math.floor(index / this.numColumns);
1458
- let column = index % this.numColumns;
1459
- let x = this.margin + column * (this.itemSize.width + this.horizontalSpacing);
1460
- y = this.margin + row * (this.itemSize.height + this.minSpace.height);
1461
- let rect = new Rect(x, y, this.itemSize.width, this.itemSize.height); // TODO: Perhaps have it so that the child key for each row is stored with the layoutInfo?
1462
-
1463
- let layoutInfo = new LayoutInfo(node.type, node.key, rect);
1464
- layoutInfo.allowOverflow = true;
1465
- this.layoutInfos.set(node.key, layoutInfo);
1466
- return layoutInfo;
1467
- } // Since the collection doesn't represent the visual layout, need to calculate what row and column the current key is in,
1468
- // then return the key that occupies the row + column below. This can be done by figuring out how many cards exist per column then dividing the
1469
- // collection contents by that number (which will give us the row distribution)
1470
-
1471
-
1472
- getKeyBelow(key) {
1473
- var _this$collection$rows;
1474
-
1475
- // Expected key is the currently focused cell so we need the parent row key
1476
- let parentRowKey = this.collection.getItem(key).parentKey;
1477
- let indexRowBelow;
1478
- let index = this.collection.rows.findIndex(card => card.key === parentRowKey);
1479
-
1480
- if (index !== -1) {
1481
- indexRowBelow = index + this.numColumns;
1482
- } else {
1483
- return null;
1225
+ getVisibleLayoutInfos(rect) {
1226
+ let res = [];
1227
+ let numItems = this.collection.size;
1228
+ if (numItems <= 0 || !this.itemSize) // If there aren't any items in the collection, we are in a loader/placeholder state. Return those layoutInfos as
1229
+ // the currently visible items
1230
+ {
1231
+ if (this.layoutInfos.size > 0) {
1232
+ for (let layoutInfo of this.layoutInfos.values())if (this.isVisible(layoutInfo, rect)) res.push(layoutInfo);
1233
+ }
1234
+ } else {
1235
+ // The approach from v2 uses indexes where other v3 layouts iterate through every node/root node. This feels more efficient
1236
+ let firstVisibleItem = this.getIndexAtPoint(rect.x, rect.y);
1237
+ let lastVisibleItem = this.getIndexAtPoint(rect.maxX, rect.maxY);
1238
+ for(let index = firstVisibleItem; index <= lastVisibleItem; index++){
1239
+ let keyFromIndex = this.collection.rows[index].key;
1240
+ let layoutInfo = this.layoutInfos.get(keyFromIndex);
1241
+ if (layoutInfo && this.isVisible(layoutInfo, rect)) res.push(layoutInfo);
1242
+ }
1243
+ // Check if loader is in view and add to res if so
1244
+ let loader = this.layoutInfos.get('loader');
1245
+ if (loader && this.isVisible(loader, rect)) res.push(loader);
1246
+ }
1247
+ return res;
1484
1248
  }
1485
-
1486
- return ((_this$collection$rows = this.collection.rows[indexRowBelow]) == null ? void 0 : _this$collection$rows.childNodes[0].key) || null;
1487
- }
1488
-
1489
- getKeyAbove(key) {
1490
- var _this$collection$rows2;
1491
-
1492
- // Expected key is the currently focused cell so we need the parent row key
1493
- let parentRowKey = this.collection.getItem(key).parentKey;
1494
- let indexRowAbove;
1495
- let index = this.collection.rows.findIndex(card => card.key === parentRowKey);
1496
-
1497
- if (index !== -1) {
1498
- indexRowAbove = index - this.numColumns;
1499
- } else {
1500
- return null;
1249
+ buildCollection() {
1250
+ let visibleWidth = this.virtualizer.visibleRect.width;
1251
+ let visibleHeight = this.virtualizer.visibleRect.height;
1252
+ let horizontalItemPadding = this.cardOrientation === 'horizontal' ? this.itemPadding : 0;
1253
+ let verticalItemPadding = this.cardOrientation === 'vertical' ? this.itemPadding : 0;
1254
+ let minCardWidth = this.minItemSize.width + horizontalItemPadding;
1255
+ // Compute the number of rows and columns needed to display the content
1256
+ let availableWidth = visibleWidth - this.margin * 2;
1257
+ let columns = Math.floor((availableWidth + this.minSpace.width) / (minCardWidth + this.minSpace.width));
1258
+ this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));
1259
+ this.numRows = Math.ceil(this.collection.size / this.numColumns);
1260
+ // Compute the available width (minus the space between items)
1261
+ let width = availableWidth - this.minSpace.width * Math.max(0, this.numColumns - 1);
1262
+ // Compute the item width based on the space available
1263
+ let itemWidth = Math.floor(width / this.numColumns);
1264
+ itemWidth = Math.max(minCardWidth, Math.min(this.maxItemSize.width, itemWidth));
1265
+ // Compute the item height, which is proportional to the item width
1266
+ let t = (itemWidth - minCardWidth) / minCardWidth;
1267
+ let itemHeight = Math.floor(this.minItemSize.height + this.minItemSize.height * t);
1268
+ itemHeight = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, itemHeight)) + verticalItemPadding;
1269
+ this.itemSize = new $jpY3B$reactstatelyvirtualizer.Size(itemWidth, itemHeight);
1270
+ // Compute the horizontal spacing and content height
1271
+ this.horizontalSpacing = this.numColumns < 2 ? 0 : Math.floor((availableWidth - this.numColumns * this.itemSize.width) / (this.numColumns - 1));
1272
+ let y = this.margin;
1273
+ let index = 0;
1274
+ for (let node of this.collection){
1275
+ let layoutInfo = this.buildChild(node, y, index);
1276
+ y = layoutInfo.rect.maxY;
1277
+ index++;
1278
+ }
1279
+ if (this.isLoading) {
1280
+ let loaderY = y;
1281
+ let loaderHeight = 60;
1282
+ // If there aren't any items, make loader take all avaliable room and remove margin from y calculation
1283
+ // so it doesn't scroll
1284
+ if (this.collection.size === 0) {
1285
+ loaderY = 0;
1286
+ loaderHeight = visibleHeight || 60;
1287
+ }
1288
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(0, loaderY, visibleWidth, loaderHeight);
1289
+ let loader = new $jpY3B$reactstatelyvirtualizer.LayoutInfo('loader', 'loader', rect);
1290
+ this.layoutInfos.set('loader', loader);
1291
+ y = loader.rect.maxY;
1292
+ }
1293
+ if (this.collection.size === 0 && !this.isLoading) {
1294
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(0, 0, visibleWidth, visibleHeight);
1295
+ let placeholder = new $jpY3B$reactstatelyvirtualizer.LayoutInfo('placeholder', 'placeholder', rect);
1296
+ this.layoutInfos.set('placeholder', placeholder);
1297
+ y = placeholder.rect.maxY;
1298
+ }
1299
+ this.contentSize = new $jpY3B$reactstatelyvirtualizer.Size(visibleWidth, y);
1501
1300
  }
1502
-
1503
- return ((_this$collection$rows2 = this.collection.rows[indexRowAbove]) == null ? void 0 : _this$collection$rows2.childNodes[0].key) || null;
1504
- }
1505
-
1506
- }
1507
-
1508
- exports.GridLayout = GridLayout;
1509
-
1510
- // TODO: this didn't have any options that varied with card size, should it have?
1511
- class WaterfallLayout extends $ae626509048548c15655cbbeb258411$export$BaseLayout {
1512
- constructor(options) {
1513
- if (options === void 0) {
1514
- options = {};
1301
+ buildChild(node, y, index) {
1302
+ let row = Math.floor(index / this.numColumns);
1303
+ let column = index % this.numColumns;
1304
+ let x = this.margin + column * (this.itemSize.width + this.horizontalSpacing);
1305
+ y = this.margin + row * (this.itemSize.height + this.minSpace.height);
1306
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(x, y, this.itemSize.width, this.itemSize.height);
1307
+ // TODO: Perhaps have it so that the child key for each row is stored with the layoutInfo?
1308
+ let layoutInfo = new $jpY3B$reactstatelyvirtualizer.LayoutInfo(node.type, node.key, rect);
1309
+ layoutInfo.allowOverflow = true;
1310
+ this.layoutInfos.set(node.key, layoutInfo);
1311
+ return layoutInfo;
1515
1312
  }
1516
-
1517
- // TODO: WaterfallLayout doesn't use card size in v2, but perhaps it should support it? Perhaps it would modify
1518
- // minItemSize defaults or other things
1519
- super(options);
1520
- this.minItemSize = void 0;
1521
- this.maxItemSize = void 0;
1522
- this.minSpace = void 0;
1523
- this.maxColumns = void 0;
1524
- this.itemPadding = void 0;
1525
- this.numColumns = void 0;
1526
- this.itemWidth = void 0;
1527
- this.horizontalSpacing = void 0;
1528
- this.minItemSize = options.minItemSize || new Size(240, 136);
1529
- this.maxItemSize = options.maxItemSize || new Size(Infinity, Infinity);
1530
- this.margin = options.margin != null ? options.margin : 24;
1531
- this.minSpace = options.minSpace || new Size(18, 18);
1532
- this.maxColumns = options.maxColumns || Infinity; // TODO: not entirely sure what this is for since the layout will automatically shift itself to the correct vertical space for the card
1533
-
1534
- this.itemPadding = options.itemPadding != null ? options.itemPadding : 56;
1535
- this.itemWidth = 0;
1536
- this.numColumns = 0;
1537
- this.lastCollection = null;
1538
- this.collator = options.collator;
1539
- }
1540
-
1541
- get layoutType() {
1542
- return 'waterfall';
1543
- }
1544
-
1545
- buildCollection(invalidationContext) {
1546
- // Compute the number of columns needed to display the content
1547
- let visibleWidth = this.virtualizer.visibleRect.width;
1548
- let availableWidth = visibleWidth - this.margin * 2;
1549
- let columns = Math.floor((availableWidth + this.minSpace.width) / (this.minItemSize.width + this.minSpace.width));
1550
- this.numColumns = Math.max(1, Math.min(this.maxColumns, columns)); // Compute the available width (minus the space between items)
1551
-
1552
- let width = availableWidth - this.minSpace.width * (this.numColumns - 1); // Compute the item width based on the space available
1553
-
1554
- let itemWidth = Math.round(width / this.numColumns);
1555
- itemWidth = Math.max(this.minItemSize.width, Math.min(this.maxItemSize.width, itemWidth));
1556
- this.itemWidth = itemWidth; // Compute the horizontal spacing
1557
- // if only one column, we cannot divide by zero, so set it to 1
1558
-
1559
- let horizontalSpacing = Math.round((availableWidth - this.numColumns * itemWidth) / Math.max(1, this.numColumns - 1));
1560
- this.horizontalSpacing = horizontalSpacing; // Setup an array of column heights
1561
-
1562
- let columnHeights = Array(this.numColumns).fill(this.margin);
1563
-
1564
- for (let node of this.collection) {
1565
- let key = node.key; // Compute the height of the item. Use the existing height if available,
1566
- // otherwise call the delegate to estimate the size.
1567
-
1568
- let oldLayoutInfo = this.layoutInfos.get(key);
1569
- let height;
1570
- let estimatedSize = true;
1571
-
1572
- if (oldLayoutInfo) {
1573
- height = oldLayoutInfo.rect.height;
1574
- estimatedSize = invalidationContext.sizeChanged || oldLayoutInfo.estimatedSize;
1575
- } else if (node.props.width && node.props.height) {
1576
- let nodeWidth = node.props.width;
1577
- let nodeHeight = node.props.height;
1578
- let scaledHeight = Math.round(nodeWidth * (itemWidth / nodeHeight));
1579
- height = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, scaledHeight)) + this.itemPadding;
1580
- } else {
1581
- height = itemWidth;
1582
- } // Figure out which column to place the item in, and compute its position.
1583
-
1584
-
1585
- let column = this.getNextColumnIndex(columnHeights);
1586
- let x = this.margin + column * (itemWidth + horizontalSpacing);
1587
- let y = columnHeights[column];
1588
- let rect = new Rect(x, y, itemWidth, height);
1589
- let layoutInfo = new LayoutInfo(node.type, key, rect);
1590
- layoutInfo.estimatedSize = estimatedSize;
1591
- layoutInfo.allowOverflow = true;
1592
- this.layoutInfos.set(key, layoutInfo); // TODO: From v2 figure out this bit, when does this get called and what to replace this.collectionView._transaction with?
1593
- // Removing it from v2 doesn't seem to do anything?
1594
- // if (layoutInfo.estimatedSize && !invalidationContext.contentChanged && !this.collectionView._transaction) {
1595
- // this.updateItemSize(new IndexPath(section, i));
1596
- // }
1597
-
1598
- columnHeights[column] += layoutInfo.rect.height + this.minSpace.height;
1313
+ // Since the collection doesn't represent the visual layout, need to calculate what row and column the current key is in,
1314
+ // then return the key that occupies the row + column below. This can be done by figuring out how many cards exist per column then dividing the
1315
+ // collection contents by that number (which will give us the row distribution)
1316
+ getKeyBelow(key) {
1317
+ var ref;
1318
+ // Expected key is the currently focused cell so we need the parent row key
1319
+ let parentRowKey = this.collection.getItem(key).parentKey;
1320
+ let indexRowBelow;
1321
+ let index = this.collection.rows.findIndex((card)=>card.key === parentRowKey
1322
+ );
1323
+ if (index !== -1) indexRowBelow = index + this.numColumns;
1324
+ else return null;
1325
+ return ((ref = this.collection.rows[indexRowBelow]) === null || ref === void 0 ? void 0 : ref.childNodes[0].key) || null;
1599
1326
  }
1327
+ getKeyAbove(key) {
1328
+ var ref;
1329
+ // Expected key is the currently focused cell so we need the parent row key
1330
+ let parentRowKey = this.collection.getItem(key).parentKey;
1331
+ let indexRowAbove;
1332
+ let index = this.collection.rows.findIndex((card)=>card.key === parentRowKey
1333
+ );
1334
+ if (index !== -1) indexRowAbove = index - this.numColumns;
1335
+ else return null;
1336
+ return ((ref = this.collection.rows[indexRowAbove]) === null || ref === void 0 ? void 0 : ref.childNodes[0].key) || null;
1337
+ }
1338
+ constructor(options = {
1339
+ }){
1340
+ super(options);
1341
+ let cardSize = 'L';
1342
+ this.cardOrientation = options.cardOrientation || 'vertical';
1343
+ this.minItemSize = options.minItemSize || $71b727f94b595b1a$var$DEFAULT_OPTIONS[cardSize].minItemSize[this.cardOrientation];
1344
+ this.maxItemSize = options.maxItemSize || $71b727f94b595b1a$var$DEFAULT_OPTIONS[cardSize].maxItemSize;
1345
+ this.margin = options.margin != null ? options.margin : $71b727f94b595b1a$var$DEFAULT_OPTIONS[cardSize].margin;
1346
+ this.minSpace = options.minSpace || $71b727f94b595b1a$var$DEFAULT_OPTIONS[cardSize].minSpace;
1347
+ this.maxColumns = options.maxColumns || $71b727f94b595b1a$var$DEFAULT_OPTIONS[cardSize].maxColumns;
1348
+ this.itemPadding = options.itemPadding != null ? options.itemPadding : $71b727f94b595b1a$var$DEFAULT_OPTIONS[cardSize].itemPadding[this.cardOrientation][this.scale];
1349
+ this.itemSize = null;
1350
+ this.numColumns = 0;
1351
+ this.numRows = 0;
1352
+ this.horizontalSpacing = 0;
1353
+ }
1354
+ }
1600
1355
 
1601
- let maxHeight = Math.max.apply(Math, columnHeights) - this.minSpace.height + this.margin;
1602
- columnHeights.fill(maxHeight);
1603
- let y = columnHeights[0];
1604
1356
 
1605
- if (this.isLoading) {
1606
- let loaderY = y;
1607
- let loaderHeight = 60; // If there aren't any items, make loader take all avaliable room and remove margin from y calculation
1608
- // so it doesn't scroll
1609
1357
 
1610
- if (this.collection.size === 0) {
1611
- loaderY = 0;
1612
- loaderHeight = this.virtualizer.visibleRect.height || 60;
1613
- }
1614
1358
 
1615
- let rect = new Rect(0, loaderY, this.virtualizer.visibleRect.width, loaderHeight);
1616
- let loader = new LayoutInfo('loader', 'loader', rect);
1617
- this.layoutInfos.set('loader', loader);
1618
- y = loader.rect.maxY;
1359
+ class $632abf8fbf0ad57b$export$e9f7cda058ba8df8 extends $5ee605f09afaa4de$export$64943d2e59d72a29 {
1360
+ get layoutType() {
1361
+ return 'waterfall';
1619
1362
  }
1620
-
1621
- if (this.collection.size === 0 && !this.isLoading) {
1622
- let rect = new Rect(0, 0, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);
1623
- let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);
1624
- this.layoutInfos.set('placeholder', placeholder);
1625
- y = placeholder.rect.maxY;
1363
+ buildCollection(invalidationContext) {
1364
+ // Compute the number of columns needed to display the content
1365
+ let visibleWidth = this.virtualizer.visibleRect.width;
1366
+ let availableWidth = visibleWidth - this.margin * 2;
1367
+ let columns = Math.floor((availableWidth + this.minSpace.width) / (this.minItemSize.width + this.minSpace.width));
1368
+ this.numColumns = Math.max(1, Math.min(this.maxColumns, columns));
1369
+ // Compute the available width (minus the space between items)
1370
+ let width = availableWidth - this.minSpace.width * (this.numColumns - 1);
1371
+ // Compute the item width based on the space available
1372
+ let itemWidth = Math.round(width / this.numColumns);
1373
+ itemWidth = Math.max(this.minItemSize.width, Math.min(this.maxItemSize.width, itemWidth));
1374
+ this.itemWidth = itemWidth;
1375
+ // Compute the horizontal spacing
1376
+ // if only one column, we cannot divide by zero, so set it to 1
1377
+ let horizontalSpacing = Math.round((availableWidth - this.numColumns * itemWidth) / Math.max(1, this.numColumns - 1));
1378
+ this.horizontalSpacing = horizontalSpacing;
1379
+ // Setup an array of column heights
1380
+ let columnHeights = Array(this.numColumns).fill(this.margin);
1381
+ for (let node of this.collection){
1382
+ let key = node.key;
1383
+ // Compute the height of the item. Use the existing height if available,
1384
+ // otherwise call the delegate to estimate the size.
1385
+ let oldLayoutInfo = this.layoutInfos.get(key);
1386
+ let height;
1387
+ let estimatedSize = true;
1388
+ if (oldLayoutInfo) {
1389
+ height = oldLayoutInfo.rect.height;
1390
+ estimatedSize = invalidationContext.sizeChanged || oldLayoutInfo.estimatedSize;
1391
+ } else if (node.props.width && node.props.height) {
1392
+ let nodeWidth = node.props.width;
1393
+ let nodeHeight = node.props.height;
1394
+ let scaledHeight = Math.round(nodeHeight * (itemWidth / nodeWidth));
1395
+ height = Math.max(this.minItemSize.height, Math.min(this.maxItemSize.height, scaledHeight));
1396
+ } else height = itemWidth;
1397
+ // Figure out which column to place the item in, and compute its position.
1398
+ let column = this.getNextColumnIndex(columnHeights);
1399
+ let x = this.margin + column * (itemWidth + horizontalSpacing);
1400
+ let y = columnHeights[column];
1401
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(x, y, itemWidth, height);
1402
+ let layoutInfo = new $jpY3B$reactstatelyvirtualizer.LayoutInfo(node.type, key, rect);
1403
+ layoutInfo.estimatedSize = estimatedSize;
1404
+ layoutInfo.allowOverflow = true;
1405
+ this.layoutInfos.set(key, layoutInfo);
1406
+ // TODO: From v2 figure out this bit, when does this get called and what to replace this.collectionView._transaction with?
1407
+ // Removing it from v2 doesn't seem to do anything?
1408
+ // if (layoutInfo.estimatedSize && !invalidationContext.contentChanged && !this.collectionView._transaction) {
1409
+ // this.updateItemSize(new IndexPath(section, i));
1410
+ // }
1411
+ columnHeights[column] += layoutInfo.rect.height + this.minSpace.height;
1412
+ }
1413
+ // Reset all columns to the maximum for the next section
1414
+ let maxHeight = Math.max.apply(Math, columnHeights) - this.minSpace.height + this.margin;
1415
+ columnHeights.fill(maxHeight);
1416
+ let y = columnHeights[0];
1417
+ if (this.isLoading) {
1418
+ let loaderY = y;
1419
+ let loaderHeight = 60;
1420
+ // If there aren't any items, make loader take all avaliable room and remove margin from y calculation
1421
+ // so it doesn't scroll
1422
+ if (this.collection.size === 0) {
1423
+ loaderY = 0;
1424
+ loaderHeight = this.virtualizer.visibleRect.height || 60;
1425
+ }
1426
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(0, loaderY, this.virtualizer.visibleRect.width, loaderHeight);
1427
+ let loader = new $jpY3B$reactstatelyvirtualizer.LayoutInfo('loader', 'loader', rect);
1428
+ this.layoutInfos.set('loader', loader);
1429
+ y = loader.rect.maxY;
1430
+ }
1431
+ if (this.collection.size === 0 && !this.isLoading) {
1432
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(0, 0, this.virtualizer.visibleRect.width, this.virtualizer.visibleRect.height);
1433
+ let placeholder = new $jpY3B$reactstatelyvirtualizer.LayoutInfo('placeholder', 'placeholder', rect);
1434
+ this.layoutInfos.set('placeholder', placeholder);
1435
+ y = placeholder.rect.maxY;
1436
+ }
1437
+ this.contentSize = new $jpY3B$reactstatelyvirtualizer.Size(this.virtualizer.visibleRect.width, y);
1626
1438
  }
1627
-
1628
- this.contentSize = new Size(this.virtualizer.visibleRect.width, y);
1629
- }
1630
-
1631
- updateItemSize(key, size) {
1632
- let layoutInfo = this.layoutInfos.get(key);
1633
-
1634
- if (!size || !layoutInfo) {
1635
- return false;
1439
+ updateItemSize(key, size) {
1440
+ let layoutInfo = this.layoutInfos.get(key);
1441
+ if (!size || !layoutInfo) return false;
1442
+ if (size.height !== layoutInfo.rect.height) {
1443
+ // TODO: also not sure about copying layout info vs mutating it. Listlayout does the below
1444
+ // but I feel that is because it actually maintained a layoutNode map cache which this doesn't have
1445
+ let newLayoutInfo = layoutInfo.copy();
1446
+ newLayoutInfo.rect.height = size.height < 600 ? size.height : 600;
1447
+ newLayoutInfo.estimatedSize = false;
1448
+ this.layoutInfos.set(key, newLayoutInfo);
1449
+ return true;
1450
+ }
1451
+ return false;
1636
1452
  }
1637
-
1638
- if (size.height !== layoutInfo.rect.height) {
1639
- // TODO: also not sure about copying layout info vs mutating it. Listlayout does the below
1640
- // but I feel that is because it actually maintained a layoutNode map cache which this doesn't have
1641
- let newLayoutInfo = layoutInfo.copy();
1642
- newLayoutInfo.rect.height = size.height;
1643
- this.layoutInfos.set(key, newLayoutInfo); // TODO: v2 had layoutInfo.estimatedSize = view.estimatedSize || false; but we can't do the same here?
1644
-
1645
- layoutInfo.estimatedSize = false;
1646
- return true;
1453
+ getNextColumnIndex(columnHeights) {
1454
+ let minIndex = 0;
1455
+ for(let i = 0; i < columnHeights.length; i++)if (columnHeights[i] < columnHeights[minIndex]) minIndex = i;
1456
+ return minIndex;
1647
1457
  }
1648
-
1649
- return false;
1650
- }
1651
-
1652
- getNextColumnIndex(columnHeights) {
1653
- let minIndex = 0;
1654
-
1655
- for (let i = 0; i < columnHeights.length; i++) {
1656
- if (columnHeights[i] < columnHeights[minIndex]) {
1657
- minIndex = i;
1658
- }
1458
+ getClosestRight(key) {
1459
+ var ref, ref1, ref2;
1460
+ let layoutInfo = this.getLayoutInfo(key);
1461
+ // Refactored from v2. Current strategy is to find the closest card in the adjacent column.
1462
+ // This prevent the issue where it was possible that the closest layoutInfo would be two columns over due to the middle card being exceptionally tall
1463
+ // and thus the top corner to top corner distance was massive.
1464
+ // First look for a card to the immediate right of the current card. If we can't find any, look for the nearest card in the entire column to the right of the card
1465
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(layoutInfo.rect.maxX + 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);
1466
+ key = (ref = this._findClosest(layoutInfo.rect, rect)) === null || ref === void 0 ? void 0 : ref.key;
1467
+ if (!key) {
1468
+ var ref3;
1469
+ rect = new $jpY3B$reactstatelyvirtualizer.Rect(layoutInfo.rect.maxX + 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);
1470
+ key = (ref3 = this._findClosest(layoutInfo.rect, rect)) === null || ref3 === void 0 ? void 0 : ref3.key;
1471
+ }
1472
+ return (ref2 = (ref1 = this.collection.getItem(key)) === null || ref1 === void 0 ? void 0 : ref1.childNodes[0]) === null || ref2 === void 0 ? void 0 : ref2.key;
1659
1473
  }
1660
-
1661
- return minIndex;
1662
- }
1663
-
1664
- getClosestRight(key) {
1665
- var _this$_findClosest, _this$collection$getI, _this$collection$getI2;
1666
-
1667
- let layoutInfo = this.getLayoutInfo(key); // Refactored from v2. Current strategy is to find the closest card in the adjacent column.
1668
- // This prevent the issue where it was possible that the closest layoutInfo would be two columns over due to the middle card being exceptionally tall
1669
- // and thus the top corner to top corner distance was massive.
1670
- // First look for a card to the immediate right of the current card. If we can't find any, look for the nearest card in the entire column to the right of the card
1671
-
1672
- let rect = new Rect(layoutInfo.rect.maxX + 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);
1673
- key = (_this$_findClosest = this._findClosest(layoutInfo.rect, rect)) == null ? void 0 : _this$_findClosest.key;
1674
-
1675
- if (!key) {
1676
- var _this$_findClosest2;
1677
-
1678
- rect = new Rect(layoutInfo.rect.maxX + 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);
1679
- key = (_this$_findClosest2 = this._findClosest(layoutInfo.rect, rect)) == null ? void 0 : _this$_findClosest2.key;
1474
+ getClosestLeft(key) {
1475
+ var ref, ref4, ref5;
1476
+ let layoutInfo = this.getLayoutInfo(key);
1477
+ // First look for a card to the immediate left of the current card. If we can't find any, look for the nearest card in the entire column to the left of the card
1478
+ let rect = new $jpY3B$reactstatelyvirtualizer.Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);
1479
+ key = (ref = this._findClosest(layoutInfo.rect, rect)) === null || ref === void 0 ? void 0 : ref.key;
1480
+ if (!key) {
1481
+ var ref6;
1482
+ rect = new $jpY3B$reactstatelyvirtualizer.Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);
1483
+ key = (ref6 = this._findClosest(layoutInfo.rect, rect)) === null || ref6 === void 0 ? void 0 : ref6.key;
1484
+ }
1485
+ return (ref5 = (ref4 = this.collection.getItem(key)) === null || ref4 === void 0 ? void 0 : ref4.childNodes[0]) === null || ref5 === void 0 ? void 0 : ref5.key;
1680
1486
  }
1487
+ getKeyRightOf(key) {
1488
+ // Expected key is the currently focused cell so we need the parent row key
1489
+ let parentRowKey = this.collection.getItem(key).parentKey;
1490
+ return this.direction === 'rtl' ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);
1491
+ }
1492
+ getKeyLeftOf(key) {
1493
+ // Expected key is the currently focused cell so we need the parent row key
1494
+ let parentRowKey = this.collection.getItem(key).parentKey;
1495
+ return this.direction === 'rtl' ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);
1496
+ }
1497
+ constructor(options = {
1498
+ }){
1499
+ // TODO: WaterfallLayout doesn't use card size in v2, but perhaps it should support it? Perhaps it would modify
1500
+ // minItemSize defaults or other things
1501
+ super(options);
1502
+ this.minItemSize = options.minItemSize || new $jpY3B$reactstatelyvirtualizer.Size(240, 136);
1503
+ this.maxItemSize = options.maxItemSize || new $jpY3B$reactstatelyvirtualizer.Size(Infinity, Infinity);
1504
+ this.margin = options.margin != null ? options.margin : 24;
1505
+ this.minSpace = options.minSpace || new $jpY3B$reactstatelyvirtualizer.Size(18, 18);
1506
+ this.maxColumns = options.maxColumns || Infinity;
1507
+ this.itemWidth = 0;
1508
+ this.numColumns = 0;
1509
+ this.lastCollection = null;
1510
+ this.collator = options.collator;
1511
+ }
1512
+ }
1681
1513
 
1682
- return (_this$collection$getI = this.collection.getItem(key)) == null ? void 0 : (_this$collection$getI2 = _this$collection$getI.childNodes[0]) == null ? void 0 : _this$collection$getI2.key;
1683
- }
1684
-
1685
- getClosestLeft(key) {
1686
- var _this$_findClosest3, _this$collection$getI3, _this$collection$getI4;
1687
-
1688
- let layoutInfo = this.getLayoutInfo(key); // First look for a card to the immediate left of the current card. If we can't find any, look for the nearest card in the entire column to the left of the card
1689
-
1690
- let rect = new Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, layoutInfo.rect.y, layoutInfo.rect.width + this.horizontalSpacing, layoutInfo.rect.height);
1691
- key = (_this$_findClosest3 = this._findClosest(layoutInfo.rect, rect)) == null ? void 0 : _this$_findClosest3.key;
1692
1514
 
1693
- if (!key) {
1694
- var _this$_findClosest4;
1695
1515
 
1696
- rect = new Rect(layoutInfo.rect.x - layoutInfo.rect.width - this.horizontalSpacing - 1, 0, layoutInfo.rect.width + this.horizontalSpacing, this.virtualizer.contentSize.height);
1697
- key = (_this$_findClosest4 = this._findClosest(layoutInfo.rect, rect)) == null ? void 0 : _this$_findClosest4.key;
1698
- }
1699
1516
 
1700
- return (_this$collection$getI3 = this.collection.getItem(key)) == null ? void 0 : (_this$collection$getI4 = _this$collection$getI3.childNodes[0]) == null ? void 0 : _this$collection$getI4.key;
1701
- }
1702
1517
 
1703
- getKeyRightOf(key) {
1704
- // Expected key is the currently focused cell so we need the parent row key
1705
- let parentRowKey = this.collection.getItem(key).parentKey;
1706
- return this.direction === 'rtl' ? this.getClosestLeft(parentRowKey) : this.getClosestRight(parentRowKey);
1707
- }
1518
+ let $6b630ac4b78ba7f3$var$Card = /*#__PURE__*/ $jpY3B$react.forwardRef((props, ref)=>{
1519
+ let context = $e57ab98cef2f01a5$export$fea0b38586ec8f13();
1520
+ if (context !== null) return null;
1521
+ else return(/*#__PURE__*/ ($parcel$interopDefault($jpY3B$react)).createElement($7888205ff7de382f$export$7a6ccaf429ad93a8, {
1522
+ ...props,
1523
+ ref: ref
1524
+ }));
1525
+ });
1526
+ // @ts-ignore
1527
+ $6b630ac4b78ba7f3$var$Card.getCollectionNode = function* getCollectionNode(props) {
1528
+ let { children: children , textValue: textValue } = props;
1529
+ yield {
1530
+ type: 'item',
1531
+ props: props,
1532
+ rendered: children,
1533
+ 'aria-label': props['aria-label'],
1534
+ hasChildNodes: false,
1535
+ textValue: textValue
1536
+ };
1537
+ };
1538
+ let $6b630ac4b78ba7f3$export$60332b2344f7fe41 = $6b630ac4b78ba7f3$var$Card;
1708
1539
 
1709
- getKeyLeftOf(key) {
1710
- // Expected key is the currently focused cell so we need the parent row key
1711
- let parentRowKey = this.collection.getItem(key).parentKey;
1712
- return this.direction === 'rtl' ? this.getClosestRight(parentRowKey) : this.getClosestLeft(parentRowKey);
1713
- }
1714
1540
 
1715
- }
1716
1541
 
1717
- exports.WaterfallLayout = WaterfallLayout;
1718
- let $bc2440b48de2b2afa97227cbf612729$var$Card = /*#__PURE__*/forwardRef((props, ref) => {
1719
- let context = $d2268ebff01b30dc8701260db9de8b73$export$useCardViewContext();
1720
1542
 
1721
- if (context !== null) {
1722
- return null;
1723
- } else {
1724
- return /*#__PURE__*/_react.createElement($c05a01cf76428c47b3d1dc747d32$export$CardBase, _babelRuntimeHelpersExtends({}, props, {
1725
- ref: ref
1726
- }));
1727
- }
1728
- }); // TODO: Update the typescript for the below and the export
1729
- // @ts-ignore
1730
- // eslint-disable-next-line
1731
-
1732
- $bc2440b48de2b2afa97227cbf612729$var$Card.getCollectionNode = function* getCollectionNode(props, context) {
1733
- let {
1734
- children,
1735
- textValue
1736
- } = props;
1737
- yield {
1738
- type: 'item',
1739
- props: props,
1740
- rendered: children,
1741
- 'aria-label': props['aria-label'],
1742
- hasChildNodes: false,
1743
- textValue
1744
- };
1745
- }; // eslint-disable-next-line
1746
-
1747
-
1748
- let Card = $bc2440b48de2b2afa97227cbf612729$var$Card;
1749
- exports.Card = Card;
1750
1543
  //# sourceMappingURL=main.js.map