@tap-payments/os-micro-frontend-shared 0.1.31-test.15 → 0.1.31-test.17

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 { MaskedTextProps } from './type';
2
- declare const MaskedText: ({ text, startLength, endLength, chipIndex, copyText, chipSelection }: MaskedTextProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const MaskedText: ({ text, startLength, endLength, chipIndex, copyText, cellContext }: MaskedTextProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default MaskedText;
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import StatusChipWithCopy from '../StatusChipWithCopy';
3
3
  import { passwordDotsIcon } from '../../constants/index.js';
4
- const MaskedText = ({ text, startLength = 8, endLength = 4, chipIndex, copyText, chipSelection }) => {
4
+ const MaskedText = ({ text, startLength = 8, endLength = 4, chipIndex, copyText, cellContext }) => {
5
5
  const startText = text.slice(0, startLength);
6
6
  const endText = text.slice(text.length - endLength);
7
- return (_jsxs(StatusChipWithCopy, Object.assign({ chipIndex: chipIndex, copyText: copyText, chipSelection: chipSelection }, { children: [startText, _jsx("img", { src: passwordDotsIcon, alt: "passwordDots" }), endText] })));
7
+ return (_jsxs(StatusChipWithCopy, Object.assign({ chipIndex: chipIndex, copyText: copyText, cellContext: cellContext }, { children: [startText, _jsx("img", { src: passwordDotsIcon, alt: "passwordDots" }), endText] })));
8
8
  };
9
9
  export default MaskedText;
@@ -11,7 +11,6 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useState } from 'react';
14
- import Box from '@mui/material/Box';
15
14
  import { useTranslation } from 'react-i18next';
16
15
  import { AnimatePresence, motion } from 'framer-motion';
17
16
  import { copyText as copyTextHandler } from '../../utils/index.js';
@@ -22,7 +21,10 @@ const StatusChip = (_a) => {
22
21
  var { children, unknownText, copyText } = _a, props = __rest(_a, ["children", "unknownText", "copyText"]);
23
22
  const [showCopy, setShowCopy] = useState(false);
24
23
  const { t } = useTranslation();
25
- const chipProps = !children ? Object.assign(Object.assign({}, props), unknownGeographyColors) : Object.assign({}, props);
24
+ const isSelected = props.isSelected;
25
+ if (!children) {
26
+ return (_jsx(ChipStyled, Object.assign({}, unknownGeographyColors, props, { isSelected: false }, { children: unknownText ? t(unknownText) : t('unknown') })));
27
+ }
26
28
  const handleCopy = (e) => {
27
29
  e.stopPropagation();
28
30
  if (copyText) {
@@ -36,21 +38,15 @@ const StatusChip = (_a) => {
36
38
  };
37
39
  }
38
40
  };
39
- const content = children ? children : unknownText ? t(unknownText) : t('unknown');
40
- return (_jsxs(Box, Object.assign({ sx: { position: 'relative', zIndex: props.isSelected ? 3 : 0 } }, { children: [_jsx(ChipStyled, Object.assign({}, chipProps, { sx: { visibility: 'hidden', pointerEvents: 'none' } }, { children: _jsx(Wrapper, { children: content }) })), _jsx(motion.div, Object.assign({ layout: true, transition: {
41
- type: 'spring',
42
- stiffness: 180,
43
- damping: 25,
44
- mass: 0.4,
45
- } }, { children: _jsxs(ChipStyled, Object.assign({}, chipProps, { sx: {
46
- position: 'absolute',
47
- top: 0,
48
- left: 0,
49
- zIndex: props.isSelected ? 3 : 0,
50
- } }, { children: [_jsx(Wrapper, { children: content }), _jsx(AnimatePresence, Object.assign({ mode: "wait" }, { children: props.isSelected && copyText && (_jsx(motion.img, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, onClick: handleCopy, src: showCopy ? greenCheckIcon : blueCopyIcon, style: {
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 ? 12 : 0,
43
+ }, transition: { delay: !isSelected ? 0.2 : 0 } }, { children: [_jsx(Wrapper, { children: children }), _jsx(AnimatePresence, { children: isSelected && copyText && (_jsx(motion.img, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, onClick: handleCopy, src: showCopy ? greenCheckIcon : blueCopyIcon, style: {
51
44
  height: 12,
52
45
  width: 12,
53
46
  objectFit: 'contain',
54
- } })) }))] })) }))] })));
47
+ position: 'absolute',
48
+ right: 8,
49
+ top: 2,
50
+ } })) })] })) }))] })));
55
51
  };
56
52
  export default StatusChip;
@@ -4,7 +4,7 @@ import { SELECTION_COLORS } from '../../utils/index.js';
4
4
  export const ChipStyled = styled(Box, {
5
5
  shouldForwardProp: (prop) => !['textColor', 'bgColor', 'borderColor', 'disabled', 'padding', 'maxWidth', 'isSelected'].includes(prop),
6
6
  })(({ theme, isSelected, textColor = theme.palette.text.primary, bgColor = '#EFF1F2', borderColor = '#EFF1F2', disabled = false, padding, maxWidth, }) => {
7
- return Object.assign({ display: 'flex', alignItems: 'center', gap: '4px', height: '18px', padding: padding || '0px 9.5px', borderRadius: '30px', border: `1px solid ${borderColor}`, backgroundColor: bgColor, color: textColor, cursor: disabled ? 'not-allowed' : 'pointer', opacity: disabled ? 0.5 : 1, whiteSpace: 'nowrap', fontSize: '11px', minWidth: '67px', maxWidth: maxWidth || 'none', overflow: 'hidden', textOverflow: maxWidth ? 'ellipsis' : 'unset', boxSizing: 'border-box', transition: 'width 0.5s ease-in-out' }, (isSelected && { color: SELECTION_COLORS.primary, borderColor: SELECTION_COLORS.primary }));
7
+ return Object.assign({ display: 'flex', alignItems: 'center', gap: '4px', height: '18px', padding: 0, borderRadius: '30px', border: `1px solid ${borderColor}`, backgroundColor: bgColor, color: textColor, cursor: disabled ? 'not-allowed' : 'pointer', opacity: disabled ? 0.5 : 1, whiteSpace: 'nowrap', fontSize: '11px', minWidth: '67px', maxWidth: maxWidth || 'none', overflow: 'hidden', textOverflow: maxWidth ? 'ellipsis' : 'unset', boxSizing: 'border-box' }, (isSelected && { color: SELECTION_COLORS.primary, borderColor: SELECTION_COLORS.primary }));
8
8
  });
9
9
  export const Wrapper = styled(Box)(() => ({
10
10
  display: 'flex',
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { StatusChipProps } from '../StatusChip';
3
- import { ChipSelection } from '../../types/index.js';
3
+ import { CellContext } from '../../types/index.js';
4
4
  export interface StatusChipWithCopyProps extends StatusChipProps {
5
5
  copyText?: string;
6
6
  chipIndex: number;
7
- chipSelection: ChipSelection;
7
+ cellContext: CellContext;
8
8
  }
9
- declare function StatusChipWithCopy({ children, copyText, chipIndex, chipSelection: { onChipClick, rowIndex, colIndex, selectedChip }, ...reset }: StatusChipWithCopyProps): import("react/jsx-runtime").JSX.Element;
9
+ declare function StatusChipWithCopy({ children, copyText, chipIndex, cellContext: { onChipClick, rowIndex, colIndex, selectedChip }, ...reset }: StatusChipWithCopyProps): import("react/jsx-runtime").JSX.Element;
10
10
  declare const _default: import("react").MemoExoticComponent<typeof StatusChipWithCopy>;
11
11
  export default _default;
@@ -14,7 +14,7 @@ import { memo, useMemo } from 'react';
14
14
  import StatusChip from '../StatusChip';
15
15
  import { checkIsChipSelected } from './utils';
16
16
  function StatusChipWithCopy(_a) {
17
- var { children, copyText, chipIndex, chipSelection: { onChipClick, rowIndex, colIndex, selectedChip } } = _a, reset = __rest(_a, ["children", "copyText", "chipIndex", "chipSelection"]);
17
+ var { children, copyText, chipIndex, cellContext: { onChipClick, rowIndex, colIndex, selectedChip } } = _a, reset = __rest(_a, ["children", "copyText", "chipIndex", "cellContext"]);
18
18
  const isSelected = useMemo(() => checkIsChipSelected({ rowIndex, colIndex, selectedChip, chipIndex }), [rowIndex, colIndex, selectedChip, chipIndex]);
19
19
  return (_jsx(StatusChip, Object.assign({}, reset, { copyText: copyText, onClick: (e) => {
20
20
  onChipClick === null || onChipClick === void 0 ? void 0 : onChipClick(e, chipIndex);
@@ -1,4 +1,4 @@
1
- import { ChipSelection } from '../../types/index.js';
2
- export declare const checkIsChipSelected: ({ chipIndex, rowIndex, colIndex, selectedChip, }: Pick<ChipSelection, "rowIndex" | "selectedChip" | "colIndex"> & {
1
+ import { CellContext } from '../../types/index.js';
2
+ export declare const checkIsChipSelected: ({ chipIndex, rowIndex, colIndex, selectedChip, }: Pick<CellContext, "rowIndex" | "selectedChip" | "colIndex"> & {
3
3
  chipIndex: number;
4
4
  }) => boolean;
@@ -1,6 +1,6 @@
1
1
  import type React from 'react';
2
2
  import type { TableCellProps } from '@mui/material';
3
- import type { Charge, TableMode, ChipSelection } from '../../../types/index.js';
3
+ import type { Charge, TableMode, CellContext } from '../../../types/index.js';
4
4
  import type { ActionType, FlagType } from './ActionCell';
5
5
  import { getGeographyBoxColor } from '../../../utils/index.js';
6
6
  export type GeographyBoxVariant = keyof ReturnType<typeof getGeographyBoxColor>;
@@ -62,7 +62,7 @@ export interface AmountCellProps extends TableCellProps {
62
62
  isTextShown?: boolean;
63
63
  tableMode?: TableMode;
64
64
  }
65
- export interface DestinationCellProps extends TableCellProps, ChipSelection {
65
+ export interface DestinationCellProps extends TableCellProps, CellContext {
66
66
  destinationsCount?: number;
67
67
  flagIcon?: string;
68
68
  destinationsTooltip?: React.ReactNode;
@@ -15,7 +15,7 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
15
15
  return null;
16
16
  const value = selector ? selector({ row, index, value: row[column === null || column === void 0 ? void 0 : column.id] }) : row[column === null || column === void 0 ? void 0 : column.id];
17
17
  const formattedValue = format ? format({ value, row, index }) : value;
18
- return render ? (render({ row, column, index, value: row[column === null || column === void 0 ? void 0 : column.id], chipSelection: { onChipClick: handleChipClick, rowIndex, colIndex, selectedChip } })) : (_jsx(_Fragment, { children: formattedValue }));
18
+ return render ? (render({ row, column, index, value: row[column === null || column === void 0 ? void 0 : column.id], cellContext: { onChipClick: handleChipClick, rowIndex, colIndex, selectedChip } })) : (_jsx(_Fragment, { children: formattedValue }));
19
19
  };
20
20
  const content = useMemo(() => (_jsx(_Fragment, { children: columns.map((column, colIndex) => {
21
21
  var _a, _b;
@@ -12,7 +12,7 @@ export declare const chargeTableCellWidth: {
12
12
  readonly id: {
13
13
  readonly default: "225px";
14
14
  readonly text: "225px";
15
- readonly sheet: "235px";
15
+ readonly sheet: "245px";
16
16
  };
17
17
  readonly product: {
18
18
  readonly default: "85px";
@@ -152,7 +152,7 @@ export declare const chargeTableCellWidth: {
152
152
  readonly receipt: {
153
153
  readonly default: "85px";
154
154
  readonly text: "150px";
155
- readonly sheet: "155px";
155
+ readonly sheet: "165px";
156
156
  };
157
157
  readonly fees: {
158
158
  readonly default: "150px";
@@ -162,7 +162,7 @@ export declare const chargeTableCellWidth: {
162
162
  readonly metadata: {
163
163
  readonly default: "180px";
164
164
  readonly text: "180px";
165
- readonly sheet: "265px";
165
+ readonly sheet: "275px";
166
166
  };
167
167
  readonly settlement: {
168
168
  readonly default: "200px";
@@ -202,12 +202,12 @@ export declare const chargeTableCellWidth: {
202
202
  readonly device: {
203
203
  readonly default: "70px";
204
204
  readonly text: "190px";
205
- readonly sheet: "225px";
205
+ readonly sheet: "235px";
206
206
  };
207
207
  readonly card_no: {
208
208
  readonly default: "120px";
209
209
  readonly text: "120px";
210
- readonly sheet: "190px";
210
+ readonly sheet: "200px";
211
211
  };
212
212
  readonly meta: {
213
213
  readonly default: "52px";
@@ -12,7 +12,7 @@ export const chargeTableCellWidth = {
12
12
  id: {
13
13
  default: '225px',
14
14
  text: '225px',
15
- sheet: '235px',
15
+ sheet: '245px',
16
16
  },
17
17
  product: {
18
18
  default: '85px',
@@ -152,7 +152,7 @@ export const chargeTableCellWidth = {
152
152
  receipt: {
153
153
  default: '85px',
154
154
  text: '150px',
155
- sheet: '155px',
155
+ sheet: '165px',
156
156
  },
157
157
  fees: {
158
158
  default: '150px',
@@ -162,7 +162,7 @@ export const chargeTableCellWidth = {
162
162
  metadata: {
163
163
  default: '180px',
164
164
  text: '180px',
165
- sheet: '265px',
165
+ sheet: '275px',
166
166
  },
167
167
  settlement: {
168
168
  default: '200px',
@@ -202,12 +202,12 @@ export const chargeTableCellWidth = {
202
202
  device: {
203
203
  default: '70px',
204
204
  text: '190px',
205
- sheet: '225px',
205
+ sheet: '235px',
206
206
  },
207
207
  card_no: {
208
208
  default: '120px',
209
209
  text: '120px',
210
- sheet: '190px',
210
+ sheet: '200px',
211
211
  },
212
212
  meta: {
213
213
  default: '52px',
@@ -50,7 +50,7 @@ export interface TableFooterProps extends BoxProps {
50
50
  export interface TableChipProps {
51
51
  onChipClick?: (rowIndex: number, columnIndex: number, event: React.MouseEvent, chipIndex: number, pinnedType?: 'start' | 'end') => void;
52
52
  }
53
- export interface ChipSelection {
53
+ export interface CellContext {
54
54
  onChipClick?: (event: React.MouseEvent, chipIndex: number) => void;
55
55
  colIndex?: number;
56
56
  rowIndex?: number;
@@ -61,7 +61,7 @@ export interface IRenderAttr<R, C> {
61
61
  column: C;
62
62
  index: number;
63
63
  value: any;
64
- chipSelection?: ChipSelection;
64
+ cellContext?: CellContext;
65
65
  }
66
66
  export interface IFormatAttr<R> {
67
67
  value: string | Record<string, any> | number;
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.31-test.15",
5
- "testVersion": 15,
4
+ "version": "0.1.31-test.17",
5
+ "testVersion": 17,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",