@jobber/components 6.4.1 → 6.5.0
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.types.d.ts +7 -0
- package/dist/DataList/components/DataListEmptyState/index.cjs +1 -0
- package/dist/DataList/components/DataListEmptyState/index.mjs +1 -0
- package/dist/DataList/index.d.ts +1 -1
- package/dist/DataListEmptyState-cjs.js +8 -5
- package/dist/DataListEmptyState-es.js +8 -5
- package/package.json +2 -2
|
@@ -192,6 +192,13 @@ export interface DataListEmptyStateProps {
|
|
|
192
192
|
* to the DataList component.
|
|
193
193
|
*/
|
|
194
194
|
readonly type?: "filtered" | "empty";
|
|
195
|
+
/**
|
|
196
|
+
* Custom render function for the empty state.
|
|
197
|
+
*
|
|
198
|
+
* If provided, this function will be used to render the empty state instead
|
|
199
|
+
* of the default rendering logic.
|
|
200
|
+
*/
|
|
201
|
+
readonly customRender?: (emptyState: Omit<DataListEmptyStateProps, "customRender">) => ReactNode;
|
|
195
202
|
}
|
|
196
203
|
export interface DataListContextProps<T extends DataListObject> extends DataListProps<T> {
|
|
197
204
|
readonly filterComponent?: ReactElement<DataListFiltersProps>;
|
package/dist/DataList/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./DataList";
|
|
2
|
-
export { DataListItemType, DataListObject, DataListSorting, DataListSortable, DataListSelectedType, DataListSelectedAllType, } from "./DataList.types";
|
|
2
|
+
export { DataListItemType, DataListObject, DataListSorting, DataListSortable, DataListSelectedType, DataListSelectedAllType, DataListEmptyStateProps, } from "./DataList.types";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-cjs.js');
|
|
3
4
|
var React = require('react');
|
|
4
5
|
var DataListContext = require('./DataListContext-cjs.js');
|
|
5
6
|
var Text = require('./Text-cjs.js');
|
|
@@ -14,21 +15,23 @@ function DataListEmptyState(_) {
|
|
|
14
15
|
}
|
|
15
16
|
function InternalDataListEmptyState() {
|
|
16
17
|
const { emptyStateComponents: components, filtered } = React.useContext(DataListContext.DataListContext);
|
|
17
|
-
const
|
|
18
|
-
return (React.createElement("div", { className: styles.emptyStateWrapper },
|
|
19
|
-
React.createElement(Text.Text, { align: "center" }, message),
|
|
20
|
-
renderButton(action)));
|
|
21
|
-
function
|
|
18
|
+
const _a = getEmptyStateContent(), { customRender } = _a, contentProps = tslib_es6.__rest(_a, ["customRender"]);
|
|
19
|
+
return (React.createElement("div", { className: styles.emptyStateWrapper }, customRender ? (customRender(Object.assign({}, contentProps))) : (React.createElement(React.Fragment, null,
|
|
20
|
+
React.createElement(Text.Text, { align: "center" }, contentProps.message),
|
|
21
|
+
renderButton(contentProps.action)))));
|
|
22
|
+
function getEmptyStateContent() {
|
|
22
23
|
const { defaultEmptyState, filteredEmptyState } = getEmptyStates(components);
|
|
23
24
|
if (filtered) {
|
|
24
25
|
return {
|
|
25
26
|
message: (filteredEmptyState === null || filteredEmptyState === void 0 ? void 0 : filteredEmptyState.props.message) || DataList_const.EMPTY_FILTER_RESULTS_MESSAGE,
|
|
26
27
|
action: filteredEmptyState === null || filteredEmptyState === void 0 ? void 0 : filteredEmptyState.props.action,
|
|
28
|
+
customRender: filteredEmptyState === null || filteredEmptyState === void 0 ? void 0 : filteredEmptyState.props.customRender,
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
31
|
return {
|
|
30
32
|
message: (defaultEmptyState === null || defaultEmptyState === void 0 ? void 0 : defaultEmptyState.props.message) || DataList_const.EMPTY_RESULTS_MESSAGE,
|
|
31
33
|
action: defaultEmptyState === null || defaultEmptyState === void 0 ? void 0 : defaultEmptyState.props.action,
|
|
34
|
+
customRender: defaultEmptyState === null || defaultEmptyState === void 0 ? void 0 : defaultEmptyState.props.customRender,
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
37
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _ as __rest } from './tslib.es6-es.js';
|
|
1
2
|
import React, { useContext, cloneElement } from 'react';
|
|
2
3
|
import { D as DataListContext } from './DataListContext-es.js';
|
|
3
4
|
import { T as Text } from './Text-es.js';
|
|
@@ -12,21 +13,23 @@ function DataListEmptyState(_) {
|
|
|
12
13
|
}
|
|
13
14
|
function InternalDataListEmptyState() {
|
|
14
15
|
const { emptyStateComponents: components, filtered } = useContext(DataListContext);
|
|
15
|
-
const
|
|
16
|
-
return (React.createElement("div", { className: styles.emptyStateWrapper },
|
|
17
|
-
React.createElement(Text, { align: "center" }, message),
|
|
18
|
-
renderButton(action)));
|
|
19
|
-
function
|
|
16
|
+
const _a = getEmptyStateContent(), { customRender } = _a, contentProps = __rest(_a, ["customRender"]);
|
|
17
|
+
return (React.createElement("div", { className: styles.emptyStateWrapper }, customRender ? (customRender(Object.assign({}, contentProps))) : (React.createElement(React.Fragment, null,
|
|
18
|
+
React.createElement(Text, { align: "center" }, contentProps.message),
|
|
19
|
+
renderButton(contentProps.action)))));
|
|
20
|
+
function getEmptyStateContent() {
|
|
20
21
|
const { defaultEmptyState, filteredEmptyState } = getEmptyStates(components);
|
|
21
22
|
if (filtered) {
|
|
22
23
|
return {
|
|
23
24
|
message: (filteredEmptyState === null || filteredEmptyState === void 0 ? void 0 : filteredEmptyState.props.message) || EMPTY_FILTER_RESULTS_MESSAGE,
|
|
24
25
|
action: filteredEmptyState === null || filteredEmptyState === void 0 ? void 0 : filteredEmptyState.props.action,
|
|
26
|
+
customRender: filteredEmptyState === null || filteredEmptyState === void 0 ? void 0 : filteredEmptyState.props.customRender,
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
29
|
return {
|
|
28
30
|
message: (defaultEmptyState === null || defaultEmptyState === void 0 ? void 0 : defaultEmptyState.props.message) || EMPTY_RESULTS_MESSAGE,
|
|
29
31
|
action: defaultEmptyState === null || defaultEmptyState === void 0 ? void 0 : defaultEmptyState.props.action,
|
|
32
|
+
customRender: defaultEmptyState === null || defaultEmptyState === void 0 ? void 0 : defaultEmptyState.props.customRender,
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -487,5 +487,5 @@
|
|
|
487
487
|
"> 1%",
|
|
488
488
|
"IE 10"
|
|
489
489
|
],
|
|
490
|
-
"gitHead": "
|
|
490
|
+
"gitHead": "33aaa4d714b638f6272b2dcf4a2cfe2525b595e6"
|
|
491
491
|
}
|