@jobber/components 4.26.3 → 4.26.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/DataList/DataList.const.d.ts +2 -0
- package/dist/DataList/DataList.d.ts +5 -18
- package/dist/DataList/DataList.types.d.ts +22 -0
- package/dist/DataList/DataList.utils.d.ts +25 -0
- package/dist/DataList/components/DataListLayout/DataListLayout.d.ts +6 -0
- package/dist/DataList/components/DataListLayout/index.d.ts +1 -0
- package/dist/DataList/storyUtils.d.ts +38 -0
- package/package.json +2 -2
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @default false
|
|
6
|
-
*/
|
|
7
|
-
loading?: boolean;
|
|
8
|
-
items: any[];
|
|
9
|
-
/**
|
|
10
|
-
* Temporary prop for setting default state for if filters are applied
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
filterApplied?: boolean;
|
|
14
|
-
children?: React.ReactElement | React.ReactElement[];
|
|
15
|
-
}
|
|
16
|
-
export declare const EMPTY_FILTER_RESULTS_MESSAGE = "No Results for Selected Filters";
|
|
17
|
-
export declare const EMPTY_FILTER_RESULTS_ACTION_LABEL = "Clear Filters";
|
|
18
|
-
export declare function DataList({ loading, items, filterApplied, children, }: DataListProps): JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DataListLayout } from "./components/DataListLayout";
|
|
3
|
+
import { DataListObject, DataListProps } from "./DataList.types";
|
|
4
|
+
export declare function DataList<T extends DataListObject>({ data, headers, loading, filterApplied, children, }: DataListProps<T>): JSX.Element;
|
|
19
5
|
export declare namespace DataList {
|
|
6
|
+
var Layout: typeof DataListLayout;
|
|
20
7
|
var EmptyState: typeof import("./components/EmptyState").EmptyState;
|
|
21
8
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
export type DataListItemType<T extends DataListObject[]> = Record<keyof T[number], ReactElement>;
|
|
3
|
+
export type DataListItemTypeFromHeader<T extends DataListHeader<T>> = Record<keyof T, ReactElement>;
|
|
4
|
+
export type DataListObject = Record<string, ReactNode | Date>;
|
|
5
|
+
export type DataListHeader<T extends DataListObject> = {
|
|
6
|
+
readonly [K in keyof T]?: string;
|
|
7
|
+
};
|
|
8
|
+
export interface DataListProps<T extends DataListObject> {
|
|
9
|
+
readonly data: T[];
|
|
10
|
+
readonly headers: DataListHeader<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Tell the DataList if the data loading
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
readonly loading?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Temporary prop for setting default state for if filters are applied
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
readonly filterApplied?: boolean;
|
|
21
|
+
readonly children: ReactElement | ReactElement[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { ReactElement } from "react";
|
|
2
|
+
import { DataListHeader, DataListItemType, DataListItemTypeFromHeader, DataListObject } from "./DataList.types";
|
|
3
|
+
import { EmptyStateProps } from "./components/EmptyState";
|
|
4
|
+
/**
|
|
5
|
+
* Return the child component that matches the `type` provided
|
|
6
|
+
*/
|
|
7
|
+
export declare function getCompoundComponent<T>(children: ReactElement | ReactElement[], type: ReactElement<T>["type"]): ReactElement<T> | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Generate the default elements the DataList would use on the data provided.
|
|
10
|
+
*/
|
|
11
|
+
export declare function generateListItemElements<T extends DataListObject>(data: T[]): DataListItemType<T[]>[];
|
|
12
|
+
/**
|
|
13
|
+
* Generate the header elements with the default styling
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateHeaderElements<T extends DataListObject>(headers: DataListHeader<T>): DataListItemTypeFromHeader<DataListHeader<T>> | undefined;
|
|
16
|
+
interface UseDataListEmptyStateProps {
|
|
17
|
+
readonly children?: ReactElement | ReactElement[];
|
|
18
|
+
readonly isFilterApplied: boolean;
|
|
19
|
+
readonly setIsFilterApplied: (isFilterApplied: boolean) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Modify EmptyState to include an empty filter results when filtering happens
|
|
23
|
+
*/
|
|
24
|
+
export declare function generateDataListEmptyState({ children, isFilterApplied, setIsFilterApplied, }: UseDataListEmptyStateProps): React.ReactElement<EmptyStateProps> | undefined;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DataListItemType, DataListObject } from "../../DataList.types";
|
|
3
|
+
export interface DataListLayoutProps<T extends DataListObject> {
|
|
4
|
+
children: (item: DataListItemType<T[]>) => JSX.Element;
|
|
5
|
+
}
|
|
6
|
+
export declare function DataListLayout<T extends DataListObject>(_: DataListLayoutProps<T>): JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DataListLayout";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ApolloClient } from "@apollo/client";
|
|
2
|
+
export interface ListQueryType {
|
|
3
|
+
allPeople: {
|
|
4
|
+
__typename?: "PeopleConnection";
|
|
5
|
+
pageInfo: {
|
|
6
|
+
hasNextPage: boolean;
|
|
7
|
+
endCursor: string;
|
|
8
|
+
};
|
|
9
|
+
edges: Array<{
|
|
10
|
+
__typename?: "PeopleEdge";
|
|
11
|
+
node: {
|
|
12
|
+
created: string;
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
gender: string;
|
|
16
|
+
hairColor: string;
|
|
17
|
+
skinColor: string;
|
|
18
|
+
homeworld: {
|
|
19
|
+
name: string;
|
|
20
|
+
id: string;
|
|
21
|
+
population: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
cursor: string;
|
|
25
|
+
}>;
|
|
26
|
+
totalCount?: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export type ListEdges = ListQueryType["allPeople"]["edges"];
|
|
30
|
+
export type ListNode = ListEdges[number]["node"];
|
|
31
|
+
export declare const LIST_QUERY: import("@apollo/client").DocumentNode;
|
|
32
|
+
export declare const apolloClient: ApolloClient<import("@apollo/client").NormalizedCacheObject>;
|
|
33
|
+
interface LoadingState {
|
|
34
|
+
loadingStatus: string;
|
|
35
|
+
loading: boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare function getLoadingState(loadingInitialContent: boolean, loadingRefresh: boolean, loadingNextPage: boolean): LoadingState;
|
|
38
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.26.
|
|
3
|
+
"version": "4.26.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"> 1%",
|
|
84
84
|
"IE 10"
|
|
85
85
|
],
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "bf27bb2276b747f43c4f7ba7be282d08c0b036b3"
|
|
87
87
|
}
|