@tap-payments/os-micro-frontend-shared 0.0.233 → 0.0.234-test.2-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.
- 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 +6 -1
- package/build/components/MultiSelectStatusButton/MultiSelectStatusButton.js +15 -25
- package/build/components/MultiSelectStatusButton/type.d.ts +2 -0
- package/build/components/StatusBar/StatusBar.d.ts +6 -12
- package/build/components/StatusBar/StatusBar.js +45 -60
- package/build/components/StatusBar/index.d.ts +1 -0
- package/build/components/StatusBar/type.d.ts +4 -2
- package/build/components/TableCells/CustomCells/ReferenceCell/constant.d.ts +0 -20
- package/build/components/TableCells/CustomCells/ReferenceCell/constant.js +0 -8
- package/build/components/index.d.ts +2 -2
- package/build/components/index.js +1 -1
- package/build/constants/assets.d.ts +6 -0
- package/build/constants/assets.js +6 -0
- package/package.json +3 -3
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: [multiple && _jsx(CheckboxStyled, { size: "small", checked: item.selected }), 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
|
+
}), 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,6 @@
|
|
|
1
1
|
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { type SxProps, type Theme } from '@mui/material/styles';
|
|
3
|
+
import { StyledMenu } from './styles';
|
|
2
4
|
export interface MenuItemI {
|
|
3
5
|
label?: string | null | ReactNode;
|
|
4
6
|
name?: string;
|
|
@@ -9,8 +11,9 @@ export interface MenuItemI {
|
|
|
9
11
|
selected?: boolean;
|
|
10
12
|
rightAction?: ReactNode;
|
|
11
13
|
alwaysShowRightAction?: boolean;
|
|
14
|
+
sx?: SxProps<Theme>;
|
|
12
15
|
}
|
|
13
|
-
export interface IProps {
|
|
16
|
+
export interface IProps extends React.ComponentProps<typeof StyledMenu> {
|
|
14
17
|
open: boolean;
|
|
15
18
|
onClose: () => void;
|
|
16
19
|
menuItems: MenuItemI[];
|
|
@@ -18,4 +21,6 @@ export interface IProps {
|
|
|
18
21
|
style?: CSSProperties;
|
|
19
22
|
selected?: number;
|
|
20
23
|
allowShadows?: boolean;
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
footer?: React.ReactNode;
|
|
21
26
|
}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useState, useRef, useEffect } from 'react';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
3
|
import { Typography, Checkbox } from '@mui/material';
|
|
5
4
|
import { ChevronIcon } from '../StatusButton/ChevronIcon';
|
|
6
5
|
import StyledBadge, { BadgeVariants } from '../CountBadge';
|
|
7
|
-
import CountryFlag from '../CountryFlag';
|
|
8
6
|
import { formatNumber } from '../../utils/index.js';
|
|
9
|
-
import { closeXIcon
|
|
7
|
+
import { closeXIcon } from '../../constants/index.js';
|
|
10
8
|
import { ChevronContainer, Label, LabelWrapper, StyledDropdown, MenuItemContainer, CheckboxStyles, StyledStatusButton, ClearIcon, ChevronIconWrapper, } from './style';
|
|
11
9
|
function MultiSelectStatusButton({ options = [], selectedValues, onSelectionChange, label, variant = 'inActive' }) {
|
|
12
|
-
const { t } = useTranslation();
|
|
13
10
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
14
11
|
const buttonRef = useRef(null);
|
|
15
12
|
const [internalSelectedValues, setInternalSelectedValues] = useState(selectedValues);
|
|
@@ -57,13 +54,9 @@ function MultiSelectStatusButton({ options = [], selectedValues, onSelectionChan
|
|
|
57
54
|
: [...internalSelectedValues, optionStatus];
|
|
58
55
|
setInternalSelectedValues(newSelection);
|
|
59
56
|
};
|
|
60
|
-
const getDisplayLabel = () => {
|
|
61
|
-
return (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: "11px", variant: "inherit" }, { children: t('Currencies') })));
|
|
62
|
-
};
|
|
63
|
-
const countBadge = (_jsx(StyledBadge, Object.assign({ pointer: true, variant: variant === 'active' ? BadgeVariants.ACTIVE : BadgeVariants.INACTIVE }, { children: formatNumber(selectedValues.length > 0 ? selectedValues.length : options.length) })));
|
|
64
57
|
return (_jsxs(_Fragment, { children: [_jsx(StyledStatusButton, Object.assign({ buttonVariant: variant, ref: buttonRef, sx: {
|
|
65
58
|
paddingInlineEnd: '27px',
|
|
66
|
-
}, "data-testid": "MultiSelectStatusButton", onClick: handleDropdownClick, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), disabled: !options.length }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [
|
|
59
|
+
}, "data-testid": "MultiSelectStatusButton", onClick: handleDropdownClick, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), disabled: !options.length }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: "11px", variant: "inherit" }, { children: label })), _jsx(StyledBadge, Object.assign({ pointer: true, variant: variant === 'active' ? BadgeVariants.ACTIVE : BadgeVariants.INACTIVE }, { children: formatNumber(selectedValues.length > 0 ? selectedValues.length : options.length) }))] })), _jsxs(ChevronContainer, Object.assign({ onClick: isHovered && internalSelectedValues.length > 0 ? handleClearAll : undefined, sx: {
|
|
67
60
|
'&:hover': {
|
|
68
61
|
backgroundColor: 'transparent',
|
|
69
62
|
},
|
|
@@ -80,21 +73,18 @@ function MultiSelectStatusButton({ options = [], selectedValues, onSelectionChan
|
|
|
80
73
|
'&:hover': {
|
|
81
74
|
boxShadow: 'none !important',
|
|
82
75
|
},
|
|
83
|
-
}, menuItems: options.map((option) => {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
}) }))] }));
|
|
76
|
+
}, menuItems: options.map((option) => ({
|
|
77
|
+
label: (_jsxs(MenuItemContainer, { children: [_jsx(Checkbox, { checked: internalSelectedValues.includes(option.status), size: "small", sx: CheckboxStyles, onClick: (e) => {
|
|
78
|
+
var _a;
|
|
79
|
+
e.stopPropagation();
|
|
80
|
+
handleOptionToggle((_a = option.status) !== null && _a !== void 0 ? _a : '', e);
|
|
81
|
+
} }), option.render ? option.render() : _jsx(Typography, Object.assign({ variant: "body2" }, { children: option.name }))] })),
|
|
82
|
+
onClick: (e) => {
|
|
83
|
+
var _a;
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
handleOptionToggle((_a = option.status) !== null && _a !== void 0 ? _a : '', e);
|
|
87
|
+
},
|
|
88
|
+
})) }))] }));
|
|
99
89
|
}
|
|
100
90
|
export default memo(MultiSelectStatusButton);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { TableHeaderStatus } from '../../types/index.js';
|
|
2
3
|
export interface CurrencyOption {
|
|
3
4
|
code: string;
|
|
4
5
|
name: string;
|
|
5
6
|
flagCode?: string;
|
|
6
7
|
status: TableHeaderStatus;
|
|
8
|
+
render?: () => JSX.Element;
|
|
7
9
|
}
|
|
8
10
|
export interface MultiSelectStatusButtonProps {
|
|
9
11
|
options: CurrencyOption[];
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { CurrencyOption } from '../MultiSelectStatusButton';
|
|
3
1
|
import { TableHeaderStatus } from '../../types/index.js';
|
|
4
2
|
import { AvailableStatus } from './type';
|
|
5
|
-
interface StatusBarProps {
|
|
6
|
-
status?:
|
|
7
|
-
availableStatuses?: AvailableStatus[];
|
|
3
|
+
interface StatusBarProps<IStatus extends TableHeaderStatus | TableHeaderStatus[] = undefined> {
|
|
4
|
+
status?: IStatus;
|
|
5
|
+
availableStatuses?: AvailableStatus<IStatus>[];
|
|
8
6
|
isFilteredIdsShown?: boolean;
|
|
9
|
-
onStatusChange?: (status:
|
|
10
|
-
onMultiSelectChange?: (status: TableHeaderStatus[]) => void;
|
|
11
|
-
currencyOptions?: CurrencyOption[];
|
|
12
|
-
selectedCurrencies?: TableHeaderStatus[];
|
|
13
|
-
enableMultiSelectCurrency?: boolean;
|
|
7
|
+
onStatusChange?: (status: IStatus) => void;
|
|
14
8
|
}
|
|
15
|
-
declare function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status,
|
|
16
|
-
declare const _default:
|
|
9
|
+
declare function StatusBar<IStatus extends TableHeaderStatus | TableHeaderStatus[] = undefined>({ isFilteredIdsShown, onStatusChange, availableStatuses, status, }: StatusBarProps<IStatus>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare const _default: typeof StatusBar;
|
|
17
11
|
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
|
-
export type AvailableStatus<T = undefined> = StatusButtonProps & {
|
|
4
|
-
status: T
|
|
4
|
+
export type AvailableStatus<T extends TableHeaderStatus | TableHeaderStatus[] = undefined> = StatusButtonProps & {
|
|
5
|
+
status: T;
|
|
6
|
+
render?: <IStatus extends T>(status: IStatus, onChange: (selected: AvailableStatus<T>['status']) => void) => React.ReactNode;
|
|
5
7
|
};
|
|
@@ -4,23 +4,3 @@ export declare const referenceIcons: {
|
|
|
4
4
|
payment: string;
|
|
5
5
|
order: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const REFERENCE_WIDTH_MAP: {
|
|
8
|
-
order: {
|
|
9
|
-
width: string;
|
|
10
|
-
};
|
|
11
|
-
payment: {
|
|
12
|
-
width: string;
|
|
13
|
-
};
|
|
14
|
-
acquirer: {
|
|
15
|
-
width: string;
|
|
16
|
-
};
|
|
17
|
-
generic: {
|
|
18
|
-
width: string;
|
|
19
|
-
};
|
|
20
|
-
merchant: {
|
|
21
|
-
width: string;
|
|
22
|
-
};
|
|
23
|
-
customer: {
|
|
24
|
-
width: string;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
@@ -5,11 +5,3 @@ export const referenceIcons = {
|
|
|
5
5
|
payment: transactionIcon,
|
|
6
6
|
order: orderIcon,
|
|
7
7
|
};
|
|
8
|
-
export const REFERENCE_WIDTH_MAP = {
|
|
9
|
-
order: { width: '185px' },
|
|
10
|
-
payment: { width: '205px' },
|
|
11
|
-
acquirer: { width: '155px' },
|
|
12
|
-
generic: { width: '166px' },
|
|
13
|
-
merchant: { width: '140px' },
|
|
14
|
-
customer: { width: '140px' },
|
|
15
|
-
};
|
|
@@ -76,7 +76,7 @@ export { default as CountryFlag } from './CountryFlag';
|
|
|
76
76
|
export { default as CurrencyIcon } from './CurrencyIcon';
|
|
77
77
|
export { default as CustomBackdrop } from './CustomBackdrop';
|
|
78
78
|
export { default as DeviceIcon } from './DeviceIcon';
|
|
79
|
-
export { default as CountBadge,
|
|
79
|
+
export { default as CountBadge, BadgeVariants, CountAnimatedBadge, type StyledBadgeProps, paymentSourceAnimation } from './CountBadge';
|
|
80
80
|
export { default as CircularProgressWithLabel } from './CircularProgressWithLabel';
|
|
81
81
|
export { default as Collapse, type CollapseProps } from './Collapse';
|
|
82
82
|
export { default as ConfirmDialog, type ConfirmDialogFunction, type ConfirmDialogProps, useConfirmDialog, ConfirmDialogContext, ConfirmDialogProvider, } from './ConfirmDialog';
|
|
@@ -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';
|
|
@@ -76,7 +76,7 @@ export { default as CountryFlag } from './CountryFlag';
|
|
|
76
76
|
export { default as CurrencyIcon } from './CurrencyIcon';
|
|
77
77
|
export { default as CustomBackdrop } from './CustomBackdrop';
|
|
78
78
|
export { default as DeviceIcon } from './DeviceIcon';
|
|
79
|
-
export { default as CountBadge, CountAnimatedBadge, paymentSourceAnimation } from './CountBadge';
|
|
79
|
+
export { default as CountBadge, BadgeVariants, CountAnimatedBadge, paymentSourceAnimation } from './CountBadge';
|
|
80
80
|
export { default as CircularProgressWithLabel } from './CircularProgressWithLabel';
|
|
81
81
|
export { default as Collapse } from './Collapse';
|
|
82
82
|
export { default as ConfirmDialog, useConfirmDialog, ConfirmDialogContext, ConfirmDialogProvider, } from './ConfirmDialog';
|
|
@@ -505,3 +505,9 @@ export declare const payoutServiceIcon: string;
|
|
|
505
505
|
export declare const refundsServiceIcon: string;
|
|
506
506
|
export declare const usersServiceIcon: string;
|
|
507
507
|
export declare const walletServiceIcon: string;
|
|
508
|
+
export declare const archievedOutlined: string;
|
|
509
|
+
export declare const closeOutlinedCircle: string;
|
|
510
|
+
export declare const dashedOutlinedCircle: string;
|
|
511
|
+
export declare const deactivatedCircle: string;
|
|
512
|
+
export declare const exclamationOutlinedCircle: string;
|
|
513
|
+
export declare const outlinedCircle: string;
|
|
@@ -509,3 +509,9 @@ export const payoutServiceIcon = `${lightUrl}/services/payoutService.svg`;
|
|
|
509
509
|
export const refundsServiceIcon = `${lightUrl}/services/refundsService.svg`;
|
|
510
510
|
export const usersServiceIcon = `${lightUrl}/services/usersService.svg`;
|
|
511
511
|
export const walletServiceIcon = `${lightUrl}/services/walletService.svg`;
|
|
512
|
+
export const archievedOutlined = `${lightUrl}/archievedOutlined.svg`;
|
|
513
|
+
export const closeOutlinedCircle = `${lightUrl}/closeOutlinedCircle.svg`;
|
|
514
|
+
export const dashedOutlinedCircle = `${lightUrl}/dashedOutlinedCircle.svg`;
|
|
515
|
+
export const deactivatedCircle = `${lightUrl}/deactivatedCircle.svg`;
|
|
516
|
+
export const exclamationOutlinedCircle = `${lightUrl}/exclamationOutlinedCircle.svg`;
|
|
517
|
+
export const outlinedCircle = `${lightUrl}/outlinedCircle.svg`;
|
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.234-test.2-test.3",
|
|
5
|
+
"testVersion": 3,
|
|
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
|
+
}
|