@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.2.10",
3
+ "version": "4.2.12",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -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 { ClickAwayListener } from '@mui/base';
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 onHandleClick = (event: React.SyntheticEvent) => {
37
+ const onHandleMenuOpen = (event: React.SyntheticEvent) => {
38
+ event.preventDefault();
39
+ event.stopPropagation();
38
40
  event.persist();
39
- setIsOpen(!isOpen);
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
- <ClickAwayListener onClickAway={() => setIsOpen(false)}>
53
+ <ThemeProvider theme={Theme}>
44
54
  <LightTooltip
45
55
  open={isOpen}
46
- onMouseOver={() => setIsOpen(true)}
47
- onMouseLeave={() => setIsOpen(false)}
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={e => onHandleClick(e)}>
65
+ <IconButton onTouchEnd={onHandleMenuToggle}>
54
66
  <IconSvgWrapper name={'infoIcon'} customDimensions disabled={disabled} />
55
67
  </IconButton>
56
68
  </LightTooltip>
57
- </ClickAwayListener>
69
+ </ThemeProvider>
58
70
  );
59
71
  };
60
72
 
@@ -52,6 +52,9 @@ export const Theme = createTheme({
52
52
  '&:hover': {
53
53
  background: 'transparent !important'
54
54
  }
55
+ }),
56
+ ...(ownerState.isactive === 'true' && {
57
+ backgroundColor: 'rgba(0, 0, 0, 0.04)'
55
58
  })
56
59
  })
57
60
  }
@@ -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>
@@ -46,7 +46,6 @@ const NestedMenu = ({ nestedItems, label, icon, amount }: INestedMenuProps) => {
46
46
  return (
47
47
  <ListItem
48
48
  key={index}
49
- onClick={() => {}}
50
49
  handleClose={() => {}}
51
50
  { ...nestedListItemProps }
52
51
  />