@tap-payments/os-micro-frontend-shared 0.0.259 → 0.0.261

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 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
+ ```
@@ -19,12 +19,12 @@ import { ChevronContainer, Label, LabelWrapper, StyledStatusIcon, StyledDropdown
19
19
  import { statusButtonIcons } from './constant';
20
20
  const StatusButton = memo((props) => {
21
21
  var _a;
22
- const { variant = 'inActive', badgeCount, icon, label, dropdownOptions, onButtonBodyClick, defaultSelectedStatus } = props, restProps = __rest(props, ["variant", "badgeCount", "icon", "label", "dropdownOptions", "onButtonBodyClick", "defaultSelectedStatus"]);
22
+ const { variant = 'inActive', badgeCount, icon, label, dropdownOptions, onButtonBodyClick } = props, restProps = __rest(props, ["variant", "badgeCount", "icon", "label", "dropdownOptions", "onButtonBodyClick"]);
23
23
  const [buttonClicks, setButtonClicks] = useState(0);
24
24
  const { t } = useTranslation();
25
25
  const buttonRef = useRef(null);
26
26
  const [anchorEl, setAnchorEl] = useState(null);
27
- const [selectedStatus, setSelectedStatus] = useState(defaultSelectedStatus !== null && defaultSelectedStatus !== void 0 ? defaultSelectedStatus : (_a = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions[0]) === null || _a === void 0 ? void 0 : _a.status);
27
+ const [selectedStatus, setSelectedStatus] = useState((_a = dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions[0]) === null || _a === void 0 ? void 0 : _a.status);
28
28
  const hasDropdown = useMemo(() => Boolean(dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.length), [dropdownOptions]);
29
29
  const isDropdownOpen = Boolean(anchorEl) && buttonClicks > 1;
30
30
  const isActiveVariant = variant === 'active';
@@ -66,8 +66,9 @@ const StatusButton = memo((props) => {
66
66
  }, [handleDropdownClose]);
67
67
  const menuItems = useMemo(() => (dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map((item) => (Object.assign(Object.assign({}, item), { onClick: handleMenuItemClick(item) })))) || [], [dropdownOptions, handleMenuItemClick]);
68
68
  const ButtonComponent = statusButtonVariants[variant];
69
+ const displayLabel = selectedStatus ? t(selectedStatus) : label;
69
70
  return (_jsxs(_Fragment, { children: [_jsx(ButtonComponent, Object.assign({ "data-testid": "StatusButton" }, restProps, { ref: buttonRef, onClick: handleButtonClick, sx: Object.assign({}, (hasDropdown && {
70
71
  paddingInlineEnd: '27px',
71
- })) }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [statusIcon, selectedStatus ? t(selectedStatus) : label, statusBadge] })), dropdownIcon && _jsx(ChevronContainer, { children: dropdownIcon })] }) })), isDropdownOpen && hasDropdown && (_jsx(StyledDropdown, { open: isDropdownOpen, onClose: handleDropdownClose, anchorEl: anchorEl, menuItems: menuItems }))] }));
72
+ })) }, { children: _jsxs(LabelWrapper, { children: [_jsxs(Label, Object.assign({ variant: variant }, { children: [statusIcon, displayLabel, statusBadge] })), dropdownIcon && _jsx(ChevronContainer, { children: dropdownIcon })] }) })), isDropdownOpen && hasDropdown && (_jsx(StyledDropdown, { open: isDropdownOpen, onClose: handleDropdownClose, anchorEl: anchorEl, menuItems: menuItems }))] }));
72
73
  });
73
74
  export default StatusButton;
@@ -13,7 +13,6 @@ export interface StatusButtonProps extends Omit<ButtonProps, 'variant' | 'childr
13
13
  showDropdownIcon?: boolean;
14
14
  totalCount?: number;
15
15
  onButtonBodyClick?: (status: TableHeaderStatus) => void;
16
- defaultSelectedStatus?: TableHeaderStatus;
17
16
  dropdownOptions?: Array<MenuItemI & {
18
17
  status: TableHeaderStatus;
19
18
  }>;
@@ -5,13 +5,13 @@ import { useTranslation } from 'react-i18next';
5
5
  import Tooltip from '../../Tooltip';
6
6
  import { unCapturedStatuses } from '../../../constants/index.js';
7
7
  import { AcquirerContainerAnimationVariants, ErrorCodeLabel, ErrorCodeLabelAnimationVariants, ErrorCodeVariants, ErrorCodeWrapper, GateWayIcon, GatewayIconWrapper, GatewayIconWrapperAnimationTransition, GatewaysContainer, GatewaysContainerAnimationVariants, StatusTextLabel, UnCapturedBadge, UnCapturedContainer, errorCodeLabelAnimation, TextViewWrapper, } from './style';
8
- import { capturedStatusesStyles, unCapturedStatusesStyles, statusIcons, sheetViewChipStyles, } from '../../TableCells/CustomCells/StatusCell/constant';
8
+ import { capturedStatusesStyles, unCapturedStatusesStyles, statusIcons, chargeSheetViewChipStyles, } from '../../TableCells/CustomCells/StatusCell/constant';
9
9
  import { StatusIcon, StatusIconWrapper, TextLabel } from '../../TableCells/CustomCells/style';
10
10
  import StatusChip from '../../StatusChip';
11
11
  export function ChargeStatusIcon({ chargeStatus, gatewayTooltip, acquirerTooltip, chargeTooltip, errorCode, isTextShown, gatewayCode, acquirerCode, unCapturedStyles, iconStyles, iconWrapperStyles, gatewayIconWrapperStyles, gatewayContainerStyles, gateWayIconStyles, tableMode, showBadge = true, }) {
12
12
  const unCapturedStatusStyle = chargeStatus ? unCapturedStatusesStyles[chargeStatus] : null;
13
13
  const captureStatusStyle = chargeStatus ? capturedStatusesStyles[chargeStatus] : null;
14
- const sheetViewStatusStyle = chargeStatus ? sheetViewChipStyles[chargeStatus] : null;
14
+ const sheetViewStatusStyle = chargeStatus ? chargeSheetViewChipStyles[chargeStatus] : null;
15
15
  const theme = useTheme();
16
16
  const { t } = useTranslation();
17
17
  const chargeTooltipTitle = chargeTooltip && (_jsx(_Fragment, { children: _jsx("div", { children: chargeTooltip }) }));
@@ -1,11 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { type RefundStatusType } from '../../TableCells';
3
+ import { TableMode } from '../../../types/index.js';
3
4
  type RefundIconProps = {
4
5
  iconStyles?: React.CSSProperties;
5
6
  refundStatus?: RefundStatusType;
6
7
  refundTooltip?: React.ReactNode;
7
8
  refundCount?: number;
8
9
  isTextShown?: boolean;
10
+ tableMode?: TableMode;
9
11
  };
10
- declare const RefundIcon: ({ isTextShown, refundStatus, refundTooltip, refundCount, iconStyles }: RefundIconProps) => import("react/jsx-runtime").JSX.Element;
12
+ declare const RefundIcon: ({ isTextShown, refundStatus, refundTooltip, refundCount, iconStyles, tableMode }: RefundIconProps) => import("react/jsx-runtime").JSX.Element;
11
13
  export default RefundIcon;
@@ -8,7 +8,8 @@ import { MultiRefundContainer, MultiRefundIcon, RefundsCountBadge } from '../../
8
8
  import { StatusIcon } from '../../TableCells/CustomCells/style';
9
9
  import { StatusTextLabel } from '../../TableCells/CustomCells/InvoiceStatusCell/style';
10
10
  import { refundStatusIcons, refundStyles } from '../../TableCells/CustomCells/StatusCell/constant';
11
- const RefundIcon = ({ isTextShown, refundStatus = 'PENDING', refundTooltip = '', refundCount, iconStyles }) => {
11
+ import StatusChip from '../../StatusChip';
12
+ const RefundIcon = ({ isTextShown, refundStatus = 'PENDING', refundTooltip = '', refundCount, iconStyles, tableMode }) => {
12
13
  const { t } = useTranslation();
13
14
  const theme = useTheme();
14
15
  const refundCountBadge = (_jsxs(RefundsCountBadge, Object.assign({ "data-testid": "StatusCell_RefundsCountBadge", initial: { width: 0, opacity: 0, padding: '0px' }, transition: {
@@ -32,6 +33,10 @@ const RefundIcon = ({ isTextShown, refundStatus = 'PENDING', refundTooltip = '',
32
33
  },
33
34
  } }, { children: [refundCount, "x"] })));
34
35
  const refundCountShown = (refundCount || 0) > 1;
36
+ if (tableMode === 'sheet') {
37
+ const { color, backgroundColor } = refundStyles[refundStatus];
38
+ return _jsx(StatusChip, { textColor: color, bgColor: backgroundColor });
39
+ }
35
40
  return (_jsx(_Fragment, { children: isTextShown ? (_jsx(Tooltip, Object.assign({ title: _jsx("div", { children: _jsx("div", { children: refundTooltip }) }) }, { children: _jsx(StatusTextLabel, Object.assign({ "data-testid": "StatusCell_RefundStatusLabel", sx: {
36
41
  color: refundStyles[refundStatus].color,
37
42
  backgroundColor: refundStyles[refundStatus].backgroundColor,
@@ -13,7 +13,7 @@ export declare const statusIcons: {
13
13
  UNKNOWN: string;
14
14
  AUTHORIZED: string;
15
15
  };
16
- export declare const sheetViewChipStyles: {
16
+ export declare const chargeSheetViewChipStyles: {
17
17
  CAPTURED: {
18
18
  color: string;
19
19
  background: string;
@@ -13,7 +13,7 @@ export const statusIcons = {
13
13
  UNKNOWN: unknownIcon,
14
14
  AUTHORIZED: authorizedIcon,
15
15
  };
16
- export const sheetViewChipStyles = {
16
+ export const chargeSheetViewChipStyles = {
17
17
  CAPTURED: {
18
18
  color: '#1F88D0',
19
19
  background: '#1F88D01A',
@@ -18,6 +18,7 @@ import { isHeightNotFullyFilledByRows, isNotFoundError, isTimeoutError, hasError
18
18
  import TableFooter from '../components/TableFooter/TableFooter';
19
19
  import TableLastItem from '../components/TableLastItem';
20
20
  import TableNoData from '../components/TableNoData';
21
+ import { SheetViewTableNoData } from './components';
21
22
  import ListItemWrapper from '../components/virtualScroll/ListItemWrapper';
22
23
  import { StyledBox, StyledTableBox, StyledVirtualList, TableContainer, TableWrapper } from '../style';
23
24
  import { SheetViewVirtualTableWrapper, PinnedStartColumnWrapper, PinnedEndColumnWrapper, MainTableWrapper, UnpinnedTableHeaderWrapper } from './style';
@@ -113,9 +114,12 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
113
114
  handleScroll,
114
115
  scrollToIndex,
115
116
  areTotalRowsNotFillingHeight,
116
- selectedCell,
117
- selectedColumn,
118
- handleCellClick,
117
+ clearBackdropVisibilityTimeout,
118
+ lastItemIndex,
119
+ pinnedEndVirtualListRef,
120
+ pinnedStartVirtualListRef,
121
+ scrollableVirtualListRef,
122
+ theme.palette.background.default,
119
123
  ]);
120
124
  const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
121
125
  const pinnedStartColumnsWidth = useMemo(() => pinnedStartColumnsData.reduce((acc, col) => {
@@ -137,7 +141,21 @@ function SheetViewVirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, sho
137
141
  overflowX: 'hidden',
138
142
  } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_PinnedStyledBox", hidePadding: true, className: "list-wrapper" }, { children: createVirtualTableContainer(columnsData, containerKey, true, columnsWidth) })) }))] })) }));
139
143
  };
140
- return (_jsxs(_Fragment, { children: [_jsxs(TableContainer, { children: [showNoDataView ? (_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-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, showNoDataView: showNoDataView }, { children: _jsx(TableWrapper, Object.assign({ isSheetView: true, "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: tableBodyStyles }, { children: _jsx(TableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps }) })) }))) : (_jsxs(SheetViewVirtualTableWrapper, { children: [renderPinnedColumn('start', pinnedStartColumnsData, pinnedStartColumnsWidth, pinnedStartColumns), _jsx(MainTableWrapper, Object.assign({ hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0 }, { 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-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, 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: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
144
+ return (_jsxs(_Fragment, { children: [_jsxs(TableContainer, { children: [showNoDataView ? (tableLoading ? (_jsx(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_StyledTableBox_Loading", "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-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, showNoDataView: showNoDataView, scrollable: true, sx: {
145
+ marginLeft: '28px',
146
+ maxHeight: 'calc(100vh - 300px)',
147
+ overflow: 'auto',
148
+ } }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_LoadingTableWrapper", showNoDataView: showNoDataView, sx: Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: 'auto' }) }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_LoadingTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: orderedColumns, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: [], onColumnPin: handleColumnPin, isPinnable: false, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_LoadingTableWrapper", sx: {
149
+ width: '100%',
150
+ minWidth: 'fit-content',
151
+ height: 'auto',
152
+ display: 'flex',
153
+ flexDirection: 'column',
154
+ } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_LoadingStyledBox", hidePadding: true, className: "list-wrapper", sx: {
155
+ height: 'auto',
156
+ display: 'flex',
157
+ flexDirection: 'column',
158
+ } }, { children: _jsx(SheetViewTableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps }) })) }))] })) }))) : (_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-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, showNoDataView: showNoDataView }, { children: _jsx(TableWrapper, Object.assign({ isSheetView: true, "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: tableBodyStyles }, { children: _jsx(TableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps }) })) })))) : (_jsxs(SheetViewVirtualTableWrapper, { children: [renderPinnedColumn('start', pinnedStartColumnsData, pinnedStartColumnsWidth, pinnedStartColumns), _jsx(MainTableWrapper, Object.assign({ hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0 }, { 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-show-background-color": !!showBackgroundColor, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showBackgroundColor: showBackgroundColor, 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: handleColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: handleColumnClick }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
141
159
  width: '100%',
142
160
  minWidth: 'fit-content',
143
161
  } }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper" }, { children: createVirtualTableContainer(unpinnedColumnsData, 'scrollable', false) })) }))] })) })) })), renderPinnedColumn('end', pinnedEndColumnsData, pinnedEndColumnsWidth, [...pinnedStartColumns, ...pinnedEndColumns])] })), !showNoDataView && areTotalRowsNotFillingHeight && !isFetchingNextPage && (_jsx(TableLastItem, { height: (itemsCount + 1) * TABLE_ROW_HEIGHT, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode, "data-testid": "SheetViewVirtualTable_TableLastItem" }))] }), _jsx(TableFooter, Object.assign({ "data-testid": "SheetViewVirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { AnimationType, IColumnProps } from '../../../../types/index.js';
3
+ interface ISheetViewTableLoadingProps {
4
+ columns: IColumnProps[];
5
+ isLoaded?: boolean;
6
+ animationType?: AnimationType;
7
+ isLoading?: boolean;
8
+ rowsCount?: number;
9
+ }
10
+ declare function SheetViewTableLoading({ columns, isLoaded, animationType, isLoading, rowsCount }: ISheetViewTableLoadingProps): import("react/jsx-runtime").JSX.Element;
11
+ declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableLoading>;
12
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { styled } from '@mui/material/styles';
4
+ import uniqueId from 'lodash/uniqueId';
5
+ import { calculateMaxAllowedRows } from '../../../../utils/index.js';
6
+ import SheetViewTableRowLoading from './SheetViewTableRowLoading';
7
+ const Wrapper = styled('section')(({ isLoaded = false }) => ({
8
+ overflow: 'hidden',
9
+ paddingInline: isLoaded ? '32px' : '0px',
10
+ backgroundColor: isLoaded ? 'rgba(255, 255, 255, 0.60)' : 'none',
11
+ filter: isLoaded ? 'blur(8px)' : 'none',
12
+ marginTop: isLoaded ? '1rem' : '0',
13
+ height: 'auto',
14
+ }));
15
+ function SheetViewTableLoading({ columns, isLoaded = false, animationType, isLoading = false, rowsCount }) {
16
+ let maxAllowedRows = rowsCount || calculateMaxAllowedRows(isLoaded, isLoading);
17
+ maxAllowedRows = rowsCount || Math.max(maxAllowedRows, 25);
18
+ return (_jsx(Wrapper, Object.assign({ isLoaded: isLoaded, "data-testid": "SheetViewTableLoading" }, { children: [...Array(maxAllowedRows)].map((_, index) => (_jsx(SheetViewTableRowLoading, { columns: columns, animationType: animationType, rowIndex: index }, `i-${uniqueId('SheetViewTableLoadingRow_')}`))) })));
19
+ }
20
+ export default memo(SheetViewTableLoading);
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import type { IColumnProps, IVirtualTable } from '../../../../types/index.js';
3
+ interface SheetViewTableNoDataProps {
4
+ tableEmpty: boolean;
5
+ tableLoading: boolean;
6
+ isTimeoutError: boolean;
7
+ error: Error | null;
8
+ tableError: boolean;
9
+ orderedColumns: IColumnProps[];
10
+ triggerDataRefetch: () => Promise<unknown>;
11
+ footerProps: IVirtualTable['footerProps'];
12
+ }
13
+ declare function SheetViewTableNoData({ error, tableEmpty, isTimeoutError, tableError, tableLoading, orderedColumns, triggerDataRefetch, footerProps, }: SheetViewTableNoDataProps): JSX.Element;
14
+ declare namespace SheetViewTableNoData {
15
+ var displayName: string;
16
+ }
17
+ declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableNoData>;
18
+ export default _default;
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { backendErrorHandler } from '../../../../utils/index.js';
4
+ import EmptyList from '../../components/EmptyList/EmptyList';
5
+ import ErrorList from '../../components/ErrorList/ErrorList';
6
+ import SheetViewTableLoading from './SheetViewTableLoading';
7
+ import { StyledSolidBackground } from '../../style';
8
+ function SheetViewTableNoData({ error, tableEmpty, isTimeoutError, tableError, tableLoading, orderedColumns, triggerDataRefetch, footerProps, }) {
9
+ let content;
10
+ if (tableLoading) {
11
+ content = (_jsx(StyledSolidBackground, Object.assign({ "data-testid": "SheetViewVirtualTable_SolidBackground" }, { children: _jsx(SheetViewTableLoading, { "data-testid": "SheetViewVirtualTable_TableLoading", columns: orderedColumns, isLoading: true }) })));
12
+ }
13
+ else if (isTimeoutError) {
14
+ content = (_jsx(ErrorList, { "data-testid": "SheetViewVirtualTable_ErrorList_timeoutError", shouldMinimizeWidth: true, heading: "timeOut", message: "yourRequestOutPleaseTryAgain", triggerDataRefetch: triggerDataRefetch, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode }));
15
+ }
16
+ else if (tableError) {
17
+ const axiosErr = error;
18
+ const { formatted } = backendErrorHandler({ error: axiosErr, fallbackMessage: 'connectionErrorMsg' });
19
+ content = (_jsx(ErrorList, { "data-testid": "SheetViewVirtualTable_ErrorList_tableError", heading: "somethingWentWrong", message: formatted, triggerDataRefetch: triggerDataRefetch, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode }));
20
+ }
21
+ else if (tableEmpty) {
22
+ const axiosErr = error;
23
+ const { formatted } = backendErrorHandler({ error: axiosErr, fallbackMessage: 'tryAdjustingTheDateOrFilters' });
24
+ content = _jsx(EmptyList, { sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode, heading: "nothingFound", message: formatted });
25
+ }
26
+ else {
27
+ content = (_jsx(ErrorList, { "data-testid": "SheetViewVirtualTable_ErrorList_tableError", heading: "somethingWentWrong", message: "connectionErrorMsg", triggerDataRefetch: triggerDataRefetch, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode }));
28
+ }
29
+ return content;
30
+ }
31
+ SheetViewTableNoData.displayName = 'SheetViewTableNoData';
32
+ export default memo(SheetViewTableNoData);
@@ -0,0 +1,12 @@
1
+ import { CSSProperties } from 'react';
2
+ import type { AnimationType, IColumnProps } from '../../../../types/index.js';
3
+ interface ISheetViewTableRowLoadingProps {
4
+ columns: IColumnProps[];
5
+ index?: number;
6
+ animationType?: AnimationType;
7
+ style?: CSSProperties;
8
+ rowIndex?: number;
9
+ }
10
+ declare function SheetViewTableRowLoading({ columns, style, index, animationType, rowIndex }: ISheetViewTableRowLoadingProps): import("react/jsx-runtime").JSX.Element;
11
+ declare const _default: import("react").MemoExoticComponent<typeof SheetViewTableRowLoading>;
12
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import Skeleton from '@mui/material/Skeleton';
4
+ import { styled } from '@mui/material/styles';
5
+ import TableCell from '@mui/material/TableCell';
6
+ import MUITableRow from '@mui/material/TableRow';
7
+ import { areEqual } from 'react-window';
8
+ const StyledSkeleton = styled(Skeleton)(() => ({
9
+ backgroundColor: '#F4F4F4',
10
+ borderRadius: '64px',
11
+ width: '100%',
12
+ minWidth: '20px',
13
+ }));
14
+ function SheetViewTableRowLoading({ columns, style, index, animationType, rowIndex = 0 }) {
15
+ return (_jsx(MUITableRow, Object.assign({ sx: Object.assign(Object.assign({}, style), { display: 'flex', borderBottom: '1px solid #F2F2F2', minHeight: '28px', height: '28px', alignItems: 'center', '&:hover': {
16
+ backgroundColor: 'transparent !important',
17
+ } }), component: "div", hover: true }, { children: columns.map((column, colIndex) => {
18
+ var _a;
19
+ const isLastColumn = colIndex === columns.length - 1;
20
+ const isFirstColumn = colIndex === 0;
21
+ const shouldShowActualData = isFirstColumn && column.render;
22
+ return (_jsx(TableCell, Object.assign({ sx: {
23
+ width: column.width || `${100 / columns.length}%` || '20%',
24
+ paddingBlock: '0',
25
+ paddingInline: '8px !important',
26
+ paddingLeft: isFirstColumn ? '8px !important' : '8px !important',
27
+ paddingRight: isLastColumn ? '8px !important' : '8px !important',
28
+ borderRight: isLastColumn ? 'none' : '1px solid #F2F2F2',
29
+ borderLeft: isFirstColumn ? '1px solid #F2F2F2' : 'none',
30
+ height: '100%',
31
+ display: 'flex',
32
+ alignItems: 'center',
33
+ boxSizing: 'border-box',
34
+ whiteSpace: 'nowrap',
35
+ overflow: 'hidden',
36
+ }, component: "div" }, { children: shouldShowActualData ? ((_a = column.render) === null || _a === void 0 ? void 0 : _a.call(column, {
37
+ index: rowIndex,
38
+ row: {},
39
+ column,
40
+ value: rowIndex + 1,
41
+ })) : (_jsx(StyledSkeleton, { variant: "rectangular", animation: animationType, height: 16 })) }), `${column.id}-${colIndex}`));
42
+ }) }), index));
43
+ }
44
+ export default memo(SheetViewTableRowLoading, areEqual);
@@ -0,0 +1,3 @@
1
+ export { default as SheetViewTableLoading } from './SheetViewTableLoading';
2
+ export { default as SheetViewTableRowLoading } from './SheetViewTableRowLoading';
3
+ export { default as SheetViewTableNoData } from './SheetViewTableNoData';
@@ -0,0 +1,3 @@
1
+ export { default as SheetViewTableLoading } from './SheetViewTableLoading';
2
+ export { default as SheetViewTableRowLoading } from './SheetViewTableRowLoading';
3
+ export { default as SheetViewTableNoData } from './SheetViewTableNoData';
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.0.259",
5
- "testVersion": 2,
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 version patch --no-git-tag-version && 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.0.261",
5
+ "testVersion": 2,
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
+ }