@jobber/components 4.26.7 → 4.26.8
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.
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from "react";
|
|
2
2
|
export type DataListItemType<T extends DataListObject[]> = Record<keyof T[number], ReactElement>;
|
|
3
|
-
export type DataListItemTypeFromHeader<
|
|
4
|
-
export
|
|
3
|
+
export type DataListItemTypeFromHeader<TData extends DataListObject, THeader extends DataListHeader<TData>> = Record<keyof THeader, ReactElement>;
|
|
4
|
+
export interface DataListObject {
|
|
5
|
+
/**
|
|
6
|
+
* The ID of the data.
|
|
7
|
+
*
|
|
8
|
+
* This is used as a key when looping through the data to prevent accidental
|
|
9
|
+
* rerender when the order of data changes.
|
|
10
|
+
*/
|
|
11
|
+
readonly id: string | number;
|
|
12
|
+
/**
|
|
13
|
+
* Styles the string as an emphasized text that differs from other keys.
|
|
14
|
+
*/
|
|
15
|
+
readonly label?: string | ReactElement;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a styled list of tags that overflows and is truncated with a +N.
|
|
18
|
+
*/
|
|
19
|
+
readonly tags?: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Support any key. The keys in this object are used as way to determine the
|
|
22
|
+
* keys you can use on the DataList header, layout, etc.
|
|
23
|
+
*/
|
|
24
|
+
readonly [key: string]: ReactNode | Date;
|
|
25
|
+
}
|
|
5
26
|
export type DataListHeader<T extends DataListObject> = {
|
|
6
27
|
readonly [K in keyof T]?: string;
|
|
7
28
|
};
|
|
@@ -9,18 +30,20 @@ export interface DataListProps<T extends DataListObject> {
|
|
|
9
30
|
readonly data: T[];
|
|
10
31
|
readonly headers: DataListHeader<T>;
|
|
11
32
|
/**
|
|
12
|
-
*
|
|
33
|
+
* Shows the loading state of the DataList.
|
|
34
|
+
*
|
|
13
35
|
* @default false
|
|
14
36
|
*/
|
|
15
37
|
readonly loading?: boolean;
|
|
16
38
|
/**
|
|
17
39
|
* Temporary prop for setting default state for if filters are applied
|
|
40
|
+
*
|
|
18
41
|
* @default false
|
|
19
42
|
*/
|
|
20
43
|
readonly filterApplied?: boolean;
|
|
21
44
|
readonly children: ReactElement | ReactElement[];
|
|
22
45
|
/**
|
|
23
|
-
* The title of the DataList
|
|
46
|
+
* The title of the DataList.
|
|
24
47
|
*/
|
|
25
48
|
readonly title?: string;
|
|
26
49
|
/**
|
|
@@ -12,7 +12,7 @@ export declare function generateListItemElements<T extends DataListObject>(data:
|
|
|
12
12
|
/**
|
|
13
13
|
* Generate the header elements with the default styling
|
|
14
14
|
*/
|
|
15
|
-
export declare function generateHeaderElements<T extends DataListObject>(headers: DataListHeader<T>): DataListItemTypeFromHeader<DataListHeader<T>> | undefined;
|
|
15
|
+
export declare function generateHeaderElements<T extends DataListObject>(headers: DataListHeader<T>): DataListItemTypeFromHeader<T, DataListHeader<T>> | undefined;
|
|
16
16
|
interface UseDataListEmptyStateProps {
|
|
17
17
|
readonly children?: ReactElement | ReactElement[];
|
|
18
18
|
readonly isFilterApplied: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.26.
|
|
3
|
+
"version": "4.26.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"> 1%",
|
|
85
85
|
"IE 10"
|
|
86
86
|
],
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "535d5a01bbcd69430f027660cb2e2b5de058a31e"
|
|
88
88
|
}
|