@tap-payments/os-micro-frontend-shared 0.1.260 → 0.1.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/build/components/CountryFilter/CountryFilter.d.ts +13 -0
- package/build/components/CountryFilter/CountryFilter.js +71 -0
- package/build/components/CountryFilter/index.d.ts +2 -0
- package/build/components/CountryFilter/index.js +2 -0
- package/build/components/CountryFilter/style.d.ts +6 -0
- package/build/components/CountryFilter/style.js +7 -0
- package/build/components/PhoneFilter/PhoneFilter.d.ts +9 -0
- package/build/components/PhoneFilter/PhoneFilter.js +13 -0
- package/build/components/PhoneFilter/index.d.ts +2 -0
- package/build/components/PhoneFilter/index.js +2 -0
- package/build/components/index.d.ts +2 -0
- package/build/components/index.js +2 -0
- package/build/constants/apps.d.ts +11 -0
- package/build/constants/apps.js +4 -0
- package/build/types/account.d.ts +2 -1
- package/build/types/account.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SxProps } from '@mui/material';
|
|
2
|
+
interface CountryFilterProps {
|
|
3
|
+
onCountriesChange: (countries: string[]) => void;
|
|
4
|
+
sx?: SxProps;
|
|
5
|
+
selectedCountries?: string[];
|
|
6
|
+
countriesOptions: {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
export default function CountryFilter({ onCountriesChange, sx, selectedCountries, countriesOptions }: CountryFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useRef, useState } from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import { ClickAwayListener } from '@mui/material';
|
|
5
|
+
import { Menu, MenuItem } from '../index.js';
|
|
6
|
+
import { rightArrow } from '../../constants/index.js';
|
|
7
|
+
export default function CountryFilter({ onCountriesChange, sx, selectedCountries, countriesOptions }) {
|
|
8
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
9
|
+
const containerRef = useRef(null);
|
|
10
|
+
const open = Boolean(anchorEl);
|
|
11
|
+
const onOpen = () => {
|
|
12
|
+
if (!open) {
|
|
13
|
+
setAnchorEl(containerRef.current);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
onClose();
|
|
17
|
+
};
|
|
18
|
+
const onClose = () => {
|
|
19
|
+
setAnchorEl(null);
|
|
20
|
+
};
|
|
21
|
+
const checkIsSelected = (countryCode) => { var _a; return (_a = selectedCountries === null || selectedCountries === void 0 ? void 0 : selectedCountries.includes(countryCode)) !== null && _a !== void 0 ? _a : false; };
|
|
22
|
+
const onClickCountry = (countryCodes) => {
|
|
23
|
+
onCountriesChange(countryCodes);
|
|
24
|
+
};
|
|
25
|
+
const handleCheckboxChange = (value) => {
|
|
26
|
+
const newCountries = (selectedCountries === null || selectedCountries === void 0 ? void 0 : selectedCountries.includes(value)) ? selectedCountries === null || selectedCountries === void 0 ? void 0 : selectedCountries.filter((c) => c !== value) : [...(selectedCountries !== null && selectedCountries !== void 0 ? selectedCountries : []), value];
|
|
27
|
+
onClickCountry(newCountries);
|
|
28
|
+
onCountriesChange(newCountries);
|
|
29
|
+
};
|
|
30
|
+
const isAllCountriesSelected = useMemo(() => {
|
|
31
|
+
return (selectedCountries === null || selectedCountries === void 0 ? void 0 : selectedCountries.length) === countriesOptions.length;
|
|
32
|
+
}, [selectedCountries, countriesOptions]);
|
|
33
|
+
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: onClose }, { children: _jsxs(Box, Object.assign({ ref: containerRef, sx: sx }, { children: [_jsx(Box, { children: _jsxs(MenuItem, Object.assign({ onMouseEnter: (e) => {
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
onOpen();
|
|
36
|
+
}, sx: {
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
paddingInline: '16px',
|
|
40
|
+
gap: '4px',
|
|
41
|
+
borderBlock: '1px solid #F2F2F2',
|
|
42
|
+
'&:hover': {
|
|
43
|
+
backgroundColor: '#fff',
|
|
44
|
+
boxShadow: '0px 0px 16px 0px #00000021',
|
|
45
|
+
},
|
|
46
|
+
}, hideCheckbox: true }, { children: [_jsx("span", { children: "Country" }), _jsx(Box, { component: "img", src: rightArrow, width: 16, height: 12, sx: { marginLeft: 'auto' } })] })) }), _jsxs(Menu, Object.assign({ open: open, anchorEl: anchorEl, sx: { marginTop: '8px', marginBottom: '8px', maxHeight: '190px', overflow: 'auto' }, placement: "right-start", popperSx: {
|
|
47
|
+
zIndex: 99999,
|
|
48
|
+
} }, { children: [_jsx(MenuItem, Object.assign({ sx: {
|
|
49
|
+
color: (theme) => theme.palette.info.dark,
|
|
50
|
+
backgroundColor: '#F4F4F4',
|
|
51
|
+
fontWeight: 600,
|
|
52
|
+
paddingInline: '16px',
|
|
53
|
+
}, onClick: (e) => {
|
|
54
|
+
e.stopPropagation();
|
|
55
|
+
if (isAllCountriesSelected) {
|
|
56
|
+
onClickCountry([]);
|
|
57
|
+
onCountriesChange([]);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
onClickCountry(countriesOptions.map(({ value }) => value));
|
|
61
|
+
onCountriesChange(countriesOptions.map(({ value }) => value));
|
|
62
|
+
}
|
|
63
|
+
}, isSelected: isAllCountriesSelected }, { children: isAllCountriesSelected ? 'Unselect All' : 'Select All' })), countriesOptions.map(({ value, label, icon }) => (_jsxs(MenuItem, Object.assign({ sx: {
|
|
64
|
+
gap: '0px',
|
|
65
|
+
paddingInline: '16px',
|
|
66
|
+
'&:hover': {
|
|
67
|
+
backgroundColor: '#fff',
|
|
68
|
+
boxShadow: '0px 0px 16px 0px #00000021',
|
|
69
|
+
},
|
|
70
|
+
}, isSelected: checkIsSelected(value), onClick: () => handleCheckboxChange(value) }, { children: [_jsx(Box, { component: "img", src: icon, width: 16, height: 12, sx: { marginRight: '4px', borderRadius: '2px' } }), label] }), value)))] }))] })) })));
|
|
71
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const FilterButton: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
5
|
+
isActive?: boolean | undefined;
|
|
6
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Box, styled } from '@mui/material';
|
|
2
|
+
export const FilterButton = styled(Box, { shouldForwardProp: (props) => props !== 'isActive' })(({ theme, isActive }) => (Object.assign({ borderRadius: '4px', border: `1px solid ${theme.palette.divider}`, height: 32, width: 30, display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', backgroundColor: theme.palette.common.white, ':hover': {
|
|
3
|
+
opacity: 0.7,
|
|
4
|
+
} }, (isActive && {
|
|
5
|
+
boxShadow: `0px 0px 4px 0px ${theme.palette.info.dark}80`,
|
|
6
|
+
border: `1px solid ${theme.palette.info.dark}`,
|
|
7
|
+
}))));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Country } from '../../types/index.js';
|
|
2
|
+
export default function PhoneFilter({ onPhoneChange, onCountryChange, selectedPhone, selectedCountry, countriesOptions, isCountriesLoading, }: {
|
|
3
|
+
onPhoneChange: (phone: string) => void;
|
|
4
|
+
onCountryChange: (countryId: string) => void;
|
|
5
|
+
selectedPhone?: string;
|
|
6
|
+
selectedCountry?: Country;
|
|
7
|
+
countriesOptions: Country[];
|
|
8
|
+
isCountriesLoading: boolean;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PhoneInputBase } from '../index.js';
|
|
3
|
+
export default function PhoneFilter({ onPhoneChange, onCountryChange, selectedPhone, selectedCountry, countriesOptions, isCountriesLoading, }) {
|
|
4
|
+
return (_jsx(PhoneInputBase, { "data-testid": `ColumnFilterInputs_PhoneInput`, phoneValue: selectedPhone, onPhoneChange: (val) => {
|
|
5
|
+
onPhoneChange(val);
|
|
6
|
+
}, countryValue: selectedCountry, onCountryChange: (c) => {
|
|
7
|
+
onCountryChange(c === null || c === void 0 ? void 0 : c.countryId);
|
|
8
|
+
}, countries: countriesOptions || [], isCountriesLoading: isCountriesLoading || false, hasError: false, disabled: isCountriesLoading, placeholder: 'User Mobile', sx: {
|
|
9
|
+
'&.MuiInputBase-root': {
|
|
10
|
+
paddingLeft: '0px !important',
|
|
11
|
+
},
|
|
12
|
+
} }));
|
|
13
|
+
}
|
package/build/constants/apps.js
CHANGED
|
@@ -320,6 +320,10 @@ export const APP_CODES = {
|
|
|
320
320
|
code: 'BRAND',
|
|
321
321
|
functions: { view: { code: 'VIEW' }, update: { code: 'UPDATE' } },
|
|
322
322
|
},
|
|
323
|
+
appSettings: {
|
|
324
|
+
code: 'APP_SETTINGS',
|
|
325
|
+
functions: { view: { code: 'VIEW' }, update: { code: 'UPDATE' } },
|
|
326
|
+
},
|
|
323
327
|
},
|
|
324
328
|
},
|
|
325
329
|
order: {
|
package/build/types/account.d.ts
CHANGED
package/build/types/account.js
CHANGED
package/package.json
CHANGED