@tap-payments/os-micro-frontend-shared 0.1.53 → 0.1.54
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/LICENSE +21 -21
- package/README.md +12 -12
- package/build/components/AccountDropdown/style.d.ts +1 -1
- package/build/components/ActivityAreaChart/styles.d.ts +3 -3
- package/build/components/AppServices/style.d.ts +1 -1
- package/build/components/CircularProgressWithLabel/style.d.ts +1 -1
- package/build/components/DockButton/style.d.ts +1 -1
- package/build/components/FileUpload/style.d.ts +2 -2
- package/build/components/FileUploader/style.d.ts +1 -1
- package/build/components/IconWithLabel/style.d.ts +1 -1
- package/build/components/IconsDropdown/style.d.ts +2 -2
- package/build/components/JSONViewer/style.d.ts +1 -1
- package/build/components/LabeledIconDropdown/style.d.ts +3 -3
- package/build/components/MultiSelectWithSearch/style.d.ts +3 -3
- package/build/components/NestedDropdown/styles.d.ts +1 -1
- package/build/components/ProgressBar/style.d.ts +1 -1
- package/build/components/ProgressRing/style.d.ts +2 -2
- package/build/components/RFH/Inputs/SelectWithAccordion/style.d.ts +3 -3
- package/build/components/SelectDropdown/style.d.ts +1 -1
- package/build/components/SelectWithSearch/style.d.ts +3 -3
- package/build/components/StatusChip/StatusChip.js +2 -2
- package/build/components/StatusChip/style.js +7 -2
- package/build/components/StatusChipWithCopy/utils.d.ts +1 -1
- package/build/components/StatusLabel/style.d.ts +1 -1
- package/build/components/TableHeader/style.d.ts +1 -1
- package/build/components/Timepicker/style.d.ts +2 -2
- package/build/components/ToolbarIcon/ExpandButton/style.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +2 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeaderCell.js +11 -4
- package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualTable.d.ts +1 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.d.ts +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +15 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.d.ts +3 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +4 -3
- package/build/components/VirtualTables/components/TableFooter/style.d.ts +2 -2
- package/build/components/VirtualTables/components/TableRow.d.ts +2 -1
- package/build/components/VirtualTables/components/TableRow.js +20 -7
- package/build/components/VirtualTables/components/style.d.ts +3 -0
- package/build/components/VirtualTables/components/style.js +7 -3
- package/build/components/Widget/style.d.ts +1 -1
- package/build/components/WindowAppIcon/style.d.ts +1 -1
- package/build/utils/style.d.ts +10 -1
- package/build/utils/style.js +30 -5
- package/package.json +134 -134
|
@@ -13,11 +13,12 @@ interface ITableRowProps<R = any> {
|
|
|
13
13
|
isSheetView?: boolean;
|
|
14
14
|
selectedCell?: string | null;
|
|
15
15
|
selectedColumn?: string | null;
|
|
16
|
+
selectedRow?: number | null;
|
|
16
17
|
selectedChip?: string | null;
|
|
17
18
|
onCellClick?: (rowIndex: number, columnIndex: number, event: React.MouseEvent, pinnedType?: 'start' | 'end') => void;
|
|
18
19
|
onChipClick?: (rowIndex: number, columnIndex: number, event: React.MouseEvent, chipIndex: number, pinnedType?: 'start' | 'end') => void;
|
|
19
20
|
isLastRow?: boolean;
|
|
20
21
|
}
|
|
21
|
-
declare function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell, selectedColumn, selectedChip, onCellClick, isLastRow, onChipClick, }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell, selectedColumn, selectedRow, selectedChip, onCellClick, isLastRow, onChipClick, }: Readonly<ITableRowProps>): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
declare const _default: import("react").MemoExoticComponent<typeof TableRow>;
|
|
23
24
|
export default _default;
|
|
@@ -4,8 +4,8 @@ import { memo, useMemo } from 'react';
|
|
|
4
4
|
import { Box } from '@mui/material';
|
|
5
5
|
import { areEqual } from 'react-window';
|
|
6
6
|
import { StyledCell, StyledTableRow } from './style';
|
|
7
|
-
import { getSelectionStyles } from '../../../utils/index.js';
|
|
8
|
-
function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, selectedChip = null, onCellClick, isLastRow = false, onChipClick, }) {
|
|
7
|
+
import { getSelectionStyles, getRowSelectionBorderStyles } from '../../../utils/index.js';
|
|
8
|
+
function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, selectedRow = null, selectedChip = null, onCellClick, isLastRow = false, onChipClick, }) {
|
|
9
9
|
const renderCell = (column, rowIndex, colIndex) => {
|
|
10
10
|
const { render, format, selector } = column;
|
|
11
11
|
const handleChipClick = (event, chipIndex) => {
|
|
@@ -24,16 +24,20 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
|
|
|
24
24
|
})) : (_jsx(_Fragment, { children: formattedValue }));
|
|
25
25
|
};
|
|
26
26
|
const content = useMemo(() => (_jsx(_Fragment, { children: columns.map((column, colIndex) => {
|
|
27
|
-
var _a, _b;
|
|
27
|
+
var _a, _b, _c;
|
|
28
28
|
const cellKey = `${(_a = column.pinned) !== null && _a !== void 0 ? _a : 'default'}-${index}-${colIndex}`;
|
|
29
29
|
const isCellSelected = selectedCell === cellKey;
|
|
30
30
|
const columnKey = `${(_b = column.pinned) !== null && _b !== void 0 ? _b : 'default'}-${colIndex}`;
|
|
31
31
|
const isColumnSelected = selectedColumn === columnKey;
|
|
32
|
-
const
|
|
32
|
+
const isRowSelected = selectedRow === index;
|
|
33
|
+
const isSelected = isCellSelected || isColumnSelected || isRowSelected;
|
|
34
|
+
const nextCellKey = colIndex < columns.length - 1 ? `${(_c = column.pinned) !== null && _c !== void 0 ? _c : 'default'}-${index}-${colIndex + 1}` : null;
|
|
35
|
+
const isNextCellSelected = nextCellKey ? selectedCell === nextCellKey : false;
|
|
33
36
|
const selectionStyles = getSelectionStyles({
|
|
34
37
|
isSelected,
|
|
35
38
|
isCellSelected,
|
|
36
39
|
isColumnSelected,
|
|
40
|
+
isRowSelected,
|
|
37
41
|
isLastRow,
|
|
38
42
|
});
|
|
39
43
|
const isFirstColumn = column.id === columns[0].id;
|
|
@@ -44,10 +48,19 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
|
|
|
44
48
|
effectiveFirst = isFirstColumn && column.pinned !== 'start';
|
|
45
49
|
effectiveLast = isLastColumn && column.pinned !== 'end';
|
|
46
50
|
}
|
|
51
|
+
const rowSelectionBorderStyles = isRowSelected
|
|
52
|
+
? getRowSelectionBorderStyles({
|
|
53
|
+
isCellSelected,
|
|
54
|
+
isNextCellSelected,
|
|
55
|
+
effectiveLast,
|
|
56
|
+
isPinnedEnd: column.pinned === 'end',
|
|
57
|
+
colIndex,
|
|
58
|
+
})
|
|
59
|
+
: {};
|
|
47
60
|
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) => {
|
|
48
61
|
onCellClick === null || onCellClick === void 0 ? void 0 : onCellClick(index, colIndex, event, column.pinned);
|
|
49
|
-
}, 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: isSheetView ? (_jsx(Box, Object.assign({ sx: { position: 'relative', zIndex: 1 } }, { children: renderCell(column, index, colIndex) }))) : (_jsx(_Fragment, { children: renderCell(column, index, colIndex) })) }), `${column.id}-${colIndex}`));
|
|
50
|
-
}) })), [columns, row, index, selectedCell, selectedColumn, onCellClick, isLastRow, selectedChip, isSheetView]);
|
|
51
|
-
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));
|
|
62
|
+
}, sx: Object.assign(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), rowSelectionBorderStyles), column.cellStyle), isSheetView: isSheetView, isSelected: isCellSelected }, { children: isSheetView ? (_jsx(Box, Object.assign({ sx: { position: 'relative', zIndex: 1 } }, { children: renderCell(column, index, colIndex) }))) : (_jsx(_Fragment, { children: renderCell(column, index, colIndex) })) }), `${column.id}-${colIndex}`));
|
|
63
|
+
}) })), [columns, row, index, selectedCell, selectedColumn, selectedRow, onCellClick, isLastRow, selectedChip, isSheetView]);
|
|
64
|
+
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, selectedRow: selectedRow, index: index }), content));
|
|
52
65
|
}
|
|
53
66
|
export default memo(TableRow, areEqual);
|
|
@@ -38,6 +38,9 @@ export declare const StyledTableRow: import("@emotion/styled").StyledComponent<i
|
|
|
38
38
|
showShadowHighlight?: boolean | undefined;
|
|
39
39
|
showLoadedStyle?: boolean | undefined;
|
|
40
40
|
isSheetView?: boolean | undefined;
|
|
41
|
+
selectedRow?: number | null | undefined;
|
|
42
|
+
isSelected?: boolean | undefined;
|
|
43
|
+
index?: number | undefined;
|
|
41
44
|
}, {}, {}>;
|
|
42
45
|
export declare const StyledTableBox: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
43
46
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
@@ -5,6 +5,7 @@ import MUITableRow from '@mui/material/TableRow';
|
|
|
5
5
|
import { motion } from 'framer-motion';
|
|
6
6
|
import { TABLE_FOOTER_HEIGHT } from './TableFooter/style';
|
|
7
7
|
import VirtualScrollList from './virtualScroll/VirtualScrollList';
|
|
8
|
+
import { SELECTION_COLORS } from '../../../utils/index.js';
|
|
8
9
|
export const TableWrapper = styled(Box, {
|
|
9
10
|
shouldForwardProp: (prop) => prop !== 'showNoDataView',
|
|
10
11
|
})(({ showNoDataView }) => ({
|
|
@@ -63,8 +64,8 @@ export const StyledVirtualList = styled(VirtualScrollList, {
|
|
|
63
64
|
backgroundColor: theme.palette.common.white,
|
|
64
65
|
}))));
|
|
65
66
|
export const StyledTableRow = styled(MUITableRow, {
|
|
66
|
-
shouldForwardProp: (props) => !['showShadowHighlight', 'showLoadedStyle', 'isSheetView'].includes(props),
|
|
67
|
-
})(({ theme, showShadowHighlight, showLoadedStyle, isSheetView }) => (Object.assign({ display: 'flex', borderBottom: `1px solid ${theme === null || theme === void 0 ? void 0 : theme.palette.divider}`, position: 'relative', height: '100%', width: '100%' }, (!isSheetView && Object.assign(Object.assign({ paddingInline: '32px', '&:hover': {
|
|
67
|
+
shouldForwardProp: (props) => !['showShadowHighlight', 'showLoadedStyle', 'isSheetView', 'selectedRow', 'isSelected'].includes(props),
|
|
68
|
+
})(({ theme, showShadowHighlight, showLoadedStyle, isSheetView, selectedRow, index }) => (Object.assign(Object.assign({ display: 'flex', borderBottom: `1px solid ${theme === null || theme === void 0 ? void 0 : theme.palette.divider}`, position: 'relative', height: '100%', width: '100%' }, (!isSheetView && Object.assign(Object.assign({ paddingInline: '32px', '&:hover': {
|
|
68
69
|
boxShadow: theme.shadows[12],
|
|
69
70
|
zIndex: 1,
|
|
70
71
|
'.payment-sources-container': {
|
|
@@ -101,7 +102,10 @@ export const StyledTableRow = styled(MUITableRow, {
|
|
|
101
102
|
position: 'absolute',
|
|
102
103
|
left: 0,
|
|
103
104
|
},
|
|
104
|
-
}))))
|
|
105
|
+
})))), (isSheetView &&
|
|
106
|
+
selectedRow === index && {
|
|
107
|
+
border: `1.5px solid ${SELECTION_COLORS.primary}`,
|
|
108
|
+
}))));
|
|
105
109
|
export const StyledTableBox = styled(Box, {
|
|
106
110
|
shouldForwardProp: (prop) => prop !== 'showNoDataView' && prop !== 'scrollable',
|
|
107
111
|
})(({ theme, showNoDataView, scrollable }) => ({
|
|
@@ -13,7 +13,7 @@ export declare const ListItemStyled: import("@emotion/styled").StyledComponent<i
|
|
|
13
13
|
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
14
14
|
export declare const ItemText: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
15
15
|
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
16
|
-
}, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "m" | "order" | "p" | "style" | "color" | "border" | "borderColor" | "borderBottom" | "flex" | "display" | "alignItems" | "
|
|
16
|
+
}, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "m" | "order" | "p" | "style" | "color" | "border" | "borderRadius" | "borderColor" | "borderBottom" | "flex" | "display" | "alignItems" | "borderRight" | "borderLeft" | "className" | "classes" | "children" | "borderTop" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignContent" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "boxShadow" | "maxWidth" | "minWidth" | "maxHeight" | "boxSizing" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping"> & {
|
|
17
17
|
component?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
18
18
|
} & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
19
19
|
export declare const ItemTextWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const TitleStyled: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
3
3
|
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
4
|
-
}, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "m" | "order" | "p" | "style" | "color" | "border" | "borderColor" | "borderBottom" | "flex" | "display" | "alignItems" | "
|
|
4
|
+
}, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "m" | "order" | "p" | "style" | "color" | "border" | "borderRadius" | "borderColor" | "borderBottom" | "flex" | "display" | "alignItems" | "borderRight" | "borderLeft" | "className" | "classes" | "children" | "borderTop" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignContent" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "boxShadow" | "maxWidth" | "minWidth" | "maxHeight" | "boxSizing" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping"> & {
|
|
5
5
|
component?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
6
6
|
} & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
7
7
|
export declare const StyledWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
package/build/utils/style.d.ts
CHANGED
|
@@ -8,8 +8,17 @@ interface GetSelectionStylesParams {
|
|
|
8
8
|
isSelected: boolean;
|
|
9
9
|
isCellSelected: boolean;
|
|
10
10
|
isColumnSelected: boolean;
|
|
11
|
+
isRowSelected?: boolean;
|
|
11
12
|
isLastRow: boolean;
|
|
12
13
|
}
|
|
13
14
|
type SelectionStyles = Record<string, string | Record<string, string>>;
|
|
14
|
-
export declare const getSelectionStyles: ({ isSelected, isCellSelected, isColumnSelected, isLastRow }: GetSelectionStylesParams) => SelectionStyles;
|
|
15
|
+
export declare const getSelectionStyles: ({ isSelected, isCellSelected, isColumnSelected, isRowSelected, isLastRow, }: GetSelectionStylesParams) => SelectionStyles;
|
|
16
|
+
interface GetRowSelectionBorderStylesParams {
|
|
17
|
+
isCellSelected: boolean;
|
|
18
|
+
isNextCellSelected: boolean;
|
|
19
|
+
effectiveLast: boolean;
|
|
20
|
+
isPinnedEnd: boolean;
|
|
21
|
+
colIndex: number;
|
|
22
|
+
}
|
|
23
|
+
export declare const getRowSelectionBorderStyles: ({ isCellSelected, isNextCellSelected, effectiveLast, isPinnedEnd, colIndex, }: GetRowSelectionBorderStylesParams) => SelectionStyles;
|
|
15
24
|
export {};
|
package/build/utils/style.js
CHANGED
|
@@ -5,18 +5,21 @@ export const SELECTION_COLORS = {
|
|
|
5
5
|
transparent: 'transparent',
|
|
6
6
|
};
|
|
7
7
|
const BORDER_STYLES = {
|
|
8
|
-
thin: '
|
|
9
|
-
thick: '
|
|
8
|
+
thin: '0.5px',
|
|
9
|
+
thick: '1px',
|
|
10
10
|
none: '0px',
|
|
11
11
|
};
|
|
12
12
|
const CELL_DIMENSIONS = {
|
|
13
13
|
minHeight: '28px',
|
|
14
14
|
fullHeight: '100%',
|
|
15
15
|
};
|
|
16
|
-
export const getSelectionStyles = ({ isSelected, isCellSelected, isColumnSelected, isLastRow }) => {
|
|
16
|
+
export const getSelectionStyles = ({ isSelected, isCellSelected, isColumnSelected, isRowSelected, isLastRow, }) => {
|
|
17
17
|
if (!isSelected) {
|
|
18
18
|
return {};
|
|
19
19
|
}
|
|
20
|
+
if (isRowSelected) {
|
|
21
|
+
return getRowSelectionStyles();
|
|
22
|
+
}
|
|
20
23
|
if (isCellSelected && !isColumnSelected) {
|
|
21
24
|
return getSingleCellSelectionStyles();
|
|
22
25
|
}
|
|
@@ -25,12 +28,21 @@ export const getSelectionStyles = ({ isSelected, isCellSelected, isColumnSelecte
|
|
|
25
28
|
}
|
|
26
29
|
return {};
|
|
27
30
|
};
|
|
31
|
+
const getRowSelectionStyles = () => ({
|
|
32
|
+
backgroundColor: SELECTION_COLORS.background,
|
|
33
|
+
color: SELECTION_COLORS.primary,
|
|
34
|
+
border: 'none',
|
|
35
|
+
'&:before': {
|
|
36
|
+
border: 'none',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
28
39
|
const getSingleCellSelectionStyles = () => ({
|
|
29
|
-
border:
|
|
40
|
+
border: `1.5px solid ${SELECTION_COLORS.primary}`,
|
|
30
41
|
backgroundColor: SELECTION_COLORS.background,
|
|
31
42
|
color: SELECTION_COLORS.primary,
|
|
43
|
+
borderRadius: '2px',
|
|
32
44
|
'&:before': {
|
|
33
|
-
border:
|
|
45
|
+
border: `1.5px solid ${SELECTION_COLORS.primary}`,
|
|
34
46
|
},
|
|
35
47
|
});
|
|
36
48
|
const getColumnSelectionStyles = (isLastRow) => {
|
|
@@ -60,3 +72,16 @@ const getBorderWidthForColumn = (isLastRow) => {
|
|
|
60
72
|
const getBorderBottomForColumn = (isLastRow) => {
|
|
61
73
|
return isLastRow ? `${BORDER_STYLES.thick} solid ${SELECTION_COLORS.primary}` : `${BORDER_STYLES.thin} solid ${SELECTION_COLORS.border}`;
|
|
62
74
|
};
|
|
75
|
+
export const getRowSelectionBorderStyles = ({ isCellSelected, isNextCellSelected, effectiveLast, isPinnedEnd, colIndex, }) => (Object.assign(Object.assign(Object.assign({ borderRadius: '0px', '&:before': {
|
|
76
|
+
border: 'none',
|
|
77
|
+
}, '&:after': {
|
|
78
|
+
border: 'none',
|
|
79
|
+
}, border: `1.5px solid ${SELECTION_COLORS.primary}` }, (isCellSelected && Object.assign({ border: `1.5px solid ${SELECTION_COLORS.primary}` }, (isNextCellSelected && {
|
|
80
|
+
borderRight: `1.5px solid ${SELECTION_COLORS.primary}`,
|
|
81
|
+
})))), (isCellSelected &&
|
|
82
|
+
colIndex > 0 && {
|
|
83
|
+
borderLeft: `1.5px solid ${SELECTION_COLORS.primary}`,
|
|
84
|
+
})), (effectiveLast &&
|
|
85
|
+
isPinnedEnd && {
|
|
86
|
+
borderRight: `2.5px solid ${SELECTION_COLORS.primary}`,
|
|
87
|
+
})));
|
package/package.json
CHANGED
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
|
-
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"testVersion": 0,
|
|
6
|
-
"type": "module",
|
|
7
|
-
"main": "build/index.js",
|
|
8
|
-
"module": "build/index.js",
|
|
9
|
-
"types": "build/index.d.ts",
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./build/index.d.ts",
|
|
13
|
-
"import": "./build/index.js",
|
|
14
|
-
"require": "./build/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./constants": {
|
|
17
|
-
"types": "./build/constants/index.d.ts",
|
|
18
|
-
"import": "./build/constants/index.js",
|
|
19
|
-
"require": "./build/constants/index.js"
|
|
20
|
-
},
|
|
21
|
-
"./components": {
|
|
22
|
-
"types": "./build/components/index.d.ts",
|
|
23
|
-
"import": "./build/components/index.js",
|
|
24
|
-
"require": "./build/components/index.js"
|
|
25
|
-
},
|
|
26
|
-
"./components/*": {
|
|
27
|
-
"types": "./build/components/*/index.d.ts",
|
|
28
|
-
"import": "./build/components/*/index.js",
|
|
29
|
-
"require": "./build/components/*/index.js"
|
|
30
|
-
},
|
|
31
|
-
"./hooks": {
|
|
32
|
-
"types": "./build/hooks/index.d.ts",
|
|
33
|
-
"import": "./build/hooks/index.js",
|
|
34
|
-
"require": "./build/hooks/index.js"
|
|
35
|
-
},
|
|
36
|
-
"./utils": {
|
|
37
|
-
"types": "./build/utils/index.d.ts",
|
|
38
|
-
"import": "./build/utils/index.js",
|
|
39
|
-
"require": "./build/utils/index.js"
|
|
40
|
-
},
|
|
41
|
-
"./theme": {
|
|
42
|
-
"types": "./build/theme/index.d.ts",
|
|
43
|
-
"import": "./build/theme/index.js",
|
|
44
|
-
"require": "./build/theme/index.js"
|
|
45
|
-
},
|
|
46
|
-
"./types": {
|
|
47
|
-
"types": "./build/types/index.d.ts",
|
|
48
|
-
"import": "./build/types/index.js",
|
|
49
|
-
"require": "./build/types/index.js"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"license": "MIT",
|
|
53
|
-
"author": {
|
|
54
|
-
"name": "Ahmed Sharkawy",
|
|
55
|
-
"email": "a.elsharkawy@tap.company"
|
|
56
|
-
},
|
|
57
|
-
"files": [
|
|
58
|
-
"build",
|
|
59
|
-
"readme.md"
|
|
60
|
-
],
|
|
61
|
-
"scripts": {
|
|
62
|
-
"ts:build": "rm -rf build && tsc -p tsconfig.npm.json && tsc-alias -p tsconfig.npm.json",
|
|
63
|
-
"push": "npm run ts:build && npm publish --access public",
|
|
64
|
-
"push:test": "node scripts/increment-test-version.cjs && npm run ts:build && npm publish --access public --tag test && node scripts/restore-version.cjs",
|
|
65
|
-
"dev": "vite",
|
|
66
|
-
"build": "tsc -b && vite build ",
|
|
67
|
-
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\"",
|
|
68
|
-
"prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\"",
|
|
69
|
-
"lint": "eslint . --color",
|
|
70
|
-
"lint:fix": "eslint src --fix --color",
|
|
71
|
-
"preview": "vite preview",
|
|
72
|
-
"prepare": "husky"
|
|
73
|
-
},
|
|
74
|
-
"dependencies": {
|
|
75
|
-
"@emotion/react": "^11.11.0",
|
|
76
|
-
"@emotion/styled": "^11.11.0",
|
|
77
|
-
"@hookform/resolvers": "^3.3.1",
|
|
78
|
-
"@mui/material": "^5.12.3",
|
|
79
|
-
"@uiw/react-json-view": "^2.0.0-alpha.16",
|
|
80
|
-
"axios": "^1.4.0",
|
|
81
|
-
"dayjs": "^1.11.8",
|
|
82
|
-
"framer-motion": "10.11.0",
|
|
83
|
-
"i18next": "^22.4.15",
|
|
84
|
-
"memoize-one": "^6.0.0",
|
|
85
|
-
"re-resizable": "^6.9.9",
|
|
86
|
-
"react": "^18.2.0",
|
|
87
|
-
"react-currency-input-field": "^3.6.11",
|
|
88
|
-
"react-dom": "^18.2.0",
|
|
89
|
-
"react-draggable": "^4.4.6",
|
|
90
|
-
"react-dropzone": "^14.2.3",
|
|
91
|
-
"react-hook-form": "^7.45.4",
|
|
92
|
-
"react-hot-toast": "^2.4.1",
|
|
93
|
-
"react-i18next": "^12.2.2",
|
|
94
|
-
"react-multi-date-picker": "^4.1.2",
|
|
95
|
-
"react-router-dom": "^7.7.0",
|
|
96
|
-
"react-virtualized-auto-sizer": "^1.0.20",
|
|
97
|
-
"react-window": "^1.8.9",
|
|
98
|
-
"react-window-infinite-loader": "^1.0.9",
|
|
99
|
-
"react18-input-otp": "^1.1.4",
|
|
100
|
-
"recharts": "^2.15.1"
|
|
101
|
-
},
|
|
102
|
-
"devDependencies": {
|
|
103
|
-
"@eslint/js": "^9.17.0",
|
|
104
|
-
"@testing-library/jest-dom": "^5.16.5",
|
|
105
|
-
"@types/lodash": "^4.17.15",
|
|
106
|
-
"@types/react": "^18.2.6",
|
|
107
|
-
"@types/react-dom": "^18.3.5",
|
|
108
|
-
"@types/react-virtualized-auto-sizer": "^1.0.8",
|
|
109
|
-
"@types/react-window": "^1.8.5",
|
|
110
|
-
"@types/react-window-infinite-loader": "^1.0.6",
|
|
111
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
112
|
-
"eslint": "^9.17.0",
|
|
113
|
-
"eslint-plugin-react-hooks": "^5.0.0",
|
|
114
|
-
"eslint-plugin-react-refresh": "^0.4.16",
|
|
115
|
-
"globals": "^15.14.0",
|
|
116
|
-
"husky": "^8.0.3",
|
|
117
|
-
"lint-staged": "^13.2.2",
|
|
118
|
-
"prettier": "^2.8.8",
|
|
119
|
-
"tsc-alias": "^1.8.16",
|
|
120
|
-
"typescript": "5.0.2",
|
|
121
|
-
"typescript-eslint": "^8.18.2",
|
|
122
|
-
"vite": "6.0.5",
|
|
123
|
-
"vite-tsconfig-paths": "^4.2.0"
|
|
124
|
-
},
|
|
125
|
-
"lint-staged": {
|
|
126
|
-
"src/**/*.{ts,tsx,json,js,jsx}": [
|
|
127
|
-
"yarn run prettier:fix",
|
|
128
|
-
"yarn run lint"
|
|
129
|
-
]
|
|
130
|
-
},
|
|
131
|
-
"publishConfig": {
|
|
132
|
-
"registry": "https://registry.npmjs.org/"
|
|
133
|
-
}
|
|
134
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
|
+
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
+
"version": "0.1.54",
|
|
5
|
+
"testVersion": 0,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "build/index.js",
|
|
8
|
+
"module": "build/index.js",
|
|
9
|
+
"types": "build/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./build/index.d.ts",
|
|
13
|
+
"import": "./build/index.js",
|
|
14
|
+
"require": "./build/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./constants": {
|
|
17
|
+
"types": "./build/constants/index.d.ts",
|
|
18
|
+
"import": "./build/constants/index.js",
|
|
19
|
+
"require": "./build/constants/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./components": {
|
|
22
|
+
"types": "./build/components/index.d.ts",
|
|
23
|
+
"import": "./build/components/index.js",
|
|
24
|
+
"require": "./build/components/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./components/*": {
|
|
27
|
+
"types": "./build/components/*/index.d.ts",
|
|
28
|
+
"import": "./build/components/*/index.js",
|
|
29
|
+
"require": "./build/components/*/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./hooks": {
|
|
32
|
+
"types": "./build/hooks/index.d.ts",
|
|
33
|
+
"import": "./build/hooks/index.js",
|
|
34
|
+
"require": "./build/hooks/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./utils": {
|
|
37
|
+
"types": "./build/utils/index.d.ts",
|
|
38
|
+
"import": "./build/utils/index.js",
|
|
39
|
+
"require": "./build/utils/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./theme": {
|
|
42
|
+
"types": "./build/theme/index.d.ts",
|
|
43
|
+
"import": "./build/theme/index.js",
|
|
44
|
+
"require": "./build/theme/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./types": {
|
|
47
|
+
"types": "./build/types/index.d.ts",
|
|
48
|
+
"import": "./build/types/index.js",
|
|
49
|
+
"require": "./build/types/index.js"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"author": {
|
|
54
|
+
"name": "Ahmed Sharkawy",
|
|
55
|
+
"email": "a.elsharkawy@tap.company"
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"build",
|
|
59
|
+
"readme.md"
|
|
60
|
+
],
|
|
61
|
+
"scripts": {
|
|
62
|
+
"ts:build": "rm -rf build && tsc -p tsconfig.npm.json && tsc-alias -p tsconfig.npm.json",
|
|
63
|
+
"push": "npm run ts:build && npm publish --access public",
|
|
64
|
+
"push:test": "node scripts/increment-test-version.cjs && npm run ts:build && npm publish --access public --tag test && node scripts/restore-version.cjs",
|
|
65
|
+
"dev": "vite",
|
|
66
|
+
"build": "tsc -b && vite build ",
|
|
67
|
+
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\"",
|
|
68
|
+
"prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\"",
|
|
69
|
+
"lint": "eslint . --color",
|
|
70
|
+
"lint:fix": "eslint src --fix --color",
|
|
71
|
+
"preview": "vite preview",
|
|
72
|
+
"prepare": "husky"
|
|
73
|
+
},
|
|
74
|
+
"dependencies": {
|
|
75
|
+
"@emotion/react": "^11.11.0",
|
|
76
|
+
"@emotion/styled": "^11.11.0",
|
|
77
|
+
"@hookform/resolvers": "^3.3.1",
|
|
78
|
+
"@mui/material": "^5.12.3",
|
|
79
|
+
"@uiw/react-json-view": "^2.0.0-alpha.16",
|
|
80
|
+
"axios": "^1.4.0",
|
|
81
|
+
"dayjs": "^1.11.8",
|
|
82
|
+
"framer-motion": "10.11.0",
|
|
83
|
+
"i18next": "^22.4.15",
|
|
84
|
+
"memoize-one": "^6.0.0",
|
|
85
|
+
"re-resizable": "^6.9.9",
|
|
86
|
+
"react": "^18.2.0",
|
|
87
|
+
"react-currency-input-field": "^3.6.11",
|
|
88
|
+
"react-dom": "^18.2.0",
|
|
89
|
+
"react-draggable": "^4.4.6",
|
|
90
|
+
"react-dropzone": "^14.2.3",
|
|
91
|
+
"react-hook-form": "^7.45.4",
|
|
92
|
+
"react-hot-toast": "^2.4.1",
|
|
93
|
+
"react-i18next": "^12.2.2",
|
|
94
|
+
"react-multi-date-picker": "^4.1.2",
|
|
95
|
+
"react-router-dom": "^7.7.0",
|
|
96
|
+
"react-virtualized-auto-sizer": "^1.0.20",
|
|
97
|
+
"react-window": "^1.8.9",
|
|
98
|
+
"react-window-infinite-loader": "^1.0.9",
|
|
99
|
+
"react18-input-otp": "^1.1.4",
|
|
100
|
+
"recharts": "^2.15.1"
|
|
101
|
+
},
|
|
102
|
+
"devDependencies": {
|
|
103
|
+
"@eslint/js": "^9.17.0",
|
|
104
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
105
|
+
"@types/lodash": "^4.17.15",
|
|
106
|
+
"@types/react": "^18.2.6",
|
|
107
|
+
"@types/react-dom": "^18.3.5",
|
|
108
|
+
"@types/react-virtualized-auto-sizer": "^1.0.8",
|
|
109
|
+
"@types/react-window": "^1.8.5",
|
|
110
|
+
"@types/react-window-infinite-loader": "^1.0.6",
|
|
111
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
112
|
+
"eslint": "^9.17.0",
|
|
113
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
114
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
115
|
+
"globals": "^15.14.0",
|
|
116
|
+
"husky": "^8.0.3",
|
|
117
|
+
"lint-staged": "^13.2.2",
|
|
118
|
+
"prettier": "^2.8.8",
|
|
119
|
+
"tsc-alias": "^1.8.16",
|
|
120
|
+
"typescript": "5.0.2",
|
|
121
|
+
"typescript-eslint": "^8.18.2",
|
|
122
|
+
"vite": "6.0.5",
|
|
123
|
+
"vite-tsconfig-paths": "^4.2.0"
|
|
124
|
+
},
|
|
125
|
+
"lint-staged": {
|
|
126
|
+
"src/**/*.{ts,tsx,json,js,jsx}": [
|
|
127
|
+
"yarn run prettier:fix",
|
|
128
|
+
"yarn run lint"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"publishConfig": {
|
|
132
|
+
"registry": "https://registry.npmjs.org/"
|
|
133
|
+
}
|
|
134
|
+
}
|