@swan-io/lake 8.18.4 → 8.18.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-io/lake",
3
- "version": "8.18.4",
3
+ "version": "8.18.6",
4
4
  "engines": {
5
5
  "node": ">=20.9.0",
6
6
  "yarn": "^1.22.0"
@@ -38,14 +38,14 @@ export type VirtualizedListProps<T, ExtraInfo> = {
38
38
  onEndReached?: () => void;
39
39
  onEndReachedThreshold?: number;
40
40
  getRowLink?: (config: LinkConfig<T, ExtraInfo>) => ReactElement | undefined;
41
- renderEmptyList?: () => ReactNode;
41
+ renderEmptyList: () => ReactNode;
42
42
  marginHorizontal?: string;
43
43
  loading?: {
44
44
  isLoading: boolean;
45
45
  count: number;
46
46
  };
47
47
  };
48
- export declare const VirtualizedList: <T, ExtraInfo>({ variant, data, stickedToStartColumns, columns, stickedToEndColumns, headerHeight, rowHeight, renderThreshold, onEndReached, onEndReachedThreshold, loading, extraInfo, keyExtractor, marginHorizontal, }: VirtualizedListProps<T, ExtraInfo>) => import("react/jsx-runtime").JSX.Element;
48
+ export declare const VirtualizedList: <T, ExtraInfo>({ variant, data, stickedToStartColumns, columns, stickedToEndColumns, headerHeight, rowHeight, renderThreshold, onEndReached, onEndReachedThreshold, loading, extraInfo, keyExtractor, marginHorizontal, renderEmptyList, }: VirtualizedListProps<T, ExtraInfo>) => import("react/jsx-runtime").JSX.Element;
49
49
  type VirtualizedListPlaceholderProps = {
50
50
  count: number;
51
51
  rowHeight: number;
@@ -14,6 +14,13 @@ const styles = StyleSheet.create({
14
14
  height: 1,
15
15
  alignSelf: "stretch",
16
16
  },
17
+ emptyListContentContainer: {
18
+ flexDirection: "column",
19
+ alignItems: "center",
20
+ justifyContent: "center",
21
+ padding: spacings[48],
22
+ minHeight: "100%",
23
+ },
17
24
  headerRow: {
18
25
  position: "sticky",
19
26
  top: 0,
@@ -127,7 +134,7 @@ const styles = StyleSheet.create({
127
134
  alignItems: "center",
128
135
  justifyContent: "flex-start",
129
136
  flexGrow: 1,
130
- paddingHorizontal: spacings[20],
137
+ paddingHorizontal: spacings[24],
131
138
  },
132
139
  loadingPlaceholder: {
133
140
  position: "absolute",
@@ -152,7 +159,7 @@ const styles = StyleSheet.create({
152
159
  width: "10%",
153
160
  },
154
161
  });
155
- export const VirtualizedList = ({ variant, data, stickedToStartColumns, columns, stickedToEndColumns, headerHeight, rowHeight, renderThreshold = 1000, onEndReached, onEndReachedThreshold = 200, loading, extraInfo, keyExtractor, marginHorizontal, }) => {
162
+ export const VirtualizedList = ({ variant, data, stickedToStartColumns, columns, stickedToEndColumns, headerHeight, rowHeight, renderThreshold = 1000, onEndReached, onEndReachedThreshold = 200, loading, extraInfo, keyExtractor, marginHorizontal, renderEmptyList, }) => {
156
163
  // Used for unique IDs generation (usefull for header IDs and cells aria-describedBy pointing to them)
157
164
  const viewId = useId();
158
165
  const scrollViewRef = useRef(null);
@@ -225,7 +232,7 @@ export const VirtualizedList = ({ variant, data, stickedToStartColumns, columns,
225
232
  ? "End"
226
233
  : "Middle")
227
234
  .toUndefined());
228
- }, [data, renderThreshold, rowHeight, stickedToStartColumnsWidth, stickedToEndColumnsWidth]);
235
+ }, [renderThreshold, rowHeight, stickedToStartColumnsWidth, stickedToEndColumnsWidth]);
229
236
  useLayoutEffect(() => {
230
237
  onLayoutUpdate();
231
238
  }, [onLayoutUpdate]);
@@ -354,6 +361,12 @@ export const VirtualizedList = ({ variant, data, stickedToStartColumns, columns,
354
361
  },
355
362
  ] }));
356
363
  }, [stickedToEndColumnsWidth, horizontalScrollPosition]);
364
+ if (data.length === 0 &&
365
+ !Option.fromNullable(loading)
366
+ .map(({ isLoading }) => isLoading)
367
+ .getOr(false)) {
368
+ return (_jsx(ScrollView, { style: styles.container, contentContainerStyle: styles.emptyListContentContainer, children: renderEmptyList() }));
369
+ }
357
370
  return (_jsxs(ScrollView, { ref: scrollViewRef, both: true, style: [styles.container, { marginHorizontal }], onScroll: onScroll, scrollEventThrottle: 32, contentContainerStyle: {
358
371
  height: containerContainerHeight,
359
372
  width: contentContainerWidth,