@tap-payments/os-micro-frontend-shared 0.1.20-test.1 → 0.1.20-test.3

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,23 @@ 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
+ if (!s.status)
40
+ return null;
41
+ const formattedStatuses = (s.status.map((item) => (typeof item === 'string' ? { value: item } : item)).filter(Boolean) ||
42
+ []);
43
+ const isCurrentStatusDropdown = !isMultiSelection && !!status && formattedStatuses.some((item) => (item === null || item === void 0 ? void 0 : item.value) === status);
40
44
  const variant = isCurrentStatusDropdown ? 'active' : 'inActive';
41
- const statusLabel = isCurrentStatusDropdown && !isMultiSelection ? status : s.status[0];
45
+ const statusLabel = isCurrentStatusDropdown && !isMultiSelection ? status : (_b = formattedStatuses[0]) === null || _b === void 0 ? void 0 : _b.value;
42
46
  return (_jsx("div", { children: _jsx(StatusButton, Object.assign({}, s, { label: t(statusLabel || ''), variant: variant, onButtonBodyClick: (buttonStatus) => {
43
47
  handleStatusChange(buttonStatus);
44
- }, dropdownOptions: s.status.map((stat) => ({
45
- label: t(stat || ''),
48
+ }, dropdownOptions: formattedStatuses.map((stat) => ({
49
+ label: t((stat === null || stat === void 0 ? void 0 : stat.value) || ''),
46
50
  onClick: () => {
47
- handleStatusChange(stat);
51
+ handleStatusChange(stat.value);
48
52
  },
49
- status: stat,
50
- })) })) }, (_c = s === null || s === void 0 ? void 0 : s.status) === null || _c === void 0 ? void 0 : _c[0]));
53
+ status: stat === null || stat === void 0 ? void 0 : stat.value,
54
+ icon: stat.icon,
55
+ })) })) }, (_c = formattedStatuses[0]) === null || _c === void 0 ? void 0 : _c.value));
51
56
  }) }));
52
57
  }
53
58
  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?: 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,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.20-test.1",
5
- "testVersion": 1,
4
+ "version": "0.1.20-test.3",
5
+ "testVersion": 3,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",