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

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