@tap-payments/os-micro-frontend-shared 0.0.98 → 0.0.99-amount-fix-1

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.
Files changed (56) hide show
  1. package/build/components/Chip/style.d.ts +0 -1
  2. package/build/components/CountBadge/style.d.ts +0 -1
  3. package/build/components/Dialog/style.d.ts +0 -1
  4. package/build/components/DropdownMenu/DropdownMenu.d.ts +1 -1
  5. package/build/components/DropdownMenu/DropdownMenu.js +3 -3
  6. package/build/components/DropdownMenu/type.d.ts +1 -0
  7. package/build/components/FlippingCard/style.d.ts +0 -1
  8. package/build/components/ImageWrapper/ImageWrapper.d.ts +0 -1
  9. package/build/components/JSONViewer/style.d.ts +0 -1
  10. package/build/components/MultiSelectStatusButton/MultiSelectStatusButton.d.ts +5 -0
  11. package/build/components/MultiSelectStatusButton/MultiSelectStatusButton.js +97 -0
  12. package/build/components/MultiSelectStatusButton/index.d.ts +3 -0
  13. package/build/components/MultiSelectStatusButton/index.js +2 -0
  14. package/build/components/MultiSelectStatusButton/style.d.ts +41 -0
  15. package/build/components/MultiSelectStatusButton/style.js +71 -0
  16. package/build/components/MultiSelectStatusButton/type.d.ts +14 -0
  17. package/build/components/MultiSelectStatusButton/type.js +1 -0
  18. package/build/components/SearchButton/styles.d.ts +0 -1
  19. package/build/components/StatusBar/StatusBar.d.ts +6 -1
  20. package/build/components/StatusBar/StatusBar.js +62 -26
  21. package/build/components/StatusIcons/AuthIcons/style.d.ts +0 -1
  22. package/build/components/StatusIcons/AuthorizationAutoIcons/style.d.ts +0 -1
  23. package/build/components/StatusIcons/ChargeStatusIcon/style.d.ts +0 -1
  24. package/build/components/StatusIcons/SourceIcons/style.d.ts +0 -1
  25. package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +0 -1
  26. package/build/components/TableCells/CustomCells/AuthenticationCell/style.d.ts +0 -1
  27. package/build/components/TableCells/CustomCells/AuthenticationStatusCell/style.d.ts +0 -1
  28. package/build/components/TableCells/CustomCells/AuthenticationTypeCell/style.d.ts +0 -1
  29. package/build/components/TableCells/CustomCells/BalanceCell/style.d.ts +0 -1
  30. package/build/components/TableCells/CustomCells/ChannelsCell/style.d.ts +0 -1
  31. package/build/components/TableCells/CustomCells/CheckoutStatusCell/style.d.ts +0 -1
  32. package/build/components/TableCells/CustomCells/DestinationStatusCell/style.d.ts +0 -1
  33. package/build/components/TableCells/CustomCells/DueDateCell/style.d.ts +0 -1
  34. package/build/components/TableCells/CustomCells/IDButton/style.d.ts +0 -1
  35. package/build/components/TableCells/CustomCells/IntentsStatusCell/style.d.ts +0 -1
  36. package/build/components/TableCells/CustomCells/InvoiceStatusCell/style.d.ts +0 -1
  37. package/build/components/TableCells/CustomCells/PayoutStatusCell/style.d.ts +0 -1
  38. package/build/components/TableCells/CustomCells/ProductsCell/style.d.ts +0 -1
  39. package/build/components/TableCells/CustomCells/ReferenceCell/style.d.ts +0 -1
  40. package/build/components/TableCells/CustomCells/RefundChargeCell/style.d.ts +0 -1
  41. package/build/components/TableCells/CustomCells/RefundStatusCell/style.d.ts +0 -1
  42. package/build/components/TableCells/CustomCells/SegmentsCell/style.d.ts +0 -1
  43. package/build/components/TableCells/CustomCells/SourceCell/style.d.ts +0 -1
  44. package/build/components/TableCells/CustomCells/SourceMergedCell/style.d.ts +0 -1
  45. package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +0 -1
  46. package/build/components/TableCells/CustomCells/TokenStatusCell/style.d.ts +0 -1
  47. package/build/components/TableCells/CustomCells/style.d.ts +0 -1
  48. package/build/components/TableHeader_V2/components/StatusButtons/ChevronIcon.d.ts +1 -1
  49. package/build/components/TableHeader_V2/components/StatusButtons/ChevronIcon.js +4 -2
  50. package/build/components/TableHeader_V2/components/StatusButtons/style.js +1 -0
  51. package/build/components/TableHeader_V2/components/StatusButtons/type.d.ts +3 -0
  52. package/build/components/VirtualTable/style.d.ts +0 -1
  53. package/build/components/index.d.ts +1 -0
  54. package/build/components/index.js +1 -0
  55. package/build/constants/server.js +2 -1
  56. package/package.json +1 -1
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  import { GetSourceAnimationFunction } from './type';
4
3
  export declare const ChipStyled: import("@emotion/styled").StyledComponent<import("react").RefAttributes<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
5
4
  variant?: import("./type").ChipVariant | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const AgreementImageWrapper: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const DialogWrapper: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,3 +1,3 @@
1
1
  import { IProps } from './type';
2
- declare function Dropdown({ open, menuItems, anchorEl, onClose, selected, ...props }: IProps): import("react/jsx-runtime").JSX.Element;
2
+ declare function Dropdown({ open, menuItems, anchorEl, onClose, selected, allowShadows, ...props }: IProps): import("react/jsx-runtime").JSX.Element;
3
3
  export default Dropdown;
@@ -13,7 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { Divider, Box, useTheme } from '@mui/material';
14
14
  import { StyledListItemText, StyledMenu, StyledListItemIcon, StyledMenuItem } from './styles';
15
15
  function Dropdown(_a) {
16
- var { open, menuItems, anchorEl, onClose, selected } = _a, props = __rest(_a, ["open", "menuItems", "anchorEl", "onClose", "selected"]);
16
+ var { open, menuItems, anchorEl, onClose, selected, allowShadows = true } = _a, props = __rest(_a, ["open", "menuItems", "anchorEl", "onClose", "selected", "allowShadows"]);
17
17
  const theme = useTheme();
18
18
  return (_jsx(StyledMenu, Object.assign({ open: open, anchorEl: anchorEl, onClose: onClose, onContextMenu: (e) => {
19
19
  e.preventDefault();
@@ -27,7 +27,7 @@ function Dropdown(_a) {
27
27
  item.onClick(e);
28
28
  }, onContextMenu: item.onRightClick, selected: item.selected, sx: Object.assign({ '&:hover': {
29
29
  backgroundColor: 'transparent',
30
- boxShadow: theme.shadows[10],
30
+ boxShadow: allowShadows ? theme.shadows[10] : 'none',
31
31
  '& .sandbox-Icon': {
32
32
  display: 'none',
33
33
  },
@@ -36,7 +36,7 @@ function Dropdown(_a) {
36
36
  },
37
37
  } }, (idx === selected && {
38
38
  backgroundColor: 'transparent',
39
- boxShadow: theme.shadows[10],
39
+ boxShadow: allowShadows ? theme.shadows[10] : 'none',
40
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
41
  }) })));
42
42
  }
@@ -17,4 +17,5 @@ export interface IProps {
17
17
  anchorEl?: Element | null | undefined;
18
18
  style?: CSSProperties;
19
19
  selected?: number;
20
+ allowShadows?: boolean;
20
21
  }
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const Wrapper: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  declare const ImageWrapper: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const FOOTER_HEIGHT = 37;
4
3
  export declare const TITLE_BAR_HEIGHT = "32px";
5
4
  export declare const VIEWER_HEIGHT = 545;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { MultiSelectStatusButtonProps } from './type';
3
+ declare function MultiSelectStatusButton({ options, selectedValues, onSelectionChange, label, variant }: MultiSelectStatusButtonProps): import("react/jsx-runtime").JSX.Element;
4
+ declare const _default: import("react").MemoExoticComponent<typeof MultiSelectStatusButton>;
5
+ export default _default;
@@ -0,0 +1,97 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { memo, useState, useRef, useEffect } from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { Typography, Checkbox } from '@mui/material';
5
+ import { ChevronIcon } from '../TableHeader_V2/components/StatusButtons/ChevronIcon';
6
+ import StyledBadge, { BadgeVariants } from '../CountBadge';
7
+ import CountryFlag from '../CountryFlag';
8
+ import { formatNumber } from '../../utils/index.js';
9
+ import { closeXIcon } from '../../constants/index.js';
10
+ import { ChevronContainer, Label, LabelWrapper, StyledDropdown, MenuItemContainer, CheckboxStyles, StyledStatusButton, ClearIcon, ChevronIconWrapper, } from './style';
11
+ function MultiSelectStatusButton({ options, selectedValues, onSelectionChange, label, variant = 'inActive' }) {
12
+ const { t } = useTranslation();
13
+ const [anchorEl, setAnchorEl] = useState(null);
14
+ const buttonRef = useRef(null);
15
+ const [internalSelectedValues, setInternalSelectedValues] = useState(selectedValues);
16
+ const [dropdownWidth, setDropdownWidth] = useState(0);
17
+ const [isHovered, setIsHovered] = useState(false);
18
+ const isOpen = Boolean(anchorEl);
19
+ useEffect(() => {
20
+ if (!isOpen) {
21
+ setInternalSelectedValues(selectedValues);
22
+ }
23
+ }, [selectedValues, isOpen]);
24
+ const handleDropdownClick = (event) => {
25
+ var _a;
26
+ event.stopPropagation();
27
+ event.preventDefault();
28
+ if (isOpen) {
29
+ handleClose();
30
+ return;
31
+ }
32
+ setAnchorEl(buttonRef.current);
33
+ const buttonWidth = ((_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) || 200;
34
+ setDropdownWidth(Math.max(buttonWidth, 200));
35
+ };
36
+ const handleClose = () => {
37
+ const hasChanged = JSON.stringify([...internalSelectedValues].sort()) !== JSON.stringify([...selectedValues].sort());
38
+ if (hasChanged) {
39
+ onSelectionChange(internalSelectedValues);
40
+ }
41
+ setAnchorEl(null);
42
+ setDropdownWidth(0);
43
+ };
44
+ const handleClearAll = (event) => {
45
+ event.stopPropagation();
46
+ event.preventDefault();
47
+ setInternalSelectedValues([]);
48
+ onSelectionChange([]);
49
+ };
50
+ const handleOptionToggle = (optionStatus, event) => {
51
+ if (event) {
52
+ event.stopPropagation();
53
+ event.preventDefault();
54
+ }
55
+ const newSelection = internalSelectedValues.includes(optionStatus)
56
+ ? internalSelectedValues.filter((status) => status !== optionStatus)
57
+ : [...internalSelectedValues, optionStatus];
58
+ setInternalSelectedValues(newSelection);
59
+ };
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
+ return (_jsxs(_Fragment, { children: [_jsx(StyledStatusButton, Object.assign({ buttonVariant: variant, ref: buttonRef, sx: {
65
+ paddingInlineEnd: '27px',
66
+ }, "data-testid": "MultiSelectStatusButton", onClick: handleDropdownClick, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [getDisplayLabel(), countBadge] })), _jsxs(ChevronContainer, Object.assign({ onClick: isHovered && internalSelectedValues.length > 0 ? handleClearAll : undefined, sx: {
67
+ '&:hover': {
68
+ backgroundColor: 'transparent',
69
+ },
70
+ } }, { children: [_jsx(ClearIcon, { variant: variant, src: closeXIcon, alt: "clear all", sx: {
71
+ opacity: isHovered && internalSelectedValues.length > 0 ? 1 : 0,
72
+ pointerEvents: isHovered && internalSelectedValues.length > 0 ? 'auto' : 'none',
73
+ } }), _jsx(ChevronIconWrapper, Object.assign({ isVisible: !(isHovered && internalSelectedValues.length > 0) }, { children: _jsx(ChevronIcon, { disableHover: true, isActive: variant === 'active' }) }))] }))] }) })), isOpen && anchorEl && (_jsx(StyledDropdown, { open: isOpen, onClose: handleClose, anchorEl: anchorEl, allowShadows: false, style: {
74
+ minWidth: dropdownWidth || 200,
75
+ width: dropdownWidth || 'auto',
76
+ marginTop: '6px',
77
+ maxWidth: 300,
78
+ }, sx: {
79
+ boxShadow: 'none !important',
80
+ '&:hover': {
81
+ boxShadow: 'none !important',
82
+ },
83
+ }, menuItems: options.map((option) => ({
84
+ label: (_jsxs(MenuItemContainer, { children: [_jsx(Checkbox, { checked: internalSelectedValues.includes(option.status), size: "small", sx: CheckboxStyles, onClick: (e) => {
85
+ var _a;
86
+ e.stopPropagation();
87
+ handleOptionToggle((_a = option.status) !== null && _a !== void 0 ? _a : '', e);
88
+ } }), _jsx(CountryFlag, { code: option.flagCode || option.code, sx: { border: '1px solid white', borderRadius: '3px' } }), _jsx(Typography, Object.assign({ variant: "body2" }, { children: option.name }))] })),
89
+ onClick: (e) => {
90
+ var _a;
91
+ e.preventDefault();
92
+ e.stopPropagation();
93
+ handleOptionToggle((_a = option.status) !== null && _a !== void 0 ? _a : '', e);
94
+ },
95
+ })) }))] }));
96
+ }
97
+ export default memo(MultiSelectStatusButton);
@@ -0,0 +1,3 @@
1
+ import MultiSelectStatusButton from './MultiSelectStatusButton';
2
+ export default MultiSelectStatusButton;
3
+ export type { CurrencyOption, MultiSelectStatusButtonProps } from './type';
@@ -0,0 +1,2 @@
1
+ import MultiSelectStatusButton from './MultiSelectStatusButton';
2
+ export default MultiSelectStatusButton;
@@ -0,0 +1,41 @@
1
+ import type React from 'react';
2
+ import { type Theme } from '@mui/material';
3
+ export { statusButtonVariants, ChevronContainer, Label, LabelWrapper, StyledDropdown, } from '../TableHeader_V2/components/StatusButtons/style';
4
+ export declare const StyledStatusButton: import("@emotion/styled").StyledComponent<import("@mui/material").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
5
+ ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
6
+ }, "disabled" | "className" | "style" | "classes" | "color" | "children" | "sx" | "tabIndex" | "size" | "variant" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "href" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<Theme> & {
7
+ buttonVariant: 'active' | 'inActive';
8
+ }, {}, {}>;
9
+ export declare const FlagContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
10
+ ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
11
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
12
+ export declare const MenuItemContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
13
+ ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
14
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
15
+ export declare const CheckboxStyles: {
16
+ padding: number;
17
+ color: string;
18
+ '&.Mui-checked': {
19
+ color: string;
20
+ };
21
+ '&.MuiCheckbox-root': {
22
+ color: string;
23
+ };
24
+ '& .MuiSvgIcon-root': {
25
+ color: string;
26
+ };
27
+ '&.Mui-checked .MuiSvgIcon-root': {
28
+ color: string;
29
+ '& path': {
30
+ fill: string;
31
+ };
32
+ };
33
+ };
34
+ export declare const ClearIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<Theme> & {
35
+ variant: 'active' | 'inActive';
36
+ }, React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
37
+ export declare const ChevronIconWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
38
+ ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
39
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme> & {
40
+ isVisible: boolean;
41
+ }, {}, {}>;
@@ -0,0 +1,71 @@
1
+ import { Box, Button } from '@mui/material';
2
+ import { styled } from '@mui/material/styles';
3
+ export { statusButtonVariants, ChevronContainer, Label, LabelWrapper, StyledDropdown, } from '../TableHeader_V2/components/StatusButtons/style';
4
+ const baseButtonStyle = (theme) => (Object.assign(Object.assign({}, theme.typography.subtitle1), { borderRadius: '50px', borderWidth: '1px', borderStyle: 'solid', minWidth: '135.11px', height: '32px', display: 'flex', justifyContent: 'center', alignItems: 'center', gap: '8px', textTransform: 'none', transition: 'background-color 0.5s ease, color 0.3s ease', paddingInline: theme.spacing(2) }));
5
+ export const StyledStatusButton = styled(Button, {
6
+ shouldForwardProp: (prop) => prop !== 'buttonVariant',
7
+ })(({ theme, buttonVariant }) => (Object.assign(Object.assign({}, baseButtonStyle(theme)), (buttonVariant === 'active'
8
+ ? {
9
+ background: theme.palette.background.gradient.shadedBlue,
10
+ color: theme.palette.common.white,
11
+ }
12
+ : {
13
+ backgroundColor: theme.palette.common.white,
14
+ borderColor: theme.palette.grey[100],
15
+ color: theme.palette.text.primary,
16
+ '&:hover': {
17
+ backgroundColor: 'white',
18
+ },
19
+ }))));
20
+ export const FlagContainer = styled(Box)(({ theme }) => ({
21
+ display: 'flex',
22
+ alignItems: 'center',
23
+ gap: theme.spacing(0.5),
24
+ }));
25
+ export const MenuItemContainer = styled(Box)(({ theme }) => ({
26
+ display: 'flex',
27
+ alignItems: 'center',
28
+ gap: theme.spacing(0.3),
29
+ width: '100%',
30
+ }));
31
+ export const CheckboxStyles = {
32
+ padding: 0.3,
33
+ color: '#8C9196',
34
+ '&.Mui-checked': {
35
+ color: '#1F88D0',
36
+ },
37
+ '&.MuiCheckbox-root': {
38
+ color: '#8C9196',
39
+ },
40
+ '& .MuiSvgIcon-root': {
41
+ color: 'inherit',
42
+ },
43
+ '&.Mui-checked .MuiSvgIcon-root': {
44
+ color: '#1F88D0',
45
+ '& path': {
46
+ fill: '#1F88D0',
47
+ },
48
+ },
49
+ };
50
+ export const ClearIcon = styled('img')(({ variant }) => ({
51
+ width: '10px',
52
+ height: '10px',
53
+ filter: variant === 'active' ? 'brightness(0) invert(1)' : 'brightness(0) invert(0)',
54
+ cursor: 'pointer',
55
+ position: 'absolute',
56
+ top: '50%',
57
+ left: '47%',
58
+ transform: 'translate(-50%, -50%)',
59
+ transition: 'opacity 0.2s ease-in-out',
60
+ }));
61
+ export const ChevronIconWrapper = styled(Box, {
62
+ shouldForwardProp: (prop) => prop !== 'isVisible',
63
+ })(({ isVisible }) => ({
64
+ opacity: isVisible ? 1 : 0,
65
+ transition: 'opacity 0.2s ease-in-out',
66
+ display: 'flex',
67
+ alignItems: 'center',
68
+ justifyContent: 'center',
69
+ width: '100%',
70
+ height: '100%',
71
+ }));
@@ -0,0 +1,14 @@
1
+ import { TableHeaderStatus } from '../../types/index.js';
2
+ export interface CurrencyOption {
3
+ code: string;
4
+ name: string;
5
+ flagCode?: string;
6
+ status: TableHeaderStatus;
7
+ }
8
+ export interface MultiSelectStatusButtonProps {
9
+ options: CurrencyOption[];
10
+ selectedValues: TableHeaderStatus[];
11
+ onSelectionChange: (selected: TableHeaderStatus[]) => void;
12
+ label?: string;
13
+ variant?: 'active' | 'inActive';
14
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledInput: import("@emotion/styled").StyledComponent<{
4
3
  width?: string | number | undefined;
5
4
  height?: string | number | undefined;
@@ -1,12 +1,17 @@
1
1
  /// <reference types="react" />
2
2
  import { AvailableStatus } from '../TableHeader_V2';
3
+ import { CurrencyOption } from '../MultiSelectStatusButton';
3
4
  import { TableHeaderStatus } from '../../types/index.js';
4
5
  interface StatusBarProps {
5
6
  status?: TableHeaderStatus;
6
7
  availableStatuses?: AvailableStatus[];
7
8
  isFilteredIdsShown?: boolean;
8
9
  onStatusChange?: (status: TableHeaderStatus) => void;
10
+ onMultiSelectChange?: (status: TableHeaderStatus[]) => void;
11
+ currencyOptions?: CurrencyOption[];
12
+ selectedCurrencies?: TableHeaderStatus[];
13
+ enableMultiSelectCurrency?: boolean;
9
14
  }
10
- declare function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status }: StatusBarProps): import("react/jsx-runtime").JSX.Element;
15
+ declare function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status, onMultiSelectChange, currencyOptions, selectedCurrencies, enableMultiSelectCurrency, }: StatusBarProps): import("react/jsx-runtime").JSX.Element;
11
16
  declare const _default: import("react").MemoExoticComponent<typeof StatusBar>;
12
17
  export default _default;
@@ -1,32 +1,68 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
1
  import { createElement as _createElement } from "react";
3
- import { memo, useCallback } from 'react';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { memo, useCallback, useState, useEffect } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { StatusButton } from '../TableHeader_V2';
6
- function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status }) {
6
+ import MultiSelectStatusButton from '../MultiSelectStatusButton';
7
+ function StatusBar({ isFilteredIdsShown, onStatusChange, availableStatuses, status, onMultiSelectChange, currencyOptions, selectedCurrencies = [], enableMultiSelectCurrency = false, }) {
7
8
  const { t } = useTranslation();
8
- const getButtonStatus = useCallback((buttonStatus) => (buttonStatus === status && !isFilteredIdsShown ? 'active' : 'inActive'), [status, isFilteredIdsShown]);
9
- return (_jsx(_Fragment, { children: availableStatuses === null || availableStatuses === void 0 ? void 0 : availableStatuses.map((s) => {
10
- var _a, _b;
11
- if (!Array.isArray(s.status)) {
12
- return (_createElement(StatusButton, Object.assign({}, s, { key: `status-button-array-${s.status}`, variant: getButtonStatus(s.status), onClick: () => {
13
- if (!Array.isArray(s.status)) {
14
- onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange(s.status);
15
- }
16
- } })));
17
- }
18
- const isCurrentStatusDropdown = (_a = s.status) === null || _a === void 0 ? void 0 : _a.includes(status || '');
19
- const variant = isCurrentStatusDropdown ? 'active' : 'inActive';
20
- const statusLabel = isCurrentStatusDropdown ? status : s.status[0];
21
- return (_jsx("div", { children: _jsx(StatusButton, Object.assign({}, s, { label: t(statusLabel || ''), variant: variant, onButtonBodyClick: (buttonStatus) => {
22
- onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange(buttonStatus);
23
- }, dropdownOptions: s.status.map((stat) => ({
24
- label: t(stat || ''),
25
- onClick: () => {
26
- onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange(stat);
27
- },
28
- status: stat,
29
- })) })) }, (_b = s === null || s === void 0 ? void 0 : s.status) === null || _b === void 0 ? void 0 : _b[0]));
30
- }) }));
9
+ const [multiSelectValues, setMultiSelectValues] = useState(selectedCurrencies);
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]);
20
+ const getButtonStatus = useCallback((buttonStatus) => {
21
+ if (multiSelectValues.length > 0) {
22
+ return 'inActive';
23
+ }
24
+ return buttonStatus === status && !isFilteredIdsShown ? 'active' : 'inActive';
25
+ }, [status, isFilteredIdsShown, multiSelectValues.length]);
26
+ const handleMultiSelectChange = useCallback((selected) => {
27
+ setMultiSelectValues(selected);
28
+ onMultiSelectChange === null || onMultiSelectChange === void 0 ? void 0 : onMultiSelectChange(selected);
29
+ if (selected.length > 0) {
30
+ onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange('');
31
+ }
32
+ }, [onMultiSelectChange, onStatusChange]);
33
+ const handleStatusChange = useCallback((newStatus) => {
34
+ if (multiSelectValues.length > 0) {
35
+ setMultiSelectValues([]);
36
+ onMultiSelectChange === null || onMultiSelectChange === void 0 ? void 0 : onMultiSelectChange([]);
37
+ }
38
+ onStatusChange === null || onStatusChange === void 0 ? void 0 : onStatusChange(newStatus);
39
+ }, [multiSelectValues.length, onMultiSelectChange, onStatusChange]);
40
+ useEffect(() => {
41
+ if (enableMultiSelectCurrency && multiSelectValues.length === 0 && selectedCurrencies.length === 0 && !status) {
42
+ handleStatusChange('all');
43
+ }
44
+ }, [enableMultiSelectCurrency, multiSelectValues.length, selectedCurrencies.length, status, handleStatusChange]);
45
+ return (_jsxs(_Fragment, { children: [enableMultiSelectCurrency && currencyOptions && (_jsx(MultiSelectStatusButton, { options: currencyOptions, selectedValues: multiSelectValues, onSelectionChange: handleMultiSelectChange, label: t('Currencies') || 'Currencies', variant: multiSelectValues.length > 0 && !status ? 'active' : 'inActive' })), availableStatuses === null || availableStatuses === void 0 ? void 0 : availableStatuses.map((s) => {
46
+ var _a, _b;
47
+ if (!Array.isArray(s.status)) {
48
+ return (_createElement(StatusButton, Object.assign({}, s, { key: `status-button-array-${s.status}`, variant: getButtonStatus(s.status), onClick: () => {
49
+ if (!Array.isArray(s.status)) {
50
+ handleStatusChange(s.status);
51
+ }
52
+ } })));
53
+ }
54
+ const isCurrentStatusDropdown = (_a = s.status) === null || _a === void 0 ? void 0 : _a.includes(status || '');
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
+ })] }));
31
67
  }
32
68
  export default memo(StatusBar);
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
4
3
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
5
4
  export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const BalanceCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const ErrorCodeLabel: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
4
3
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
5
4
  export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const ActionCellContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
4
3
  export declare const ActionsIconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
5
4
  selected: boolean;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const AuthIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
4
3
  export declare const AuthCellContainer: import("@emotion/styled").StyledComponent<{
5
4
  hidden?: boolean | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const UnCapturedContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const UnCapturedContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const BalanceCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
4
3
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
5
4
  export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const DueDateCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const UnCapturedContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const DueDateCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const Button: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const DueDateCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const DueDateCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const UnCapturedContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const ProductCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
4
3
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
5
4
  export declare const ReferenceSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const RefundChargeCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const RefundCellContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
4
3
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
5
4
  export declare const ReferenceSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const StyledSourceCell: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
4
3
  export declare const StyledSourceImage: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
5
4
  export declare const PaymentSourcesContainer: import("@emotion/styled").StyledComponent<{
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const collapsedViewIconVariants: {
4
3
  default: {
5
4
  duration: number;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const MultiRefundIcon: import("@emotion/styled").StyledComponent<{
4
3
  width?: string | number | undefined;
5
4
  height?: string | number | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const UnCapturedContainer: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  id?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const GeographyBox: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
4
3
  variant?: "Local" | "Global" | "Regional" | undefined;
5
4
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
@@ -1,2 +1,2 @@
1
1
  import { ChevronIconProps } from './type';
2
- export declare function ChevronIcon({ isActive }: ChevronIconProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function ChevronIcon({ isActive, disableHover }: ChevronIconProps): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { useTheme } from '@mui/material';
4
- export function ChevronIcon({ isActive }) {
4
+ export function ChevronIcon({ isActive, disableHover }) {
5
5
  const [isHovered, setIsHovered] = useState(false);
6
6
  const theme = useTheme();
7
7
  const handleMouseEnter = () => {
8
- setIsHovered(true);
8
+ if (!disableHover) {
9
+ setIsHovered(true);
10
+ }
9
11
  };
10
12
  const handleMouseLeave = () => {
11
13
  setIsHovered(false);
@@ -58,6 +58,7 @@ export const ChevronContainer = styled('span')(() => ({
58
58
  right: '0',
59
59
  bottom: '0',
60
60
  overflow: 'hidden',
61
+ transition: 'opacity 1s ease',
61
62
  }));
62
63
  export const Label = styled(Box)(({ variant }) => ({
63
64
  display: 'flex',
@@ -15,8 +15,11 @@ export interface StatusButtonProps extends Omit<ButtonProps, 'variant' | 'childr
15
15
  dropdownOptions?: Array<MenuItemI & {
16
16
  status: TableHeaderStatus;
17
17
  }>;
18
+ render?: (status: TableHeaderStatus) => ReactNode;
19
+ onMultiSelectChange?: (status: TableHeaderStatus[]) => void;
18
20
  }
19
21
  export interface ChevronIconProps {
20
22
  isActive?: boolean;
23
+ disableHover?: boolean;
21
24
  }
22
25
  export type StatusButtonIcon = keyof typeof statusButtonIcons;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  interface TableWrapperProps {
4
3
  showNoDataView?: boolean;
5
4
  isSheetView?: boolean;
@@ -86,6 +86,7 @@ export { default as FlagDetails } from './FlagDetails';
86
86
  export { default as TapLoader } from './Loaders';
87
87
  export { default as Error } from './Error';
88
88
  export { default as StatusBar } from './StatusBar';
89
+ export { default as MultiSelectStatusButton, type CurrencyOption, type MultiSelectStatusButtonProps } from './MultiSelectStatusButton';
89
90
  export * from './Chip';
90
91
  export * from './TableHeader_V2';
91
92
  export { default as RangeCalender } from './RangeCalender';
@@ -86,6 +86,7 @@ export { default as FlagDetails } from './FlagDetails';
86
86
  export { default as TapLoader } from './Loaders';
87
87
  export { default as Error } from './Error';
88
88
  export { default as StatusBar } from './StatusBar';
89
+ export { default as MultiSelectStatusButton } from './MultiSelectStatusButton';
89
90
  export * from './Chip';
90
91
  export * from './TableHeader_V2';
91
92
  export { default as RangeCalender } from './RangeCalender';
@@ -1,5 +1,6 @@
1
1
  var _a;
2
- export const BASE_URL = (_a = import.meta.env.VITE_MW_BASE_URL) !== null && _a !== void 0 ? _a : import.meta.env.VITE_BASE_URL;
2
+ const isSAOCI = import.meta.env.VITE_DEPLOYMENT_REGION === 'sa-oci';
3
+ export const BASE_URL = (_a = (isSAOCI ? 'https://mw-os.tap.com.sa' : import.meta.env.VITE_MW_BASE_URL)) !== null && _a !== void 0 ? _a : import.meta.env.VITE_BASE_URL;
3
4
  export const API_URL = `${BASE_URL}/api`;
4
5
  export const ENV = import.meta.env.VITE_ENV;
5
6
  export const TEST_SECRET_KEY = import.meta.env.VITE_TEST_FIXED_SK;
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.0.98",
4
+ "version": " 0.0.99-amount-fix-1",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
7
7
  "module": "build/index.js",