@tap-payments/os-micro-frontend-shared 0.1.90-test.23 → 0.1.90-test.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type RefundStatusType } from '../../TableCells';
|
|
3
|
+
import { SelectionProps } from '../../../types/index.js';
|
|
3
4
|
type RefundIconProps = {
|
|
4
5
|
iconStyles?: React.CSSProperties;
|
|
5
6
|
refundStatus?: RefundStatusType;
|
|
6
7
|
refundTooltip?: React.ReactNode;
|
|
7
8
|
refundCount?: number;
|
|
8
9
|
isTextShown?: boolean;
|
|
10
|
+
isSheetViewShown?: boolean;
|
|
11
|
+
chipIndex?: number;
|
|
12
|
+
selectionProps?: SelectionProps;
|
|
9
13
|
};
|
|
10
|
-
declare const RefundIcon: ({ isTextShown, refundStatus, refundTooltip, refundCount, iconStyles }: RefundIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare const RefundIcon: ({ isTextShown, refundStatus, refundTooltip, refundCount, iconStyles, isSheetViewShown, chipIndex, selectionProps, }: RefundIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
15
|
export default RefundIcon;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import camelCase from 'lodash/camelCase';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import Tooltip from '../../Tooltip';
|
|
@@ -8,9 +8,15 @@ import { MultiRefundContainer, MultiRefundIcon, RefundsCountBadge } from '../../
|
|
|
8
8
|
import { StatusIcon } from '../../TableCells/CustomCells/style';
|
|
9
9
|
import { StatusTextLabel } from '../../TableCells/CustomCells/InvoiceStatusCell/style';
|
|
10
10
|
import { refundStatusIcons, refundStyles } from '../../TableCells/CustomCells/StatusCell/constant';
|
|
11
|
-
|
|
11
|
+
import StatusChipWithCopy from '../../StatusChipWithCopy';
|
|
12
|
+
const RefundIcon = ({ isTextShown, refundStatus = 'PENDING', refundTooltip = '', refundCount, iconStyles, isSheetViewShown, chipIndex = 0, selectionProps = {}, }) => {
|
|
12
13
|
const { t } = useTranslation();
|
|
13
14
|
const theme = useTheme();
|
|
15
|
+
const refundCountShown = (refundCount || 0) > 1;
|
|
16
|
+
const status = t(camelCase(refundStatus));
|
|
17
|
+
if (isSheetViewShown) {
|
|
18
|
+
return (_jsxs(StatusChipWithCopy, Object.assign({ chipIndex: chipIndex, selectionProps: selectionProps, copyText: status }, { children: [status, " ", refundCountShown ? `${refundCount}x` : null] })));
|
|
19
|
+
}
|
|
14
20
|
const refundCountBadge = (_jsxs(RefundsCountBadge, Object.assign({ "data-testid": "StatusCell_RefundsCountBadge", initial: { width: 0, opacity: 0, padding: '0px' }, transition: {
|
|
15
21
|
animate: {
|
|
16
22
|
duration: 0.5,
|
|
@@ -31,8 +37,8 @@ const RefundIcon = ({ isTextShown, refundStatus = 'PENDING', refundTooltip = '',
|
|
|
31
37
|
opacity: 1,
|
|
32
38
|
},
|
|
33
39
|
} }, { children: [refundCount, "x"] })));
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
if (isTextShown) {
|
|
41
|
+
return (_jsx(Tooltip, Object.assign({ title: _jsx("div", { children: _jsx("div", { children: refundTooltip }) }) }, { children: _jsx(StatusTextLabel, Object.assign({ "data-testid": "StatusCell_RefundStatusLabel", sx: {
|
|
36
42
|
color: refundStyles[refundStatus].color,
|
|
37
43
|
backgroundColor: refundStyles[refundStatus].backgroundColor,
|
|
38
44
|
width: '90px',
|
|
@@ -41,11 +47,13 @@ const RefundIcon = ({ isTextShown, refundStatus = 'PENDING', refundTooltip = '',
|
|
|
41
47
|
boxShadow: theme.shadows[4],
|
|
42
48
|
gap: theme.spacing(0.5),
|
|
43
49
|
},
|
|
44
|
-
} }, { children: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
} }, { children: [status, " ", refundCountShown ? refundCountBadge : null] })) })) })));
|
|
51
|
+
}
|
|
52
|
+
return (_jsx(Tooltip, Object.assign({ title: _jsx("div", { children: _jsx("div", { children: refundTooltip }) }) }, { children: refundCountShown ? (_jsxs(MultiRefundContainer, Object.assign({ whileHover: ['animate', 'fadeIn'], animate: "start", variants: {
|
|
53
|
+
animate: {
|
|
54
|
+
boxShadow: theme.shadows[4],
|
|
55
|
+
gap: theme.spacing(0.5),
|
|
56
|
+
},
|
|
57
|
+
} }, { children: [_jsx(MultiRefundIcon, { src: refundSettledIcon, alt: "multi-refunded-icon", "data-testid": "StatusCell_MultiRefundIcon" }), refundCountBadge] }))) : (_jsx(StatusIcon, { src: refundStatusIcons[refundStatus], alt: "refunded-icon", "data-testid": "StatusCell_RefundStatusIcon", style: iconStyles })) })));
|
|
50
58
|
};
|
|
51
59
|
export default RefundIcon;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.90-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.90-test.26",
|
|
5
|
+
"testVersion": 26,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|