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

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