@tap-payments/os-micro-frontend-shared 0.1.96-test.3 → 0.1.96-test.4

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,3 +1,3 @@
1
1
  import { ChipProps } from './type';
2
- declare const StatusChip: ({ children, unknownText, copyText, ...props }: ChipProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const StatusChip: ({ children, unknownText, copyText, expandDirection, ...props }: ChipProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default StatusChip;
@@ -18,7 +18,7 @@ import { copyIcon, greenCheckIcon } from '../../constants/index.js';
18
18
  import { unknownGeographyColors } from './constants';
19
19
  import { ChipStyled, Wrapper, CopyWrapper } from './style';
20
20
  const StatusChip = (_a) => {
21
- var { children, unknownText, copyText } = _a, props = __rest(_a, ["children", "unknownText", "copyText"]);
21
+ var { children, unknownText, copyText, expandDirection = 'right' } = _a, props = __rest(_a, ["children", "unknownText", "copyText", "expandDirection"]);
22
22
  const [showCopy, setShowCopy] = useState(false);
23
23
  const { t } = useTranslation();
24
24
  const isSelected = props.isSelected;
@@ -38,12 +38,15 @@ const StatusChip = (_a) => {
38
38
  };
39
39
  }
40
40
  };
41
- return (_jsxs(motion.div, Object.assign({ style: { position: 'relative' }, animate: { zIndex: isSelected ? 3 : 0 } }, { children: [_jsx(ChipStyled, Object.assign({}, props, { sx: { visibility: 'hidden', pointerEvents: 'none' } }, { children: _jsx(Wrapper, { children: children }) })), _jsx(ChipStyled, Object.assign({}, props, { isSelected: isSelected, style: { position: 'absolute', top: 0, left: 0, zIndex: isSelected ? 3 : 0 } }, { children: _jsxs(motion.div, Object.assign({ layout: "size", style: { display: 'flex', gap: '4px' }, animate: {
42
- paddingRight: isSelected && copyText ? 12 : 0,
43
- }, transition: { delay: isSelected ? 0 : 0.2, duration: 0.2 } }, { children: [_jsx(Wrapper, { children: children }), _jsx(AnimatePresence, { children: isSelected && copyText && (_jsx(CopyWrapper, { children: _jsx(motion.img, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { delay: isSelected ? 0.2 : 0, duration: 0.1 }, onClick: handleCopy, src: showCopy ? greenCheckIcon : copyIcon, style: {
44
- height: 12,
45
- width: 12,
46
- objectFit: 'contain',
47
- } }) })) })] })) }))] })));
41
+ const isCopyActive = isSelected && copyText;
42
+ return (_jsxs(motion.div, Object.assign({ style: { position: 'relative' }, animate: { zIndex: isSelected ? 3 : 0 } }, { children: [_jsx(ChipStyled, Object.assign({}, props, { sx: { visibility: 'hidden', pointerEvents: 'none' } }, { children: _jsx(Wrapper, { children: children }) })), _jsx(motion.div, Object.assign({ style: { position: 'absolute', top: 0, zIndex: isSelected ? 3 : 0 }, animate: {
43
+ left: isCopyActive && expandDirection === 'left' ? -12 : 0,
44
+ }, transition: { delay: isSelected ? 0 : 0.2, duration: 0.2 } }, { children: _jsx(ChipStyled, Object.assign({}, props, { isSelected: isSelected }, { children: _jsxs(motion.div, Object.assign({ layout: "size", style: { display: 'flex', gap: '4px' }, animate: {
45
+ paddingRight: isCopyActive ? 12 : 0,
46
+ }, transition: { delay: isSelected ? 0 : 0.2, duration: 0.2 } }, { children: [_jsx(Wrapper, { children: children }), _jsx(AnimatePresence, Object.assign({ initial: false }, { children: isCopyActive && (_jsx(CopyWrapper, { children: _jsx(motion.img, { initial: { opacity: 0, x: -5 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0, x: -2 }, transition: { delay: 0.2, duration: 0.1 }, onClick: handleCopy, src: showCopy ? greenCheckIcon : copyIcon, style: {
47
+ height: 12,
48
+ width: 12,
49
+ objectFit: 'contain',
50
+ } }) })) }))] })) })) }))] })));
48
51
  };
49
52
  export default StatusChip;
@@ -11,6 +11,7 @@ export declare const ChipStyled: import("@emotion/styled").StyledComponent<impor
11
11
  maxWidth?: string | undefined;
12
12
  isSelected?: boolean | undefined;
13
13
  copyText?: string | undefined;
14
+ expandDirection?: "left" | "right" | undefined;
14
15
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
15
16
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
16
17
  }, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & {
@@ -10,4 +10,5 @@ export type ChipProps = PropsWithChildren<{
10
10
  maxWidth?: string;
11
11
  isSelected?: boolean;
12
12
  copyText?: string;
13
+ expandDirection?: 'left' | 'right';
13
14
  } & BoxProps>;
@@ -7,10 +7,7 @@ interface ISheetViewTableLoadingProps {
7
7
  isLoading?: boolean;
8
8
  rowsCount?: number;
9
9
  isPinned?: boolean;
10
- tableType?: string;
11
- containerHeight?: number;
12
- isCompact?: boolean;
13
10
  }
14
- declare function SheetViewTableLoading({ columns, isLoaded, animationType, isPinned, containerHeight }: ISheetViewTableLoadingProps): import("react/jsx-runtime").JSX.Element;
11
+ declare function SheetViewTableLoading({ columns, isLoaded, animationType, isLoading, rowsCount, isPinned, }: ISheetViewTableLoadingProps): import("react/jsx-runtime").JSX.Element;
15
12
  declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableLoading>;
16
13
  export default _default;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import uniqueId from 'lodash/uniqueId';
5
- import { calculateSheetViewMaxRows, getSheetViewRowHeight } from '../../../../utils/index.js';
5
+ import { calculateMaxAllowedRows } from '../../../../utils/index.js';
6
6
  import SheetViewTableRowLoading from './SheetViewTableRowLoading';
7
7
  const Wrapper = styled('section')(({ isLoaded = false, isPinned = false }) => ({
8
8
  overflow: 'hidden',
@@ -11,11 +11,9 @@ const Wrapper = styled('section')(({ isLoaded = false, isPinned = false }) => ({
11
11
  filter: isLoaded && !isPinned ? 'blur(8px)' : 'none',
12
12
  marginTop: isLoaded && !isPinned ? '1rem' : '0',
13
13
  }));
14
- function SheetViewTableLoading({ columns, isLoaded = false, animationType, isPinned = false, containerHeight }) {
15
- const availableHeight = containerHeight || window.innerHeight * 0.8;
16
- const rowHeight = getSheetViewRowHeight();
17
- const maxAllowedRows = calculateSheetViewMaxRows(availableHeight, rowHeight);
18
- console.log({ maxAllowedRows, availableHeight, rowHeight, containerHeight });
14
+ function SheetViewTableLoading({ columns, isLoaded = false, animationType, isLoading = false, rowsCount, isPinned = false, }) {
15
+ let maxAllowedRows = rowsCount || calculateMaxAllowedRows(isLoaded, isLoading);
16
+ maxAllowedRows = rowsCount || Math.max(maxAllowedRows, 25);
19
17
  return (_jsx(Wrapper, Object.assign({ isLoaded: isLoaded, isPinned: isPinned, "data-testid": "SheetViewTableLoading" }, { children: [...Array(maxAllowedRows)].map((_, index) => (_jsx(SheetViewTableRowLoading, { columns: columns, animationType: animationType, rowIndex: index, useTableBackground: !isPinned }, `i-${uniqueId('SheetViewTableLoadingRow_')}`))) })));
20
18
  }
21
19
  export default memo(SheetViewTableLoading);
@@ -146,7 +146,7 @@ export const SheetViewTableContainer = styled(Box)(() => ({
146
146
  position: 'relative',
147
147
  display: 'flex',
148
148
  flexDirection: 'column',
149
- height: '100%',
149
+ height: 'calc(100vh - 300px)',
150
150
  paddingInline: '28px',
151
151
  borderRadius: '8px',
152
152
  marginBottom: '16px !important',
@@ -57,12 +57,12 @@ export declare const authorizationTableCellWidth: {
57
57
  readonly payment_agreement: {
58
58
  readonly default: "50px";
59
59
  readonly text: "150px";
60
- readonly sheet: "170px";
60
+ readonly sheet: "230px";
61
61
  };
62
62
  readonly amount: {
63
63
  readonly default: "170px";
64
64
  readonly text: "195px";
65
- readonly sheet: "195px";
65
+ readonly sheet: "150px";
66
66
  };
67
67
  readonly destinations: {
68
68
  readonly default: "70px";
@@ -57,12 +57,12 @@ export const authorizationTableCellWidth = {
57
57
  payment_agreement: {
58
58
  default: '50px',
59
59
  text: '150px',
60
- sheet: '170px',
60
+ sheet: '230px',
61
61
  },
62
62
  amount: {
63
63
  default: '170px',
64
64
  text: '195px',
65
- sheet: '195px',
65
+ sheet: '150px',
66
66
  },
67
67
  destinations: {
68
68
  default: '70px',
@@ -52,7 +52,7 @@ export declare const chargeTableCellWidth: {
52
52
  readonly payment_agreement: {
53
53
  readonly default: "50px";
54
54
  readonly text: "150px";
55
- readonly sheet: "165px";
55
+ readonly sheet: "230px";
56
56
  };
57
57
  readonly payment_initiated: {
58
58
  readonly default: "150px";
@@ -222,7 +222,7 @@ export declare const chargeTableCellWidth: {
222
222
  readonly consolidated_amount: {
223
223
  readonly default: "180px";
224
224
  readonly text: "180px";
225
- readonly sheet: "180px";
225
+ readonly sheet: "150px";
226
226
  };
227
227
  readonly customer_amount: {
228
228
  readonly default: "150px";
@@ -52,7 +52,7 @@ export const chargeTableCellWidth = {
52
52
  payment_agreement: {
53
53
  default: '50px',
54
54
  text: '150px',
55
- sheet: '165px',
55
+ sheet: '230px',
56
56
  },
57
57
  payment_initiated: {
58
58
  default: '150px',
@@ -222,7 +222,7 @@ export const chargeTableCellWidth = {
222
222
  consolidated_amount: {
223
223
  default: '180px',
224
224
  text: '180px',
225
- sheet: '180px',
225
+ sheet: '150px',
226
226
  },
227
227
  customer_amount: {
228
228
  default: '150px',
@@ -62,12 +62,12 @@ export declare const destinationsTableCellWidth: {
62
62
  readonly payment_agreement: {
63
63
  readonly default: "50px";
64
64
  readonly text: "250px";
65
- readonly sheet: "165px";
65
+ readonly sheet: "230px";
66
66
  };
67
67
  readonly amount: {
68
68
  readonly default: "195px";
69
69
  readonly text: "195px";
70
- readonly sheet: "195px";
70
+ readonly sheet: "150px";
71
71
  };
72
72
  readonly status: {
73
73
  readonly default: "50px";
@@ -62,12 +62,12 @@ export const destinationsTableCellWidth = {
62
62
  payment_agreement: {
63
63
  default: '50px',
64
64
  text: '250px',
65
- sheet: '165px',
65
+ sheet: '230px',
66
66
  },
67
67
  amount: {
68
68
  default: '195px',
69
69
  text: '195px',
70
- sheet: '195px',
70
+ sheet: '150px',
71
71
  },
72
72
  status: {
73
73
  default: '50px',
@@ -47,7 +47,7 @@ export declare const refundTableCellWidth: {
47
47
  readonly payment_agreement: {
48
48
  readonly default: "50px";
49
49
  readonly text: "200px";
50
- readonly sheet: "165px";
50
+ readonly sheet: "230px";
51
51
  };
52
52
  readonly payment_initiated: {
53
53
  readonly default: "150px";
@@ -92,7 +92,7 @@ export declare const refundTableCellWidth: {
92
92
  readonly amount: {
93
93
  readonly default: "195px";
94
94
  readonly text: "195px";
95
- readonly sheet: "180px";
95
+ readonly sheet: "150px";
96
96
  };
97
97
  readonly payouts: {
98
98
  readonly default: "195px";
@@ -47,7 +47,7 @@ export const refundTableCellWidth = {
47
47
  payment_agreement: {
48
48
  default: '50px',
49
49
  text: '200px',
50
- sheet: '165px',
50
+ sheet: '230px',
51
51
  },
52
52
  payment_initiated: {
53
53
  default: '150px',
@@ -92,7 +92,7 @@ export const refundTableCellWidth = {
92
92
  amount: {
93
93
  default: '195px',
94
94
  text: '195px',
95
- sheet: '180px',
95
+ sheet: '150px',
96
96
  },
97
97
  payouts: {
98
98
  default: '195px',
@@ -6,9 +6,4 @@ export declare const getColumnWidthPercentage: (widthInPx: number, options?: {
6
6
  export declare const getCellWidth: ({ table, cellID, tableMode }: TableCellWidthProps) => string;
7
7
  export declare const calculateMaxAllowedRows: (isLoaded: boolean, isLoading: boolean) => number;
8
8
  export declare const isHeightNotFullyFilledByRows: (totalRows: number) => boolean;
9
- export declare const calculateSheetViewHeight: (totalRows: number, rowHeight?: number) => number;
10
- export declare const calculateSheetViewMaxRows: (availableHeight: number, rowHeight?: number) => number;
11
- export declare const isSheetViewScrollable: (totalRows: number, containerHeight: number, rowHeight?: number) => boolean;
12
- export declare const getSheetViewRowHeight: () => number;
13
- export declare const calculateSheetViewOptimalHeight: (totalRows: number, tableType: string, maxHeightPercentage?: number) => number;
14
9
  export declare const isTableDefaultMode: (tableMode?: TableMode) => boolean;
@@ -1,4 +1,4 @@
1
- import { walletDetailsTableCellWidth, authenticationsTableCellWidth, authorizationTableCellWidth, chargeTableCellWidth, destinationsTableCellWidth, intentsTableCellWidth, invoicesTableCellWidth, leadsTableCellWidth, ordersTableCellWidth, payoutsTableCellWidth, protectChargesTableCellWidth, protectAuthorizationsTableCellWidth, refundTableCellWidth, tokensTableCellWidth, walletStatementTableCellWidth, topupsTableCellWidth, walletTableCellWidth, TABLE_CONTENT_ROW_HEIGHT, TABLE_LOADING_ROW_HEIGHT, TABLE_ROW_HEIGHT, merchantsTableCellWidth, terminalsTableCellWidth, SHEET_VIEW_TABLE_ROW_HEIGHT, } from '../constants/index.js';
1
+ import { walletDetailsTableCellWidth, authenticationsTableCellWidth, authorizationTableCellWidth, chargeTableCellWidth, destinationsTableCellWidth, intentsTableCellWidth, invoicesTableCellWidth, leadsTableCellWidth, ordersTableCellWidth, payoutsTableCellWidth, protectChargesTableCellWidth, protectAuthorizationsTableCellWidth, refundTableCellWidth, tokensTableCellWidth, walletStatementTableCellWidth, topupsTableCellWidth, walletTableCellWidth, TABLE_CONTENT_ROW_HEIGHT, TABLE_LOADING_ROW_HEIGHT, TABLE_ROW_HEIGHT, merchantsTableCellWidth, terminalsTableCellWidth, } from '../constants/index.js';
2
2
  export const getColumnWidthPercentage = (widthInPx, options) => {
3
3
  const { isFirst, isLast } = options || {};
4
4
  const paddingInPx = isFirst || isLast ? 0 : 0;
@@ -73,38 +73,6 @@ export const isHeightNotFullyFilledByRows = (totalRows) => {
73
73
  const allowedRows = maxRowsThatFit();
74
74
  return totalRows < allowedRows + 1;
75
75
  };
76
- export const calculateSheetViewHeight = (totalRows, rowHeight = TABLE_CONTENT_ROW_HEIGHT) => {
77
- const headerHeight = 56;
78
- const padding = 16;
79
- const calculatedHeight = headerHeight + totalRows * rowHeight + padding;
80
- const minHeight = 200;
81
- const maxHeight = window.innerHeight * 0.8;
82
- return Math.max(minHeight, Math.min(calculatedHeight, maxHeight));
83
- };
84
- export const calculateSheetViewMaxRows = (availableHeight, rowHeight = TABLE_CONTENT_ROW_HEIGHT) => {
85
- const headerHeight = 56;
86
- const padding = 16;
87
- const availableContentHeight = availableHeight - headerHeight - padding;
88
- return Math.floor(availableContentHeight / rowHeight);
89
- };
90
- export const isSheetViewScrollable = (totalRows, containerHeight, rowHeight = TABLE_CONTENT_ROW_HEIGHT) => {
91
- const headerHeight = 56;
92
- const padding = 16;
93
- const contentHeight = headerHeight + totalRows * rowHeight + padding;
94
- return contentHeight > containerHeight;
95
- };
96
- export const getSheetViewRowHeight = () => {
97
- const baseRowHeight = SHEET_VIEW_TABLE_ROW_HEIGHT;
98
- return baseRowHeight * 0.8;
99
- };
100
- export const calculateSheetViewOptimalHeight = (totalRows, tableType, maxHeightPercentage = 0.8) => {
101
- const rowHeight = getSheetViewRowHeight();
102
- const headerHeight = 56;
103
- const padding = 16;
104
- const calculatedHeight = headerHeight + totalRows * rowHeight + padding;
105
- const maxHeight = window.innerHeight * maxHeightPercentage;
106
- return Math.min(calculatedHeight, maxHeight);
107
- };
108
76
  export const isTableDefaultMode = (tableMode = 'default') => {
109
77
  return tableMode === 'default';
110
78
  };
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.96-test.3",
5
- "testVersion": 3,
4
+ "version": "0.1.96-test.4",
5
+ "testVersion": 4,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",