@tap-payments/os-micro-frontend-shared 0.1.101 → 0.1.103

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 (31) hide show
  1. package/build/components/AmountStatusChip/AmountStatusChip.d.ts +9 -0
  2. package/build/components/AmountStatusChip/AmountStatusChip.js +20 -0
  3. package/build/components/AmountStatusChip/index.d.ts +3 -0
  4. package/build/components/AmountStatusChip/index.js +2 -0
  5. package/build/components/AmountStatusChip/style.d.ts +4 -0
  6. package/build/components/AmountStatusChip/style.js +27 -0
  7. package/build/components/ColorPicker/ColorPicker.d.ts +4 -1
  8. package/build/components/ColorPicker/ColorPicker.js +3 -12
  9. package/build/components/StatusChip/StatusChip.d.ts +1 -1
  10. package/build/components/StatusChip/StatusChip.js +11 -8
  11. package/build/components/StatusChip/style.d.ts +1 -0
  12. package/build/components/StatusChip/type.d.ts +1 -0
  13. package/build/components/VirtualTables/SheetViewVirtualTable/components/LoadingMainTable.js +2 -0
  14. package/build/components/VirtualTables/SheetViewVirtualTable/components/MainTable.js +5 -1
  15. package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumn.js +5 -1
  16. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableLoading.js +37 -3
  17. package/build/components/VirtualTables/components/style.js +1 -1
  18. package/build/components/index.d.ts +1 -0
  19. package/build/components/index.js +1 -0
  20. package/build/constants/table/cell/authorizationTableCellWidth.d.ts +2 -2
  21. package/build/constants/table/cell/authorizationTableCellWidth.js +2 -2
  22. package/build/constants/table/cell/chargeTableCellWidth.d.ts +2 -2
  23. package/build/constants/table/cell/chargeTableCellWidth.js +2 -2
  24. package/build/constants/table/cell/destinationsTableCellWidth.d.ts +2 -2
  25. package/build/constants/table/cell/destinationsTableCellWidth.js +2 -2
  26. package/build/constants/table/cell/refundTableCellWidth.d.ts +2 -2
  27. package/build/constants/table/cell/refundTableCellWidth.js +2 -2
  28. package/build/utils/color.d.ts +11 -0
  29. package/build/utils/color.js +10 -0
  30. package/build/utils/style.js +0 -4
  31. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { StatusChipWithCopyProps } from '../StatusChipWithCopy';
3
+ export interface AmountStatusChipProps extends StatusChipWithCopyProps {
4
+ amount?: string;
5
+ currency?: string;
6
+ }
7
+ declare function AmountStatusChip({ amount, currency, ...rest }: AmountStatusChipProps): import("react/jsx-runtime").JSX.Element;
8
+ declare const _default: import("react").MemoExoticComponent<typeof AmountStatusChip>;
9
+ export default _default;
@@ -0,0 +1,20 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { memo } from 'react';
14
+ import CurrencyIcon from '../CurrencyIcon';
15
+ import { AmountLabel, CurrencyIconContainer, StyledAmountStatusChip } from './style';
16
+ function AmountStatusChip(_a) {
17
+ var { amount, currency } = _a, rest = __rest(_a, ["amount", "currency"]);
18
+ return (_jsxs(StyledAmountStatusChip, Object.assign({ expandDirection: "left" }, rest, { children: [currency && (_jsx(AmountLabel, { children: _jsx(CurrencyIconContainer, { children: _jsx(CurrencyIcon, { currency: currency, fontSize: 10 }) }) })), amount] })));
19
+ }
20
+ export default memo(AmountStatusChip);
@@ -0,0 +1,3 @@
1
+ import AmountStatusChip from './AmountStatusChip';
2
+ export { type AmountStatusChipProps } from './AmountStatusChip';
3
+ export default AmountStatusChip;
@@ -0,0 +1,2 @@
1
+ import AmountStatusChip from './AmountStatusChip';
2
+ export default AmountStatusChip;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledAmountStatusChip: import("@emotion/styled").StyledComponent<import("../StatusChipWithCopy").StatusChipWithCopyProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
3
+ export declare const AmountLabel: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
4
+ export declare const CurrencyIconContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
@@ -0,0 +1,27 @@
1
+ import { styled } from '@mui/material/styles';
2
+ import StatusChipWithCopy from '../StatusChipWithCopy';
3
+ export const StyledAmountStatusChip = styled(StatusChipWithCopy)(() => ({
4
+ backgroundColor: '#EFF1F2',
5
+ border: 'none',
6
+ display: 'flex',
7
+ alignItems: 'center',
8
+ justifyContent: 'center',
9
+ transition: 'none !important',
10
+ animation: 'none !important',
11
+ transform: 'none !important',
12
+ '& *': {
13
+ transition: 'none !important',
14
+ animation: 'none !important',
15
+ transform: 'none !important',
16
+ },
17
+ }));
18
+ export const AmountLabel = styled('span')(() => ({
19
+ marginRight: '2px',
20
+ display: 'flex',
21
+ alignItems: 'center',
22
+ }));
23
+ export const CurrencyIconContainer = styled('span')(() => ({
24
+ marginInline: '1.5px',
25
+ display: 'flex',
26
+ alignItems: 'center',
27
+ }));
@@ -5,6 +5,9 @@ type ColorPickerProps = {
5
5
  onChange: (value: string) => void;
6
6
  onReset?: () => void;
7
7
  sx?: SxProps;
8
+ options?: {
9
+ hideReset?: boolean;
10
+ };
8
11
  };
9
- declare const ColorPicker: ({ id, value, onChange, onReset, sx }: ColorPickerProps) => import("react/jsx-runtime").JSX.Element;
12
+ declare const ColorPicker: ({ id, value, onChange, onReset, sx, options }: ColorPickerProps) => import("react/jsx-runtime").JSX.Element;
10
13
  export default ColorPicker;
@@ -13,7 +13,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useCallback, useRef, useState } from 'react';
14
14
  import { RgbaColorPicker } from 'react-colorful';
15
15
  import { useTranslation } from 'react-i18next';
16
- import Color from 'color';
17
16
  import Box from '@mui/material/Box';
18
17
  import ClickAwayListener from '@mui/material/ClickAwayListener';
19
18
  import Divider from '@mui/material/Divider';
@@ -22,16 +21,8 @@ import Stack from '@mui/material/Stack';
22
21
  import Typography from '@mui/material/Typography';
23
22
  import { CancelButton, ConfirmButton, Footer, StyledCloseButtonWrapper, StyledColorWidgetWrapper } from './style';
24
23
  import { closeXIcon } from '../../constants/index.js';
25
- const hexa2Rgba = (value) => {
26
- const colorInstance = Color(value).rgb();
27
- const { r, g, b, alpha = 1 } = colorInstance.object();
28
- return {
29
- value: { r, g, b, alpha },
30
- stringified: `rgba(${r},${g},${b},${alpha})`,
31
- };
32
- };
33
- const rgba2Hexa = (value) => Color(value).hexa();
34
- const ColorPicker = ({ id, value = '#ffffff', onChange, onReset, sx }) => {
24
+ import { hexa2Rgba, rgba2Hexa } from '../../utils/index.js';
25
+ const ColorPicker = ({ id, value = '#ffffff', onChange, onReset, sx, options }) => {
35
26
  const { t } = useTranslation();
36
27
  const [anchorEl, setAnchorEl] = useState(null);
37
28
  const rootRef = useRef(null);
@@ -54,6 +45,6 @@ const ColorPicker = ({ id, value = '#ffffff', onChange, onReset, sx }) => {
54
45
  onChange(rgba2Hexa(Object.assign(Object.assign({}, rest), { alpha })));
55
46
  setAnchorEl(null);
56
47
  }, [onChange, color]);
57
- return (_jsx(ClickAwayListener, Object.assign({ onClickAway: () => setAnchorEl(null) }, { children: _jsxs(Stack, Object.assign({ ref: rootRef, bgcolor: "grey.400", borderRadius: "4px", p: "4px", pr: "12px", direction: "row", justifyContent: "space-between", spacing: 1, alignItems: "center", className: "color-picker" }, { children: [_jsxs(Stack, Object.assign({ sx: sx, direction: "row", spacing: 1, alignItems: "center", className: "color-picker__controls-wrapper" }, { children: [_jsx(Box, { borderRadius: "5px", width: 32, height: 32, sx: { backgroundColor: value }, className: "color-picker__viewer" }), _jsxs(Box, Object.assign({ className: "color-picker__actions-wrapper" }, { children: [_jsx(Typography, Object.assign({ className: "color-picker__label", fontWeight: 500, fontSize: 9, color: "text.primary", textTransform: "uppercase" }, { children: value })), _jsx(Typography, Object.assign({ className: "color-picker__edit-btn", role: "button", onClick: handleOpen, htmlFor: id, fontWeight: 500, fontSize: 9, color: "info.dark", component: "label", sx: { textDecoration: 'underline', cursor: 'pointer' } }, { children: "Edit" }))] }))] })), _jsx(StyledCloseButtonWrapper, Object.assign({ className: "color-picker__close-btn", type: "button", onClick: onReset }, { children: _jsx(Box, { component: "img", src: closeXIcon, width: 10, height: 10 }) })), _jsx(Popper, Object.assign({ anchorEl: anchorEl, open: !!anchorEl, placement: "top" }, { children: _jsxs(StyledColorWidgetWrapper, Object.assign({ className: "color-picker__widget" }, { children: [_jsx(RgbaColorPicker, { color: color, onChange: setColor }), _jsx(Divider, { sx: { my: '12px' } }), _jsxs(Footer, Object.assign({ className: "color-picker__widget-actions" }, { children: [_jsx(CancelButton, Object.assign({ className: "color-picker__widget-actions__cancel", onClick: handleCancel }, { children: t('cancel') })), _jsx(ConfirmButton, Object.assign({ className: "color-picker__widget-actions__confirm", onClick: handleConfirm }, { children: t('okay') }))] }))] })) }))] })) })));
48
+ return (_jsx(ClickAwayListener, Object.assign({ onClickAway: () => setAnchorEl(null) }, { children: _jsxs(Stack, Object.assign({ ref: rootRef, bgcolor: "grey.400", borderRadius: "4px", p: "4px", pr: "12px", direction: "row", justifyContent: "space-between", spacing: 1, alignItems: "center", className: "color-picker", sx: sx }, { children: [_jsxs(Stack, Object.assign({ direction: "row", spacing: 1, alignItems: "center", className: "color-picker__controls-wrapper" }, { children: [_jsx(Box, { borderRadius: "5px", width: 32, height: 32, sx: { backgroundColor: value }, className: "color-picker__viewer" }), _jsxs(Box, Object.assign({ className: "color-picker__actions-wrapper" }, { children: [_jsx(Typography, Object.assign({ className: "color-picker__label", fontWeight: 500, fontSize: 9, color: "text.primary", textTransform: "uppercase" }, { children: value })), _jsx(Typography, Object.assign({ className: "color-picker__edit-btn", role: "button", onClick: handleOpen, htmlFor: id, fontWeight: 500, fontSize: 9, color: "info.dark", component: "label", sx: { textDecoration: 'underline', cursor: 'pointer' } }, { children: "Edit" }))] }))] })), !(options === null || options === void 0 ? void 0 : options.hideReset) ? (_jsx(StyledCloseButtonWrapper, Object.assign({ className: "color-picker__close-btn", type: "button", onClick: onReset }, { children: _jsx(Box, { component: "img", src: closeXIcon, width: 10, height: 10 }) }))) : (_jsx("div", {})), _jsx(Popper, Object.assign({ anchorEl: anchorEl, open: !!anchorEl, placement: "top" }, { children: _jsxs(StyledColorWidgetWrapper, Object.assign({ className: "color-picker__widget" }, { children: [_jsx(RgbaColorPicker, { color: color, onChange: setColor }), _jsx(Divider, { sx: { my: '12px' } }), _jsxs(Footer, Object.assign({ className: "color-picker__widget-actions" }, { children: [_jsx(CancelButton, Object.assign({ className: "color-picker__widget-actions__cancel", onClick: handleCancel }, { children: t('cancel') })), _jsx(ConfirmButton, Object.assign({ className: "color-picker__widget-actions__confirm", onClick: handleConfirm }, { children: t('okay') }))] }))] })) }))] })) })));
58
49
  };
59
50
  export default ColorPicker;
@@ -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, copyText, expandDirection, ...props }: ChipProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default StatusChip;
@@ -18,7 +18,7 @@ import { copyIcon, greenCheckIcon } from '../../constants/index.js';
18
18
  import { unknownGeographyColors } from './constants';
19
19
  import { ChipStyled, Wrapper, CopyWrapper } from './style';
20
20
  const StatusChip = (_a) => {
21
- var { children, unknownText, copyText } = _a, props = __rest(_a, ["children", "unknownText", "copyText"]);
21
+ var { children, unknownText, copyText, expandDirection = 'right' } = _a, props = __rest(_a, ["children", "unknownText", "copyText", "expandDirection"]);
22
22
  const [showCopy, setShowCopy] = useState(false);
23
23
  const { t } = useTranslation();
24
24
  const isSelected = props.isSelected;
@@ -38,12 +38,15 @@ const StatusChip = (_a) => {
38
38
  };
39
39
  }
40
40
  };
41
- return (_jsxs(motion.div, Object.assign({ style: { position: 'relative' }, animate: { zIndex: isSelected ? 3 : 0 } }, { children: [_jsx(ChipStyled, Object.assign({}, props, { sx: { visibility: 'hidden', pointerEvents: 'none' } }, { children: _jsx(Wrapper, { children: children }) })), _jsx(ChipStyled, Object.assign({}, props, { isSelected: isSelected, style: { position: 'absolute', top: 0, left: 0, zIndex: isSelected ? 3 : 0 } }, { children: _jsxs(motion.div, Object.assign({ layout: "size", style: { display: 'flex', gap: '4px' }, animate: {
42
- paddingRight: isSelected && copyText ? 12 : 0,
43
- }, transition: { delay: isSelected ? 0 : 0.2, duration: 0.2 } }, { children: [_jsx(Wrapper, { children: children }), _jsx(AnimatePresence, { children: isSelected && copyText && (_jsx(CopyWrapper, { children: _jsx(motion.img, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { delay: isSelected ? 0.2 : 0, duration: 0.1 }, onClick: handleCopy, src: showCopy ? greenCheckIcon : copyIcon, style: {
44
- height: 12,
45
- width: 12,
46
- objectFit: 'contain',
47
- } }) })) })] })) }))] })));
41
+ const isCopyActive = isSelected && copyText;
42
+ return (_jsxs(motion.div, Object.assign({ style: { position: 'relative' }, animate: { zIndex: isSelected ? 3 : 0 } }, { children: [_jsx(ChipStyled, Object.assign({}, props, { sx: { visibility: 'hidden', pointerEvents: 'none' } }, { children: _jsx(Wrapper, { children: children }) })), _jsx(motion.div, Object.assign({ style: { position: 'absolute', top: 0, zIndex: isSelected ? 3 : 0 }, animate: {
43
+ left: isCopyActive && expandDirection === 'left' ? -12 : 0,
44
+ }, transition: { delay: isSelected ? 0 : 0.2, duration: 0.2 } }, { children: _jsx(ChipStyled, Object.assign({}, props, { isSelected: isSelected }, { children: _jsxs(motion.div, Object.assign({ layout: "size", style: { display: 'flex', gap: '4px' }, animate: {
45
+ paddingRight: isCopyActive ? 12 : 0,
46
+ }, transition: { delay: isSelected ? 0 : 0.2, duration: 0.2 } }, { children: [_jsx(Wrapper, { children: children }), _jsx(AnimatePresence, { children: isCopyActive && (_jsx(CopyWrapper, { children: _jsx(motion.img, { initial: { opacity: 0, x: -5 }, animate: { opacity: 1, x: 0 }, exit: { opacity: 0, x: -2 }, transition: { delay: 0.2, duration: 0.1 }, onClick: handleCopy, src: showCopy ? greenCheckIcon : copyIcon, style: {
47
+ height: 12,
48
+ width: 12,
49
+ objectFit: 'contain',
50
+ } }) })) })] })) })) }))] })));
48
51
  };
49
52
  export default StatusChip;
@@ -11,6 +11,7 @@ export declare const ChipStyled: import("@emotion/styled").StyledComponent<impor
11
11
  maxWidth?: string | undefined;
12
12
  isSelected?: boolean | undefined;
13
13
  copyText?: string | undefined;
14
+ expandDirection?: "left" | "right" | undefined;
14
15
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
15
16
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
16
17
  }, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & {
@@ -10,4 +10,5 @@ export type ChipProps = PropsWithChildren<{
10
10
  maxWidth?: string;
11
11
  isSelected?: boolean;
12
12
  copyText?: string;
13
+ expandDirection?: 'left' | 'right';
13
14
  } & BoxProps>;
@@ -12,8 +12,10 @@ function LoadingMainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, s
12
12
  minWidth: 'fit-content',
13
13
  } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_LoadingStyledBox", hidePadding: true, className: "list-wrapper", sx: {
14
14
  height: '100%',
15
+ maxHeight: '100%',
15
16
  display: 'flex',
16
17
  flexDirection: 'column',
18
+ overflow: 'hidden',
17
19
  } }, { children: _jsx(SheetViewTableLoading, { "data-testid": "SheetViewVirtualTable_TableLoading", columns: unpinnedColumnsData, isLoading: true, isPinned: false }) })) }))] })) })) })));
18
20
  }
19
21
  export default memo(LoadingMainTable);
@@ -10,6 +10,10 @@ function MainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, showHead
10
10
  return (_jsx(MainTableWrapper, Object.assign({ hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }, { children: _jsx(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox", "data-title": tableTitle, "data-direction": theme.direction, "data-are-all-rows-loaded": !!areAllRowsLoaded, "data-is-fetching-next-page": !!isFetchingNextPage, "data-scroll-to-index": scrollToIndex, "data-is-loading": !!isLoading, "data-is-error": !!isError, "data-is-error-timeout": !!hasTimeoutError, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showNoDataView: showNoDataView, scrollable: true }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: '100%' }) }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_UnpinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: unpinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [...pinnedStartColumns, ...pinnedEndColumns], onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick, tablePosition: "scrollable", hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
11
11
  width: '100%',
12
12
  minWidth: 'fit-content',
13
- } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper" }, { children: tableLoading ? (_jsx(SheetViewTableLoading, { "data-testid": "SheetViewVirtualTable_TableLoading", columns: unpinnedColumnsData, isLoading: true, isPinned: false })) : (createVirtualTableContainer(unpinnedColumnsData, 'scrollable', false)) })) }))] })) })) })));
13
+ } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper", sx: {
14
+ height: '100%',
15
+ maxHeight: '100%',
16
+ overflow: 'hidden',
17
+ } }, { children: tableLoading ? (_jsx(SheetViewTableLoading, { "data-testid": "SheetViewVirtualTable_TableLoading", columns: unpinnedColumnsData, isLoading: true, isPinned: false })) : (createVirtualTableContainer(unpinnedColumnsData, 'scrollable', false)) })) }))] })) })) })));
14
18
  }
15
19
  export default memo(MainTable);
@@ -15,6 +15,10 @@ function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList,
15
15
  width: '100%',
16
16
  minWidth: 'fit-content',
17
17
  overflowX: 'hidden',
18
- } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_PinnedStyledBox", hidePadding: true, className: "list-wrapper" }, { children: tableLoading ? (_jsx(SheetViewTableLoading, { "data-testid": `SheetViewVirtualTable_PinnedTableLoading_${position}`, columns: columnsData, isLoading: true, isPinned: true })) : (createVirtualTableContainer(columnsData, containerKey, true, columnsWidth)) })) }))] })) }));
18
+ } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_PinnedStyledBox", hidePadding: true, className: "list-wrapper", sx: {
19
+ height: '100%',
20
+ maxHeight: '100%',
21
+ overflow: 'hidden',
22
+ } }, { children: tableLoading ? (_jsx(SheetViewTableLoading, { "data-testid": `SheetViewVirtualTable_PinnedTableLoading_${position}`, columns: columnsData, isLoading: true, isPinned: true })) : (createVirtualTableContainer(columnsData, containerKey, true, columnsWidth)) })) }))] })) }));
19
23
  }
20
24
  export default memo(PinnedColumn);
@@ -1,19 +1,53 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { memo } from 'react';
2
+ import { memo, useEffect, useState } from 'react';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import uniqueId from 'lodash/uniqueId';
5
5
  import { calculateMaxAllowedRows } from '../../../../utils/index.js';
6
6
  import SheetViewTableRowLoading from './SheetViewTableRowLoading';
7
+ import { SHEET_VIEW_TABLE_ROW_HEIGHT } from '../../../../constants/index.js';
7
8
  const Wrapper = styled('section')(({ isLoaded = false, isPinned = false }) => ({
8
9
  overflow: 'hidden',
9
10
  paddingInline: isLoaded && !isPinned ? '32px' : '0px',
10
11
  backgroundColor: isLoaded && !isPinned ? 'rgba(255, 255, 255, 0.60)' : 'none',
11
12
  filter: isLoaded && !isPinned ? 'blur(8px)' : 'none',
12
13
  marginTop: isLoaded && !isPinned ? '1rem' : '0',
14
+ height: '100%',
15
+ maxHeight: '100%',
13
16
  }));
14
17
  function SheetViewTableLoading({ columns, isLoaded = false, animationType, isLoading = false, rowsCount, isPinned = false, }) {
15
- let maxAllowedRows = rowsCount || calculateMaxAllowedRows(isLoaded, isLoading);
16
- maxAllowedRows = rowsCount || Math.max(maxAllowedRows, 25);
18
+ const [maxAllowedRows, setMaxAllowedRows] = useState(() => {
19
+ return rowsCount || Math.min(calculateMaxAllowedRows(isLoaded, isLoading), 15);
20
+ });
21
+ useEffect(() => {
22
+ if (rowsCount) {
23
+ setMaxAllowedRows(rowsCount);
24
+ return;
25
+ }
26
+ const calculateRowsForContainer = () => {
27
+ var _a;
28
+ const wrapperElement = document.querySelector('[data-testid="SheetViewTableLoading"]');
29
+ if (!wrapperElement) {
30
+ return Math.min(calculateMaxAllowedRows(isLoaded, isLoading), 25);
31
+ }
32
+ const containerHeight = ((_a = wrapperElement.parentElement) === null || _a === void 0 ? void 0 : _a.clientHeight) || 0;
33
+ const rowHeight = SHEET_VIEW_TABLE_ROW_HEIGHT;
34
+ const headerHeight = 40;
35
+ const availableHeight = containerHeight - headerHeight;
36
+ if (availableHeight <= 0) {
37
+ return Math.min(calculateMaxAllowedRows(isLoaded, isLoading), 25);
38
+ }
39
+ const calculatedRows = Math.floor(availableHeight / rowHeight);
40
+ return Math.max(3, Math.min(calculatedRows + 2, 25));
41
+ };
42
+ const rows = calculateRowsForContainer();
43
+ setMaxAllowedRows(rows);
44
+ const handleResize = () => {
45
+ const calculatedRows = calculateRowsForContainer();
46
+ setMaxAllowedRows(calculatedRows);
47
+ };
48
+ window.addEventListener('resize', handleResize);
49
+ return () => window.removeEventListener('resize', handleResize);
50
+ }, [isLoaded, isLoading, rowsCount]);
17
51
  return (_jsx(Wrapper, Object.assign({ isLoaded: isLoaded, isPinned: isPinned, "data-testid": "SheetViewTableLoading" }, { children: [...Array(maxAllowedRows)].map((_, index) => (_jsx(SheetViewTableRowLoading, { columns: columns, animationType: animationType, rowIndex: index, useTableBackground: !isPinned }, `i-${uniqueId('SheetViewTableLoadingRow_')}`))) })));
18
52
  }
19
53
  export default memo(SheetViewTableLoading);
@@ -146,7 +146,7 @@ export const SheetViewTableContainer = styled(Box)(() => ({
146
146
  position: 'relative',
147
147
  display: 'flex',
148
148
  flexDirection: 'column',
149
- height: 'calc(100vh - 300px)',
149
+ height: '100%',
150
150
  paddingInline: '28px',
151
151
  borderRadius: '8px',
152
152
  marginBottom: '16px !important',
@@ -105,4 +105,5 @@ export * from './LeftPeekRightExpandingChip';
105
105
  export { default as ColorPicker } from './ColorPicker';
106
106
  export { default as WindowBackdrop } from './WindowBackdrop';
107
107
  export { default as LazyImage } from './LazyImage';
108
+ export { default as AmountStatusChip, type AmountStatusChipProps } from './AmountStatusChip';
108
109
  export * from './LazyImage';
@@ -105,4 +105,5 @@ export * from './LeftPeekRightExpandingChip';
105
105
  export { default as ColorPicker } from './ColorPicker';
106
106
  export { default as WindowBackdrop } from './WindowBackdrop';
107
107
  export { default as LazyImage } from './LazyImage';
108
+ export { default as AmountStatusChip } from './AmountStatusChip';
108
109
  export * from './LazyImage';
@@ -57,12 +57,12 @@ export declare const authorizationTableCellWidth: {
57
57
  readonly payment_agreement: {
58
58
  readonly default: "50px";
59
59
  readonly text: "150px";
60
- readonly sheet: "170px";
60
+ readonly sheet: "230px";
61
61
  };
62
62
  readonly amount: {
63
63
  readonly default: "170px";
64
64
  readonly text: "195px";
65
- readonly sheet: "195px";
65
+ readonly sheet: "150px";
66
66
  };
67
67
  readonly destinations: {
68
68
  readonly default: "70px";
@@ -57,12 +57,12 @@ export const authorizationTableCellWidth = {
57
57
  payment_agreement: {
58
58
  default: '50px',
59
59
  text: '150px',
60
- sheet: '170px',
60
+ sheet: '230px',
61
61
  },
62
62
  amount: {
63
63
  default: '170px',
64
64
  text: '195px',
65
- sheet: '195px',
65
+ sheet: '150px',
66
66
  },
67
67
  destinations: {
68
68
  default: '70px',
@@ -52,7 +52,7 @@ export declare const chargeTableCellWidth: {
52
52
  readonly payment_agreement: {
53
53
  readonly default: "50px";
54
54
  readonly text: "150px";
55
- readonly sheet: "165px";
55
+ readonly sheet: "230px";
56
56
  };
57
57
  readonly payment_initiated: {
58
58
  readonly default: "150px";
@@ -222,7 +222,7 @@ export declare const chargeTableCellWidth: {
222
222
  readonly consolidated_amount: {
223
223
  readonly default: "180px";
224
224
  readonly text: "180px";
225
- readonly sheet: "180px";
225
+ readonly sheet: "150px";
226
226
  };
227
227
  readonly customer_amount: {
228
228
  readonly default: "150px";
@@ -52,7 +52,7 @@ export const chargeTableCellWidth = {
52
52
  payment_agreement: {
53
53
  default: '50px',
54
54
  text: '150px',
55
- sheet: '165px',
55
+ sheet: '230px',
56
56
  },
57
57
  payment_initiated: {
58
58
  default: '150px',
@@ -222,7 +222,7 @@ export const chargeTableCellWidth = {
222
222
  consolidated_amount: {
223
223
  default: '180px',
224
224
  text: '180px',
225
- sheet: '180px',
225
+ sheet: '150px',
226
226
  },
227
227
  customer_amount: {
228
228
  default: '150px',
@@ -62,12 +62,12 @@ export declare const destinationsTableCellWidth: {
62
62
  readonly payment_agreement: {
63
63
  readonly default: "50px";
64
64
  readonly text: "250px";
65
- readonly sheet: "165px";
65
+ readonly sheet: "230px";
66
66
  };
67
67
  readonly amount: {
68
68
  readonly default: "195px";
69
69
  readonly text: "195px";
70
- readonly sheet: "195px";
70
+ readonly sheet: "150px";
71
71
  };
72
72
  readonly status: {
73
73
  readonly default: "50px";
@@ -62,12 +62,12 @@ export const destinationsTableCellWidth = {
62
62
  payment_agreement: {
63
63
  default: '50px',
64
64
  text: '250px',
65
- sheet: '165px',
65
+ sheet: '230px',
66
66
  },
67
67
  amount: {
68
68
  default: '195px',
69
69
  text: '195px',
70
- sheet: '195px',
70
+ sheet: '150px',
71
71
  },
72
72
  status: {
73
73
  default: '50px',
@@ -47,7 +47,7 @@ export declare const refundTableCellWidth: {
47
47
  readonly payment_agreement: {
48
48
  readonly default: "50px";
49
49
  readonly text: "200px";
50
- readonly sheet: "165px";
50
+ readonly sheet: "230px";
51
51
  };
52
52
  readonly payment_initiated: {
53
53
  readonly default: "150px";
@@ -92,7 +92,7 @@ export declare const refundTableCellWidth: {
92
92
  readonly amount: {
93
93
  readonly default: "195px";
94
94
  readonly text: "195px";
95
- readonly sheet: "180px";
95
+ readonly sheet: "150px";
96
96
  };
97
97
  readonly payouts: {
98
98
  readonly default: "195px";
@@ -47,7 +47,7 @@ export const refundTableCellWidth = {
47
47
  payment_agreement: {
48
48
  default: '50px',
49
49
  text: '200px',
50
- sheet: '165px',
50
+ sheet: '230px',
51
51
  },
52
52
  payment_initiated: {
53
53
  default: '150px',
@@ -92,7 +92,7 @@ export const refundTableCellWidth = {
92
92
  amount: {
93
93
  default: '195px',
94
94
  text: '195px',
95
- sheet: '180px',
95
+ sheet: '150px',
96
96
  },
97
97
  payouts: {
98
98
  default: '195px',
@@ -1,2 +1,13 @@
1
+ import { ColorObject } from 'color';
1
2
  export declare function getRandomColor(): string;
2
3
  export declare function getRandomGradientColor(): string;
4
+ export declare const hexa2Rgba: (value: string) => {
5
+ value: {
6
+ r: number;
7
+ g: number;
8
+ b: number;
9
+ alpha: number;
10
+ };
11
+ stringified: string;
12
+ };
13
+ export declare const rgba2Hexa: (value: ColorObject) => string;
@@ -1,3 +1,4 @@
1
+ import Color from 'color';
1
2
  export function getRandomColor() {
2
3
  const colors = [
3
4
  '#D6D6D6',
@@ -36,3 +37,12 @@ export function getRandomGradientColor() {
36
37
  ];
37
38
  return colors[Math.trunc(Math.random() * colors.length)];
38
39
  }
40
+ export const hexa2Rgba = (value) => {
41
+ const colorInstance = Color(value).rgb();
42
+ const { r, g, b, alpha = 1 } = colorInstance.object();
43
+ return {
44
+ value: { r, g, b, alpha },
45
+ stringified: `rgba(${r},${g},${b},${alpha})`,
46
+ };
47
+ };
48
+ export const rgba2Hexa = (value) => Color(value).hexa();
@@ -31,10 +31,6 @@ export const getSelectionStyles = ({ isSelected, isCellSelected, isColumnSelecte
31
31
  const getRowSelectionStyles = () => ({
32
32
  backgroundColor: SELECTION_COLORS.background,
33
33
  color: SELECTION_COLORS.primary,
34
- border: 'none',
35
- '&:before': {
36
- border: 'none',
37
- },
38
34
  });
39
35
  const getSingleCellSelectionStyles = () => ({
40
36
  border: `${BORDER_STYLES.thin} solid ${SELECTION_COLORS.primary}`,
package/package.json CHANGED
@@ -1,7 +1,7 @@
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.101",
4
+ "version": "0.1.103",
5
5
  "testVersion": 4,
6
6
  "type": "module",
7
7
  "main": "build/index.js",