@bytebrand/fe-ui-core 4.2.12 → 4.2.14
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
|
@@ -8,6 +8,11 @@ export const IconSvgWrapper = styled(IconSVG)(props => ({
|
|
|
8
8
|
height: '10px'
|
|
9
9
|
}));
|
|
10
10
|
|
|
11
|
+
export const TooltipWrapper = styled('div')(props => ({
|
|
12
|
+
// zIndex: props.zindex ? props.zindex : 9996,
|
|
13
|
+
display: 'inline-block'
|
|
14
|
+
}))
|
|
15
|
+
|
|
11
16
|
export const Theme = createTheme({
|
|
12
17
|
components: {
|
|
13
18
|
MuiTooltip: {
|
|
@@ -2,8 +2,10 @@ 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, Theme } from './MaterialTooltip.styled';
|
|
5
|
+
import { IconSvgWrapper, Theme, TooltipWrapper } from './MaterialTooltip.styled';
|
|
6
6
|
import { ThemeProvider } from '@mui/material/styles';
|
|
7
|
+
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
8
|
+
import { debounce } from 'lodash'
|
|
7
9
|
|
|
8
10
|
interface IMaterialTooltip {
|
|
9
11
|
text: string;
|
|
@@ -34,10 +36,9 @@ const LightTooltip = styled(({ className, ...props }: TooltipProps) => (
|
|
|
34
36
|
const MaterialTooltip = ({ text, placement, className, disabled, zindex }: IMaterialTooltip) => {
|
|
35
37
|
const [isOpen, setIsOpen] = useState(false);
|
|
36
38
|
|
|
37
|
-
const onHandleMenuOpen = (event:
|
|
38
|
-
event.preventDefault();
|
|
39
|
-
event.stopPropagation();
|
|
39
|
+
const onHandleMenuOpen = (event: any) => {
|
|
40
40
|
event.persist();
|
|
41
|
+
event.preventDefault();
|
|
41
42
|
setIsOpen(true);
|
|
42
43
|
};
|
|
43
44
|
|
|
@@ -45,27 +46,38 @@ const MaterialTooltip = ({ text, placement, className, disabled, zindex }: IMate
|
|
|
45
46
|
setIsOpen(false);
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
const onHandleMenuToggle = () => {
|
|
49
|
-
setIsOpen(!isOpen);
|
|
50
|
-
}
|
|
49
|
+
const onHandleMenuToggle = debounce((event: any) => {
|
|
50
|
+
setIsOpen(() => !isOpen);
|
|
51
|
+
}, 50)
|
|
51
52
|
|
|
52
53
|
return (
|
|
53
54
|
<ThemeProvider theme={Theme}>
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
<ClickAwayListener touchEvent={'onTouchStart'} onClickAway={onHandleMenuClose}>
|
|
56
|
+
<TooltipWrapper>
|
|
57
|
+
<LightTooltip
|
|
58
|
+
open={isOpen}
|
|
59
|
+
onMouseOver={onHandleMenuOpen}
|
|
60
|
+
onMouseLeave={onHandleMenuClose}
|
|
61
|
+
onClose={onHandleMenuClose}
|
|
62
|
+
onTouchEnd={onHandleMenuToggle}
|
|
63
|
+
placement={placement}
|
|
64
|
+
title={text}
|
|
65
|
+
enterTouchDelay={0}
|
|
66
|
+
leaveTouchDelay={10000}
|
|
67
|
+
disableFocusListener
|
|
68
|
+
disableTouchListener
|
|
69
|
+
className={className}
|
|
70
|
+
zindex={zindex}
|
|
71
|
+
PopperProps={{
|
|
72
|
+
disablePortal: true,
|
|
73
|
+
}}
|
|
74
|
+
>
|
|
75
|
+
<IconButton>
|
|
76
|
+
<IconSvgWrapper name={'infoIcon'} customDimensions disabled={disabled} />
|
|
77
|
+
</IconButton>
|
|
78
|
+
</LightTooltip>
|
|
79
|
+
</TooltipWrapper>
|
|
80
|
+
</ClickAwayListener>
|
|
69
81
|
</ThemeProvider>
|
|
70
82
|
);
|
|
71
83
|
};
|
|
@@ -98,6 +98,13 @@ const TimePicker = ({
|
|
|
98
98
|
[day, time]
|
|
99
99
|
);
|
|
100
100
|
|
|
101
|
+
useEffect(
|
|
102
|
+
() => {
|
|
103
|
+
onHandleTimestampChange(+new Date(`${new Date(nextWeekDaysFull[day]).toDateString()} ${getTimeRanges()[time].time}`) / 1000);
|
|
104
|
+
},
|
|
105
|
+
[currentDay]
|
|
106
|
+
);
|
|
107
|
+
|
|
101
108
|
const getHours = (time: string) => {
|
|
102
109
|
const date = new Date(`${new Date().toDateString()}, ${time}:00`);
|
|
103
110
|
return date;
|