@bytebrand/fe-ui-core 4.2.10 → 4.2.12
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/package.json +1 -1
- package/source/components/_common/MaterialTooltip/MaterialTooltip.styled.tsx +11 -0
- package/source/components/_common/MaterialTooltip/MaterialTooltip.tsx +21 -9
- package/source/components/_common/UserMenu/MaterialMenu.styled.tsx +3 -0
- package/source/components/_common/UserMenu/MaterialMenuItem.tsx +6 -4
- package/source/components/_common/UserMenu/NestedMenu.tsx +0 -1
package/package.json
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { styled } from '@mui/system';
|
|
2
2
|
import IconSVG from '../IconSVG/IconSVG';
|
|
3
|
+
import { createTheme } from '@mui/material/styles';
|
|
3
4
|
|
|
4
5
|
export const IconSvgWrapper = styled(IconSVG)(props => ({
|
|
5
6
|
fill: props.disabled ? '#4C4E6442' : '#4C4E648A',
|
|
6
7
|
width: '10px',
|
|
7
8
|
height: '10px'
|
|
8
9
|
}));
|
|
10
|
+
|
|
11
|
+
export const Theme = createTheme({
|
|
12
|
+
components: {
|
|
13
|
+
MuiTooltip: {
|
|
14
|
+
styleOverrides: {
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
})
|
|
@@ -2,8 +2,8 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import IconButton from '@mui/material/IconButton';
|
|
3
3
|
import Tooltip, { TooltipProps, tooltipClasses } from '@mui/material/Tooltip';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
|
-
import { IconSvgWrapper } from './MaterialTooltip.styled';
|
|
6
|
-
import {
|
|
5
|
+
import { IconSvgWrapper, Theme } from './MaterialTooltip.styled';
|
|
6
|
+
import { ThemeProvider } from '@mui/material/styles';
|
|
7
7
|
|
|
8
8
|
interface IMaterialTooltip {
|
|
9
9
|
text: string;
|
|
@@ -34,27 +34,39 @@ const LightTooltip = styled(({ className, ...props }: TooltipProps) => (
|
|
|
34
34
|
const MaterialTooltip = ({ text, placement, className, disabled, zindex }: IMaterialTooltip) => {
|
|
35
35
|
const [isOpen, setIsOpen] = useState(false);
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const onHandleMenuOpen = (event: React.SyntheticEvent) => {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
event.stopPropagation();
|
|
38
40
|
event.persist();
|
|
39
|
-
setIsOpen(
|
|
41
|
+
setIsOpen(true);
|
|
40
42
|
};
|
|
41
43
|
|
|
44
|
+
const onHandleMenuClose = () => {
|
|
45
|
+
setIsOpen(false);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const onHandleMenuToggle = () => {
|
|
49
|
+
setIsOpen(!isOpen);
|
|
50
|
+
}
|
|
51
|
+
|
|
42
52
|
return (
|
|
43
|
-
<
|
|
53
|
+
<ThemeProvider theme={Theme}>
|
|
44
54
|
<LightTooltip
|
|
45
55
|
open={isOpen}
|
|
46
|
-
onMouseOver={
|
|
47
|
-
onMouseLeave={
|
|
56
|
+
onMouseOver={onHandleMenuOpen}
|
|
57
|
+
onMouseLeave={onHandleMenuClose}
|
|
58
|
+
onClose={onHandleMenuClose}
|
|
48
59
|
placement={placement}
|
|
49
60
|
title={text}
|
|
61
|
+
leaveTouchDelay={2500}
|
|
50
62
|
className={className}
|
|
51
63
|
zindex={zindex}
|
|
52
64
|
>
|
|
53
|
-
<IconButton onTouchEnd={
|
|
65
|
+
<IconButton onTouchEnd={onHandleMenuToggle}>
|
|
54
66
|
<IconSvgWrapper name={'infoIcon'} customDimensions disabled={disabled} />
|
|
55
67
|
</IconButton>
|
|
56
68
|
</LightTooltip>
|
|
57
|
-
</
|
|
69
|
+
</ThemeProvider>
|
|
58
70
|
);
|
|
59
71
|
};
|
|
60
72
|
|
|
@@ -10,15 +10,16 @@ interface IListItem {
|
|
|
10
10
|
label: any;
|
|
11
11
|
amount?: number;
|
|
12
12
|
divider?: boolean;
|
|
13
|
-
onClick?: () => void;
|
|
13
|
+
onClick?: (e: React.MouseEvent<HTMLSpanElement>) => void;
|
|
14
14
|
href?: string;
|
|
15
15
|
isComponent?: boolean;
|
|
16
16
|
isSelect?: boolean;
|
|
17
17
|
Link?: any;
|
|
18
18
|
handleClose?: () => void;
|
|
19
|
+
isActive?: boolean;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
const ListItem = ({ icon, label, amount, divider, onClick, href, isComponent, Link, handleClose }: IListItem) => {
|
|
22
|
+
const ListItem = ({ icon, label, amount, divider, onClick, href, isComponent, Link, handleClose, isActive }: IListItem) => {
|
|
22
23
|
return !!href ? (
|
|
23
24
|
<Link color='#4C4E64DE' variant='caption' to={href} underline='none' onClick={onClick}>
|
|
24
25
|
<MenuItem
|
|
@@ -33,12 +34,13 @@ const ListItem = ({ icon, label, amount, divider, onClick, href, isComponent, Li
|
|
|
33
34
|
</Link>
|
|
34
35
|
) : (
|
|
35
36
|
<MenuItem
|
|
36
|
-
onClick={() => {
|
|
37
|
-
onClick();
|
|
37
|
+
onClick={(e: React.MouseEvent<HTMLSpanElement>) => {
|
|
38
|
+
onClick(e);
|
|
38
39
|
handleClose();
|
|
39
40
|
}}
|
|
40
41
|
divider={divider}
|
|
41
42
|
disableRipple={isComponent ? true : false}
|
|
43
|
+
isactive={!!isActive ? isActive.toString() : 'false'}
|
|
42
44
|
>
|
|
43
45
|
{icon && <ListItemIcon><IconSVG customDimensions name={icon} /></ListItemIcon>}
|
|
44
46
|
<ListItemText>
|