@tap-payments/os-micro-frontend-shared 0.0.129-sheetview-component-ui-v1 → 0.0.129-sheetview-component-ui-v2
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/build/components/StatusChip/style.js +1 -1
- package/build/components/StatusIcons/AuthorizedIcon/AuthorizedIcon.js +1 -1
- package/build/components/StatusIcons/PayoutIcon/PayoutIcon.d.ts +3 -1
- package/build/components/StatusIcons/PayoutIcon/PayoutIcon.js +7 -2
- package/build/components/TableCells/CustomCells/CustomerCell/CustomerCell.js +4 -1
- package/build/components/TableCells/CustomCells/OrderCell/OrderCell.js +1 -1
- package/build/components/TableCells/CustomCells/ReferenceCell/ReferenceCell.js +20 -6
- package/build/components/TableCells/CustomCells/ReferenceCell/constant.d.ts +5 -0
- package/build/components/TableCells/CustomCells/ReferenceCell/constant.js +9 -0
- package/build/components/TableCells/CustomCells/ReferenceCell/style.d.ts +0 -1
- package/build/components/TableCells/CustomCells/ReferenceCell/style.js +0 -4
- package/build/components/TableCells/CustomCells/StatusCell/constant.d.ts +17 -0
- package/build/components/TableCells/CustomCells/StatusCell/constant.js +17 -0
- package/build/constants/table/cell/chargeTableCellWidth.d.ts +1 -1
- package/build/constants/table/cell/chargeTableCellWidth.js +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ export const ChipStyled = styled(Box)((_a) => {
|
|
|
18
18
|
alignItems: 'center',
|
|
19
19
|
justifyContent: 'center',
|
|
20
20
|
height: '18px',
|
|
21
|
-
padding: padding || `${theme.spacing(0.
|
|
21
|
+
padding: padding || `${theme.spacing(0.5)} ${theme.spacing(1.5)}`,
|
|
22
22
|
borderRadius: '30px',
|
|
23
23
|
border: `1px solid ${borderColor}`,
|
|
24
24
|
backgroundColor: bgColor,
|
|
@@ -9,7 +9,7 @@ import { TextLabel } from '../../TableCells/CustomCells/style';
|
|
|
9
9
|
export const AuthorizedIcon = ({ authorizedStatus, isTextShown, iconStyles, tableMode }) => {
|
|
10
10
|
const { t } = useTranslation();
|
|
11
11
|
const theme = useTheme();
|
|
12
|
-
return (_jsx(Tooltip, Object.assign({ title: t(camelCase(authorizedStatus)) }, { children: isTextShown ? (_jsx(TextLabel, Object.assign({ "data-testid": "StatusCell_AuthorizedStatusLabel", sx: Object.assign({ color: theme.palette.info.dark }, (tableMode === 'sheet' && {
|
|
12
|
+
return (_jsx(Tooltip, Object.assign({ title: tableMode === 'sheet' ? '' : t(camelCase(authorizedStatus)) }, { children: isTextShown ? (_jsx(TextLabel, Object.assign({ "data-testid": "StatusCell_AuthorizedStatusLabel", sx: Object.assign({ color: theme.palette.info.dark }, (tableMode === 'sheet' && {
|
|
13
13
|
height: '18px',
|
|
14
14
|
})) }, { children: t(camelCase(authorizedStatus)) }))) : (_jsx(Icon, { src: authorizedStatusIcons[authorizedStatus], alt: "authorized-icon", "data-testid": "StatusCell_AuthorizedStatusIcon", sx: iconStyles })) })));
|
|
15
15
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PayoutStatusType } from '../../TableCells';
|
|
3
|
+
import { TableMode } from '../../../types/index.js';
|
|
3
4
|
type PayoutIconProps = {
|
|
4
5
|
iconStyles?: React.CSSProperties;
|
|
5
6
|
payoutStatus?: PayoutStatusType;
|
|
6
7
|
payoutTooltip?: React.ReactNode;
|
|
7
8
|
isTextShown?: boolean;
|
|
9
|
+
tableMode?: TableMode;
|
|
8
10
|
};
|
|
9
|
-
export declare const PayoutIcon: ({ payoutStatus, isTextShown, payoutTooltip, iconStyles }: PayoutIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const PayoutIcon: ({ payoutStatus, tableMode, isTextShown, payoutTooltip, iconStyles }: PayoutIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export {};
|
|
@@ -4,9 +4,14 @@ import { useTranslation } from 'react-i18next';
|
|
|
4
4
|
import Tooltip from '../../Tooltip';
|
|
5
5
|
import { StatusIcon } from '../../TableCells/CustomCells/style';
|
|
6
6
|
import { StatusTextLabel } from '../../TableCells/CustomCells/InvoiceStatusCell/style';
|
|
7
|
-
import { payoutStatusIcons } from '../../TableCells/CustomCells/StatusCell/constant';
|
|
8
|
-
|
|
7
|
+
import { payoutStatusIcons, payoutStatusStyles } from '../../TableCells/CustomCells/StatusCell/constant';
|
|
8
|
+
import { StatusChip } from '../../index.js';
|
|
9
|
+
export const PayoutIcon = ({ payoutStatus = 'PENDING', tableMode, isTextShown, payoutTooltip, iconStyles }) => {
|
|
9
10
|
const { t } = useTranslation();
|
|
11
|
+
const payoutStatusStyle = payoutStatusStyles[payoutStatus];
|
|
12
|
+
if (tableMode === 'sheet') {
|
|
13
|
+
return _jsx(StatusChip, Object.assign({ sx: Object.assign({}, payoutStatusStyle) }, { children: t(camelCase(payoutStatus)) }));
|
|
14
|
+
}
|
|
10
15
|
const title = payoutTooltip ? payoutTooltip : t(camelCase(payoutStatus));
|
|
11
16
|
return (_jsx(Tooltip, Object.assign({ title: title }, { children: isTextShown ? (_jsx(StatusTextLabel, Object.assign({ "data-testid": "StatusCell_PayoutStatusLabel" }, { children: t(camelCase(payoutStatus)) }))) : (_jsx(StatusIcon, { src: payoutStatusIcons[payoutStatus], alt: "settled-icon", "data-testid": "StatusCell_PayoutStatusIcon", style: iconStyles })) })));
|
|
12
17
|
};
|
|
@@ -38,7 +38,10 @@ function CustomerCell(_a) {
|
|
|
38
38
|
return null;
|
|
39
39
|
return (_jsx("div", Object.assign({ "data-testid": "CustomerCell_customerTooltip" }, { children: tooltipOptions.map(({ name, value }) => value && (_jsx("div", Object.assign({ "data-testid": `CustomerCell_customerTooltip_${name}` }, { children: name === 'Name' ? value : `${name}: ${value}` }), value))) })));
|
|
40
40
|
}, [tooltipOptions]);
|
|
41
|
-
|
|
41
|
+
if (tableMode === 'sheet') {
|
|
42
|
+
return (_jsx(StyledCustomerName, Object.assign({ tableMode: tableMode, "data-testid": "CustomerCell_StyledCustomerName", "data-is-arabic": isArabicCustomerName }, { children: children })));
|
|
43
|
+
}
|
|
44
|
+
return (_jsx(TableCell, Object.assign({}, props, { "data-testid": "CustomerCell_TableCell" }, { children: _jsxs(StyledCustomerCell, Object.assign({ "data-testid": "CustomerCell_StyledCustomerCell" }, { children: [customerShownIcon, _jsx(Tooltip, Object.assign({ title: customerTooltip }, { children: _jsx(StyledCustomerName, Object.assign({ "data-testid": "CustomerCell_StyledCustomerName", "data-is-arabic": isArabicCustomerName }, { children: children })) })), !hideTimezoneIcon && (_jsx(StyledCustomerIconContainer, Object.assign({ "data-testid": "CustomerCell_StyledCustomerIconContainer" }, { children: isTimezoneIconShown && _jsx(StyledCustomerIcon, { src: timezoneIcon, "data-testid": "CustomerCell_StyledCustomerIcon" }) }))), !hideCustomerInitiatedIcon && (_jsx(Tooltip, Object.assign({ title: customerInitiatedTooltip }, { children: _jsx(StarBadgeWrapper, Object.assign({ "data-testid": "CustomerCell_StarBadgeWrapper", className: "geography-box", isShown: !!customerInitiatedTooltip }, { children: customerInitiatedTooltip && (_jsx("img", { "data-testid": "CustomerCell_merchantInitiatedIcon", src: merchantInitiatedIcon, alt: "merchant", style: {
|
|
42
45
|
width: '16px',
|
|
43
46
|
height: '16px',
|
|
44
47
|
} })) })) })))] })) })));
|
|
@@ -23,7 +23,7 @@ function OrderCell(_a) {
|
|
|
23
23
|
return _jsx("div", { children: truncatedItemContent }, item.id);
|
|
24
24
|
}) }));
|
|
25
25
|
if (tableMode === 'sheet') {
|
|
26
|
-
return (_jsx(TableCell, Object.assign({
|
|
26
|
+
return (_jsx(TableCell, Object.assign({ sx: { fontSize: '11px' } }, props, { children: orderLabel })));
|
|
27
27
|
}
|
|
28
28
|
return (_jsx(Tooltip, Object.assign({ title: (items || []).length > 1 ? orderTooltip : undefined }, { children: _jsx(TableCell, Object.assign({}, props, { children: _jsx("span", { children: orderLabel }) })) })));
|
|
29
29
|
}
|
|
@@ -17,9 +17,9 @@ import Tooltip from '../../../Tooltip';
|
|
|
17
17
|
import { ImageWrapper } from '../../../index.js';
|
|
18
18
|
import { TableCell } from '../../../TableCells';
|
|
19
19
|
import StatusChip from '../../../StatusChip';
|
|
20
|
-
import { referenceIcons } from './constant';
|
|
21
|
-
import { ReferenceTextLabel, ReferenceTextWrapper, ReferenceSourcesContainer, StyledSourceCell, StyledSourceImage,
|
|
22
|
-
|
|
20
|
+
import { referenceIcons, REFERENCE_ORDER, REFERENCE_WIDTH_MAP } from './constant';
|
|
21
|
+
import { ReferenceTextLabel, ReferenceTextWrapper, ReferenceSourcesContainer, StyledSourceCell, StyledSourceImage, referenceSourceAnimation, } from './style';
|
|
22
|
+
import { Box } from '@mui/material';
|
|
23
23
|
function ReferenceCell(_a) {
|
|
24
24
|
var { isTextShown, tableMode } = _a, props = __rest(_a, ["isTextShown", "tableMode"]);
|
|
25
25
|
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
|
|
@@ -37,11 +37,25 @@ function ReferenceCell(_a) {
|
|
|
37
37
|
}), [props, references, isTextShown, theme]);
|
|
38
38
|
const referenceSourcesCount = (ReferenceSources === null || ReferenceSources === void 0 ? void 0 : ReferenceSources.length) || 0;
|
|
39
39
|
if (tableMode === 'sheet') {
|
|
40
|
-
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StyledSourceCell, { children: REFERENCE_ORDER.map((referenceKey) => {
|
|
40
|
+
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StyledSourceCell, Object.assign({ sx: { gap: '4px', display: 'flex', flexWrap: 'nowrap' } }, { children: REFERENCE_ORDER.map((referenceKey) => {
|
|
41
41
|
const referenceValue = props[referenceKey];
|
|
42
42
|
const hasValue = !!referenceValue;
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const widthConfig = REFERENCE_WIDTH_MAP[referenceKey];
|
|
44
|
+
return (_jsx(Box, Object.assign({ sx: {
|
|
45
|
+
width: widthConfig.width,
|
|
46
|
+
minWidth: widthConfig.width,
|
|
47
|
+
maxWidth: widthConfig.width,
|
|
48
|
+
flexShrink: 0,
|
|
49
|
+
} }, { children: hasValue ? (_jsx(StatusChip, Object.assign({ sx: {
|
|
50
|
+
maxWidth: '100%',
|
|
51
|
+
overflow: 'hidden',
|
|
52
|
+
textOverflow: 'ellipsis',
|
|
53
|
+
whiteSpace: 'nowrap',
|
|
54
|
+
boxSizing: 'border-box',
|
|
55
|
+
display: 'inline-block',
|
|
56
|
+
padding: '0.75px 12px',
|
|
57
|
+
} }, { children: `${startCase(referenceKey)}: ${referenceValue}` }))) : null }), referenceKey));
|
|
58
|
+
}) })) })));
|
|
45
59
|
}
|
|
46
60
|
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StyledSourceCell, { children: referenceSourcesCount > 0 ? (_jsx(ReferenceSourcesContainer, Object.assign({ layout: true, className: "reference-sources-container", whileHover: "animate", animate: isTooltipOpen ? 'animate' : 'start', sourcesCount: referenceSourcesCount, variants: { animate: { width: referenceSourcesCount * (6 + 32) } }, style: {
|
|
47
61
|
zIndex: 29,
|
|
@@ -4,3 +4,8 @@ export declare const referenceIcons: {
|
|
|
4
4
|
payment: string;
|
|
5
5
|
order: string;
|
|
6
6
|
};
|
|
7
|
+
export type ReferenceFields = 'order' | 'payment' | 'acquirer' | 'generic' | 'merchant' | 'customer';
|
|
8
|
+
export declare const REFERENCE_ORDER: ReferenceFields[];
|
|
9
|
+
export declare const REFERENCE_WIDTH_MAP: Record<ReferenceFields, {
|
|
10
|
+
width: string;
|
|
11
|
+
}>;
|
|
@@ -5,3 +5,12 @@ export const referenceIcons = {
|
|
|
5
5
|
payment: transactionIcon,
|
|
6
6
|
order: orderIcon,
|
|
7
7
|
};
|
|
8
|
+
export const REFERENCE_ORDER = ['order', 'payment', 'acquirer', 'generic', 'merchant', 'customer'];
|
|
9
|
+
export const REFERENCE_WIDTH_MAP = {
|
|
10
|
+
order: { width: '185px' },
|
|
11
|
+
payment: { width: '190px' },
|
|
12
|
+
acquirer: { width: '146px' },
|
|
13
|
+
generic: { width: '130px' },
|
|
14
|
+
merchant: { width: '140px' },
|
|
15
|
+
customer: { width: '140px' },
|
|
16
|
+
};
|
|
@@ -267,7 +267,6 @@ export declare const ReferenceSourcesContainer: import("@emotion/styled").Styled
|
|
|
267
267
|
}, {}, {}>;
|
|
268
268
|
export declare const ReferenceTextLabel: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
269
269
|
export declare const ReferenceTextWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
270
|
-
export declare const ReferenceSheetContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
271
270
|
export declare const ReferenceEmptyPlaceholder: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
272
271
|
export declare const referenceSourceAnimation: (index: number, shadow: string, xDelta?: number) => {
|
|
273
272
|
start: {
|
|
@@ -34,10 +34,6 @@ export const ReferenceTextWrapper = styled('div')(() => ({
|
|
|
34
34
|
justifyContent: 'center',
|
|
35
35
|
paddingInline: '4px',
|
|
36
36
|
}));
|
|
37
|
-
export const ReferenceSheetContainer = styled('div')(() => ({
|
|
38
|
-
minWidth: '200px',
|
|
39
|
-
maxWidth: '250px',
|
|
40
|
-
}));
|
|
41
37
|
export const ReferenceEmptyPlaceholder = styled('div')(() => ({
|
|
42
38
|
height: '18px',
|
|
43
39
|
}));
|
|
@@ -38,6 +38,23 @@ export declare const payoutStatusIcons: {
|
|
|
38
38
|
SETTLED: string;
|
|
39
39
|
PENDING: string;
|
|
40
40
|
};
|
|
41
|
+
export declare const payoutStatusStyles: {
|
|
42
|
+
PAID_OUT: {
|
|
43
|
+
color: string;
|
|
44
|
+
background: string;
|
|
45
|
+
border: string;
|
|
46
|
+
};
|
|
47
|
+
SETTLED: {
|
|
48
|
+
color: string;
|
|
49
|
+
background: string;
|
|
50
|
+
border: string;
|
|
51
|
+
};
|
|
52
|
+
PENDING: {
|
|
53
|
+
color: string;
|
|
54
|
+
background: string;
|
|
55
|
+
border: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
41
58
|
export declare const authorizedStatusIcons: {
|
|
42
59
|
AUTHORIZED: string;
|
|
43
60
|
};
|
|
@@ -82,6 +82,23 @@ export const payoutStatusIcons = {
|
|
|
82
82
|
SETTLED: settledIcon,
|
|
83
83
|
PENDING: settlementInitiatedIcon,
|
|
84
84
|
};
|
|
85
|
+
export const payoutStatusStyles = {
|
|
86
|
+
PAID_OUT: {
|
|
87
|
+
color: '#2ACE00',
|
|
88
|
+
background: '#2ACE001A',
|
|
89
|
+
border: 'none',
|
|
90
|
+
},
|
|
91
|
+
SETTLED: {
|
|
92
|
+
color: '#2ACE00',
|
|
93
|
+
background: 'transparent',
|
|
94
|
+
border: '1px solid #2ACE0066',
|
|
95
|
+
},
|
|
96
|
+
PENDING: {
|
|
97
|
+
color: '#FF7A00',
|
|
98
|
+
background: '#FF7A000D',
|
|
99
|
+
border: 'none',
|
|
100
|
+
},
|
|
101
|
+
};
|
|
85
102
|
export const authorizedStatusIcons = {
|
|
86
103
|
AUTHORIZED: authorizedIcon,
|
|
87
104
|
};
|
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.129-sheetview-component-ui-
|
|
4
|
+
"version": "0.0.129-sheetview-component-ui-v2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"module": "build/index.js",
|