@react-spectrum/card 3.0.0-alpha.3 → 3.0.0-alpha.30

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