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