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

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.
@@ -5,6 +5,7 @@ interface Props extends Omit<TooltipProps, 'children'> {
5
5
  placement?: TooltipProps['placement'];
6
6
  children?: ReactElement;
7
7
  className?: string;
8
+ intersectionRoot?: Element | null;
8
9
  }
9
- declare function Tooltip({ className, title, placement, children, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
10
+ declare function Tooltip({ className, title, placement, children, intersectionRoot, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
10
11
  export default Tooltip;
@@ -10,9 +10,35 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
13
+ import { useRef, useState, useEffect } from 'react';
13
14
  import { StyledTooltip } from './styles';
14
15
  function Tooltip(_a) {
15
- var { className, title, placement = 'top', children } = _a, rest = __rest(_a, ["className", "title", "placement", "children"]);
16
- return (_jsx(StyledTooltip, Object.assign({ classes: { popper: className }, title: title, placement: placement, arrow: true }, rest, { children: children || _jsx(_Fragment, {}) })));
16
+ var { className, title, placement = 'top', children, intersectionRoot = null } = _a, rest = __rest(_a, ["className", "title", "placement", "children", "intersectionRoot"]);
17
+ const toolTipRef = useRef(null);
18
+ const [inView, setInView] = useState(true);
19
+ useEffect(() => {
20
+ if (!toolTipRef.current)
21
+ return;
22
+ const currentElement = toolTipRef.current;
23
+ const observer = new IntersectionObserver((entries) => {
24
+ const entry = entries[0];
25
+ setInView(entry.isIntersecting);
26
+ }, {
27
+ root: intersectionRoot,
28
+ rootMargin: '0px',
29
+ threshold: 0,
30
+ });
31
+ observer.observe(currentElement);
32
+ return () => {
33
+ observer.unobserve(currentElement);
34
+ };
35
+ }, [intersectionRoot]);
36
+ return (_jsx(StyledTooltip, Object.assign({ ref: toolTipRef, classes: { popper: className }, title: title, placement: placement, arrow: true, componentsProps: {
37
+ tooltip: {
38
+ sx: {
39
+ display: inView ? 'block' : 'none',
40
+ },
41
+ },
42
+ } }, rest, { children: children || _jsx(_Fragment, {}) })));
17
43
  }
18
44
  export default Tooltip;
@@ -46,7 +46,7 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
46
46
  }
47
47
  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
48
  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}`));
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: _jsx(Box, Object.assign({ sx: Object.assign({}, (isSheetView && { position: 'relative', zIndex: 1 })) }, { children: renderCell(column, index, colIndex) })) }), `${column.id}-${colIndex}`));
50
50
  }) })), [columns, row, index, selectedCell, selectedColumn, onCellClick, isLastRow, selectedChip, isSheetView]);
51
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));
52
52
  }
@@ -259,9 +259,4 @@ export declare const chargeTableCellWidth: {
259
259
  readonly text: "125px";
260
260
  readonly sheet: "145px";
261
261
  };
262
- readonly brand: {
263
- readonly default: "116px";
264
- readonly text: "116px";
265
- readonly sheet: "116px";
266
- };
267
262
  };
@@ -259,9 +259,4 @@ export const chargeTableCellWidth = {
259
259
  text: '125px',
260
260
  sheet: '145px',
261
261
  },
262
- brand: {
263
- default: '116px',
264
- text: '116px',
265
- sheet: '116px',
266
- },
267
262
  };
@@ -9,8 +9,8 @@ export declare function filterShownColumns<T>(columns: Array<IColumnProps<T & {
9
9
  export declare function isParameterSelected(columns: ColumnViewProps[], columnId: string, parameter: string): boolean;
10
10
  export declare function mapDataToViews(columnData?: ColumnsView[], language?: string): ColumnViewProps[];
11
11
  export declare function mapViewsToData(columns: ColumnViewProps[]): ColumnsView[];
12
- export declare const updateColumnSelection: ({ columnsViewData, columnsName, selected, }: {
12
+ export declare const updateColumnSelection: ({ columnsViewData, columnName, selected, }: {
13
13
  columnsViewData: ColumnsView[];
14
- columnsName: string[];
14
+ columnName: string;
15
15
  selected: boolean;
16
16
  }) => ColumnsView[];
@@ -65,10 +65,11 @@ export function mapViewsToData(columns) {
65
65
  };
66
66
  });
67
67
  }
68
- export const updateColumnSelection = ({ columnsViewData, columnsName, selected, }) => {
68
+ export const updateColumnSelection = ({ columnsViewData, columnName, selected, }) => {
69
69
  return columnsViewData.map((column) => {
70
- var _a;
71
- if (columnsName.includes((_a = column.name[0]) === null || _a === void 0 ? void 0 : _a.text)) {
70
+ var _a, _b;
71
+ const columnText = (_b = (_a = column.name[0]) === null || _a === void 0 ? void 0 : _a.text) === null || _b === void 0 ? void 0 : _b.toLowerCase();
72
+ if (columnText === columnName.toLowerCase()) {
72
73
  return Object.assign(Object.assign({}, column), { selected });
73
74
  }
74
75
  return column;
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.48-test.3",
5
- "testVersion": 3,
4
+ "version": "0.1.48-test.5",
5
+ "testVersion": 5,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",