@astral/ui 4.41.0 → 4.42.0
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/Notification.js +1 -0
- package/components/Notification/NotificationContainer/styles.js +16 -5
- package/components/Notification/NotificationStackContainer/NotificationStackContainer.js +3 -3
- package/components/Notification/NotificationStackContainer/styles.js +261 -23
- package/components/Notification/NotificationStackContainer/useLogic/hooks/index.d.ts +1 -0
- package/components/Notification/NotificationStackContainer/useLogic/hooks/index.js +1 -0
- package/components/Notification/NotificationStackContainer/useLogic/hooks/useHover/useHover.d.ts +5 -1
- package/components/Notification/NotificationStackContainer/useLogic/hooks/useHover/useHover.js +6 -2
- package/components/Notification/NotificationStackContainer/useLogic/hooks/useTouchStackExpand/index.d.ts +1 -0
- package/components/Notification/NotificationStackContainer/useLogic/hooks/useTouchStackExpand/index.js +1 -0
- package/components/Notification/NotificationStackContainer/useLogic/hooks/useTouchStackExpand/useTouchStackExpand.d.ts +10 -0
- package/components/Notification/NotificationStackContainer/useLogic/hooks/useTouchStackExpand/useTouchStackExpand.js +54 -0
- package/components/Notification/NotificationStackContainer/useLogic/useLogic.d.ts +1 -1
- package/components/Notification/NotificationStackContainer/useLogic/useLogic.js +19 -9
- package/components/Notification/NotificationTemplate/styles.js +20 -0
- package/components/Notification/constants.d.ts +4 -0
- package/components/Notification/constants.js +4 -0
- package/node/components/Notification/Notification.js +1 -0
- package/node/components/Notification/NotificationContainer/styles.js +15 -4
- package/node/components/Notification/NotificationStackContainer/NotificationStackContainer.js +3 -3
- package/node/components/Notification/NotificationStackContainer/styles.js +260 -22
- package/node/components/Notification/NotificationStackContainer/useLogic/hooks/index.d.ts +1 -0
- package/node/components/Notification/NotificationStackContainer/useLogic/hooks/index.js +1 -0
- package/node/components/Notification/NotificationStackContainer/useLogic/hooks/useHover/useHover.d.ts +5 -1
- package/node/components/Notification/NotificationStackContainer/useLogic/hooks/useHover/useHover.js +6 -2
- package/node/components/Notification/NotificationStackContainer/useLogic/hooks/useTouchStackExpand/index.d.ts +1 -0
- package/node/components/Notification/NotificationStackContainer/useLogic/hooks/useTouchStackExpand/index.js +17 -0
- package/node/components/Notification/NotificationStackContainer/useLogic/hooks/useTouchStackExpand/useTouchStackExpand.d.ts +10 -0
- package/node/components/Notification/NotificationStackContainer/useLogic/hooks/useTouchStackExpand/useTouchStackExpand.js +58 -0
- package/node/components/Notification/NotificationStackContainer/useLogic/useLogic.d.ts +1 -1
- package/node/components/Notification/NotificationStackContainer/useLogic/useLogic.js +18 -8
- package/node/components/Notification/NotificationTemplate/styles.js +20 -0
- package/node/components/Notification/constants.d.ts +4 -0
- package/node/components/Notification/constants.js +5 -1
- package/package.json +1 -1
|
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useLogic = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const react_toastify_next_1 = require("react-toastify-next");
|
|
6
|
+
const useViewportType_1 = require("../../../useViewportType");
|
|
6
7
|
const constants_1 = require("../../constants");
|
|
7
8
|
const sleep_1 = require("../../utils/sleep");
|
|
8
9
|
const hooks_1 = require("./hooks");
|
|
9
10
|
const useLogic = ({ containerId: externalContainerId, }) => {
|
|
11
|
+
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
10
12
|
const [toasts, setToasts] = (0, react_1.useState)([]);
|
|
11
13
|
const [container, setContainer] = (0, react_1.useState)();
|
|
12
14
|
const [isStartedClosingNotify, setStartedClosingNotify] = (0, react_1.useState)(false);
|
|
@@ -32,7 +34,16 @@ const useLogic = ({ containerId: externalContainerId, }) => {
|
|
|
32
34
|
setStartedClosingNotify(false);
|
|
33
35
|
}
|
|
34
36
|
}, [toasts]);
|
|
35
|
-
const
|
|
37
|
+
const hasOpenNotify = Boolean(toasts.length);
|
|
38
|
+
const { isHovered } = (0, hooks_1.useHover)(container, {
|
|
39
|
+
enabled: !isMobile,
|
|
40
|
+
});
|
|
41
|
+
const isTouchExpanded = (0, hooks_1.useTouchStackExpand)({
|
|
42
|
+
stackContainerElement: container ?? null,
|
|
43
|
+
enabled: isMobile,
|
|
44
|
+
hasOpenNotify,
|
|
45
|
+
});
|
|
46
|
+
const isStackExpanded = isMobile ? isTouchExpanded : isHovered;
|
|
36
47
|
const handleAddToast = ({ id, containerId }) => {
|
|
37
48
|
if (Object.is(containerId, externalContainerId)) {
|
|
38
49
|
setToasts((currentToasts) => [...currentToasts, id]);
|
|
@@ -61,29 +72,28 @@ const useLogic = ({ containerId: externalContainerId, }) => {
|
|
|
61
72
|
return unsubscribe;
|
|
62
73
|
}, []);
|
|
63
74
|
(0, react_1.useEffect)(() => {
|
|
64
|
-
if (!
|
|
75
|
+
if (!isStackExpanded || !container) {
|
|
65
76
|
return;
|
|
66
77
|
}
|
|
67
78
|
(async () => {
|
|
68
79
|
// Ожидаем пока отработает анимация и стек с уведомлениями раскроется
|
|
69
80
|
await (0, sleep_1.sleep)(300);
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
81
|
+
const hasVerticalScroll = container.scrollHeight > container.clientHeight;
|
|
82
|
+
if (hasVerticalScroll) {
|
|
72
83
|
container.scrollTo({
|
|
73
84
|
top: container.scrollHeight,
|
|
74
85
|
behavior: 'smooth',
|
|
75
86
|
});
|
|
76
87
|
}
|
|
77
88
|
})();
|
|
78
|
-
}, [container,
|
|
89
|
+
}, [container, isStackExpanded]);
|
|
79
90
|
const closeAll = () => {
|
|
80
91
|
setStartedClosingNotify(true);
|
|
81
92
|
react_toastify_next_1.toast.dismiss({ containerId: externalContainerId });
|
|
82
93
|
};
|
|
83
|
-
const hasOpenNotify = Boolean(toasts.length);
|
|
84
94
|
return {
|
|
85
|
-
isVisibleCloseButton: hasOpenNotify,
|
|
86
|
-
|
|
95
|
+
isVisibleCloseButton: hasOpenNotify && (isMobile ? isStackExpanded : true),
|
|
96
|
+
isStackExpanded,
|
|
87
97
|
isStartedClosingNotify,
|
|
88
98
|
closeAll,
|
|
89
99
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Title = exports.CloseButton = exports.IconWrapper = exports.Footer = exports.Content = exports.Header = exports.Wrapper = void 0;
|
|
4
|
+
const constants_1 = require("../../Button/constants");
|
|
4
5
|
const IconButton_1 = require("../../IconButton");
|
|
6
|
+
const constants_2 = require("../../SvgIcon/constants");
|
|
5
7
|
const styled_1 = require("../../styled");
|
|
6
8
|
const Typography_1 = require("../../Typography");
|
|
7
9
|
const utils_1 = require("./utils");
|
|
@@ -18,6 +20,10 @@ exports.Wrapper = styled_1.styled.article `
|
|
|
18
20
|
color: ${({ theme }) => theme.palette.grey[900]};
|
|
19
21
|
|
|
20
22
|
background: ${({ theme }) => theme.palette.background.default};
|
|
23
|
+
|
|
24
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
25
|
+
padding: ${({ theme }) => theme.spacing(2, 3)};
|
|
26
|
+
}
|
|
21
27
|
`;
|
|
22
28
|
exports.Header = styled_1.styled.header `
|
|
23
29
|
display: flex;
|
|
@@ -25,6 +31,13 @@ exports.Header = styled_1.styled.header `
|
|
|
25
31
|
|
|
26
32
|
width: 100%;
|
|
27
33
|
min-height: 24px;
|
|
34
|
+
|
|
35
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
36
|
+
.${constants_1.buttonClassnames.root} {
|
|
37
|
+
width: 24px;
|
|
38
|
+
height: 24px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
28
41
|
`;
|
|
29
42
|
exports.Content = (0, styled_1.styled)(Typography_1.Typography) `
|
|
30
43
|
margin-top: ${({ theme }) => theme.spacing(2)};
|
|
@@ -41,6 +54,13 @@ exports.IconWrapper = styled_1.styled.div `
|
|
|
41
54
|
display: flex;
|
|
42
55
|
|
|
43
56
|
margin-right: ${({ theme }) => theme.spacing(2)};
|
|
57
|
+
|
|
58
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
59
|
+
.${constants_2.svgIconClassnames.root} {
|
|
60
|
+
width: 24px;
|
|
61
|
+
height: 24px;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
44
64
|
`;
|
|
45
65
|
exports.CloseButton = (0, styled_1.styled)(IconButton_1.IconButton) `
|
|
46
66
|
align-self: center;
|
|
@@ -18,9 +18,13 @@ export declare const NOTIFY_STATIC_CONTAINER_ID = "static-notify-container";
|
|
|
18
18
|
export declare const BANNER_CONTAINER_ID = "banner-container-id";
|
|
19
19
|
export declare const NOTIFY_NO_TRANSITION_ATTR = "data-no-transition";
|
|
20
20
|
export declare const NOTIFY_HEIGHT = "56px";
|
|
21
|
+
export declare const NOTIFY_HEIGHT_MOBILE = "40px";
|
|
21
22
|
export declare const notifyClassnames: {
|
|
22
23
|
root: string;
|
|
23
24
|
body: string;
|
|
25
|
+
stack: string;
|
|
26
|
+
/** Обёртка только над stacked ToastContainer — без :has() отделяем внешний .Toastify от статичного */
|
|
27
|
+
stackHost: string;
|
|
24
28
|
container: string;
|
|
25
29
|
animationIn: string;
|
|
26
30
|
animationOut: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.notifyClassnames = exports.NOTIFY_HEIGHT = exports.NOTIFY_NO_TRANSITION_ATTR = exports.BANNER_CONTAINER_ID = exports.NOTIFY_STATIC_CONTAINER_ID = exports.NOTIFY_CONTAINER_ID = exports.NOTIFY_POSITIONS = exports.NotificationVariantTypes = void 0;
|
|
3
|
+
exports.notifyClassnames = exports.NOTIFY_HEIGHT_MOBILE = exports.NOTIFY_HEIGHT = exports.NOTIFY_NO_TRANSITION_ATTR = exports.BANNER_CONTAINER_ID = exports.NOTIFY_STATIC_CONTAINER_ID = exports.NOTIFY_CONTAINER_ID = exports.NOTIFY_POSITIONS = exports.NotificationVariantTypes = void 0;
|
|
4
4
|
const createUIKitClassname_1 = require("../utils/createUIKitClassname");
|
|
5
5
|
var NotificationVariantTypes;
|
|
6
6
|
(function (NotificationVariantTypes) {
|
|
@@ -23,9 +23,13 @@ exports.NOTIFY_STATIC_CONTAINER_ID = 'static-notify-container';
|
|
|
23
23
|
exports.BANNER_CONTAINER_ID = 'banner-container-id';
|
|
24
24
|
exports.NOTIFY_NO_TRANSITION_ATTR = 'data-no-transition';
|
|
25
25
|
exports.NOTIFY_HEIGHT = '56px';
|
|
26
|
+
exports.NOTIFY_HEIGHT_MOBILE = '40px';
|
|
26
27
|
exports.notifyClassnames = {
|
|
27
28
|
root: (0, createUIKitClassname_1.createUIKitClassname)('notify'),
|
|
28
29
|
body: (0, createUIKitClassname_1.createUIKitClassname)('notify__body'),
|
|
30
|
+
stack: (0, createUIKitClassname_1.createUIKitClassname)('notify__stack'),
|
|
31
|
+
/** Обёртка только над stacked ToastContainer — без :has() отделяем внешний .Toastify от статичного */
|
|
32
|
+
stackHost: (0, createUIKitClassname_1.createUIKitClassname)('notify__stack-host'),
|
|
29
33
|
container: (0, createUIKitClassname_1.createUIKitClassname)('notify__container'),
|
|
30
34
|
animationIn: (0, createUIKitClassname_1.createUIKitClassname)('notify_animation-in'),
|
|
31
35
|
animationOut: (0, createUIKitClassname_1.createUIKitClassname)('notify_animation-out'),
|