@tap-payments/os-micro-frontend-shared 0.1.31-test.7 → 0.1.32-test.1

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.
Files changed (26) hide show
  1. package/build/components/StatusChip/StatusChip.d.ts +1 -1
  2. package/build/components/StatusChip/StatusChip.js +3 -36
  3. package/build/components/StatusChip/style.d.ts +3 -7
  4. package/build/components/StatusChip/style.js +36 -6
  5. package/build/components/StatusChip/type.d.ts +0 -2
  6. package/build/components/StatusGroupChips/style.d.ts +0 -2
  7. package/build/components/StatusGroupChips/type.d.ts +0 -2
  8. package/build/components/TableCells/CustomCells/ActionCell/ActionsColumn.d.ts +2 -2
  9. package/build/components/TableCells/CustomCells/ActionCell/ActionsColumn.js +1 -0
  10. package/build/components/TableCells/CustomCells/DestinationCell/DestinationCell.d.ts +1 -1
  11. package/build/components/TableCells/CustomCells/DestinationCell/DestinationCell.js +11 -12
  12. package/build/components/TableCells/CustomCells/type.d.ts +2 -2
  13. package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +1 -3
  14. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.d.ts +0 -2
  15. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +0 -19
  16. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.d.ts +3 -7
  17. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +3 -5
  18. package/build/components/VirtualTables/components/TableRow.d.ts +2 -4
  19. package/build/components/VirtualTables/components/TableRow.js +5 -11
  20. package/build/components/VirtualTables/components/virtualScroll/ListItemWrapper.js +1 -1
  21. package/build/constants/assets.d.ts +0 -1
  22. package/build/constants/assets.js +0 -1
  23. package/build/types/table.d.ts +0 -10
  24. package/build/utils/style.d.ts +0 -6
  25. package/build/utils/style.js +1 -1
  26. package/package.json +2 -2
@@ -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, ...props }: ChipProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default StatusChip;
@@ -9,49 +9,16 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useState } from 'react';
14
- import Box from '@mui/material/Box';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
15
13
  import { useTranslation } from 'react-i18next';
16
- import { AnimatePresence, motion } from 'framer-motion';
17
- import { copyText as copyTextHandler } from '../../utils/index.js';
18
- import { blueCopyIcon, greenCheckIcon } from '../../constants/index.js';
19
14
  import { unknownGeographyColors } from './constants';
20
15
  import { ChipStyled } from './style';
21
16
  const StatusChip = (_a) => {
22
- var { children, unknownText, copyText } = _a, props = __rest(_a, ["children", "unknownText", "copyText"]);
23
- const [showCopy, setShowCopy] = useState(false);
17
+ var { children, unknownText } = _a, props = __rest(_a, ["children", "unknownText"]);
24
18
  const { t } = useTranslation();
25
19
  if (!children) {
26
20
  return (_jsx(ChipStyled, Object.assign({}, unknownGeographyColors, props, { children: unknownText ? t(unknownText) : t('unknown') })));
27
21
  }
28
- const handleCopy = (e) => {
29
- e.stopPropagation();
30
- if (copyText) {
31
- setShowCopy(true);
32
- copyTextHandler(copyText);
33
- const timer = setTimeout(() => {
34
- setShowCopy(false);
35
- }, 2000);
36
- return () => {
37
- clearTimeout(timer);
38
- };
39
- }
40
- };
41
- return (_jsxs(Box, Object.assign({ sx: { position: 'relative', zIndex: props.isSelected ? 3 : 0 } }, { children: [_jsx(ChipStyled, Object.assign({}, props, { sx: { visibility: 'hidden', pointerEvents: 'none' } }, { children: _jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: '4px' } }, { children: children })) })), _jsx(motion.div, Object.assign({ layout: true, transition: {
42
- type: 'spring',
43
- stiffness: 180,
44
- damping: 25,
45
- mass: 0.4,
46
- } }, { children: _jsxs(ChipStyled, Object.assign({}, props, { sx: {
47
- position: 'absolute',
48
- top: 0,
49
- left: 0,
50
- zIndex: props.isSelected ? 3 : 0,
51
- } }, { children: [_jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: '4px' } }, { children: children })), _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: {
52
- height: 12,
53
- width: 12,
54
- objectFit: 'contain',
55
- } })) }))] })) }))] })));
22
+ return _jsx(ChipStyled, Object.assign({}, props, { children: children }));
56
23
  };
57
24
  export default StatusChip;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- export declare const ChipStyled: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
2
+ export declare const ChipStyled: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
3
3
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
4
- }, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
4
+ }, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
5
5
  textColor?: string | undefined;
6
6
  bgColor?: string | undefined;
7
7
  borderColor?: string | undefined;
@@ -9,12 +9,8 @@ export declare const ChipStyled: import("@emotion/styled").StyledComponent<impor
9
9
  padding?: string | undefined;
10
10
  unknownText?: string | undefined;
11
11
  maxWidth?: string | undefined;
12
- isSelected?: boolean | undefined;
13
- copyText?: string | undefined;
14
12
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
15
13
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
16
- }, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & {
14
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & {
17
15
  children?: import("react").ReactNode;
18
- } & {
19
- isSelected?: boolean | undefined;
20
16
  }, {}, {}>;
@@ -1,8 +1,38 @@
1
- import Box from '@mui/material/Box';
2
- import { styled } from '@mui/material/styles';
3
- import { SELECTION_COLORS } from '../../utils/index.js';
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { Box, styled } from '@mui/material';
4
13
  export const ChipStyled = styled(Box, {
5
- shouldForwardProp: (prop) => !['textColor', 'bgColor', 'borderColor', 'disabled', 'padding', 'maxWidth', 'isSelected'].includes(prop),
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 }));
14
+ shouldForwardProp: (prop) => !['textColor', 'bgColor', 'borderColor', 'disabled', 'padding', 'maxWidth'].includes(prop),
15
+ })((_a) => {
16
+ var { theme } = _a, props = __rest(_a, ["theme"]);
17
+ const { textColor = theme.palette.text.primary, bgColor = '#EFF1F2', borderColor = '#EFF1F2', disabled = false, padding, maxWidth } = props;
18
+ return {
19
+ display: 'block',
20
+ textAlign: 'center',
21
+ verticalAlign: 'middle',
22
+ height: '18px',
23
+ padding: padding || '0px 9.5px',
24
+ borderRadius: '30px',
25
+ border: `1px solid ${borderColor}`,
26
+ backgroundColor: bgColor,
27
+ color: textColor,
28
+ cursor: disabled ? 'not-allowed' : 'pointer',
29
+ opacity: disabled ? 0.5 : 1,
30
+ whiteSpace: 'nowrap',
31
+ fontSize: '11px',
32
+ minWidth: '67px',
33
+ maxWidth: maxWidth || 'none',
34
+ overflow: 'hidden',
35
+ textOverflow: maxWidth ? 'ellipsis' : 'unset',
36
+ boxSizing: 'border-box',
37
+ };
8
38
  });
@@ -8,6 +8,4 @@ export type ChipProps = PropsWithChildren<{
8
8
  padding?: string;
9
9
  unknownText?: string;
10
10
  maxWidth?: string;
11
- isSelected?: boolean;
12
- copyText?: string;
13
11
  } & BoxProps>;
@@ -10,8 +10,6 @@ export declare const StyledStatusChip: import("@emotion/styled").StyledComponent
10
10
  padding?: string | undefined;
11
11
  unknownText?: string | undefined;
12
12
  maxWidth?: string | undefined;
13
- isSelected?: boolean | undefined;
14
- copyText?: string | undefined;
15
13
  } & import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
16
14
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
17
15
  }, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & {
@@ -5,8 +5,6 @@ export interface ChipConfig {
5
5
  content: React.ReactNode;
6
6
  sx?: object;
7
7
  onClick?: (event: React.MouseEvent) => void;
8
- copyText: string;
9
- isSelected?: boolean;
10
8
  }
11
9
  export interface StatusGroupChipsProps extends Omit<BoxProps, 'children'> {
12
10
  chips: ChipConfig[];
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import type { ActionCellProps } from '../type';
3
3
  import { TableMode } from '../../../../types/index.js';
4
4
  type ActionsColumnProps = Readonly<Pick<ActionCellProps, 'flag' | 'flagTooltip' | 'flagsCount' | 'row' | 'showJsonViewer' | 'isTextShown' | 'showIdButton' | 'rowId'>> & {
@@ -6,5 +6,5 @@ type ActionsColumnProps = Readonly<Pick<ActionCellProps, 'flag' | 'flagTooltip'
6
6
  tableMode?: TableMode;
7
7
  };
8
8
  declare function ActionsColumn({ flag, flagTooltip, flagsCount, row, showJsonViewer, isTextShown, showIdButton, rowId, onJsonViewClick, tableMode, ...props }: ActionsColumnProps): import("react/jsx-runtime").JSX.Element;
9
- declare const _default: React.MemoExoticComponent<typeof ActionsColumn>;
9
+ declare const _default: import("react").MemoExoticComponent<typeof ActionsColumn>;
10
10
  export default _default;
@@ -24,6 +24,7 @@ function ActionsColumn(_a) {
24
24
  var { flag, flagTooltip, flagsCount, row, showJsonViewer = true, isTextShown, showIdButton = true, rowId, onJsonViewClick, tableMode } = _a, props = __rest(_a, ["flag", "flagTooltip", "flagsCount", "row", "showJsonViewer", "isTextShown", "showIdButton", "rowId", "onJsonViewClick", "tableMode"]);
25
25
  return (_jsx(TableCell, Object.assign({}, props, { sx: {
26
26
  overflow: 'visible',
27
+ zIndex: 1,
27
28
  } }, { children: _jsxs(ActionCellContainer, Object.assign({ "data-testid": "ActionsColumn_ActionCellContainer", tableMode: tableMode }, { children: [flag && (_jsx(_Fragment, { children: isTextShown ? (_jsx(Tooltip, Object.assign({ title: flagTooltip }, { children: _jsx(TextLabel, Object.assign({ "data-testid": "ActionsColumn_FlagLabel", sx: {
28
29
  textAlign: 'left',
29
30
  justifyContent: 'flex-start',
@@ -1,3 +1,3 @@
1
1
  import { DestinationCellProps } from '../type';
2
- declare function DestinationCell({ destinationsCount, destinationsTooltip, isTextShown, destination, destinationsAmount, hidden, iconDirection, tableMode, onChipClick, selectedChip, rowIndex, colIndex, ...props }: DestinationCellProps): import("react/jsx-runtime").JSX.Element | null;
2
+ declare function DestinationCell({ destinationsCount, destinationsTooltip, isTextShown, destination, destinationsAmount, hidden, iconDirection, tableMode, ...props }: DestinationCellProps): import("react/jsx-runtime").JSX.Element | null;
3
3
  export default DestinationCell;
@@ -10,16 +10,16 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
13
- import Box from '@mui/material/Box';
14
13
  import Tooltip from '../../../Tooltip';
15
14
  import { destinationSolidIcon } from '../../../../constants/index.js';
16
15
  import { formatAmount } from '../../../../utils/index.js';
17
16
  import { DestinationCellContainer, DestinationCount, StyledDestinationCell, StyledDestinationIcon } from './styled';
17
+ import TableCell from '../../TableCell';
18
18
  import { TextLabel } from '../style';
19
19
  import { CurrencyIcon, StatusGroupChips } from '../../../index.js';
20
20
  function DestinationCell(_a) {
21
21
  var _b, _c, _d, _e, _f;
22
- var { destinationsCount, destinationsTooltip, isTextShown, destination, destinationsAmount, hidden, iconDirection, tableMode, onChipClick, selectedChip, rowIndex, colIndex } = _a, props = __rest(_a, ["destinationsCount", "destinationsTooltip", "isTextShown", "destination", "destinationsAmount", "hidden", "iconDirection", "tableMode", "onChipClick", "selectedChip", "rowIndex", "colIndex"]);
22
+ var { destinationsCount, destinationsTooltip, isTextShown, destination, destinationsAmount, hidden, iconDirection, tableMode } = _a, props = __rest(_a, ["destinationsCount", "destinationsTooltip", "isTextShown", "destination", "destinationsAmount", "hidden", "iconDirection", "tableMode"]);
23
23
  const destinations = (destination === null || destination === void 0 ? void 0 : destination.destination) || [];
24
24
  const formattedAmount = formatAmount(destinationsAmount || 0);
25
25
  const firstDestinationFormattedAmount = formatAmount(((_b = destinations === null || destinations === void 0 ? void 0 : destinations[0]) === null || _b === void 0 ? void 0 : _b.amount) || 0);
@@ -27,19 +27,15 @@ function DestinationCell(_a) {
27
27
  if (isSheetView) {
28
28
  const sheetViewChips = destinations === null || destinations === void 0 ? void 0 : destinations.map((dest, index) => {
29
29
  const formattedDestAmount = formatAmount((dest === null || dest === void 0 ? void 0 : dest.amount) || 0);
30
- const [, selectedRowIndex, selectedColumnIndex, selectedChipIndex] = (selectedChip !== null && selectedChip !== void 0 ? selectedChip : '').split('-');
31
- const isSelected = Number(selectedRowIndex) === rowIndex && Number(selectedColumnIndex) === colIndex && Number(selectedChipIndex) === index;
32
30
  return {
33
31
  key: `destination-${(dest === null || dest === void 0 ? void 0 : dest.id) || index}`,
34
32
  content: (_jsxs(_Fragment, { children: [_jsxs("div", { children: [dest === null || dest === void 0 ? void 0 : dest.id, " |"] }), _jsx(CurrencyIcon, { currency: dest === null || dest === void 0 ? void 0 : dest.currency }), _jsxs("span", { children: [formattedDestAmount.integerAmount, ".", formattedDestAmount.decimalAmount] })] })),
35
- isSelected,
36
- onClick: (e) => {
37
- onChipClick === null || onChipClick === void 0 ? void 0 : onChipClick(e, index);
38
- },
39
- copyText: `${formattedDestAmount.integerAmount}.${formattedDestAmount.decimalAmount}`,
40
33
  };
41
- }, [selectedChip, rowIndex, colIndex]);
42
- return (_jsx(Box, Object.assign({}, props, { children: _jsx(StatusGroupChips, { chips: sheetViewChips }) })));
34
+ }, []);
35
+ return (_jsx(TableCell, Object.assign({ sx: {
36
+ width: 'fit-content',
37
+ overflow: 'visible',
38
+ } }, props, { children: _jsx(StatusGroupChips, { chips: sheetViewChips }) })));
43
39
  }
44
40
  if (!destinationsCount || hidden) {
45
41
  return null;
@@ -49,6 +45,9 @@ function DestinationCell(_a) {
49
45
  justifyContent: 'flex-start',
50
46
  height: 'auto',
51
47
  } }, { children: destinationsCount > 1 ? (_jsxs("div", { children: ["Destination ", (_c = destinations === null || destinations === void 0 ? void 0 : destinations[0]) === null || _c === void 0 ? void 0 : _c.id, " - ", _jsx(CurrencyIcon, { currency: (_d = destinations === null || destinations === void 0 ? void 0 : destinations[0]) === null || _d === void 0 ? void 0 : _d.currency }), ' ', firstDestinationFormattedAmount.integerAmount, ".", firstDestinationFormattedAmount.decimalAmount, " +", destinationsCount - 1] })) : (_jsxs("div", { children: ["Destination ", (_e = destinations === null || destinations === void 0 ? void 0 : destinations[0]) === null || _e === void 0 ? void 0 : _e.id, " - ", _jsx(CurrencyIcon, { currency: (_f = destinations === null || destinations === void 0 ? void 0 : destinations[0]) === null || _f === void 0 ? void 0 : _f.currency }), " ", formattedAmount.integerAmount, ".", formattedAmount.decimalAmount] })) })));
52
- return (_jsx(Box, Object.assign({}, props, { children: _jsx(Tooltip, Object.assign({ title: destinationsTooltip }, { children: !isTextShown ? (_jsxs(StyledDestinationCell, Object.assign({ tableMode: tableMode }, { children: [_jsx(StyledDestinationIcon, { src: destinationSolidIcon, pointLeft: iconDirection === 'left' }), destinationsCount > 1 && (_jsx(DestinationCellContainer, Object.assign({ destinationsCount: 1 }, { children: _jsx(DestinationCount, { children: destinationsCount }) })))] }))) : (textView) })) })));
48
+ return (_jsx(TableCell, Object.assign({ sx: {
49
+ width: 'fit-content',
50
+ overflow: 'visible',
51
+ } }, props, { children: _jsx(Tooltip, Object.assign({ title: destinationsTooltip }, { children: !isTextShown ? (_jsxs(StyledDestinationCell, Object.assign({ tableMode: tableMode }, { children: [_jsx(StyledDestinationIcon, { src: destinationSolidIcon, pointLeft: iconDirection === 'left' }), destinationsCount > 1 && (_jsx(DestinationCellContainer, Object.assign({ destinationsCount: 1 }, { children: _jsx(DestinationCount, { children: destinationsCount }) })))] }))) : (textView) })) })));
53
52
  }
54
53
  export default DestinationCell;
@@ -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 } 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 {
66
66
  destinationsCount?: number;
67
67
  flagIcon?: string;
68
68
  destinationsTooltip?: React.ReactNode;
@@ -7,7 +7,7 @@ import { SheetViewVirtualTableWrapper } from './style';
7
7
  import { usePinnedColumns, useSynchronizedScroll, useTableState, useTableData, useVirtualTableContainer, usePinnedColumnsWidths } from './hooks';
8
8
  import { PinnedColumn, MainTable, LoadingMainTable, NoDataView, VirtualTable } from './components';
9
9
  function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, rowHeight = 28, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableTitle, dragControls, onColumnPin, clearBackdropVisibilityTimeout = 100, isPinnable = false, tableMode, }) {
10
- const { selectedCell, selectedColumn, showBackDrop, setShowBackdrop, handleCellClick, handleColumnClick, handleChipClick, selectedChip } = useTableState();
10
+ const { selectedCell, selectedColumn, showBackDrop, setShowBackdrop, handleCellClick, handleColumnClick } = useTableState();
11
11
  const { isError, tableLoading, tableError, tableEmpty, hasTimeoutError, showNoDataView, lastItemIndex, areTotalRowsNotFillingHeight, itemsCount, isDelayedFetchingNextPage, } = useTableData({
12
12
  rows,
13
13
  isLoading,
@@ -29,9 +29,7 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
29
29
  isError,
30
30
  selectedCell,
31
31
  selectedColumn,
32
- selectedChip,
33
32
  handleCellClick,
34
- handleChipClick,
35
33
  });
36
34
  const onPointerDown = (e) => {
37
35
  dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
@@ -8,9 +8,7 @@ export declare const useTableState: () => {
8
8
  selectedCell: string | null;
9
9
  selectedColumn: string | null;
10
10
  showBackDrop: boolean;
11
- selectedChip: string | null;
12
11
  setShowBackdrop: import("react").Dispatch<import("react").SetStateAction<boolean>>;
13
- handleChipClick: (rowIndex: number, columnIndex: number, event: React.MouseEvent, chipIndex: number, pinnedType?: 'start' | 'end') => void;
14
12
  handleCellClick: (rowIndex: number, columnIndex: number, event: React.MouseEvent, pinnedType?: 'start' | 'end') => void;
15
13
  handleColumnClick: (columnIndex: number, event: React.MouseEvent, pinnedType?: 'start' | 'end') => void;
16
14
  resetSelection: () => void;
@@ -2,47 +2,28 @@ import { useState, useCallback } from 'react';
2
2
  export const useTableState = () => {
3
3
  const [selectedCell, setSelectedCell] = useState(null);
4
4
  const [selectedColumn, setSelectedColumn] = useState(null);
5
- const [selectedChip, setSelectedChip] = useState(null);
6
5
  const [showBackDrop, setShowBackdrop] = useState(false);
7
- const handleChipClick = useCallback((rowIndex, columnIndex, event, chipIndex, pinnedType) => {
8
- event.stopPropagation();
9
- const chipKey = `${pinnedType !== null && pinnedType !== void 0 ? pinnedType : 'default'}-${rowIndex}-${columnIndex}-${chipIndex}`;
10
- const cellKey = `${pinnedType !== null && pinnedType !== void 0 ? pinnedType : 'default'}-${rowIndex}-${columnIndex}`;
11
- const isChipAlreadySelected = selectedChip === chipKey;
12
- if (isChipAlreadySelected) {
13
- setSelectedChip(null);
14
- setSelectedCell(null);
15
- return;
16
- }
17
- setSelectedChip(chipKey);
18
- setSelectedCell(cellKey);
19
- }, [selectedChip, setSelectedChip, setSelectedCell]);
20
6
  const handleCellClick = useCallback((rowIndex, columnIndex, event, pinnedType) => {
21
7
  event.stopPropagation();
22
8
  const cellKey = `${pinnedType !== null && pinnedType !== void 0 ? pinnedType : 'default'}-${rowIndex}-${columnIndex}`;
23
9
  setSelectedCell((prev) => (prev === cellKey ? null : cellKey));
24
10
  setSelectedColumn(null);
25
- setSelectedChip(null);
26
11
  }, []);
27
12
  const handleColumnClick = useCallback((columnIndex, event, pinnedType) => {
28
13
  event.stopPropagation();
29
14
  const columnKey = `${pinnedType !== null && pinnedType !== void 0 ? pinnedType : 'default'}-${columnIndex}`;
30
15
  setSelectedColumn((prev) => (prev === columnKey ? null : columnKey));
31
16
  setSelectedCell(null);
32
- setSelectedChip(null);
33
17
  }, []);
34
18
  const resetSelection = useCallback(() => {
35
19
  setSelectedCell(null);
36
20
  setSelectedColumn(null);
37
- setSelectedChip(null);
38
21
  }, []);
39
22
  return {
40
23
  selectedCell,
41
24
  selectedColumn,
42
25
  showBackDrop,
43
- selectedChip,
44
26
  setShowBackdrop,
45
- handleChipClick,
46
27
  handleCellClick,
47
28
  handleColumnClick,
48
29
  resetSelection,
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import type { IColumnProps, TableChipProps } from '../../../../types/index.js';
2
+ import type { IColumnProps } from '../../../../types/index.js';
3
3
  import type { TableRowProps } from '@mui/material/TableRow';
4
- interface UseVirtualTableContainerProps<T = unknown> extends TableChipProps {
4
+ interface UseVirtualTableContainerProps<T = unknown> {
5
5
  rowHeight: number;
6
6
  areAllRowsLoaded?: boolean;
7
7
  rows: T[];
@@ -16,11 +16,9 @@ interface UseVirtualTableContainerProps<T = unknown> extends TableChipProps {
16
16
  isError: boolean;
17
17
  selectedCell: string | null;
18
18
  selectedColumn: string | null;
19
- selectedChip: string | null;
20
19
  handleCellClick: (rowIndex: number, columnIndex: number, event: React.MouseEvent, pinnedType?: 'start' | 'end') => void;
21
- handleChipClick: (rowIndex: number, columnIndex: number, event: React.MouseEvent, chipIndex: number, pinnedType?: 'start' | 'end') => void;
22
20
  }
23
- export declare const useVirtualTableContainer: <T = unknown>({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, selectedChip, handleCellClick, handleChipClick, }: UseVirtualTableContainerProps<T>) => {
21
+ export declare const useVirtualTableContainer: <T = unknown>({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, handleCellClick, }: UseVirtualTableContainerProps<T>) => {
24
22
  getItemSize: (index: number, height: number) => number;
25
23
  getItemDataForContainer: (columnsData: IColumnProps[], isPinnedColumn: boolean, height: number) => {
26
24
  columns: any;
@@ -38,9 +36,7 @@ export declare const useVirtualTableContainer: <T = unknown>({ rowHeight, areAll
38
36
  isPinned: any;
39
37
  selectedCell: any;
40
38
  selectedColumn: any;
41
- selectedChip: any;
42
39
  onCellClick: any;
43
- onChipClick: any;
44
40
  containerHeight: any;
45
41
  rowHeight: any;
46
42
  };
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useMemo } from 'react';
2
2
  import memoize from 'memoize-one';
3
- const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, selectedChip, onCellClick, onChipClick, containerHeight, rowHeight) => ({
3
+ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, onCellClick, containerHeight, rowHeight) => ({
4
4
  columns,
5
5
  isLoading,
6
6
  rows,
@@ -16,13 +16,11 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
16
16
  isPinned,
17
17
  selectedCell,
18
18
  selectedColumn,
19
- selectedChip,
20
19
  onCellClick,
21
- onChipClick,
22
20
  containerHeight,
23
21
  rowHeight,
24
22
  }));
25
- export const useVirtualTableContainer = ({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, selectedChip, handleCellClick, handleChipClick, }) => {
23
+ export const useVirtualTableContainer = ({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, handleCellClick, }) => {
26
24
  const getItemSize = useCallback((index, height) => {
27
25
  const isLastRow = areAllRowsLoaded && index === rows.length;
28
26
  if (isLastRow) {
@@ -46,7 +44,7 @@ export const useVirtualTableContainer = ({ rowHeight, areAllRowsLoaded, rows, is
46
44
  areAllRowsLoaded,
47
45
  ];
48
46
  }, [isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount, isError, areAllRowsLoaded]);
49
- const commonItemDataSuffix = useMemo(() => [selectedCell, selectedColumn, selectedChip, handleCellClick, handleChipClick], [selectedCell, selectedColumn, selectedChip, handleCellClick, handleChipClick]);
47
+ const commonItemDataSuffix = useMemo(() => [selectedCell, selectedColumn, handleCellClick], [selectedCell, selectedColumn, handleCellClick]);
50
48
  const getItemDataForContainer = useCallback((columnsData, isPinnedColumn, height) => createItemData(columnsData, ...commonItemDataParams, isPinnedColumn, ...commonItemDataSuffix, height, rowHeight), [commonItemDataParams, commonItemDataSuffix, rowHeight]);
51
49
  return {
52
50
  getItemSize,
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { type TableRowProps } from '@mui/material';
2
+ import type { TableRowProps } from '@mui/material';
3
3
  import type { IColumnProps } from '../../../types/index.js';
4
4
  interface ITableRowProps<R = any> {
5
5
  row: R;
@@ -13,11 +13,9 @@ interface ITableRowProps<R = any> {
13
13
  isSheetView?: boolean;
14
14
  selectedCell?: string | null;
15
15
  selectedColumn?: string | null;
16
- selectedChip?: string | null;
17
16
  onCellClick?: (rowIndex: number, columnIndex: number, event: React.MouseEvent, pinnedType?: 'start' | 'end') => void;
18
- onChipClick?: (rowIndex: number, columnIndex: number, event: React.MouseEvent, chipIndex: number, pinnedType?: 'start' | 'end') => void;
19
17
  isLastRow?: boolean;
20
18
  }
21
- declare function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell, selectedColumn, selectedChip, onCellClick, isLastRow, onChipClick, }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
19
+ declare function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell, selectedColumn, onCellClick, isLastRow, }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
22
20
  declare const _default: import("react").MemoExoticComponent<typeof TableRow>;
23
21
  export default _default;
@@ -1,21 +1,17 @@
1
1
  import { createElement as _createElement } from "react";
2
2
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
3
  import { memo, useMemo } from 'react';
4
- import { Box } from '@mui/material';
5
4
  import { areEqual } from 'react-window';
6
5
  import { StyledCell, StyledTableRow } from './style';
7
6
  import { getSelectionStyles } from '../../../utils/index.js';
8
- function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, selectedChip = null, onCellClick, isLastRow = false, onChipClick, }) {
9
- const renderCell = (column, rowIndex, colIndex) => {
7
+ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, onCellClick, isLastRow = false, }) {
8
+ const renderCell = (column) => {
10
9
  const { render, format, selector } = column;
11
- const handleChipClick = (event, chipIndex) => {
12
- onChipClick === null || onChipClick === void 0 ? void 0 : onChipClick(rowIndex, colIndex, event, chipIndex, column.pinned);
13
- };
14
10
  if (!(column === null || column === void 0 ? void 0 : column.id) || !row)
15
11
  return null;
16
12
  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
13
  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 }));
14
+ return render ? render({ row, column, index, value: row[column === null || column === void 0 ? void 0 : column.id] }) : _jsx(_Fragment, { children: formattedValue });
19
15
  };
20
16
  const content = useMemo(() => (_jsx(_Fragment, { children: columns.map((column, colIndex) => {
21
17
  var _a, _b;
@@ -38,10 +34,8 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
38
34
  effectiveFirst = isFirstColumn && column.pinned !== 'start';
39
35
  effectiveLast = isLastColumn && column.pinned !== 'end';
40
36
  }
41
- return (_jsx(StyledCell, Object.assign({ component: "div", "data-testid": "TableRow_TableCell", "data-column-id": column.id, "data-column-width": column.width, "data-column-width-used": column.width, "data-column-align": column.align, "data-column-order": column.order, "data-column-header": typeof column.header === 'string' ? column.header : 'component', "data-column-sortable": !!column.sortable, "data-column-filterable": !!column.filter, isFirst: effectiveFirst, isLast: effectiveLast, onClick: (event) => {
42
- onCellClick === null || onCellClick === void 0 ? void 0 : onCellClick(index, colIndex, event, column.pinned);
43
- }, sx: Object.assign(Object.assign({ width: column.width, minWidth: column.width, textAlign: column.align, justifyContent: column.align === 'right' ? 'flex-end' : 'flex-start', cursor: onCellClick ? 'pointer' : 'default' }, selectionStyles), column.cellStyle), isSheetView: isSheetView, isSelected: isCellSelected }, { children: _jsx(Box, Object.assign({ sx: { position: 'relative', zIndex: 1, width: '100%' } }, { children: renderCell(column, index, colIndex) })) }), `${column.id}-${colIndex}`));
44
- }) })), [columns, row, index, selectedCell, selectedColumn, onCellClick, isLastRow, selectedChip, isSheetView]);
37
+ return (_jsx(StyledCell, Object.assign({ component: "div", "data-testid": "TableRow_TableCell", "data-column-id": column.id, "data-column-width": column.width, "data-column-width-used": column.width, "data-column-align": column.align, "data-column-order": column.order, "data-column-header": typeof column.header === 'string' ? column.header : 'component', "data-column-sortable": !!column.sortable, "data-column-filterable": !!column.filter, isFirst: effectiveFirst, isLast: effectiveLast, onClick: (event) => onCellClick === null || onCellClick === void 0 ? void 0 : onCellClick(index, colIndex, event, column.pinned), sx: Object.assign(Object.assign({ width: column.width, minWidth: column.width, textAlign: column.align, justifyContent: column.align === 'right' ? 'flex-end' : 'flex-start', cursor: onCellClick ? 'pointer' : 'default' }, selectionStyles), column.cellStyle), isSheetView: isSheetView, isSelected: isCellSelected }, { children: renderCell(column) }), `${column.id}-${colIndex}`));
38
+ }) })), [columns, row, index, selectedCell, selectedColumn, onCellClick, isLastRow]);
45
39
  return (_createElement(StyledTableRow, Object.assign({ "data-testid": "TableRow", onClick: rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick, showShadowHighlight: rowProps === null || rowProps === void 0 ? void 0 : rowProps.showShadowHighlight, showLoadedStyle: rowProps === null || rowProps === void 0 ? void 0 : rowProps.showLoadedStyle, component: "article" }, rowProps, { key: index, isSheetView: isSheetView }), content));
46
40
  }
47
41
  export default memo(TableRow, areEqual);
@@ -57,7 +57,7 @@ function ListItemWrapper(_a) {
57
57
  const row = rows[index];
58
58
  const isLoadingRow = isLoading && index === lastItemIndex + 1;
59
59
  const isLoadedRow = index <= newLoadedRowsEndIndex;
60
- const rowClickHandler = React.useCallback(() => createRowClickHandler(row, rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick), [row, rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick]);
60
+ const rowClickHandler = React.useCallback(createRowClickHandler(row, rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick), [row, rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick]);
61
61
  const memoizedRowProps = React.useMemo(() => (Object.assign(Object.assign({ showShadowHighlight: scrollToIndex === index, showLoadedStyle: isLoadedRow }, rowProps), { onClick: rowClickHandler })), [scrollToIndex, index, isLoadedRow, rowProps, rowClickHandler]);
62
62
  const renderSheetViewLoadingRow = React.useCallback((lastRowContent) => {
63
63
  return (_jsx(Box, Object.assign({ sx: {
@@ -523,4 +523,3 @@ export declare const deactivatedCircle: string;
523
523
  export declare const exclamationOutlinedCircle: string;
524
524
  export declare const outlinedCircle: string;
525
525
  export declare const greenCheck2ACE00: string;
526
- export declare const blueCopyIcon: string;
@@ -527,4 +527,3 @@ export const deactivatedCircle = `${lightUrl}/deactivatedCircle.svg`;
527
527
  export const exclamationOutlinedCircle = `${lightUrl}/exclamationOutlinedCircle.svg`;
528
528
  export const outlinedCircle = `${lightUrl}/outlinedCircle.svg`;
529
529
  export const greenCheck2ACE00 = `${lightUrl}/greenCheck2ACE00.svg`;
530
- export const blueCopyIcon = `${lightUrl}/blueCopyIcon.svg`;
@@ -47,21 +47,11 @@ export interface TableFooterProps extends BoxProps {
47
47
  maximized?: boolean;
48
48
  children?: React.ReactNode;
49
49
  }
50
- export interface TableChipProps {
51
- onChipClick?: (rowIndex: number, columnIndex: number, event: React.MouseEvent, chipIndex: number, pinnedType?: 'start' | 'end') => void;
52
- }
53
- export interface ChipSelection {
54
- onChipClick?: (event: React.MouseEvent, chipIndex: number) => void;
55
- colIndex?: number;
56
- rowIndex?: number;
57
- selectedChip?: string | null;
58
- }
59
50
  export interface IRenderAttr<R, C> {
60
51
  row: R;
61
52
  column: C;
62
53
  index: number;
63
54
  value: any;
64
- chipSelection?: ChipSelection;
65
55
  }
66
56
  export interface IFormatAttr<R> {
67
57
  value: string | Record<string, any> | number;
@@ -1,9 +1,3 @@
1
- export declare const SELECTION_COLORS: {
2
- readonly primary: "#1F88D0";
3
- readonly background: "white";
4
- readonly border: "#F2F2F2";
5
- readonly transparent: "transparent";
6
- };
7
1
  interface GetSelectionStylesParams {
8
2
  isSelected: boolean;
9
3
  isCellSelected: boolean;
@@ -1,4 +1,4 @@
1
- export const SELECTION_COLORS = {
1
+ const SELECTION_COLORS = {
2
2
  primary: '#1F88D0',
3
3
  background: 'white',
4
4
  border: '#F2F2F2',
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.7",
5
- "testVersion": 7,
4
+ "version": "0.1.32-test.1",
5
+ "testVersion": 1,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",