@tap-payments/os-micro-frontend-shared 0.0.234-test.2-test.3 → 0.0.235-test.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.
|
@@ -4,7 +4,7 @@ interface StatusBarProps<IStatus extends TableHeaderStatus | TableHeaderStatus[]
|
|
|
4
4
|
status?: IStatus;
|
|
5
5
|
availableStatuses?: AvailableStatus<IStatus>[];
|
|
6
6
|
isFilteredIdsShown?: boolean;
|
|
7
|
-
onStatusChange?: (status
|
|
7
|
+
onStatusChange?: (status?: IStatus) => void;
|
|
8
8
|
}
|
|
9
9
|
declare function StatusBar<IStatus extends TableHeaderStatus | TableHeaderStatus[] = undefined>({ isFilteredIdsShown, onStatusChange, availableStatuses, status, }: StatusBarProps<IStatus>): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
declare const _default: typeof StatusBar;
|
|
@@ -20,19 +20,19 @@ function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, stat
|
|
|
20
20
|
const getButtonStatus = useCallback((buttonStatus) => {
|
|
21
21
|
return buttonStatus === status && !isFilteredIdsShown ? 'active' : 'inActive';
|
|
22
22
|
}, [status, isFilteredIdsShown]);
|
|
23
|
-
const
|
|
23
|
+
const handleStatusChange = useCallback((selected) => {
|
|
24
24
|
onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange(selected);
|
|
25
25
|
}, [onStatusChange]);
|
|
26
26
|
return (_jsx(_Fragment, { children: availableStatuses === null || availableStatuses === void 0 ? void 0 : availableStatuses.map((_a, index) => {
|
|
27
27
|
var _b, _c;
|
|
28
28
|
var { render } = _a, s = __rest(_a, ["render"]);
|
|
29
29
|
if (render) {
|
|
30
|
-
return _jsx(Fragment, { children: render(status,
|
|
30
|
+
return (_jsx(Fragment, { children: render({ status: status, onChange: handleStatusChange }, Object.assign(Object.assign({}, s), { index })) }, `custom-status-slot-${index}`));
|
|
31
31
|
}
|
|
32
32
|
if (!Array.isArray(s.status)) {
|
|
33
33
|
return (_createElement(StatusButton, Object.assign({}, s, { key: `status-button-array-${s.status}`, variant: getButtonStatus(s.status), onClick: () => {
|
|
34
34
|
if (!Array.isArray(s.status)) {
|
|
35
|
-
|
|
35
|
+
handleStatusChange(s.status);
|
|
36
36
|
}
|
|
37
37
|
} })));
|
|
38
38
|
}
|
|
@@ -40,11 +40,11 @@ function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, stat
|
|
|
40
40
|
const variant = isCurrentStatusDropdown ? 'active' : 'inActive';
|
|
41
41
|
const statusLabel = isCurrentStatusDropdown && !isMultiSelection ? status : s.status[0];
|
|
42
42
|
return (_jsx("div", { children: _jsx(StatusButton, Object.assign({}, s, { label: t(statusLabel || ''), variant: variant, onButtonBodyClick: (buttonStatus) => {
|
|
43
|
-
|
|
43
|
+
handleStatusChange(buttonStatus);
|
|
44
44
|
}, dropdownOptions: s.status.map((stat) => ({
|
|
45
45
|
label: t(stat || ''),
|
|
46
46
|
onClick: () => {
|
|
47
|
-
|
|
47
|
+
handleStatusChange(stat);
|
|
48
48
|
},
|
|
49
49
|
status: stat,
|
|
50
50
|
})) })) }, (_c = s === null || s === void 0 ? void 0 : s.status) === null || _c === void 0 ? void 0 : _c[0]));
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import { StatusButtonProps } from '../StatusButton';
|
|
3
3
|
import { TableHeaderStatus } from '../../types/index.js';
|
|
4
4
|
export type AvailableStatus<T extends TableHeaderStatus | TableHeaderStatus[] = undefined> = StatusButtonProps & {
|
|
5
|
-
status
|
|
6
|
-
render?: <IStatus extends T>(
|
|
5
|
+
status?: T;
|
|
6
|
+
render?: <IStatus extends T>(controls: {
|
|
7
|
+
status: IStatus;
|
|
8
|
+
onChange: (selected?: AvailableStatus<T>['status']) => void;
|
|
9
|
+
}, options?: Omit<AvailableStatus<T>, 'render'> & {
|
|
10
|
+
index: number;
|
|
11
|
+
}) => React.ReactNode;
|
|
7
12
|
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.0.235-test.1",
|
|
5
|
+
"testVersion": 1,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|