@tap-payments/os-micro-frontend-shared 0.0.227-test.16 → 0.0.228-test.17
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.
- package/LICENSE +21 -21
- package/README.md +12 -12
- package/build/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/build/components/DropdownMenu/DropdownMenu.js +22 -22
- package/build/components/DropdownMenu/styles.d.ts +1 -0
- package/build/components/DropdownMenu/styles.js +16 -1
- package/build/components/DropdownMenu/type.d.ts +4 -0
- package/build/components/StatusBar/StatusBar.d.ts +3 -8
- package/build/components/StatusBar/StatusBar.js +45 -60
- package/build/components/StatusBar/index.d.ts +1 -0
- package/build/components/StatusBar/type.d.ts +2 -0
- package/build/components/StatusButton/StatusButton.js +13 -3
- package/build/components/StatusButton/type.d.ts +3 -0
- package/build/components/index.d.ts +1 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Tap Payments
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tap Payments
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# os-micro-frontend-shared
|
|
2
|
-
|
|
3
|
-
## Publishing Workflow
|
|
4
|
-
|
|
5
|
-
1. Update version in package.json
|
|
6
|
-
2. Commit changes
|
|
7
|
-
3. Create and push a tag:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm version patch # or minor, major
|
|
11
|
-
git push origin main --tags
|
|
12
|
-
```
|
|
1
|
+
# os-micro-frontend-shared
|
|
2
|
+
|
|
3
|
+
## Publishing Workflow
|
|
4
|
+
|
|
5
|
+
1. Update version in package.json
|
|
6
|
+
2. Commit changes
|
|
7
|
+
3. Create and push a tag:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm version patch # or minor, major
|
|
11
|
+
git push origin main --tags
|
|
12
|
+
```
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IProps } from './type';
|
|
2
|
-
declare function Dropdown({ open, menuItems, anchorEl, onClose, selected, allowShadows, ...props }: IProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare function Dropdown({ open, menuItems, anchorEl, onClose, footer, selected, multiple, allowShadows, ...props }: IProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default Dropdown;
|
|
@@ -11,33 +11,33 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { Divider, Box, useTheme } from '@mui/material';
|
|
14
|
-
import { StyledListItemText, StyledMenu, StyledListItemIcon, StyledMenuItem } from './styles';
|
|
14
|
+
import { StyledListItemText, StyledMenu, StyledListItemIcon, StyledMenuItem, CheckboxStyled } from './styles';
|
|
15
15
|
function Dropdown(_a) {
|
|
16
|
-
var { open, menuItems, anchorEl, onClose, selected, allowShadows = true } = _a, props = __rest(_a, ["open", "menuItems", "anchorEl", "onClose", "selected", "allowShadows"]);
|
|
16
|
+
var { open, menuItems, anchorEl, onClose, footer, selected, multiple, allowShadows = true } = _a, props = __rest(_a, ["open", "menuItems", "anchorEl", "onClose", "footer", "selected", "multiple", "allowShadows"]);
|
|
17
17
|
const theme = useTheme();
|
|
18
|
-
return (
|
|
18
|
+
return (_jsxs(StyledMenu, Object.assign({ open: open, anchorEl: anchorEl, onClose: onClose, onContextMenu: (e) => {
|
|
19
19
|
e.preventDefault();
|
|
20
20
|
onClose();
|
|
21
|
-
} }, props, { className: "tap-dropdown", minWidth: (anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.clientWidth) || 'auto' }, { children: menuItems.map((item, idx) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
} }, props, { className: "tap-dropdown", minWidth: (anchorEl === null || anchorEl === void 0 ? void 0 : anchorEl.clientWidth) || 'auto' }, { children: [menuItems.map((item, idx) => {
|
|
22
|
+
if (item.name === 'divider') {
|
|
23
|
+
return _jsx(Divider, { sx: { margin: '0 !important' } }, `${item.label}-${idx}`);
|
|
24
|
+
}
|
|
25
|
+
return (_jsx("div", { children: item.label && (_jsxs(StyledMenuItem, Object.assign({ alwaysShowRightAction: item.alwaysShowRightAction, onClick: (e) => {
|
|
26
|
+
if (item.onClick)
|
|
27
|
+
item.onClick(e);
|
|
28
|
+
}, onContextMenu: item.onRightClick, selected: item.selected, sx: Object.assign(Object.assign({ '&:hover': {
|
|
29
|
+
backgroundColor: 'transparent',
|
|
30
|
+
boxShadow: allowShadows ? theme.shadows[10] : 'none',
|
|
31
|
+
'& .sandbox-Icon': {
|
|
32
|
+
display: 'none',
|
|
33
|
+
},
|
|
34
|
+
'& .close-Icon': {
|
|
35
|
+
display: 'block !important',
|
|
36
|
+
},
|
|
37
|
+
} }, (idx === selected && {
|
|
29
38
|
backgroundColor: 'transparent',
|
|
30
39
|
boxShadow: allowShadows ? theme.shadows[10] : 'none',
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
'& .close-Icon': {
|
|
35
|
-
display: 'block !important',
|
|
36
|
-
},
|
|
37
|
-
} }, (idx === selected && {
|
|
38
|
-
backgroundColor: 'transparent',
|
|
39
|
-
boxShadow: allowShadows ? theme.shadows[10] : 'none',
|
|
40
|
-
})) }, { children: [item.icon && _jsx(StyledListItemIcon, { children: item.icon }), _jsx(StyledListItemText, { children: item.label }), _jsx(Box, Object.assign({ className: item.alwaysShowRightAction ? '' : 'menu-right-action' }, { children: item.rightAction && item.rightAction }))] }))) }, `${item.label}-${idx}`));
|
|
41
|
-
}) })));
|
|
40
|
+
})), item.sx) }, { children: [item.icon && _jsx(StyledListItemIcon, { children: item.icon }), multiple && _jsx(CheckboxStyled, { size: "small", checked: item.selected }), _jsx(StyledListItemText, { children: item.label }), _jsx(Box, Object.assign({ className: item.alwaysShowRightAction ? '' : 'menu-right-action' }, { children: item.rightAction && item.rightAction }))] }))) }, `${item.label}-${idx}`));
|
|
41
|
+
}), footer] })));
|
|
42
42
|
}
|
|
43
43
|
export default Dropdown;
|
|
@@ -16,3 +16,4 @@ export declare const StyledOption: import("@emotion/styled").StyledComponent<imp
|
|
|
16
16
|
export declare const StyledSelectComponent: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
17
17
|
export declare const StyledMenuTitle: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
18
18
|
export declare const StyledIconForDropDown: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
19
|
+
export declare const CheckboxStyled: import("@emotion/styled").StyledComponent<import("@mui/material").CheckboxProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Checkbox from '../Checkbox';
|
|
2
|
+
import { ListItemText, Menu, MenuItem, styled, ListItemIcon, Select, alpha } from '@mui/material';
|
|
2
3
|
export const StyledMenuItem = styled(MenuItem, {
|
|
3
4
|
shouldForwardProp: (prop) => prop !== 'alwaysShowRightAction',
|
|
4
5
|
})(({ theme, alwaysShowRightAction }) => ({
|
|
@@ -141,3 +142,17 @@ export const StyledIconForDropDown = styled('img')(() => ({
|
|
|
141
142
|
verticalAlign: 'middle',
|
|
142
143
|
boxSizing: 'border-box',
|
|
143
144
|
}));
|
|
145
|
+
export const CheckboxStyled = styled(Checkbox)(({ theme }) => ({
|
|
146
|
+
padding: 0,
|
|
147
|
+
paddingRight: '4px',
|
|
148
|
+
width: '14px !important',
|
|
149
|
+
svg: {
|
|
150
|
+
width: '12px !important',
|
|
151
|
+
height: '12px !important',
|
|
152
|
+
},
|
|
153
|
+
'&.Mui-disabled': {
|
|
154
|
+
'[data-testid="IndeterminateCheckBoxIcon"]': {
|
|
155
|
+
fill: alpha(theme.palette.common.black, 0.26),
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
}));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { type SxProps, type Theme } from '@mui/material/styles';
|
|
2
3
|
export interface MenuItemI {
|
|
3
4
|
label?: string | null | ReactNode;
|
|
4
5
|
name?: string;
|
|
@@ -9,6 +10,7 @@ export interface MenuItemI {
|
|
|
9
10
|
selected?: boolean;
|
|
10
11
|
rightAction?: ReactNode;
|
|
11
12
|
alwaysShowRightAction?: boolean;
|
|
13
|
+
sx?: SxProps<Theme>;
|
|
12
14
|
}
|
|
13
15
|
export interface IProps {
|
|
14
16
|
open: boolean;
|
|
@@ -18,4 +20,6 @@ export interface IProps {
|
|
|
18
20
|
style?: CSSProperties;
|
|
19
21
|
selected?: number;
|
|
20
22
|
allowShadows?: boolean;
|
|
23
|
+
multiple?: boolean;
|
|
24
|
+
footer?: React.ReactNode;
|
|
21
25
|
}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CurrencyOption } from '../MultiSelectStatusButton';
|
|
3
2
|
import { TableHeaderStatus } from '../../types/index.js';
|
|
4
3
|
import { AvailableStatus } from './type';
|
|
5
4
|
interface StatusBarProps {
|
|
6
|
-
status?: TableHeaderStatus;
|
|
5
|
+
status?: TableHeaderStatus | TableHeaderStatus[];
|
|
7
6
|
availableStatuses?: AvailableStatus[];
|
|
8
7
|
isFilteredIdsShown?: boolean;
|
|
9
|
-
onStatusChange?: (status:
|
|
10
|
-
onMultiSelectChange?: (status: TableHeaderStatus[]) => void;
|
|
11
|
-
currencyOptions?: CurrencyOption[];
|
|
12
|
-
selectedCurrencies?: TableHeaderStatus[];
|
|
13
|
-
enableMultiSelectCurrency?: boolean;
|
|
8
|
+
onStatusChange?: (status: StatusBarProps['status']) => void;
|
|
14
9
|
}
|
|
15
|
-
declare function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status,
|
|
10
|
+
declare function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status, }: StatusBarProps): import("react/jsx-runtime").JSX.Element;
|
|
16
11
|
declare const _default: import("react").MemoExoticComponent<typeof StatusBar>;
|
|
17
12
|
export default _default;
|
|
@@ -1,68 +1,53 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { createElement as _createElement } from "react";
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment
|
|
3
|
-
import { memo, useCallback,
|
|
13
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { Fragment, memo, useCallback, useMemo } from 'react';
|
|
4
15
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import MultiSelectStatusButton from '../MultiSelectStatusButton';
|
|
6
16
|
import StatusButton from '../StatusButton';
|
|
7
|
-
function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status,
|
|
17
|
+
function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status, }) {
|
|
8
18
|
const { t } = useTranslation();
|
|
9
|
-
const
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
if (status && multiSelectValues.length > 0) {
|
|
12
|
-
setMultiSelectValues([]);
|
|
13
|
-
}
|
|
14
|
-
}, [status, multiSelectValues.length]);
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
if (!status) {
|
|
17
|
-
setMultiSelectValues(selectedCurrencies);
|
|
18
|
-
}
|
|
19
|
-
}, [selectedCurrencies, status]);
|
|
19
|
+
const isMultiSelection = useMemo(() => Array.isArray(status), [status]);
|
|
20
20
|
const getButtonStatus = useCallback((buttonStatus) => {
|
|
21
|
-
if (multiSelectValues.length > 0) {
|
|
22
|
-
return 'inActive';
|
|
23
|
-
}
|
|
24
21
|
return buttonStatus === status && !isFilteredIdsShown ? 'active' : 'inActive';
|
|
25
|
-
}, [status, isFilteredIdsShown
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const variant = multiSelectValues.length > 0 ? 'inActive' : isCurrentStatusDropdown ? 'active' : 'inActive';
|
|
56
|
-
const statusLabel = isCurrentStatusDropdown ? status : s.status[0];
|
|
57
|
-
return (_jsx("div", { children: _jsx(StatusButton, Object.assign({}, s, { label: t(statusLabel || ''), variant: variant, onButtonBodyClick: (buttonStatus) => {
|
|
58
|
-
handleStatusChange(buttonStatus);
|
|
59
|
-
}, dropdownOptions: s.status.map((stat) => ({
|
|
60
|
-
label: t(stat || ''),
|
|
61
|
-
onClick: () => {
|
|
62
|
-
handleStatusChange(stat);
|
|
63
|
-
},
|
|
64
|
-
status: stat,
|
|
65
|
-
})) })) }, (_b = s === null || s === void 0 ? void 0 : s.status) === null || _b === void 0 ? void 0 : _b[0]));
|
|
66
|
-
})] }));
|
|
22
|
+
}, [status, isFilteredIdsShown]);
|
|
23
|
+
const handleChange = useCallback((selected) => {
|
|
24
|
+
onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange(selected);
|
|
25
|
+
}, [onStatusChange]);
|
|
26
|
+
return (_jsx(_Fragment, { children: availableStatuses === null || availableStatuses === void 0 ? void 0 : availableStatuses.map((_a, index) => {
|
|
27
|
+
var _b, _c;
|
|
28
|
+
var { render } = _a, s = __rest(_a, ["render"]);
|
|
29
|
+
if (render) {
|
|
30
|
+
return _jsx(Fragment, { children: render(status, handleChange) }, `custom-status-slot-${index}`);
|
|
31
|
+
}
|
|
32
|
+
if (!Array.isArray(s.status)) {
|
|
33
|
+
return (_createElement(StatusButton, Object.assign({}, s, { key: `status-button-array-${s.status}`, variant: getButtonStatus(s.status), onClick: () => {
|
|
34
|
+
if (!Array.isArray(s.status)) {
|
|
35
|
+
handleChange(s.status);
|
|
36
|
+
}
|
|
37
|
+
} })));
|
|
38
|
+
}
|
|
39
|
+
const isCurrentStatusDropdown = !isMultiSelection && ((_b = s.status) === null || _b === void 0 ? void 0 : _b.includes(status || ''));
|
|
40
|
+
const variant = isCurrentStatusDropdown ? 'active' : 'inActive';
|
|
41
|
+
const statusLabel = isCurrentStatusDropdown && !isMultiSelection ? status : s.status[0];
|
|
42
|
+
return (_jsx("div", { children: _jsx(StatusButton, Object.assign({}, s, { label: t(statusLabel || ''), variant: variant, onButtonBodyClick: (buttonStatus) => {
|
|
43
|
+
handleChange(buttonStatus);
|
|
44
|
+
}, dropdownOptions: s.status.map((stat) => ({
|
|
45
|
+
label: t(stat || ''),
|
|
46
|
+
onClick: () => {
|
|
47
|
+
handleChange(stat);
|
|
48
|
+
},
|
|
49
|
+
status: stat,
|
|
50
|
+
})) })) }, (_c = s === null || s === void 0 ? void 0 : s.status) === null || _c === void 0 ? void 0 : _c[0]));
|
|
51
|
+
}) }));
|
|
67
52
|
}
|
|
68
53
|
export default memo(StatusBar);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { StatusButtonProps } from '../StatusButton';
|
|
2
3
|
import { TableHeaderStatus } from '../../types/index.js';
|
|
3
4
|
export type AvailableStatus<T = undefined> = StatusButtonProps & {
|
|
4
5
|
status: T | TableHeaderStatus | (TableHeaderStatus | T)[];
|
|
6
|
+
render?: (status: AvailableStatus['status'], onChange: (selected: AvailableStatus['status']) => void) => React.ReactNode;
|
|
5
7
|
};
|
|
@@ -19,7 +19,7 @@ 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 } = props, restProps = __rest(props, ["variant", "badgeCount", "icon", "label", "dropdownOptions", "onButtonBodyClick"]);
|
|
22
|
+
const { variant = 'inActive', badgeCount, icon, label, dropdownOptions, multiple, onButtonBodyClick, onConfirm, onCancel } = props, restProps = __rest(props, ["variant", "badgeCount", "icon", "label", "dropdownOptions", "multiple", "onButtonBodyClick", "onConfirm", "onCancel"]);
|
|
23
23
|
const [buttonClicks, setButtonClicks] = useState(0);
|
|
24
24
|
const { t } = useTranslation();
|
|
25
25
|
const buttonRef = useRef(null);
|
|
@@ -61,14 +61,24 @@ const StatusButton = memo((props) => {
|
|
|
61
61
|
const handleMenuItemClick = useCallback((item) => (e) => {
|
|
62
62
|
var _a;
|
|
63
63
|
(_a = item === null || item === void 0 ? void 0 : item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, e);
|
|
64
|
+
if (multiple)
|
|
65
|
+
return;
|
|
64
66
|
setSelectedStatus(item.status);
|
|
65
67
|
handleDropdownClose();
|
|
66
|
-
}, [handleDropdownClose]);
|
|
68
|
+
}, [handleDropdownClose, multiple]);
|
|
69
|
+
const handleConfirm = useCallback(() => {
|
|
70
|
+
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
|
|
71
|
+
handleDropdownClose();
|
|
72
|
+
}, [onConfirm, handleDropdownClose]);
|
|
73
|
+
const handleCancel = useCallback(() => {
|
|
74
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
75
|
+
handleDropdownClose();
|
|
76
|
+
}, [onCancel, handleDropdownClose]);
|
|
67
77
|
const menuItems = useMemo(() => (dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((item) => (Object.assign(Object.assign({}, item), { onClick: handleMenuItemClick(item) })))) || [], [dropdownOptions, handleMenuItemClick]);
|
|
68
78
|
const ButtonComponent = statusButtonVariants[variant];
|
|
69
79
|
const displayLabel = selectedStatus ? t(selectedStatus) : label;
|
|
70
80
|
return (_jsxs(_Fragment, { children: [_jsx(ButtonComponent, Object.assign({ "data-testid": "StatusButton" }, restProps, { ref: buttonRef, onClick: handleButtonClick, sx: Object.assign({}, (hasDropdown && {
|
|
71
81
|
paddingInlineEnd: '27px',
|
|
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 }))] }));
|
|
82
|
+
})) }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [statusIcon, displayLabel, statusBadge] })), dropdownIcon && _jsx(ChevronContainer, { children: dropdownIcon })] }) })), isDropdownOpen && hasDropdown && (_jsx(StyledDropdown, { multiple: multiple, open: isDropdownOpen, onClose: handleDropdownClose, anchorEl: anchorEl, menuItems: menuItems }))] }));
|
|
73
83
|
});
|
|
74
84
|
export default StatusButton;
|
|
@@ -16,6 +16,9 @@ export interface StatusButtonProps extends Omit<ButtonProps, 'variant' | 'childr
|
|
|
16
16
|
dropdownOptions?: Array<MenuItemI & {
|
|
17
17
|
status: TableHeaderStatus;
|
|
18
18
|
}>;
|
|
19
|
+
multiple?: boolean;
|
|
20
|
+
onConfirm?: () => void;
|
|
21
|
+
onCancel?: () => void;
|
|
19
22
|
}
|
|
20
23
|
export interface ChevronIconProps {
|
|
21
24
|
isActive?: boolean;
|
|
@@ -87,7 +87,7 @@ export { default as OTPInput } from './OTPInput';
|
|
|
87
87
|
export { default as FlagDetails } from './FlagDetails';
|
|
88
88
|
export { default as TapLoader } from './Loaders';
|
|
89
89
|
export { default as Error } from './Error';
|
|
90
|
-
export { default as StatusBar } from './StatusBar';
|
|
90
|
+
export { default as StatusBar, type AvailableStatus } from './StatusBar';
|
|
91
91
|
export { default as MultiSelectStatusButton, type CurrencyOption, type MultiSelectStatusButtonProps } from './MultiSelectStatusButton';
|
|
92
92
|
export * from './Chip';
|
|
93
93
|
export * from './StatusGroupChips';
|
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.228-test.17",
|
|
5
|
+
"testVersion": 17,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|