@tap-payments/os-micro-frontend-shared 0.0.251 → 0.0.252
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.
- package/build/components/TableCells/CustomCells/style.js +1 -1
- package/build/components/VirtualTable/SheetView/SheetViewTableHeader.js +1 -1
- package/build/components/VirtualTable/SheetView/style.d.ts +1 -3
- package/build/components/VirtualTable/SheetView/style.js +1 -1
- package/build/components/VirtualTable/components/TableRow.js +3 -3
- package/build/components/VirtualTable/style.js +1 -1
- package/build/components/VirtualTable/utils/{getBorderStyle.d.ts → getSelectionStyles.d.ts} +6 -3
- package/build/components/VirtualTable/utils/{getBorderStyle.js → getSelectionStyles.js} +6 -6
- package/package.json +2 -2
|
@@ -63,7 +63,7 @@ export const CountBadge = styled('span')(({ theme }) => ({
|
|
|
63
63
|
fontSize: '9.782px',
|
|
64
64
|
fontWeight: 600,
|
|
65
65
|
}));
|
|
66
|
-
export const IdButtonContainer = styled('div')((
|
|
66
|
+
export const IdButtonContainer = styled('div')(() => ({
|
|
67
67
|
display: 'flex',
|
|
68
68
|
width: '24px',
|
|
69
69
|
height: '24px',
|
|
@@ -45,7 +45,7 @@ function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort
|
|
|
45
45
|
const isPinned = pinnedColumns.includes(id);
|
|
46
46
|
const isDefaultPinned = !!column.isDefaultPinned;
|
|
47
47
|
const isSelected = selectedColumn === id;
|
|
48
|
-
return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell", "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, "data-column-pinned": isPinned, isFirst: isFirst, isLast: isLast, isSheetView: true, onClick: (event) => onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event), sx: Object.assign({ display: 'flex', gap: theme.spacing(0.5), alignItems: 'center', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width: column.width, textAlign: align, overflow: 'unset', cursor: 'pointer', boxSizing: 'border-box', border: isSelected ? '
|
|
48
|
+
return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell", "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, "data-column-pinned": isPinned, isFirst: isFirst, isLast: isLast, isSheetView: true, onClick: (event) => onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event), sx: Object.assign({ display: 'flex', gap: theme.spacing(0.5), alignItems: 'center', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width: column.width, textAlign: align, overflow: 'unset', cursor: 'pointer', boxSizing: 'border-box', border: isSelected ? '2px solid #1F88D0' : '1px solid #F2F2F2', backgroundColor: isSelected ? '#F2F2F2' : '#FCFCFC', height: isSelected ? '100%' : 'auto', minHeight: isSelected ? '28px' : 'auto' }, headerStyle) }, { children: [typeof header === 'function' ? (header()) : (_jsx(Box, Object.assign({ "data-testid": "SheetViewTableHeader_columns_header", sx: { maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, { children: header && _jsx(HeaderText, Object.assign({ "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell_header_text" }, { children: header })) }))), filter && _jsx(ColumnFilter, Object.assign({}, filter)), sortable && _jsx(ColumnIcon, { onClick: sortable ? handleClick : undefined, src: columnIcon, alt: "column-icon", "data-id": id }), isPinnable && pinnable && !isDefaultPinned && !isLast && (_jsx(PinIconContainer, Object.assign({ onClick: (event) => {
|
|
49
49
|
event.stopPropagation();
|
|
50
50
|
handlePinClick(id);
|
|
51
51
|
}, title: isPinned ? 'Unpin column' : 'Pin column' }, { children: _jsx("img", { src: isPinned ? unpinIcon : pinIcon, alt: "pin-icon" }) })))] }), `${id}-${colIndex}`));
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
export declare const ActionIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
3
3
|
export declare const ColumnIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
4
4
|
export declare const HeaderText: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
5
|
-
export declare const PinIconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme
|
|
6
|
-
isPinned: boolean;
|
|
7
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
+
export declare const PinIconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
8
6
|
interface StyledHeaderProps {
|
|
9
7
|
showBackDrop: boolean;
|
|
10
8
|
}
|
|
@@ -18,7 +18,7 @@ export const HeaderText = styled('span')(({ theme }) => ({
|
|
|
18
18
|
fontSize: '12px',
|
|
19
19
|
fontWeight: 600,
|
|
20
20
|
}));
|
|
21
|
-
export const PinIconContainer = styled('div')((
|
|
21
|
+
export const PinIconContainer = styled('div')(() => ({
|
|
22
22
|
width: '16px',
|
|
23
23
|
height: 'auto',
|
|
24
24
|
cursor: 'pointer',
|
|
@@ -3,7 +3,7 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { memo, useMemo } from 'react';
|
|
4
4
|
import { areEqual } from 'react-window';
|
|
5
5
|
import { StyledCell, StyledTableRow } from '../style';
|
|
6
|
-
import {
|
|
6
|
+
import { getSelectionStyles } from '../utils/getSelectionStyles';
|
|
7
7
|
function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, onCellClick, isLastRow = false, }) {
|
|
8
8
|
const renderCell = (column) => {
|
|
9
9
|
const { render, format, selector } = column;
|
|
@@ -19,13 +19,13 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
|
|
|
19
19
|
const isCellSelected = selectedCell === cellKey;
|
|
20
20
|
const isColumnSelected = selectedColumn === columnIdStr;
|
|
21
21
|
const isSelected = isCellSelected || isColumnSelected;
|
|
22
|
-
const
|
|
22
|
+
const selectionStyles = getSelectionStyles({
|
|
23
23
|
isSelected,
|
|
24
24
|
isCellSelected,
|
|
25
25
|
isColumnSelected,
|
|
26
26
|
isLastRow,
|
|
27
27
|
});
|
|
28
|
-
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: column.id === columns[0].id, isLast: column.id === columns[columns.length - 1].id, onClick: (event) => onCellClick === null || onCellClick === void 0 ? void 0 : onCellClick(index, columnIdStr, event), 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' },
|
|
28
|
+
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: column.id === columns[0].id, isLast: column.id === columns[columns.length - 1].id, onClick: (event) => onCellClick === null || onCellClick === void 0 ? void 0 : onCellClick(index, columnIdStr, event), 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 }, { children: renderCell(column) }), `${column.id}-${colIndex}`));
|
|
29
29
|
}) })), [columns, row, index, selectedCell, selectedColumn, onCellClick, isLastRow]);
|
|
30
30
|
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));
|
|
31
31
|
}
|
|
@@ -30,7 +30,7 @@ export const StyledSolidBackground = styled(Box)(({ theme }) => ({
|
|
|
30
30
|
}));
|
|
31
31
|
export const StyledCell = styled(TableCell, {
|
|
32
32
|
shouldForwardProp: (prop) => !['isLast', 'isFirst', 'isSheetView'].includes(prop),
|
|
33
|
-
})(({ theme, isLast, isFirst, isSheetView }) => (Object.assign({ paddingBlock: '0', paddingInline: '0.3875rem !important', paddingLeft: isFirst ? '0 !important' : '0.3875rem !important', paddingRight: isLast ? '0 !important' : '0.3875rem !important', color: theme.palette.grey[700], fontSize: theme.typography.caption.fontSize, height: '100%', fontWeight: theme.typography.fontWeightRegular, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: 'flex', alignItems: 'center' }, (isSheetView && {
|
|
33
|
+
})(({ theme, isLast, isFirst, isSheetView }) => (Object.assign({ paddingBlock: '0', paddingInline: '0.3875rem !important', paddingLeft: isFirst ? '0 !important' : '0.3875rem !important', paddingRight: isLast ? '0 !important' : '0.3875rem !important', color: isSheetView ? theme.palette.text.primary : theme.palette.grey[700], fontSize: isSheetView ? theme.typography.subtitle1.fontSize : theme.typography.caption.fontSize, height: '100%', fontWeight: isSheetView ? 400 : theme.typography.fontWeightRegular, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: 'flex', alignItems: 'center' }, (isSheetView && {
|
|
34
34
|
borderRight: isLast ? 'none' : `1px solid ${theme.palette.divider}`,
|
|
35
35
|
paddingInline: '8px !important',
|
|
36
36
|
paddingLeft: '8px !important',
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface GetSelectionStylesParams {
|
|
2
2
|
isSelected: boolean;
|
|
3
3
|
isCellSelected: boolean;
|
|
4
4
|
isColumnSelected: boolean;
|
|
5
5
|
isLastRow: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const getSelectionStyles: ({ isSelected, isCellSelected, isColumnSelected, isLastRow }: GetSelectionStylesParams) => {
|
|
8
8
|
border?: undefined;
|
|
9
9
|
backgroundColor?: undefined;
|
|
10
|
+
color?: undefined;
|
|
10
11
|
borderWidth?: undefined;
|
|
11
12
|
borderStyle?: undefined;
|
|
12
13
|
borderColor?: undefined;
|
|
@@ -18,6 +19,7 @@ export declare const getBorderStyle: ({ isSelected, isCellSelected, isColumnSele
|
|
|
18
19
|
} | {
|
|
19
20
|
border: string;
|
|
20
21
|
backgroundColor: string;
|
|
22
|
+
color: string;
|
|
21
23
|
borderWidth?: undefined;
|
|
22
24
|
borderStyle?: undefined;
|
|
23
25
|
borderColor?: undefined;
|
|
@@ -31,11 +33,12 @@ export declare const getBorderStyle: ({ isSelected, isCellSelected, isColumnSele
|
|
|
31
33
|
borderStyle: string;
|
|
32
34
|
borderColor: string;
|
|
33
35
|
borderBottom: string;
|
|
34
|
-
backgroundColor: string;
|
|
35
36
|
height: string;
|
|
36
37
|
minHeight: string;
|
|
37
38
|
display: string;
|
|
38
39
|
alignItems: string;
|
|
39
40
|
border?: undefined;
|
|
41
|
+
backgroundColor?: undefined;
|
|
42
|
+
color?: undefined;
|
|
40
43
|
};
|
|
41
44
|
export {};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const getSelectionStyles = ({ isSelected, isCellSelected, isColumnSelected, isLastRow }) => {
|
|
2
2
|
if (!isSelected)
|
|
3
3
|
return {};
|
|
4
4
|
if (isCellSelected && !isColumnSelected) {
|
|
5
5
|
return {
|
|
6
|
-
border: '
|
|
7
|
-
backgroundColor: '
|
|
6
|
+
border: '2px solid #1F88D0',
|
|
7
|
+
backgroundColor: 'white',
|
|
8
|
+
color: '#1F88D0',
|
|
8
9
|
};
|
|
9
10
|
}
|
|
10
11
|
if (isColumnSelected) {
|
|
11
12
|
return {
|
|
12
|
-
borderWidth: isLastRow ? '0px
|
|
13
|
+
borderWidth: isLastRow ? '0px 1.5px 1px 1.5px' : '0px 1.5px 0px 1.5px',
|
|
13
14
|
borderStyle: 'solid',
|
|
14
15
|
borderColor: '#1F88D0',
|
|
15
|
-
borderBottom: !isLastRow ? '1px solid #F2F2F2' : '
|
|
16
|
-
backgroundColor: '#F4F9FC',
|
|
16
|
+
borderBottom: !isLastRow ? '1px solid #F2F2F2' : '1.5px solid #1F88D0',
|
|
17
17
|
height: '100%',
|
|
18
18
|
minHeight: '28px',
|
|
19
19
|
display: 'flex',
|
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.0.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.0.252",
|
|
5
|
+
"testVersion": 3,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|