@react-spectrum/card 3.0.0-alpha.0 → 3.0.0-alpha.11

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