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

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 (38) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +12 -12
  3. package/build/components/StatusChip/StatusChip.d.ts +1 -1
  4. package/build/components/StatusChip/StatusChip.js +3 -36
  5. package/build/components/StatusChip/style.d.ts +3 -5
  6. package/build/components/StatusChip/style.js +23 -6
  7. package/build/components/StatusChip/type.d.ts +0 -2
  8. package/build/components/StatusGroupChips/style.d.ts +0 -2
  9. package/build/components/StatusGroupChips/type.d.ts +0 -2
  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/components/index.d.ts +0 -1
  22. package/build/components/index.js +0 -1
  23. package/build/constants/assets.d.ts +0 -1
  24. package/build/constants/assets.js +0 -1
  25. package/build/types/table.d.ts +0 -10
  26. package/build/utils/style.d.ts +0 -6
  27. package/build/utils/style.js +1 -1
  28. package/package.json +3 -3
  29. package/build/components/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.d.ts +0 -3
  30. package/build/components/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.js +0 -43
  31. package/build/components/RightLeftExpandingCenterChip/index.d.ts +0 -2
  32. package/build/components/RightLeftExpandingCenterChip/index.js +0 -2
  33. package/build/components/RightLeftExpandingCenterChip/style.d.ts +0 -3415
  34. package/build/components/RightLeftExpandingCenterChip/style.js +0 -104
  35. package/build/components/RightLeftExpandingCenterChip/type.d.ts +0 -10
  36. package/build/components/RightLeftExpandingCenterChip/type.js +0 -1
  37. package/build/components/RightLeftExpandingCenterChip/useRightLeftExpandingCenterChip.d.ts +0 -31
  38. package/build/components/RightLeftExpandingCenterChip/useRightLeftExpandingCenterChip.js +0 -156
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Tap Payments
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Tap Payments
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # os-micro-frontend-shared
2
-
3
- ## Publishing Workflow
4
-
5
- 1. Update version in package.json
6
- 2. Commit changes
7
- 3. Create and push a tag:
8
-
9
- ```bash
10
- npm version patch # or minor, major
11
- git push origin main --tags
12
- ```
1
+ # os-micro-frontend-shared
2
+
3
+ ## Publishing Workflow
4
+
5
+ 1. Update version in package.json
6
+ 2. Commit changes
7
+ 3. Create and push a tag:
8
+
9
+ ```bash
10
+ npm version patch # or minor, major
11
+ git push origin main --tags
12
+ ```
@@ -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: 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: [children, _jsx(AnimatePresence, Object.assign({ mode: "wait" }, { children: props.isSelected && copyText && (_jsx(motion.img, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, style: {
52
- height: 12,
53
- width: 12,
54
- objectFit: 'contain',
55
- }, src: showCopy ? greenCheckIcon : blueCopyIcon, onClick: handleCopy })) }))] })) }))] })));
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,10 +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
16
  }, {}, {}>;
@@ -9,13 +9,30 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import Box from '@mui/material/Box';
13
- import { styled } from '@mui/material/styles';
14
- import { SELECTION_COLORS } from '../../utils/index.js';
12
+ import { Box, styled } from '@mui/material';
15
13
  export const ChipStyled = styled(Box, {
16
- shouldForwardProp: (prop) => !['textColor', 'bgColor', 'borderColor', 'disabled', 'padding', 'maxWidth', 'isSelected'].includes(prop),
14
+ shouldForwardProp: (prop) => !['textColor', 'bgColor', 'borderColor', 'disabled', 'padding', 'maxWidth'].includes(prop),
17
15
  })((_a) => {
18
16
  var { theme } = _a, props = __rest(_a, ["theme"]);
19
- const { textColor = theme.palette.text.primary, bgColor = '#EFF1F2', borderColor = '#EFF1F2', disabled = false, padding, maxWidth, isSelected, } = props;
20
- return Object.assign({ display: 'block', textAlign: 'center', verticalAlign: 'middle', 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 }));
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
+ };
21
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,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 } }, { 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: {
@@ -97,4 +97,3 @@ export { default as AppServices } from './AppServices';
97
97
  export { default as ScrollLoader } from './ScrollLoader';
98
98
  export * from './ScrollLoader';
99
99
  export * from './TooltipChip';
100
- export * from './RightLeftExpandingCenterChip';
@@ -97,4 +97,3 @@ export { default as AppServices } from './AppServices';
97
97
  export { default as ScrollLoader } from './ScrollLoader';
98
98
  export * from './ScrollLoader';
99
99
  export * from './TooltipChip';
100
- export * from './RightLeftExpandingCenterChip';
@@ -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.5",
5
- "testVersion": 5,
4
+ "version": "0.1.31",
5
+ "testVersion": 3,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -131,4 +131,4 @@
131
131
  "publishConfig": {
132
132
  "registry": "https://registry.npmjs.org/"
133
133
  }
134
- }
134
+ }
@@ -1,3 +0,0 @@
1
- import { RightLeftExpandingCenterChipProps } from './type';
2
- declare function RightLeftExpandingCenterChip({ leftIcons, rightIcons, centerIcon, expandableCenter, expandedZIndex, ...props }: Readonly<RightLeftExpandingCenterChipProps>): import("react/jsx-runtime").JSX.Element;
3
- export default RightLeftExpandingCenterChip;