@react-spectrum/card 3.0.0-alpha.15 → 3.0.0-alpha.16

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