@astral/ui 4.71.1 → 4.71.2
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/components/Notification/NotificationStackContainer/useLogic/hooks/useHover/useHover.js +1 -4
- package/components/Notification/NotificationStackContainer/useLogic/useLogic.js +4 -1
- package/node/components/Notification/NotificationStackContainer/useLogic/hooks/useHover/useHover.js +1 -4
- package/node/components/Notification/NotificationStackContainer/useLogic/useLogic.js +4 -1
- package/package.json +1 -1
package/components/Notification/NotificationStackContainer/useLogic/hooks/useHover/useHover.js
CHANGED
|
@@ -4,13 +4,10 @@ export const useHover = (element, { enabled = true } = {}) => {
|
|
|
4
4
|
const handleMouseEnter = () => setHover(true);
|
|
5
5
|
const handleMouseLeave = () => setHover(false);
|
|
6
6
|
useEffect(() => {
|
|
7
|
-
if (!enabled) {
|
|
7
|
+
if (!enabled || !element) {
|
|
8
8
|
setHover(false);
|
|
9
9
|
return undefined;
|
|
10
10
|
}
|
|
11
|
-
if (!element) {
|
|
12
|
-
return undefined;
|
|
13
|
-
}
|
|
14
11
|
element.addEventListener('mouseenter', handleMouseEnter);
|
|
15
12
|
element.addEventListener('mouseleave', handleMouseLeave);
|
|
16
13
|
return () => {
|
|
@@ -14,6 +14,9 @@ export const useLogic = ({ containerId: externalContainerId, }) => {
|
|
|
14
14
|
const scrollContainer = document.querySelector(`#${externalContainerId} .Toastify__toast-container`);
|
|
15
15
|
setContainer(scrollContainer);
|
|
16
16
|
}
|
|
17
|
+
else {
|
|
18
|
+
setContainer(null);
|
|
19
|
+
}
|
|
17
20
|
}, [externalContainerId, toasts]);
|
|
18
21
|
// Ориентируемся на data-атрибут для отключении анимации стека при добавлении нового уведомления
|
|
19
22
|
const handleAddNoTransitionAttr = () => {
|
|
@@ -40,7 +43,7 @@ export const useLogic = ({ containerId: externalContainerId, }) => {
|
|
|
40
43
|
enabled: isMobile,
|
|
41
44
|
hasOpenNotify,
|
|
42
45
|
});
|
|
43
|
-
const isStackExpanded = isMobile ? isTouchExpanded : isHovered;
|
|
46
|
+
const isStackExpanded = (isMobile ? isTouchExpanded : isHovered) && hasOpenNotify;
|
|
44
47
|
const handleAddToast = ({ id, containerId }) => {
|
|
45
48
|
if (Object.is(containerId, externalContainerId)) {
|
|
46
49
|
setToasts((currentToasts) => [...currentToasts, id]);
|
package/node/components/Notification/NotificationStackContainer/useLogic/hooks/useHover/useHover.js
CHANGED
|
@@ -7,13 +7,10 @@ const useHover = (element, { enabled = true } = {}) => {
|
|
|
7
7
|
const handleMouseEnter = () => setHover(true);
|
|
8
8
|
const handleMouseLeave = () => setHover(false);
|
|
9
9
|
(0, react_1.useEffect)(() => {
|
|
10
|
-
if (!enabled) {
|
|
10
|
+
if (!enabled || !element) {
|
|
11
11
|
setHover(false);
|
|
12
12
|
return undefined;
|
|
13
13
|
}
|
|
14
|
-
if (!element) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
14
|
element.addEventListener('mouseenter', handleMouseEnter);
|
|
18
15
|
element.addEventListener('mouseleave', handleMouseLeave);
|
|
19
16
|
return () => {
|
|
@@ -17,6 +17,9 @@ const useLogic = ({ containerId: externalContainerId, }) => {
|
|
|
17
17
|
const scrollContainer = document.querySelector(`#${externalContainerId} .Toastify__toast-container`);
|
|
18
18
|
setContainer(scrollContainer);
|
|
19
19
|
}
|
|
20
|
+
else {
|
|
21
|
+
setContainer(null);
|
|
22
|
+
}
|
|
20
23
|
}, [externalContainerId, toasts]);
|
|
21
24
|
// Ориентируемся на data-атрибут для отключении анимации стека при добавлении нового уведомления
|
|
22
25
|
const handleAddNoTransitionAttr = () => {
|
|
@@ -43,7 +46,7 @@ const useLogic = ({ containerId: externalContainerId, }) => {
|
|
|
43
46
|
enabled: isMobile,
|
|
44
47
|
hasOpenNotify,
|
|
45
48
|
});
|
|
46
|
-
const isStackExpanded = isMobile ? isTouchExpanded : isHovered;
|
|
49
|
+
const isStackExpanded = (isMobile ? isTouchExpanded : isHovered) && hasOpenNotify;
|
|
47
50
|
const handleAddToast = ({ id, containerId }) => {
|
|
48
51
|
if (Object.is(containerId, externalContainerId)) {
|
|
49
52
|
setToasts((currentToasts) => [...currentToasts, id]);
|