@tap-payments/os-micro-frontend-shared 0.1.25 → 0.1.26-test.2
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.
|
@@ -36,18 +36,24 @@ function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, stat
|
|
|
36
36
|
}
|
|
37
37
|
} })));
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const statusItems = s.status;
|
|
40
|
+
if (!statusItems)
|
|
41
|
+
return null;
|
|
42
|
+
const formattedStatuses = (statusItems.filter(Boolean).map((item) => (typeof item === 'string' ? { value: item } : item)) ||
|
|
43
|
+
[]);
|
|
44
|
+
const isCurrentStatusDropdown = !isMultiSelection && !!status && formattedStatuses.some((item) => (item === null || item === void 0 ? void 0 : item.value) === status);
|
|
40
45
|
const variant = isCurrentStatusDropdown ? 'active' : 'inActive';
|
|
41
|
-
const statusLabel = isCurrentStatusDropdown && !isMultiSelection ? status :
|
|
46
|
+
const statusLabel = isCurrentStatusDropdown && !isMultiSelection ? status : (_b = formattedStatuses[0]) === null || _b === void 0 ? void 0 : _b.value;
|
|
42
47
|
return (_jsx("div", { children: _jsx(StatusButton, Object.assign({}, s, { label: t(statusLabel || ''), variant: variant, onButtonBodyClick: (buttonStatus) => {
|
|
43
48
|
handleStatusChange(buttonStatus);
|
|
44
|
-
}, dropdownOptions:
|
|
45
|
-
label: t(stat || ''),
|
|
49
|
+
}, dropdownOptions: formattedStatuses.map((stat) => ({
|
|
50
|
+
label: t((stat === null || stat === void 0 ? void 0 : stat.value) || ''),
|
|
46
51
|
onClick: () => {
|
|
47
|
-
handleStatusChange(stat);
|
|
52
|
+
handleStatusChange(stat.value);
|
|
48
53
|
},
|
|
49
|
-
status: stat,
|
|
50
|
-
|
|
54
|
+
status: stat === null || stat === void 0 ? void 0 : stat.value,
|
|
55
|
+
icon: stat.icon,
|
|
56
|
+
})) })) }, (_c = formattedStatuses[0]) === null || _c === void 0 ? void 0 : _c.value));
|
|
51
57
|
}) }));
|
|
52
58
|
}
|
|
53
59
|
export default memo(StatusBar);
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { StatusButtonProps } from '../StatusButton';
|
|
3
3
|
import { TableHeaderStatus } from '../../types/index.js';
|
|
4
|
+
export type DetailedStatusItem<T> = {
|
|
5
|
+
value: T extends Array<unknown> ? T[number] : T;
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
};
|
|
4
8
|
export type AvailableStatus<T extends TableHeaderStatus | TableHeaderStatus[] = undefined> = StatusButtonProps & {
|
|
5
|
-
status?: T;
|
|
9
|
+
status?: T | DetailedStatusItem<T>[];
|
|
6
10
|
render?: <IStatus extends T>(controls: {
|
|
7
11
|
status: IStatus;
|
|
8
|
-
onChange: (selected?:
|
|
12
|
+
onChange: (selected?: T) => void;
|
|
9
13
|
}, options?: Omit<AvailableStatus<T>, 'render'> & {
|
|
10
14
|
index: number;
|
|
11
15
|
}) => React.ReactNode;
|
|
12
16
|
};
|
|
17
|
+
export type TerminalStatus = 'ACTIVE' | 'INACTIVE' | 'DEACTIVATED' | 'FAULTY' | 'CANCELLED' | 'ARCHIVED' | (string & {});
|
package/build/types/api.d.ts
CHANGED
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.1.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.26-test.2",
|
|
5
|
+
"testVersion": 2,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
@@ -131,4 +131,4 @@
|
|
|
131
131
|
"publishConfig": {
|
|
132
132
|
"registry": "https://registry.npmjs.org/"
|
|
133
133
|
}
|
|
134
|
-
}
|
|
134
|
+
}
|