@tap-payments/os-micro-frontend-shared 0.1.268 → 0.1.269
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/ViewColumnRadioFilter/ViewColumnRadioFilter.d.ts +2 -0
- package/build/components/ViewColumnRadioFilter/ViewColumnRadioFilter.js +28 -0
- package/build/components/ViewColumnRadioFilter/index.d.ts +1 -0
- package/build/components/ViewColumnRadioFilter/index.js +1 -0
- package/build/components/ViewColumnRadioFilter/style.d.ts +3 -0
- package/build/components/ViewColumnRadioFilter/style.js +20 -0
- package/build/components/ViewColumnRadioFilter/type.d.ts +9 -0
- package/build/components/ViewColumnRadioFilter/type.js +1 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { rightArrow } from '../../constants/index.js';
|
|
4
|
+
import { RadioGroup } from '../index.js';
|
|
5
|
+
import { SubMenu, FilterMenuItem } from './style';
|
|
6
|
+
export default function ViewColumnRadioFilter({ menuLabel, options, selectedValue, onValueChange }) {
|
|
7
|
+
const [submenuAnchorEl, setSubmenuAnchorEl] = useState(null);
|
|
8
|
+
const [localSelectedValue, setLocalSelectedValue] = useState(selectedValue);
|
|
9
|
+
const menuItemRef = useRef(null);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setLocalSelectedValue(selectedValue);
|
|
12
|
+
}, [selectedValue]);
|
|
13
|
+
const onOpen = (event) => {
|
|
14
|
+
setSubmenuAnchorEl(event.currentTarget);
|
|
15
|
+
};
|
|
16
|
+
const onClose = () => {
|
|
17
|
+
setSubmenuAnchorEl(null);
|
|
18
|
+
};
|
|
19
|
+
const onClick = (event) => {
|
|
20
|
+
event.stopPropagation();
|
|
21
|
+
setSubmenuAnchorEl(event.currentTarget);
|
|
22
|
+
};
|
|
23
|
+
const handleRadioChange = (value) => {
|
|
24
|
+
setLocalSelectedValue(value);
|
|
25
|
+
onValueChange(value);
|
|
26
|
+
};
|
|
27
|
+
return (_jsxs(FilterMenuItem, Object.assign({ ref: menuItemRef, onMouseEnter: onOpen, onMouseLeave: onClose, onClick: onClick, hideCheckbox: true }, { children: [_jsx("span", Object.assign({ className: "label" }, { children: menuLabel })), _jsx("img", { src: rightArrow, alt: "arrow", style: { height: 12 } }), _jsx(SubMenu, Object.assign({ open: Boolean(submenuAnchorEl), anchorEl: submenuAnchorEl, placement: "right-start" }, { children: _jsx(RadioGroup, { options: options, value: localSelectedValue || '', onOptionChange: handleRadioChange, defaultValue: options[0].value }) }))] })));
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ViewColumnRadioFilter } from './ViewColumnRadioFilter';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ViewColumnRadioFilter } from './ViewColumnRadioFilter';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SubMenu: import("@emotion/styled").StyledComponent<Omit<import("../Menu/Menu").MenuProps, "ref"> & import("react").RefAttributes<HTMLDivElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
3
|
+
export declare const FilterMenuItem: import("@emotion/styled").StyledComponent<import("../MenuItem/MenuItem").MenuItemProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { styled } from '@mui/material/styles';
|
|
2
|
+
import { MenuItem, Menu } from '../index.js';
|
|
3
|
+
export const SubMenu = styled(Menu)(() => ({
|
|
4
|
+
marginTop: '-1px',
|
|
5
|
+
'&:hover': {
|
|
6
|
+
boxShadow: '0px 0px 16px 0px #00000021',
|
|
7
|
+
},
|
|
8
|
+
}));
|
|
9
|
+
export const FilterMenuItem = styled(MenuItem)(({ theme }) => ({
|
|
10
|
+
height: 40,
|
|
11
|
+
flex: 'unset',
|
|
12
|
+
paddingTop: 0,
|
|
13
|
+
paddingBottom: 0,
|
|
14
|
+
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
15
|
+
paddingLeft: '16px',
|
|
16
|
+
maxHeight: '35px',
|
|
17
|
+
'.label': {
|
|
18
|
+
flexGrow: 1,
|
|
19
|
+
},
|
|
20
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED