@sproutsocial/seeds-react-list 0.0.2 → 0.1.1
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +13 -0
- package/dist/esm/index.js +1053 -38
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +57 -5
- package/dist/index.d.ts +57 -5
- package/dist/index.js +1059 -41
- package/dist/index.js.map +1 -1
- package/package.json +8 -4
- package/src/DataItemSkeleton.tsx +43 -0
- package/src/DataItemSkeletonTypes.ts +8 -0
- package/src/DataList.stories.tsx +659 -0
- package/src/DataList.tsx +88 -0
- package/src/DataListTypes.ts +31 -0
- package/src/DynamicVirtualizedExample.tsx +85 -0
- package/src/List.stories.tsx +13 -5
- package/src/List.tsx +1 -10
- package/src/ListItem.tsx +22 -19
- package/src/ListItemButton.tsx +17 -5
- package/src/ListItemTypes.ts +2 -0
- package/src/ListTypes.ts +2 -0
- package/src/VirtualizedDataList.stories.tsx +353 -0
- package/src/VirtualizedDataList.tsx +122 -0
- package/src/VirtualizedExamples.tsx +55 -0
- package/src/__tests__/DataList.test.tsx +218 -0
- package/src/__tests__/List.test.tsx +10 -10
- package/src/index.ts +13 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ interface TypeListProps extends TypeStyledComponentsCommonProps {
|
|
|
9
9
|
as?: TypeListElement;
|
|
10
10
|
/** Array of elements to render as list items */
|
|
11
11
|
children: React.ReactNode;
|
|
12
|
+
/** Inline styles to apply to the list element */
|
|
13
|
+
style?: React.CSSProperties;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
declare const List: {
|
|
@@ -21,6 +23,8 @@ interface TypeListItemProps extends TypeStyledComponentsCommonProps {
|
|
|
21
23
|
isBordered?: boolean;
|
|
22
24
|
/** Children to display inside the list item */
|
|
23
25
|
children: React.ReactNode;
|
|
26
|
+
/** Inline styles to apply to the list item element */
|
|
27
|
+
style?: React.CSSProperties;
|
|
24
28
|
}
|
|
25
29
|
interface TypeListItemContentProps extends TypeStyledComponentsCommonProps {
|
|
26
30
|
/** Main text displayed as SmallSubheadline */
|
|
@@ -37,14 +41,62 @@ interface TypeListItemContentProps extends TypeStyledComponentsCommonProps {
|
|
|
37
41
|
actions?: React.ReactNode;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
declare const ListItem:
|
|
41
|
-
({ isBordered, children, ...rest }: TypeListItemProps): react_jsx_runtime.JSX.Element;
|
|
42
|
-
displayName: string;
|
|
43
|
-
};
|
|
44
|
+
declare const ListItem: React.ForwardRefExoticComponent<Omit<TypeListItemProps, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
44
45
|
|
|
45
46
|
declare const ListItemContent: {
|
|
46
47
|
({ text, details, aside, iconName, iconLabel, actions, ...rest }: TypeListItemContentProps): react_jsx_runtime.JSX.Element;
|
|
47
48
|
displayName: string;
|
|
48
49
|
};
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
interface TypeDataItemSkeletonProps {
|
|
52
|
+
/** If true, shows an icon skeleton */
|
|
53
|
+
hasIcon?: boolean;
|
|
54
|
+
/** If true, shows an aside skeleton */
|
|
55
|
+
hasAside?: boolean;
|
|
56
|
+
/** If true, shows a subtext/details skeleton */
|
|
57
|
+
hasSubtext?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface TypeDataListProps<T> extends Omit<TypeListProps, "children"> {
|
|
61
|
+
/** Array of data items to render */
|
|
62
|
+
data: T[];
|
|
63
|
+
/** Function to render each item in the data array */
|
|
64
|
+
renderItem: (item: T, index?: number) => React.ReactNode;
|
|
65
|
+
/** If true, shows loading skeletons instead of data */
|
|
66
|
+
isLoading?: boolean;
|
|
67
|
+
/** Component to render when loading. Receives props for customizing skeleton appearance */
|
|
68
|
+
LoadingComponent?: React.ComponentType<TypeDataItemSkeletonProps>;
|
|
69
|
+
/** Estimated height of each item in pixels for virtualization. Defaults to 60 */
|
|
70
|
+
estimateItemSize?: number;
|
|
71
|
+
/** Props to pass to the list item component */
|
|
72
|
+
listItemProps?: Omit<TypeListItemProps, "children">;
|
|
73
|
+
/** Callback function called when the end of the list is reached (for infinite scrolling) */
|
|
74
|
+
onEndReached?: () => void;
|
|
75
|
+
/** Whether there is a next page available (for infinite scrolling) */
|
|
76
|
+
hasNextPage?: boolean;
|
|
77
|
+
/** Whether the next page is currently being fetched */
|
|
78
|
+
isFetchingNextPage?: boolean;
|
|
79
|
+
/** Header component to display at the top of the list */
|
|
80
|
+
Header?: React.ReactNode;
|
|
81
|
+
/** Scroll offset in pixels at which the header should be removed/hidden. Defaults to 500 */
|
|
82
|
+
removeHeaderDepth?: number;
|
|
83
|
+
/** Height of the header in pixels. Defaults to 60 */
|
|
84
|
+
headerHeight?: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare const DataList: {
|
|
88
|
+
<T>({ as, data, renderItem, isLoading, LoadingComponent, listItemProps, estimateItemSize, Header, ...rest }: TypeDataListProps<T>): react_jsx_runtime.JSX.Element;
|
|
89
|
+
displayName: string;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
declare const DataItemSkeleton: {
|
|
93
|
+
({ hasIcon, hasAside, hasSubtext, }: TypeDataItemSkeletonProps): react_jsx_runtime.JSX.Element;
|
|
94
|
+
displayName: string;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
declare const Experimental_VirtualizedDataList: {
|
|
98
|
+
<T>({ as, data, renderItem, estimateItemSize, onEndReached, hasNextPage, isFetchingNextPage, Header, removeHeaderDepth, headerHeight, ...rest }: TypeDataListProps<T>): react_jsx_runtime.JSX.Element;
|
|
99
|
+
displayName: string;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export { DataItemSkeleton, DataList, Experimental_VirtualizedDataList, List, ListItem, ListItemContent, type TypeDataItemSkeletonProps, type TypeDataListProps, type TypeListElement, type TypeListItemContentProps, type TypeListItemProps, type TypeListProps };
|