@tap-payments/os-micro-frontend-shared 0.1.90-test.22 → 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,10 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import { PayoutStatusType } from '../../TableCells';
3
+ import { SelectionProps } 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
+ isSheetViewShown?: boolean;
10
+ chipIndex?: number;
11
+ selectionProps?: SelectionProps;
8
12
  };
9
- export declare const PayoutIcon: ({ payoutStatus, isTextShown, payoutTooltip, iconStyles }: PayoutIconProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const PayoutIcon: ({ payoutStatus, isTextShown, payoutTooltip, iconStyles, isSheetViewShown, chipIndex, selectionProps, }: PayoutIconProps) => import("react/jsx-runtime").JSX.Element;
10
14
  export {};
@@ -5,8 +5,13 @@ import Tooltip from '../../Tooltip';
5
5
  import { StatusIcon } from '../../TableCells/CustomCells/style';
6
6
  import { StatusTextLabel } from '../../TableCells/CustomCells/InvoiceStatusCell/style';
7
7
  import { payoutStatusIcons } from '../../TableCells/CustomCells/StatusCell/constant';
8
- export const PayoutIcon = ({ payoutStatus = 'PENDING', isTextShown, payoutTooltip, iconStyles }) => {
8
+ import StatusChipWithCopy from '../../StatusChipWithCopy';
9
+ export const PayoutIcon = ({ payoutStatus = 'PENDING', isTextShown, payoutTooltip, iconStyles, isSheetViewShown, chipIndex = 0, selectionProps = {}, }) => {
9
10
  const { t } = useTranslation();
10
- const title = payoutTooltip ? payoutTooltip : t(camelCase(payoutStatus));
11
- 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 })) })));
11
+ const statusText = t(camelCase(payoutStatus));
12
+ const title = payoutTooltip ? payoutTooltip : statusText;
13
+ if (isSheetViewShown) {
14
+ return (_jsx(StatusChipWithCopy, Object.assign({ chipIndex: chipIndex, copyText: statusText, selectionProps: selectionProps }, { children: statusText })));
15
+ }
16
+ return (_jsx(Tooltip, Object.assign({ title: title }, { children: isTextShown ? (_jsx(StatusTextLabel, Object.assign({ "data-testid": "StatusCell_PayoutStatusLabel" }, { children: statusText }))) : (_jsx(StatusIcon, { src: payoutStatusIcons[payoutStatus], alt: "settled-icon", "data-testid": "StatusCell_PayoutStatusIcon", style: iconStyles })) })));
12
17
  };
@@ -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, Fragment as _Fragment } from "react/jsx-runtime";
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
- const RefundIcon = ({ isTextShown, refundStatus = 'PENDING', refundTooltip = '', refundCount, iconStyles }) => {
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
- const refundCountShown = (refundCount || 0) > 1;
35
- return (_jsx(_Fragment, { children: isTextShown ? (_jsx(Tooltip, Object.assign({ title: _jsx("div", { children: _jsx("div", { children: refundTooltip }) }) }, { children: _jsx(StatusTextLabel, Object.assign({ "data-testid": "StatusCell_RefundStatusLabel", sx: {
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: [t(camelCase(refundStatus)), " ", refundCountShown ? refundCountBadge : null] })) })) }))) : (_jsx(Tooltip, Object.assign({ title: _jsx("div", { children: _jsx("div", { children: refundTooltip }) }) }, { children: refundCountShown ? (_jsxs(MultiRefundContainer, Object.assign({ whileHover: ['animate', 'fadeIn'], animate: "start", variants: {
45
- animate: {
46
- boxShadow: theme.shadows[4],
47
- gap: theme.spacing(0.5),
48
- },
49
- } }, { 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
+ } }, { 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.22",
5
- "testVersion": 22,
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",