@tap-payments/os-micro-frontend-shared 0.1.103-test.122 → 0.1.103-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.
Files changed (30) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +12 -12
  3. package/build/components/AmountStatusChip/AmountStatusChip.js +2 -3
  4. package/build/components/AmountStatusChip/style.d.ts +0 -1
  5. package/build/components/AmountStatusChip/style.js +0 -6
  6. package/build/components/AuthenticationTypeChip/AuthenticationTypeChip.d.ts +9 -0
  7. package/build/components/AuthenticationTypeChip/AuthenticationTypeChip.js +21 -0
  8. package/build/components/AuthenticationTypeChip/constants.d.ts +16 -0
  9. package/build/components/AuthenticationTypeChip/constants.js +13 -0
  10. package/build/components/AuthenticationTypeChip/index.d.ts +3 -0
  11. package/build/components/AuthenticationTypeChip/index.js +2 -0
  12. package/build/components/StatusChip/StatusChip.js +2 -2
  13. package/build/components/StatusChip/style.js +2 -2
  14. package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +17 -37
  15. package/build/components/VirtualTables/SheetViewVirtualTable/components/MainTable.js +2 -4
  16. package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumn.js +4 -27
  17. package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualTable.js +1 -18
  18. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +3 -15
  19. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +4 -8
  20. package/build/components/index.d.ts +1 -0
  21. package/build/components/index.js +1 -0
  22. package/build/constants/chips/index.d.ts +1 -0
  23. package/build/constants/chips/index.js +1 -0
  24. package/build/{components/StatusChip/constants.d.ts → constants/chips/statusChips.d.ts} +1 -1
  25. package/build/{components/StatusChip/constants.js → constants/chips/statusChips.js} +1 -1
  26. package/build/constants/index.d.ts +1 -0
  27. package/build/constants/index.js +1 -0
  28. package/package.json +5 -9
  29. package/build/components/VirtualTables/optimization/AnimationOptimizations.d.ts +0 -25
  30. package/build/components/VirtualTables/optimization/AnimationOptimizations.js +0 -86
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
+ ```
@@ -11,10 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { memo } from 'react';
14
- import CurrencyIcon from '../CurrencyIcon';
15
- import { AmountLabel, CurrencyIconContainer, StyledAmountStatusChip } from './style';
14
+ import { AmountLabel, StyledAmountStatusChip } from './style';
16
15
  function AmountStatusChip(_a) {
17
16
  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] })));
17
+ return (_jsxs(StyledAmountStatusChip, Object.assign({ expandDirection: "left" }, rest, { children: [currency && _jsx(AmountLabel, { children: currency }), amount] })));
19
18
  }
20
19
  export default memo(AmountStatusChip);
@@ -1,4 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  export declare const StyledAmountStatusChip: import("@emotion/styled").StyledComponent<import("../StatusChipWithCopy").StatusChipWithCopyProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
3
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>, {}>;
@@ -16,12 +16,6 @@ export const StyledAmountStatusChip = styled(StatusChipWithCopy)(() => ({
16
16
  },
17
17
  }));
18
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
19
  display: 'flex',
26
20
  alignItems: 'center',
27
21
  }));
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { StatusChipWithCopyProps } from '../StatusChipWithCopy';
3
+ import { chipAuthenticationTypes } from './constants';
4
+ export interface AuthenticationTypeChipProps extends StatusChipWithCopyProps {
5
+ title: keyof typeof chipAuthenticationTypes;
6
+ }
7
+ declare function AuthenticationTypeChip({ title, ...rest }: AuthenticationTypeChipProps): import("react/jsx-runtime").JSX.Element;
8
+ declare const _default: import("react").MemoExoticComponent<typeof AuthenticationTypeChip>;
9
+ export default _default;
@@ -0,0 +1,21 @@
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 } from "react/jsx-runtime";
13
+ import { memo } from 'react';
14
+ import StatusChipWithCopy from '../StatusChipWithCopy';
15
+ import { chipAuthenticationTypes } from './constants';
16
+ function AuthenticationTypeChip(_a) {
17
+ var { title } = _a, rest = __rest(_a, ["title"]);
18
+ const authenticationType = chipAuthenticationTypes[title];
19
+ return (_jsx(StatusChipWithCopy, Object.assign({}, rest, { sx: Object.assign(Object.assign({}, authenticationType.styles), rest.sx) }, { children: authenticationType.text })));
20
+ }
21
+ export default memo(AuthenticationTypeChip);
@@ -0,0 +1,16 @@
1
+ export declare const chipAuthenticationTypes: {
2
+ '3DS': {
3
+ text: string;
4
+ };
5
+ 'Non-3DS': {
6
+ text: string;
7
+ styles: {
8
+ bgColor: string;
9
+ borderColor: string;
10
+ textColor: string;
11
+ };
12
+ };
13
+ 'Device Biometric': {
14
+ text: string;
15
+ };
16
+ };
@@ -0,0 +1,13 @@
1
+ import { emptyStatusChipColors } from '../../constants/index.js';
2
+ export const chipAuthenticationTypes = {
3
+ '3DS': {
4
+ text: '3DS',
5
+ },
6
+ 'Non-3DS': {
7
+ text: 'Non 3DS',
8
+ styles: Object.assign({}, emptyStatusChipColors),
9
+ },
10
+ 'Device Biometric': {
11
+ text: 'Biometric',
12
+ },
13
+ };
@@ -0,0 +1,3 @@
1
+ import AuthenticationTypeChip from './AuthenticationTypeChip';
2
+ export { type AuthenticationTypeChipProps } from './AuthenticationTypeChip';
3
+ export default AuthenticationTypeChip;
@@ -0,0 +1,2 @@
1
+ import AuthenticationTypeChip from './AuthenticationTypeChip';
2
+ export default AuthenticationTypeChip;
@@ -15,15 +15,15 @@ import { useTranslation } from 'react-i18next';
15
15
  import { AnimatePresence, motion } from 'framer-motion';
16
16
  import { copyText as copyTextHandler } from '../../utils/index.js';
17
17
  import { copyIcon, greenCheckIcon } from '../../constants/index.js';
18
- import { unknownGeographyColors } from './constants';
19
18
  import { ChipStyled, Wrapper, CopyWrapper } from './style';
19
+ import { emptyStatusChipColors } from 'src/constants/chips/statusChips';
20
20
  const StatusChip = (_a) => {
21
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;
25
25
  if (!children) {
26
- return (_jsx(ChipStyled, Object.assign({}, unknownGeographyColors, props, { isSelected: false, sx: (theme) => ({ borderColor: theme.palette.divider }) }, { children: unknownText ? t(unknownText) : t('unknown') })));
26
+ return (_jsx(ChipStyled, Object.assign({}, emptyStatusChipColors, props, { isSelected: false, sx: (theme) => ({ borderColor: theme.palette.divider }) }, { children: unknownText ? t(unknownText) : t('unknown') })));
27
27
  }
28
28
  const handleCopy = (e) => {
29
29
  e.stopPropagation();
@@ -3,8 +3,8 @@ import { styled } from '@mui/material/styles';
3
3
  export const ChipStyled = styled(Box, {
4
4
  shouldForwardProp: (prop) => !['textColor', 'bgColor', 'borderColor', 'disabled', 'padding', 'maxWidth', 'isSelected'].includes(prop),
5
5
  })(({ theme, isSelected, textColor = theme.palette.text.primary, bgColor = '#EFF1F2', borderColor = '#EFF1F2', disabled = false, padding, maxWidth, }) => {
6
- return Object.assign({ display: 'flex', alignItems: 'center', gap: '4px', 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', width: 'fit-content', overflow: 'hidden', textOverflow: maxWidth ? 'ellipsis' : 'unset', boxSizing: 'border-box', borderColor: theme.palette.common.white }, (isSelected && {
7
- boxShadow: 'rgb(242, 242, 242) 7px 0px 8px 2px',
6
+ return Object.assign({ display: 'flex', alignItems: 'center', gap: '4px', 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', width: 'fit-content', overflow: 'hidden', textOverflow: maxWidth ? 'ellipsis' : 'unset', boxSizing: 'border-box' }, (isSelected && {
7
+ boxShadow: 'white 7px 0px 8px 2px',
8
8
  }));
9
9
  });
10
10
  export const Wrapper = styled(Box)(() => ({
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { memo, useCallback, useMemo } from 'react';
2
+ import { memo, useCallback } from 'react';
3
3
  import { SHEET_VIEW_TABLE_THRESHOLD } from '../../../constants/index.js';
4
4
  import TableFooter from '../components/TableFooter/TableFooter';
5
5
  import { SheetViewTableContainer } from '../components/style';
@@ -37,50 +37,30 @@ function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THR
37
37
  const onPointerDown = (e) => {
38
38
  dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
39
39
  };
40
- const scrollHandlers = useMemo(() => ({
41
- start: (scrollProps) => handleScroll(scrollProps, 'start'),
42
- end: (scrollProps) => handleScroll(scrollProps, 'end'),
43
- scrollable: (scrollProps) => handleScroll(scrollProps, 'scrollable'),
44
- }), [handleScroll]);
45
- const stableTableProps = useMemo(() => ({
46
- itemCount: itemsCount,
47
- lastItemIndex,
48
- areAllRowsLoaded,
49
- loadMoreItems,
50
- threshold,
51
- areTotalRowsNotFillingHeight,
52
- clearBackdropVisibilityTimeout,
53
- overscanCount,
54
- }), [
40
+ const createVirtualTableContainer = useCallback((columnsData, containerKey, isPinned = false, fixedWidth) => {
41
+ const listRef = containerKey === 'pinnedStart' ? pinnedStartVirtualListRef : containerKey === 'pinnedEnd' ? pinnedEndVirtualListRef : scrollableVirtualListRef;
42
+ const handleScrollCallback = (scrollProps) => {
43
+ const source = containerKey === 'pinnedStart' ? 'start' : containerKey === 'pinnedEnd' ? 'end' : 'scrollable';
44
+ handleScroll(scrollProps, source);
45
+ };
46
+ return (_jsx(VirtualTable, { columnsData: columnsData, itemCount: itemsCount, lastItemIndex: lastItemIndex, areAllRowsLoaded: areAllRowsLoaded, loadMoreItems: loadMoreItems, threshold: threshold, getItemSize: getItemSize, getItemData: getItemDataForContainer, isPinned: isPinned, fixedWidth: fixedWidth, scrollToIndex: scrollToIndex, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, onScroll: handleScrollCallback, setBackdropVisibility: setShowBackdrop, listRef: listRef, overscanCount: overscanCount }));
47
+ }, [
55
48
  itemsCount,
56
49
  lastItemIndex,
57
50
  areAllRowsLoaded,
58
51
  loadMoreItems,
59
52
  threshold,
53
+ getItemSize,
54
+ getItemDataForContainer,
55
+ scrollToIndex,
60
56
  areTotalRowsNotFillingHeight,
61
57
  clearBackdropVisibilityTimeout,
62
- overscanCount,
58
+ handleScroll,
59
+ setShowBackdrop,
60
+ pinnedStartVirtualListRef,
61
+ pinnedEndVirtualListRef,
62
+ scrollableVirtualListRef,
63
63
  ]);
64
- const dynamicTableProps = useMemo(() => ({
65
- getItemSize,
66
- getItemData: getItemDataForContainer,
67
- scrollToIndex,
68
- setBackdropVisibility: setShowBackdrop,
69
- }), [getItemSize, getItemDataForContainer, scrollToIndex, setShowBackdrop]);
70
- const createPinnedStartTable = useCallback((columnsData, fixedWidth) => (_jsx(VirtualTable, Object.assign({ columnsData: columnsData }, stableTableProps, dynamicTableProps, { isPinned: true, fixedWidth: fixedWidth, onScroll: scrollHandlers.start, listRef: pinnedStartVirtualListRef }), "pinned-start")), [stableTableProps, dynamicTableProps, scrollHandlers.start, pinnedStartVirtualListRef]);
71
- const createPinnedEndTable = useCallback((columnsData, fixedWidth) => (_jsx(VirtualTable, Object.assign({ columnsData: columnsData }, stableTableProps, dynamicTableProps, { isPinned: true, fixedWidth: fixedWidth, onScroll: scrollHandlers.end, listRef: pinnedEndVirtualListRef }), "pinned-end")), [stableTableProps, dynamicTableProps, scrollHandlers.end, pinnedEndVirtualListRef]);
72
- const createScrollableTable = (columnsData) => (_jsx(VirtualTable, Object.assign({ columnsData: columnsData }, stableTableProps, dynamicTableProps, { isPinned: false, onScroll: scrollHandlers.scrollable, listRef: scrollableVirtualListRef }), "scrollable"));
73
- const createVirtualTableContainer = useCallback((columnsData, containerKey, isPinned = false, fixedWidth) => {
74
- switch (containerKey) {
75
- case 'pinnedStart':
76
- return createPinnedStartTable(columnsData, fixedWidth);
77
- case 'pinnedEnd':
78
- return createPinnedEndTable(columnsData, fixedWidth);
79
- case 'scrollable':
80
- default:
81
- return createScrollableTable(columnsData);
82
- }
83
- }, [createPinnedStartTable, createPinnedEndTable, createScrollableTable]);
84
64
  const baseCommonProps = {
85
65
  showHeader,
86
66
  columnsSorting,
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useMemo } from 'react';
2
+ import { memo } from 'react';
3
3
  import { useTheme } from '@mui/material/styles';
4
4
  import { StyledTableBox, TableWrapper, StyledBox } from '../../components/style';
5
5
  import { MainTableWrapper, UnpinnedTableHeaderWrapper } from '../style';
@@ -7,9 +7,7 @@ import SheetViewTableHeader from './SheetViewTableHeader';
7
7
  import SheetViewTableLoading from './SheetViewTableLoading';
8
8
  function MainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, pinnedStartColumns, pinnedEndColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableBodyStyles, tableLoading, createVirtualTableContainer, }) {
9
9
  const theme = useTheme();
10
- const allPinnedColumns = useMemo(() => [...pinnedStartColumns, ...pinnedEndColumns], [pinnedStartColumns, pinnedEndColumns]);
11
- const memoizedTableBodyStyles = useMemo(() => (Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: '100%' })), [tableBodyStyles]);
12
- 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: memoizedTableBodyStyles }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_UnpinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: unpinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: allPinnedColumns, 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: {
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: {
13
11
  width: '100%',
14
12
  minWidth: 'fit-content',
15
13
  } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper", sx: {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useMemo } from 'react';
2
+ import { memo } from 'react';
3
3
  import { useTheme } from '@mui/material/styles';
4
4
  import { StyledTableBox, TableWrapper, StyledBox } from '../../components/style';
5
5
  import { PinnedStartColumnWrapper, PinnedEndColumnWrapper } from '../style';
@@ -7,15 +7,10 @@ import SheetViewTableHeader from './SheetViewTableHeader';
7
7
  import SheetViewTableLoading from './SheetViewTableLoading';
8
8
  function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, hasPinnedStart, hasPinnedEnd, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableLoading, createVirtualTableContainer, }) {
9
9
  const theme = useTheme();
10
- const { Wrapper, containerKey } = useMemo(() => {
11
- const key = position === 'start' ? 'pinnedStart' : 'pinnedEnd';
12
- return {
13
- Wrapper: position === 'start' ? PinnedStartColumnWrapper : PinnedEndColumnWrapper,
14
- containerKey: key,
15
- };
16
- }, [position]);
17
10
  if (columnsData.length === 0)
18
11
  return null;
12
+ const Wrapper = position === 'start' ? PinnedStartColumnWrapper : PinnedEndColumnWrapper;
13
+ const containerKey = position === 'start' ? 'pinnedStart' : 'pinnedEnd';
19
14
  return (_jsx(Wrapper, { children: _jsxs(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 }, { children: [showHeader && (_jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_PinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: columnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: pinnedColumnsList, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick, tablePosition: position === 'start' ? 'pinnedStart' : 'pinnedEnd', hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
20
15
  width: '100%',
21
16
  minWidth: 'fit-content',
@@ -26,22 +21,4 @@ function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList,
26
21
  overflow: 'hidden',
27
22
  } }, { children: tableLoading ? (_jsx(SheetViewTableLoading, { "data-testid": `SheetViewVirtualTable_PinnedTableLoading_${position}`, columns: columnsData, isLoading: true, isPinned: true })) : (createVirtualTableContainer(columnsData, containerKey, true, columnsWidth)) })) }))] })) }));
28
23
  }
29
- export default memo(PinnedColumn, (prevProps, nextProps) => {
30
- var _a, _b, _c, _d, _e, _f;
31
- const criticalProps = [
32
- 'position',
33
- 'columnsWidth',
34
- 'showHeader',
35
- 'showBackDrop',
36
- 'tableLoading',
37
- 'showNoDataView',
38
- 'hasPinnedStart',
39
- 'hasPinnedEnd',
40
- ];
41
- const areCriticalPropsSame = criticalProps.every((prop) => prevProps[prop] === nextProps[prop]);
42
- const areColumnsDataSame = ((_a = prevProps.columnsData) === null || _a === void 0 ? void 0 : _a.length) === ((_b = nextProps.columnsData) === null || _b === void 0 ? void 0 : _b.length) &&
43
- ((_c = prevProps.columnsData) === null || _c === void 0 ? void 0 : _c.every((col, index) => { var _a, _b, _c, _d; return col.id === ((_b = (_a = nextProps.columnsData) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.id) && col.width === ((_d = (_c = nextProps.columnsData) === null || _c === void 0 ? void 0 : _c[index]) === null || _d === void 0 ? void 0 : _d.width); }));
44
- const arePinnedColumnsSame = ((_d = prevProps.pinnedColumnsList) === null || _d === void 0 ? void 0 : _d.length) === ((_e = nextProps.pinnedColumnsList) === null || _e === void 0 ? void 0 : _e.length) &&
45
- ((_f = prevProps.pinnedColumnsList) === null || _f === void 0 ? void 0 : _f.every((col, index) => { var _a; return col === ((_a = nextProps.pinnedColumnsList) === null || _a === void 0 ? void 0 : _a[index]); }));
46
- return areCriticalPropsSame && areColumnsDataSame && arePinnedColumnsSame;
47
- });
24
+ export default memo(PinnedColumn);
@@ -30,21 +30,4 @@ function VirtualTable({ columnsData, itemCount, lastItemIndex, areAllRowsLoaded,
30
30
  } }, { children: ListItemWrapper })));
31
31
  } }))) })));
32
32
  }
33
- export default memo(VirtualTable, (prevProps, nextProps) => {
34
- var _a, _b, _c;
35
- const propsToCompare = [
36
- 'columnsData',
37
- 'itemCount',
38
- 'lastItemIndex',
39
- 'areAllRowsLoaded',
40
- 'isPinned',
41
- 'fixedWidth',
42
- 'scrollToIndex',
43
- 'areTotalRowsNotFillingHeight',
44
- 'overscanCount',
45
- ];
46
- const areCriticalPropsSame = propsToCompare.every((key) => prevProps[key] === nextProps[key]);
47
- const areColumnsDataSame = ((_a = prevProps.columnsData) === null || _a === void 0 ? void 0 : _a.length) === ((_b = nextProps.columnsData) === null || _b === void 0 ? void 0 : _b.length) &&
48
- ((_c = prevProps.columnsData) === null || _c === void 0 ? void 0 : _c.every((col, index) => { var _a, _b, _c, _d; return col.id === ((_b = (_a = nextProps.columnsData) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.id) && col.width === ((_d = (_c = nextProps.columnsData) === null || _c === void 0 ? void 0 : _c[index]) === null || _d === void 0 ? void 0 : _d.width); }));
49
- return areCriticalPropsSame && areColumnsDataSame;
50
- });
33
+ export default memo(VirtualTable);
@@ -1,4 +1,4 @@
1
- import { useState, useCallback, useMemo } from 'react';
1
+ import { useState, useCallback } from 'react';
2
2
  export const useTableState = () => {
3
3
  const [selectedCell, setSelectedCell] = useState(null);
4
4
  const [selectedColumn, setSelectedColumn] = useState(null);
@@ -48,7 +48,7 @@ export const useTableState = () => {
48
48
  setSelectedChip(null);
49
49
  setSelectedRow(null);
50
50
  }, []);
51
- const tableStateAPI = useMemo(() => ({
51
+ return {
52
52
  selectedCell,
53
53
  selectedColumn,
54
54
  selectedRow,
@@ -59,17 +59,5 @@ export const useTableState = () => {
59
59
  handleCellClick,
60
60
  handleColumnClick,
61
61
  resetSelection,
62
- }), [
63
- selectedCell,
64
- selectedColumn,
65
- selectedRow,
66
- showBackDrop,
67
- selectedChip,
68
- setShowBackdrop,
69
- handleChipClick,
70
- handleCellClick,
71
- handleColumnClick,
72
- resetSelection,
73
- ]);
74
- return tableStateAPI;
62
+ };
75
63
  };
@@ -1,4 +1,4 @@
1
- import { useCallback, useMemo, useRef } from 'react';
1
+ import { useCallback, useMemo } from 'react';
2
2
  import memoize from 'memoize-one';
3
3
  const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, selectedRow, selectedChip, onCellClick, onChipClick, containerHeight, rowHeight) => ({
4
4
  columns,
@@ -24,20 +24,16 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
24
24
  rowHeight,
25
25
  }));
26
26
  export const useVirtualTableContainer = ({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, selectedRow, selectedChip, handleCellClick, handleChipClick, }) => {
27
- const stableRowsLength = useRef(rows.length);
28
- if (stableRowsLength.current !== rows.length) {
29
- stableRowsLength.current = rows.length;
30
- }
31
27
  const getItemSize = useCallback((index, height) => {
32
- const isLastRow = areAllRowsLoaded && index === stableRowsLength.current;
28
+ const isLastRow = areAllRowsLoaded && index === rows.length;
33
29
  if (isLastRow) {
34
- const usedHeight = stableRowsLength.current * rowHeight;
30
+ const usedHeight = rows.length * rowHeight;
35
31
  const remainingHeight = height - usedHeight;
36
32
  const minimumLastRowHeight = rowHeight * 2;
37
33
  return Math.max(remainingHeight, minimumLastRowHeight);
38
34
  }
39
35
  return rowHeight;
40
- }, [areAllRowsLoaded, rowHeight]);
36
+ }, [areAllRowsLoaded, rows.length, rowHeight]);
41
37
  const commonItemDataParams = useMemo(() => {
42
38
  var _a;
43
39
  return [
@@ -106,4 +106,5 @@ export { default as ColorPicker } from './ColorPicker';
106
106
  export { default as WindowBackdrop } from './WindowBackdrop';
107
107
  export { default as LazyImage } from './LazyImage';
108
108
  export { default as AmountStatusChip, type AmountStatusChipProps } from './AmountStatusChip';
109
+ export { default as AuthenticationTypeChip, type AuthenticationTypeChipProps } from './AuthenticationTypeChip';
109
110
  export * from './LazyImage';
@@ -106,4 +106,5 @@ export { default as ColorPicker } from './ColorPicker';
106
106
  export { default as WindowBackdrop } from './WindowBackdrop';
107
107
  export { default as LazyImage } from './LazyImage';
108
108
  export { default as AmountStatusChip } from './AmountStatusChip';
109
+ export { default as AuthenticationTypeChip } from './AuthenticationTypeChip';
109
110
  export * from './LazyImage';
@@ -0,0 +1 @@
1
+ export * from './statusChips';
@@ -0,0 +1 @@
1
+ export * from './statusChips';
@@ -1,4 +1,4 @@
1
- export declare const unknownGeographyColors: {
1
+ export declare const emptyStatusChipColors: {
2
2
  bgColor: string;
3
3
  borderColor: string;
4
4
  textColor: string;
@@ -1,4 +1,4 @@
1
- export const unknownGeographyColors = {
1
+ export const emptyStatusChipColors = {
2
2
  bgColor: 'white',
3
3
  borderColor: '#F2F2F2',
4
4
  textColor: '#20232B33',
@@ -12,3 +12,4 @@ export * from './table';
12
12
  export * from './toggleOptions';
13
13
  export * from './payment';
14
14
  export * from './segment';
15
+ export * from './chips';
@@ -12,3 +12,4 @@ export * from './table';
12
12
  export * from './toggleOptions';
13
13
  export * from './payment';
14
14
  export * from './segment';
15
+ export * from './chips';
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.103-test.122",
5
- "testVersion": 122,
4
+ "version": "0.1.103-test.5",
5
+ "testVersion": 5,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -118,19 +118,15 @@
118
118
  "eslint-plugin-react-hooks": "^5.0.0",
119
119
  "eslint-plugin-react-refresh": "^0.4.16",
120
120
  "globals": "^15.14.0",
121
- "husky": "^9.1.7",
122
- "lint-staged": "^16.1.6",
121
+ "husky": "^8.0.3",
122
+ "lint-staged": "^13.2.2",
123
123
  "prettier": "^2.8.8",
124
124
  "tsc-alias": "^1.8.16",
125
125
  "typescript": "5.0.2",
126
126
  "typescript-eslint": "^8.18.2",
127
- "vite": "^7.1.4",
127
+ "vite": "6.0.5",
128
128
  "vite-tsconfig-paths": "^4.2.0"
129
129
  },
130
- "peerDependencies": {
131
- "react": ">=18.0.0",
132
- "react-dom": ">=18.0.0"
133
- },
134
130
  "lint-staged": {
135
131
  "src/**/*.{ts,tsx,json,js,jsx}": [
136
132
  "yarn run prettier:fix",
@@ -1,25 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const useAnimationOptimization: (isAnimating: boolean) => ((callback: () => void) => void) | null;
3
- export declare const OptimizedAnimatedCell: import("react").MemoExoticComponent<({ children, ...props }: {
4
- [key: string]: unknown;
5
- children: React.ReactNode;
6
- }) => import("react/jsx-runtime").JSX.Element>;
7
- export declare const animationStyles: {
8
- slideIn: {
9
- transform: string;
10
- transition: string;
11
- };
12
- slideOut: {
13
- transform: string;
14
- transition: string;
15
- };
16
- fadeIn: {
17
- opacity: number;
18
- transition: string;
19
- };
20
- fadeOut: {
21
- opacity: number;
22
- transition: string;
23
- };
24
- };
25
- export declare const useScrollOptimization: () => boolean;
@@ -1,86 +0,0 @@
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 } from "react/jsx-runtime";
13
- import { memo, useMemo, useRef, useEffect } from 'react';
14
- const optimizedCellStyles = {
15
- willChange: 'transform, opacity',
16
- transform: 'translateZ(0)',
17
- contain: 'layout style paint',
18
- };
19
- export const useAnimationOptimization = (isAnimating) => {
20
- const animationFrameRef = useRef();
21
- const throttledUpdate = useMemo(() => {
22
- if (!isAnimating)
23
- return null;
24
- return (callback) => {
25
- if (animationFrameRef.current) {
26
- cancelAnimationFrame(animationFrameRef.current);
27
- }
28
- animationFrameRef.current = requestAnimationFrame(callback);
29
- };
30
- }, [isAnimating]);
31
- useEffect(() => {
32
- return () => {
33
- if (animationFrameRef.current) {
34
- cancelAnimationFrame(animationFrameRef.current);
35
- }
36
- };
37
- }, []);
38
- return throttledUpdate;
39
- };
40
- export const OptimizedAnimatedCell = memo((_a) => {
41
- var { children } = _a, props = __rest(_a, ["children"]);
42
- return (_jsx("div", Object.assign({ style: optimizedCellStyles }, props, { children: children })));
43
- }, (prevProps, nextProps) => {
44
- return prevProps.isAnimating === nextProps.isAnimating && prevProps.children === nextProps.children;
45
- });
46
- export const animationStyles = {
47
- slideIn: {
48
- transform: 'translateX(0)',
49
- transition: 'transform 0.2s ease-out',
50
- },
51
- slideOut: {
52
- transform: 'translateX(-100%)',
53
- transition: 'transform 0.2s ease-out',
54
- },
55
- fadeIn: {
56
- opacity: 1,
57
- transition: 'opacity 0.15s ease-out',
58
- },
59
- fadeOut: {
60
- opacity: 0,
61
- transition: 'opacity 0.15s ease-out',
62
- },
63
- };
64
- export const useScrollOptimization = () => {
65
- const isScrolling = useRef(false);
66
- const scrollTimeoutRef = useRef();
67
- useEffect(() => {
68
- const handleScroll = () => {
69
- isScrolling.current = true;
70
- if (scrollTimeoutRef.current) {
71
- clearTimeout(scrollTimeoutRef.current);
72
- }
73
- scrollTimeoutRef.current = setTimeout(() => {
74
- isScrolling.current = false;
75
- }, 150);
76
- };
77
- window.addEventListener('scroll', handleScroll, { passive: true });
78
- return () => {
79
- window.removeEventListener('scroll', handleScroll);
80
- if (scrollTimeoutRef.current) {
81
- clearTimeout(scrollTimeoutRef.current);
82
- }
83
- };
84
- }, []);
85
- return isScrolling.current;
86
- };