@tap-payments/os-micro-frontend-shared 0.1.296 → 0.1.297
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/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/package.json +1 -1
- /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();
|
package/build/types/index.d.ts
CHANGED
package/build/types/index.js
CHANGED
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|