@tap-payments/os-micro-frontend-shared 0.1.286-test.1 → 0.1.286-test.3
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/build/components/PartnersFilter/PartnersFilter.d.ts +10 -0
- package/build/components/PartnersFilter/PartnersFilter.js +50 -0
- package/build/components/PartnersFilter/index.d.ts +1 -0
- package/build/components/PartnersFilter/index.js +1 -0
- package/build/components/StatusFilter/StatusFilter.d.ts +1 -2
- package/build/components/StatusFilter/StatusFilter.js +1 -1
- package/build/components/StatusFilter/utils.d.ts +1 -1
- package/build/components/StatusFilter/utils.js +1 -1
- package/build/components/VirtualTables/VirtualTable/VirtualTable.d.ts +1 -1
- package/build/components/VirtualTables/VirtualTable/VirtualTable.js +2 -2
- package/build/components/VirtualTables/components/TableFooter/TableFooter.d.ts +1 -1
- package/build/components/VirtualTables/components/TableFooter/TableFooter.js +11 -2
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/build/types/index.d.ts +1 -0
- package/build/types/index.js +1 -0
- package/build/types/table.d.ts +1 -1
- package/package.json +2 -2
- /package/build/{components/StatusFilter/type.d.ts → types/filter.d.ts} +0 -0
- /package/build/{components/StatusFilter/type.js → types/filter.js} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface PartnersFilterProps {
|
|
2
|
+
options: {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}[];
|
|
6
|
+
selectedFilters?: Record<string, boolean | undefined>;
|
|
7
|
+
onChange: (filters: Record<string, boolean | undefined>) => void;
|
|
8
|
+
}
|
|
9
|
+
export default function PartnersFilter({ options, selectedFilters, onChange }: Readonly<PartnersFilterProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import { Popper } from '@mui/material';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import { MenuItem, RadioGroup } from '../index.js';
|
|
6
|
+
import { rightArrow } from '../../constants/index.js';
|
|
7
|
+
import { StatusValue } from '../../types/index.js';
|
|
8
|
+
export default function PartnersFilter({ options, selectedFilters, onChange }) {
|
|
9
|
+
const [childAnchorEl, setChildAnchorEl] = useState(null);
|
|
10
|
+
const [hoveredStatus, setHoveredStatus] = useState(null);
|
|
11
|
+
const onChildLeave = useCallback(() => {
|
|
12
|
+
setChildAnchorEl(null);
|
|
13
|
+
setHoveredStatus(null);
|
|
14
|
+
}, []);
|
|
15
|
+
const getSelectedValue = (value) => {
|
|
16
|
+
return value === StatusValue.ALL ? undefined : value === StatusValue.ENABLED;
|
|
17
|
+
};
|
|
18
|
+
const onClickStatus = (value) => {
|
|
19
|
+
if (hoveredStatus) {
|
|
20
|
+
onChange({ [hoveredStatus]: getSelectedValue(value) });
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const radioSelectedValue = useMemo(() => {
|
|
24
|
+
const value = selectedFilters === null || selectedFilters === void 0 ? void 0 : selectedFilters[hoveredStatus || ''];
|
|
25
|
+
return value === undefined ? StatusValue.ALL : value ? StatusValue.ENABLED : StatusValue.DISABLED;
|
|
26
|
+
}, [selectedFilters, hoveredStatus]);
|
|
27
|
+
return (_jsxs(_Fragment, { children: [options.map(({ label, value }, index) => (_jsxs(MenuItem, Object.assign({ onMouseOver: (e) => {
|
|
28
|
+
setChildAnchorEl(e.currentTarget);
|
|
29
|
+
setHoveredStatus(value);
|
|
30
|
+
}, sx: Object.assign({ minHeight: '35px', padding: '8px 16px', display: 'flex', alignItems: 'center', justifyContent: 'space-between', cursor: 'pointer', '&:hover': { backgroundColor: '#fff', boxShadow: '0px 0px 16px 0px #00000021' } }, (index === options.length - 1 && {
|
|
31
|
+
borderBottom: '1px solid #F2F2F2',
|
|
32
|
+
})), hideCheckbox: true }, { children: [_jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', gap: '4px' } }, { children: label })), _jsx(Box, { component: "img", src: rightArrow, width: 16, height: 12, sx: { marginLeft: 'auto' } })] }), value))), _jsx(Popper, Object.assign({ open: Boolean(childAnchorEl), anchorEl: childAnchorEl, placement: "right-start", onMouseLeave: onChildLeave }, { children: _jsx(Box, Object.assign({ sx: {
|
|
33
|
+
backgroundColor: '#fff',
|
|
34
|
+
borderEndEndRadius: '8px',
|
|
35
|
+
border: '1px solid #F2F2F2',
|
|
36
|
+
} }, { children: _jsx(RadioGroup, { options: [
|
|
37
|
+
{
|
|
38
|
+
value: StatusValue.ALL,
|
|
39
|
+
label: 'All',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
value: StatusValue.ENABLED,
|
|
43
|
+
label: 'Available',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
value: StatusValue.DISABLED,
|
|
47
|
+
label: 'Not Available',
|
|
48
|
+
},
|
|
49
|
+
], value: radioSelectedValue, onOptionChange: onClickStatus }) })) }))] }));
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as PartnersFilter } from './PartnersFilter';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as PartnersFilter } from './PartnersFilter';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CustomColumnFilterProps } from '../VirtualTables';
|
|
2
|
-
import { StatusValue } from '
|
|
3
|
-
import { ColumnFilterValues } from '../../types/index.js';
|
|
2
|
+
import { ColumnFilterValues, StatusValue } from '../../types/index.js';
|
|
4
3
|
interface StatusFilterProps extends CustomColumnFilterProps {
|
|
5
4
|
options: {
|
|
6
5
|
icon: string;
|
|
@@ -6,8 +6,8 @@ import { Menu, MenuItem, RadioGroup } from '../index.js';
|
|
|
6
6
|
import { FilterCancelButton, FilterFooter, FilterOkayButton, FilterTitle } from '../Filters';
|
|
7
7
|
import { rightArrow } from '../../constants/index.js';
|
|
8
8
|
import { ClickAwayListener, Popper } from '@mui/material';
|
|
9
|
-
import { StatusValue } from './type';
|
|
10
9
|
import { getInitialStatuses } from './utils';
|
|
10
|
+
import { StatusValue } from '../../types/index.js';
|
|
11
11
|
export default function StatusFilter({ anchorEl, options, apiKey = 'statuses', initialStatuses, onCloseDropdown, onClear, onConfirm, }) {
|
|
12
12
|
const open = Boolean(anchorEl);
|
|
13
13
|
const { t } = useTranslation();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IVirtualTable } from '../../../types/index.js';
|
|
3
|
-
declare function VirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle, onStartDrag, isSheetView, isMinimized,
|
|
3
|
+
declare function VirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle, onStartDrag, isSheetView, isMinimized, }: Readonly<IVirtualTable>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof VirtualTable>;
|
|
5
5
|
export default _default;
|
|
@@ -34,7 +34,7 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
|
|
|
34
34
|
areAllRowsLoaded,
|
|
35
35
|
isSheetView,
|
|
36
36
|
}));
|
|
37
|
-
function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle, onStartDrag, isSheetView = false, isMinimized,
|
|
37
|
+
function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle, onStartDrag, isSheetView = false, isMinimized, }) {
|
|
38
38
|
var _a;
|
|
39
39
|
const theme = useTheme();
|
|
40
40
|
const onPointerDown = (e) => {
|
|
@@ -107,6 +107,6 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
107
107
|
// rows height + header height
|
|
108
108
|
, {
|
|
109
109
|
// rows height + header height
|
|
110
|
-
height: (itemsCount + 1) * tableRowHeight, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode, "data-testid": "VirtualTable_TableLastItem" }))] }),
|
|
110
|
+
height: (itemsCount + 1) * tableRowHeight, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode, "data-testid": "VirtualTable_TableLastItem" }))] }), _jsx(TableFooter, Object.assign({ "data-testid": "VirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
|
|
111
111
|
}
|
|
112
112
|
export default memo(VirtualTable);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TableFooterProps } from '../../../../types/index.js';
|
|
3
|
-
declare function TableFooter({ totalCount, showBackDrop, showSeparator, sandboxMode, maximized, ...other }: Readonly<TableFooterProps>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function TableFooter({ totalCount, showBackDrop, showSeparator, sandboxMode, maximized, children, ...other }: Readonly<TableFooterProps>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: React.MemoExoticComponent<typeof TableFooter>;
|
|
5
5
|
export default _default;
|
|
@@ -15,8 +15,17 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import { formatNumber } from '../../../../utils/index.js';
|
|
16
16
|
import { StyledFooter, Label, Title, ValueWrapper, EngravingLine } from './style';
|
|
17
17
|
function TableFooter(_a) {
|
|
18
|
-
var { totalCount, showBackDrop = false, showSeparator, sandboxMode, maximized } = _a, other = __rest(_a, ["totalCount", "showBackDrop", "showSeparator", "sandboxMode", "maximized"]);
|
|
18
|
+
var { totalCount, showBackDrop = false, showSeparator, sandboxMode, maximized, children } = _a, other = __rest(_a, ["totalCount", "showBackDrop", "showSeparator", "sandboxMode", "maximized", "children"]);
|
|
19
19
|
const { t } = useTranslation();
|
|
20
|
-
|
|
20
|
+
// const min = 10000
|
|
21
|
+
// const max = 50000
|
|
22
|
+
// const average = 30000
|
|
23
|
+
// const sum = 100000
|
|
24
|
+
// const currency = 'SAR'
|
|
25
|
+
// const { integerAmount: minIntegerAmount, decimalAmount: minDecimalAmount } = formatAmount(min)
|
|
26
|
+
// const { integerAmount: maxIntegerAmount, decimalAmount: maxDecimalAmount } = formatAmount(max)
|
|
27
|
+
// const { integerAmount: averageIntegerAmount, decimalAmount: averageDecimalAmount } = formatAmount(average)
|
|
28
|
+
// const { integerAmount: sumIntegerAmount, decimalAmount: sumDecimalAmount } = formatAmount(sum)
|
|
29
|
+
return (_jsxs(StyledFooter, Object.assign({ component: "footer", "data-testid": "TableFooter", maximized: maximized !== null && maximized !== void 0 ? maximized : false, sandboxMode: sandboxMode, showBackDrop: showBackDrop, areTotalRowsNotFillingHeight: !!showSeparator }, other, { children: [showSeparator && _jsx(EngravingLine, {}), totalCount || totalCount === 0 ? (_jsxs(Label, Object.assign({ sx: { gap: '6px', cursor: 'text' } }, { children: [_jsx(Title, { children: t('count') }), _jsx(ValueWrapper, { children: formatNumber(totalCount || 0) })] }))) : null, children] })));
|
|
21
30
|
}
|
|
22
31
|
export default React.memo(TableFooter);
|
package/build/types/index.d.ts
CHANGED
package/build/types/index.js
CHANGED
package/build/types/table.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export interface TableFooterProps extends BoxProps {
|
|
|
46
46
|
showSeparator?: boolean;
|
|
47
47
|
sandboxMode?: boolean;
|
|
48
48
|
maximized?: boolean;
|
|
49
|
+
children?: React.ReactNode;
|
|
49
50
|
}
|
|
50
51
|
export interface TableChipProps {
|
|
51
52
|
onChipClick?: (rowIndex: number, columnIndex: number, event: React.MouseEvent, chipIndex: number, pinnedType?: 'start' | 'end') => void;
|
|
@@ -139,7 +140,6 @@ export interface IVirtualTable<R = any> {
|
|
|
139
140
|
onStartDrag?: DragControls['start'];
|
|
140
141
|
isSheetView?: boolean;
|
|
141
142
|
isMinimized?: boolean;
|
|
142
|
-
footerComponent?: React.ReactNode;
|
|
143
143
|
}
|
|
144
144
|
export type ColumnFilterValues = Record<string, boolean | string | string[] | Record<string, boolean> | Record<string, string> | {
|
|
145
145
|
phone: string;
|
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.286-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.286-test.3",
|
|
5
|
+
"testVersion": 3,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|
|
File without changes
|
|
File without changes
|