@jobber/components 4.26.6 → 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<T extends DataListHeader<T>> = Record<keyof T, ReactElement>;
4
- export type DataListObject = Record<string, ReactNode | Date>;
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
- * Tell the DataList if the data loading
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;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface DataListTagsProps {
3
+ readonly items: string[];
4
+ }
5
+ export declare function DataListTags({ items }: DataListTagsProps): JSX.Element;
6
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./DataListTags";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "4.26.6",
3
+ "version": "4.26.8",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -64,6 +64,7 @@
64
64
  "autoprefixer": "^9.5.1",
65
65
  "copyfiles": "^2.4.1",
66
66
  "glob": "^7.1.4",
67
+ "jsdom-testing-mocks": "^1.9.0",
67
68
  "postcss": "^8.4.21",
68
69
  "postcss-import": "^12.0.1",
69
70
  "postcss-preset-env": "^8.3.0",
@@ -83,5 +84,5 @@
83
84
  "> 1%",
84
85
  "IE 10"
85
86
  ],
86
- "gitHead": "bb8c0e3fd1c1f6eb924ff0aac0ed2d75b11ecc5c"
87
+ "gitHead": "535d5a01bbcd69430f027660cb2e2b5de058a31e"
87
88
  }