@tap-payments/os-micro-frontend-shared 0.0.249 → 0.0.250-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.
@@ -1,5 +1,4 @@
1
- import type { SxProps } from '@mui/material/styles';
2
- import { Theme } from '@mui/system';
1
+ import type { SxProps, Theme } from '@mui/material/styles';
3
2
  export interface IconProps {
4
3
  src: string;
5
4
  onClick?: () => void;
@@ -1,7 +1,7 @@
1
1
  import { MouseEvent } from 'react';
2
2
  import { PopperProps } from '@mui/material/Popper';
3
3
  import type { CalenderMode, Timezone } from '../../types/index.js';
4
- import { SxProps } from '@mui/system';
4
+ import type { SxProps } from '@mui/material/styles';
5
5
  interface RangeCalendarProps {
6
6
  defaultDate: [Date, Date];
7
7
  onDateChange: (date: [Date, Date], timezoneOffset?: number) => void;
@@ -19,12 +19,12 @@ import { ChevronContainer, Label, LabelWrapper, StyledStatusIcon, StyledDropdown
19
19
  import { statusButtonIcons } from './constant';
20
20
  const StatusButton = memo((props) => {
21
21
  var _a;
22
- const { variant = 'inActive', badgeCount, icon, label, dropdownOptions, onButtonBodyClick, defaultSelectedStatus } = props, restProps = __rest(props, ["variant", "badgeCount", "icon", "label", "dropdownOptions", "onButtonBodyClick", "defaultSelectedStatus"]);
22
+ const { variant = 'inActive', badgeCount, icon, label, dropdownOptions, onButtonBodyClick } = props, restProps = __rest(props, ["variant", "badgeCount", "icon", "label", "dropdownOptions", "onButtonBodyClick"]);
23
23
  const [buttonClicks, setButtonClicks] = useState(0);
24
24
  const { t } = useTranslation();
25
25
  const buttonRef = useRef(null);
26
26
  const [anchorEl, setAnchorEl] = useState(null);
27
- const [selectedStatus, setSelectedStatus] = useState(defaultSelectedStatus !== null && defaultSelectedStatus !== void 0 ? defaultSelectedStatus : (_a = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions[0]) === null || _a === void 0 ? void 0 : _a.status);
27
+ const [selectedStatus, setSelectedStatus] = useState((_a = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions[0]) === null || _a === void 0 ? void 0 : _a.status);
28
28
  const hasDropdown = useMemo(() => Boolean(dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.length), [dropdownOptions]);
29
29
  const isDropdownOpen = Boolean(anchorEl) && buttonClicks > 1;
30
30
  const isActiveVariant = variant === 'active';
@@ -66,8 +66,9 @@ const StatusButton = memo((props) => {
66
66
  }, [handleDropdownClose]);
67
67
  const menuItems = useMemo(() => (dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((item) => (Object.assign(Object.assign({}, item), { onClick: handleMenuItemClick(item) })))) || [], [dropdownOptions, handleMenuItemClick]);
68
68
  const ButtonComponent = statusButtonVariants[variant];
69
+ const displayLabel = selectedStatus ? t(selectedStatus) : label;
69
70
  return (_jsxs(_Fragment, { children: [_jsx(ButtonComponent, Object.assign({ "data-testid": "StatusButton" }, restProps, { ref: buttonRef, onClick: handleButtonClick, sx: Object.assign({}, (hasDropdown && {
70
71
  paddingInlineEnd: '27px',
71
- })) }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [statusIcon, selectedStatus ? t(selectedStatus) : label, statusBadge] })), dropdownIcon && _jsx(ChevronContainer, { children: dropdownIcon })] }) })), isDropdownOpen && hasDropdown && (_jsx(StyledDropdown, { open: isDropdownOpen, onClose: handleDropdownClose, anchorEl: anchorEl, menuItems: menuItems }))] }));
72
+ })) }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [statusIcon, displayLabel, statusBadge] })), dropdownIcon && _jsx(ChevronContainer, { children: dropdownIcon })] }) })), isDropdownOpen && hasDropdown && (_jsx(StyledDropdown, { open: isDropdownOpen, onClose: handleDropdownClose, anchorEl: anchorEl, menuItems: menuItems }))] }));
72
73
  });
73
74
  export default StatusButton;
@@ -13,7 +13,6 @@ export interface StatusButtonProps extends Omit<ButtonProps, 'variant' | 'childr
13
13
  showDropdownIcon?: boolean;
14
14
  totalCount?: number;
15
15
  onButtonBodyClick?: (status: TableHeaderStatus) => void;
16
- defaultSelectedStatus?: TableHeaderStatus;
17
16
  dropdownOptions?: Array<MenuItemI & {
18
17
  status: TableHeaderStatus;
19
18
  }>;
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.249",
5
- "testVersion": 0,
4
+ "version": "0.0.250-test.3",
5
+ "testVersion": 3,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -72,10 +72,7 @@
72
72
  "prepare": "husky"
73
73
  },
74
74
  "dependencies": {
75
- "@emotion/react": "^11.11.0",
76
- "@emotion/styled": "^11.11.0",
77
75
  "@hookform/resolvers": "^3.3.1",
78
- "@mui/material": "^5.12.3",
79
76
  "@uiw/react-json-view": "^2.0.0-alpha.16",
80
77
  "axios": "^1.4.0",
81
78
  "dayjs": "^1.11.8",
@@ -83,16 +80,13 @@
83
80
  "i18next": "^22.4.15",
84
81
  "memoize-one": "^6.0.0",
85
82
  "re-resizable": "^6.9.9",
86
- "react": "^18.2.0",
87
83
  "react-currency-input-field": "^3.6.11",
88
- "react-dom": "^18.2.0",
89
84
  "react-draggable": "^4.4.6",
90
85
  "react-dropzone": "^14.2.3",
91
86
  "react-hook-form": "^7.45.4",
92
87
  "react-hot-toast": "^2.4.1",
93
88
  "react-i18next": "^12.2.2",
94
89
  "react-multi-date-picker": "^4.1.2",
95
- "react-router-dom": "^7.7.0",
96
90
  "react-virtualized-auto-sizer": "^1.0.20",
97
91
  "react-window": "^1.8.9",
98
92
  "react-window-infinite-loader": "^1.0.9",
@@ -120,7 +114,21 @@
120
114
  "typescript": "5.0.2",
121
115
  "typescript-eslint": "^8.18.2",
122
116
  "vite": "6.0.5",
123
- "vite-tsconfig-paths": "^4.2.0"
117
+ "vite-tsconfig-paths": "^4.2.0",
118
+ "react": "^18.2.0",
119
+ "react-dom": "^18.2.0",
120
+ "react-router-dom": "^7.7.0",
121
+ "@emotion/react": "^11.11.0",
122
+ "@emotion/styled": "^11.11.0",
123
+ "@mui/material": "^5.12.3"
124
+ },
125
+ "peerDependencies": {
126
+ "react": "^18.2.0",
127
+ "react-dom": "^18.2.0",
128
+ "react-router-dom": "^7.7.0",
129
+ "@emotion/react": "^11.11.0",
130
+ "@emotion/styled": "^11.11.0",
131
+ "@mui/material": "^5.12.3"
124
132
  },
125
133
  "lint-staged": {
126
134
  "src/**/*.{ts,tsx,json,js,jsx}": [
@@ -131,4 +139,4 @@
131
139
  "publishConfig": {
132
140
  "registry": "https://registry.npmjs.org/"
133
141
  }
134
- }
142
+ }