@tap-payments/os-micro-frontend-shared 0.1.25 → 0.1.26

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 isCurrentStatusDropdown = !isMultiSelection && ((_b = s.status) === null || _b === void 0 ? void 0 : _b.includes(status || ''));
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 : s.status[0];
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: s.status.map((stat) => ({
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
- })) })) }, (_c = s === null || s === void 0 ? void 0 : s.status) === null || _c === void 0 ? void 0 : _c[0]));
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,3 +1,3 @@
1
1
  import StatusBar from './StatusBar';
2
2
  export default StatusBar;
3
- export { type AvailableStatus } from './type';
3
+ export { type AvailableStatus, type DetailedStatusItem } from './type';
@@ -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?: AvailableStatus<T>['status']) => void;
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 & {});
@@ -1 +1,7 @@
1
+ const test = [
2
+ {
3
+ status: [{ value: 'ACTIVE' }, { value: 'ACTIVE', icon: '' }],
4
+ },
5
+ ];
6
+ console.log(test);
1
7
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
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.25",
4
+ "version": "0.1.26",
5
5
  "testVersion": 0,
6
6
  "type": "module",
7
7
  "main": "build/index.js",