@alfalab/core-components-notification-manager 5.3.18 → 5.4.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/component.d.ts +8 -0
- package/component.js +10 -5
- package/cssm/component.d.ts +8 -0
- package/cssm/component.js +9 -4
- package/cssm/index.module.css +5 -1
- package/esm/component.d.ts +8 -0
- package/esm/component.js +10 -5
- package/esm/index.css +15 -11
- package/index.css +15 -11
- package/modern/component.d.ts +8 -0
- package/modern/component.js +7 -4
- package/modern/index.css +15 -11
- package/package.json +2 -2
- package/src/component.tsx +11 -2
- package/src/index.module.css +4 -0
package/component.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ type NotificationManagerProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
21
21
|
* z-index компонента
|
|
22
22
|
*/
|
|
23
23
|
zIndex?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Отступ от верхнего края
|
|
26
|
+
*/
|
|
27
|
+
offset?: number;
|
|
24
28
|
/**
|
|
25
29
|
* Удаление нотификации
|
|
26
30
|
*/
|
|
@@ -50,6 +54,10 @@ declare const NotificationManager: React.ForwardRefExoticComponent<React.HTMLAtt
|
|
|
50
54
|
* z-index компонента
|
|
51
55
|
*/
|
|
52
56
|
zIndex?: number | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Отступ от верхнего края
|
|
59
|
+
*/
|
|
60
|
+
offset?: number | undefined;
|
|
53
61
|
/**
|
|
54
62
|
* Удаление нотификации
|
|
55
63
|
*/
|
package/component.js
CHANGED
|
@@ -15,7 +15,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
15
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
16
16
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
17
17
|
|
|
18
|
-
var styles = {"component":"notification-
|
|
18
|
+
var styles = {"component":"notification-manager__component_16pmy","notification":"notification-manager__notification_16pmy","withoutMargin":"notification-manager__withoutMargin_16pmy","enter":"notification-manager__enter_16pmy","enterActive":"notification-manager__enterActive_16pmy"};
|
|
19
19
|
require('./index.css')
|
|
20
20
|
|
|
21
21
|
var CSS_TRANSITION_CLASS_NAMES = {
|
|
@@ -27,11 +27,16 @@ var TIMEOUT = {
|
|
|
27
27
|
enter: 400,
|
|
28
28
|
};
|
|
29
29
|
var NotificationManager = React.forwardRef(function (_a, ref) {
|
|
30
|
-
var notifications = _a.notifications, className = _a.className, dataTestId = _a.dataTestId, _b = _a.zIndex, zIndex = _b === void 0 ? coreComponentsStack.stackingOrder.TOAST : _b, _c = _a.style, style = _c === void 0 ? {} : _c, onRemoveNotification = _a.onRemoveNotification, container = _a.container, restProps = tslib.__rest(_a, ["notifications", "className", "dataTestId", "zIndex", "style", "onRemoveNotification", "container"]);
|
|
30
|
+
var notifications = _a.notifications, className = _a.className, dataTestId = _a.dataTestId, _b = _a.zIndex, zIndex = _b === void 0 ? coreComponentsStack.stackingOrder.TOAST : _b, _c = _a.style, style = _c === void 0 ? {} : _c, offset = _a.offset, onRemoveNotification = _a.onRemoveNotification, container = _a.container, restProps = tslib.__rest(_a, ["notifications", "className", "dataTestId", "zIndex", "style", "offset", "onRemoveNotification", "container"]);
|
|
31
31
|
return (React__default.default.createElement(coreComponentsStack.Stack, { value: zIndex }, function (computedZIndex) { return (React__default.default.createElement(coreComponentsPortal.Portal, { getPortalContainer: container },
|
|
32
|
-
React__default.default.createElement("div", tslib.__assign({ className: cn__default.default(styles.component, className), ref: ref, "data-test-id": dataTestId, style: tslib.__assign({ zIndex: computedZIndex }, style) }, restProps),
|
|
33
|
-
React__default.default.createElement(reactTransitionGroup.TransitionGroup, null, notifications.map(function (element) {
|
|
34
|
-
|
|
32
|
+
React__default.default.createElement("div", tslib.__assign({ className: cn__default.default(styles.component, className), ref: ref, "data-test-id": dataTestId, style: tslib.__assign({ zIndex: computedZIndex, top: offset }, style) }, restProps),
|
|
33
|
+
React__default.default.createElement(reactTransitionGroup.TransitionGroup, null, notifications.map(function (element, index) {
|
|
34
|
+
var _a;
|
|
35
|
+
return (React__default.default.createElement(reactTransitionGroup.CSSTransition, { key: element.props.id, timeout: TIMEOUT, classNames: CSS_TRANSITION_CLASS_NAMES, unmountOnExit: true },
|
|
36
|
+
React__default.default.createElement(components_notification_component.Notification, { element: element, className: cn__default.default(styles.notification, (_a = {},
|
|
37
|
+
_a[styles.withoutMargin] = offset && index === 0,
|
|
38
|
+
_a)), onRemoveNotification: onRemoveNotification })));
|
|
39
|
+
}))))); }));
|
|
35
40
|
});
|
|
36
41
|
|
|
37
42
|
exports.NotificationManager = NotificationManager;
|
package/cssm/component.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ type NotificationManagerProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
21
21
|
* z-index компонента
|
|
22
22
|
*/
|
|
23
23
|
zIndex?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Отступ от верхнего края
|
|
26
|
+
*/
|
|
27
|
+
offset?: number;
|
|
24
28
|
/**
|
|
25
29
|
* Удаление нотификации
|
|
26
30
|
*/
|
|
@@ -50,6 +54,10 @@ declare const NotificationManager: React.ForwardRefExoticComponent<React.HTMLAtt
|
|
|
50
54
|
* z-index компонента
|
|
51
55
|
*/
|
|
52
56
|
zIndex?: number | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Отступ от верхнего края
|
|
59
|
+
*/
|
|
60
|
+
offset?: number | undefined;
|
|
53
61
|
/**
|
|
54
62
|
* Удаление нотификации
|
|
55
63
|
*/
|
package/cssm/component.js
CHANGED
|
@@ -26,11 +26,16 @@ var TIMEOUT = {
|
|
|
26
26
|
enter: 400,
|
|
27
27
|
};
|
|
28
28
|
var NotificationManager = React.forwardRef(function (_a, ref) {
|
|
29
|
-
var notifications = _a.notifications, className = _a.className, dataTestId = _a.dataTestId, _b = _a.zIndex, zIndex = _b === void 0 ? coreComponentsStack.stackingOrder.TOAST : _b, _c = _a.style, style = _c === void 0 ? {} : _c, onRemoveNotification = _a.onRemoveNotification, container = _a.container, restProps = tslib.__rest(_a, ["notifications", "className", "dataTestId", "zIndex", "style", "onRemoveNotification", "container"]);
|
|
29
|
+
var notifications = _a.notifications, className = _a.className, dataTestId = _a.dataTestId, _b = _a.zIndex, zIndex = _b === void 0 ? coreComponentsStack.stackingOrder.TOAST : _b, _c = _a.style, style = _c === void 0 ? {} : _c, offset = _a.offset, onRemoveNotification = _a.onRemoveNotification, container = _a.container, restProps = tslib.__rest(_a, ["notifications", "className", "dataTestId", "zIndex", "style", "offset", "onRemoveNotification", "container"]);
|
|
30
30
|
return (React__default.default.createElement(coreComponentsStack.Stack, { value: zIndex }, function (computedZIndex) { return (React__default.default.createElement(coreComponentsPortal.Portal, { getPortalContainer: container },
|
|
31
|
-
React__default.default.createElement("div", tslib.__assign({ className: cn__default.default(styles__default.default.component, className), ref: ref, "data-test-id": dataTestId, style: tslib.__assign({ zIndex: computedZIndex }, style) }, restProps),
|
|
32
|
-
React__default.default.createElement(reactTransitionGroup.TransitionGroup, null, notifications.map(function (element) {
|
|
33
|
-
|
|
31
|
+
React__default.default.createElement("div", tslib.__assign({ className: cn__default.default(styles__default.default.component, className), ref: ref, "data-test-id": dataTestId, style: tslib.__assign({ zIndex: computedZIndex, top: offset }, style) }, restProps),
|
|
32
|
+
React__default.default.createElement(reactTransitionGroup.TransitionGroup, null, notifications.map(function (element, index) {
|
|
33
|
+
var _a;
|
|
34
|
+
return (React__default.default.createElement(reactTransitionGroup.CSSTransition, { key: element.props.id, timeout: TIMEOUT, classNames: CSS_TRANSITION_CLASS_NAMES, unmountOnExit: true },
|
|
35
|
+
React__default.default.createElement(components_notification_component.Notification, { element: element, className: cn__default.default(styles__default.default.notification, (_a = {},
|
|
36
|
+
_a[styles__default.default.withoutMargin] = offset && index === 0,
|
|
37
|
+
_a)), onRemoveNotification: onRemoveNotification })));
|
|
38
|
+
}))))); }));
|
|
34
39
|
});
|
|
35
40
|
|
|
36
41
|
exports.NotificationManager = NotificationManager;
|
package/cssm/index.module.css
CHANGED
|
@@ -15,9 +15,13 @@
|
|
|
15
15
|
.component .notification {
|
|
16
16
|
width: calc(100vw - var(--gap-xl));
|
|
17
17
|
margin-top: var(--gap-s);
|
|
18
|
-
will-change: transform
|
|
18
|
+
will-change: transform
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
.component .notification.withoutMargin {
|
|
22
|
+
margin-top: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
.component .notification.notification {
|
|
22
26
|
position: static;
|
|
23
27
|
}
|
package/esm/component.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ type NotificationManagerProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
21
21
|
* z-index компонента
|
|
22
22
|
*/
|
|
23
23
|
zIndex?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Отступ от верхнего края
|
|
26
|
+
*/
|
|
27
|
+
offset?: number;
|
|
24
28
|
/**
|
|
25
29
|
* Удаление нотификации
|
|
26
30
|
*/
|
|
@@ -50,6 +54,10 @@ declare const NotificationManager: React.ForwardRefExoticComponent<React.HTMLAtt
|
|
|
50
54
|
* z-index компонента
|
|
51
55
|
*/
|
|
52
56
|
zIndex?: number | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Отступ от верхнего края
|
|
59
|
+
*/
|
|
60
|
+
offset?: number | undefined;
|
|
53
61
|
/**
|
|
54
62
|
* Удаление нотификации
|
|
55
63
|
*/
|
package/esm/component.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Portal } from '@alfalab/core-components-portal/esm';
|
|
|
6
6
|
import { stackingOrder, Stack } from '@alfalab/core-components-stack/esm';
|
|
7
7
|
import { Notification } from './components/notification/component.js';
|
|
8
8
|
|
|
9
|
-
var styles = {"component":"notification-
|
|
9
|
+
var styles = {"component":"notification-manager__component_16pmy","notification":"notification-manager__notification_16pmy","withoutMargin":"notification-manager__withoutMargin_16pmy","enter":"notification-manager__enter_16pmy","enterActive":"notification-manager__enterActive_16pmy"};
|
|
10
10
|
require('./index.css')
|
|
11
11
|
|
|
12
12
|
var CSS_TRANSITION_CLASS_NAMES = {
|
|
@@ -18,11 +18,16 @@ var TIMEOUT = {
|
|
|
18
18
|
enter: 400,
|
|
19
19
|
};
|
|
20
20
|
var NotificationManager = forwardRef(function (_a, ref) {
|
|
21
|
-
var notifications = _a.notifications, className = _a.className, dataTestId = _a.dataTestId, _b = _a.zIndex, zIndex = _b === void 0 ? stackingOrder.TOAST : _b, _c = _a.style, style = _c === void 0 ? {} : _c, onRemoveNotification = _a.onRemoveNotification, container = _a.container, restProps = __rest(_a, ["notifications", "className", "dataTestId", "zIndex", "style", "onRemoveNotification", "container"]);
|
|
21
|
+
var notifications = _a.notifications, className = _a.className, dataTestId = _a.dataTestId, _b = _a.zIndex, zIndex = _b === void 0 ? stackingOrder.TOAST : _b, _c = _a.style, style = _c === void 0 ? {} : _c, offset = _a.offset, onRemoveNotification = _a.onRemoveNotification, container = _a.container, restProps = __rest(_a, ["notifications", "className", "dataTestId", "zIndex", "style", "offset", "onRemoveNotification", "container"]);
|
|
22
22
|
return (React.createElement(Stack, { value: zIndex }, function (computedZIndex) { return (React.createElement(Portal, { getPortalContainer: container },
|
|
23
|
-
React.createElement("div", __assign({ className: cn(styles.component, className), ref: ref, "data-test-id": dataTestId, style: __assign({ zIndex: computedZIndex }, style) }, restProps),
|
|
24
|
-
React.createElement(TransitionGroup, null, notifications.map(function (element) {
|
|
25
|
-
|
|
23
|
+
React.createElement("div", __assign({ className: cn(styles.component, className), ref: ref, "data-test-id": dataTestId, style: __assign({ zIndex: computedZIndex, top: offset }, style) }, restProps),
|
|
24
|
+
React.createElement(TransitionGroup, null, notifications.map(function (element, index) {
|
|
25
|
+
var _a;
|
|
26
|
+
return (React.createElement(CSSTransition, { key: element.props.id, timeout: TIMEOUT, classNames: CSS_TRANSITION_CLASS_NAMES, unmountOnExit: true },
|
|
27
|
+
React.createElement(Notification, { element: element, className: cn(styles.notification, (_a = {},
|
|
28
|
+
_a[styles.withoutMargin] = offset && index === 0,
|
|
29
|
+
_a)), onRemoveNotification: onRemoveNotification })));
|
|
30
|
+
}))))); }));
|
|
26
31
|
});
|
|
27
32
|
|
|
28
33
|
export { NotificationManager };
|
package/esm/index.css
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 15zoi */
|
|
2
2
|
:root {
|
|
3
3
|
--gap-s: 12px;
|
|
4
4
|
--gap-xl: 24px;
|
|
5
5
|
--gap-4xl: 48px;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.notification-
|
|
8
|
+
.notification-manager__component_16pmy {
|
|
9
9
|
position: fixed;
|
|
10
10
|
top: 0;
|
|
11
11
|
right: var(--gap-s);
|
|
@@ -13,41 +13,45 @@
|
|
|
13
13
|
flex-direction: column;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.notification-
|
|
16
|
+
.notification-manager__component_16pmy .notification-manager__notification_16pmy {
|
|
17
17
|
width: calc(100vw - var(--gap-xl));
|
|
18
18
|
margin-top: var(--gap-s);
|
|
19
|
-
will-change: transform
|
|
19
|
+
will-change: transform
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.notification-
|
|
22
|
+
.notification-manager__component_16pmy .notification-manager__notification_16pmy.notification-manager__withoutMargin_16pmy {
|
|
23
|
+
margin-top: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.notification-manager__component_16pmy .notification-manager__notification_16pmy.notification-manager__notification_16pmy {
|
|
23
27
|
position: static;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
.notification-
|
|
30
|
+
.notification-manager__enter_16pmy {
|
|
27
31
|
visibility: hidden;
|
|
28
32
|
transform: translate(0, -500px);
|
|
29
33
|
}
|
|
30
34
|
|
|
31
|
-
.notification-
|
|
35
|
+
.notification-manager__enterActive_16pmy {
|
|
32
36
|
visibility: visible;
|
|
33
37
|
transform: translate(0);
|
|
34
38
|
transition: transform 0.4s ease-out;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
@media (min-width: 600px) {
|
|
38
|
-
.notification-
|
|
42
|
+
.notification-manager__component_16pmy {
|
|
39
43
|
right: var(--gap-4xl);
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
.notification-
|
|
46
|
+
.notification-manager__component_16pmy .notification-manager__notification_16pmy {
|
|
43
47
|
width: auto;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
.notification-
|
|
50
|
+
.notification-manager__enter_16pmy {
|
|
47
51
|
transform: translate(100%, 0);
|
|
48
52
|
}
|
|
49
53
|
|
|
50
|
-
.notification-
|
|
54
|
+
.notification-manager__enterActive_16pmy {
|
|
51
55
|
transform: translate(0);
|
|
52
56
|
}
|
|
53
57
|
}
|
package/index.css
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 15zoi */
|
|
2
2
|
:root {
|
|
3
3
|
--gap-s: 12px;
|
|
4
4
|
--gap-xl: 24px;
|
|
5
5
|
--gap-4xl: 48px;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.notification-
|
|
8
|
+
.notification-manager__component_16pmy {
|
|
9
9
|
position: fixed;
|
|
10
10
|
top: 0;
|
|
11
11
|
right: var(--gap-s);
|
|
@@ -13,41 +13,45 @@
|
|
|
13
13
|
flex-direction: column;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.notification-
|
|
16
|
+
.notification-manager__component_16pmy .notification-manager__notification_16pmy {
|
|
17
17
|
width: calc(100vw - var(--gap-xl));
|
|
18
18
|
margin-top: var(--gap-s);
|
|
19
|
-
will-change: transform
|
|
19
|
+
will-change: transform
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.notification-
|
|
22
|
+
.notification-manager__component_16pmy .notification-manager__notification_16pmy.notification-manager__withoutMargin_16pmy {
|
|
23
|
+
margin-top: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.notification-manager__component_16pmy .notification-manager__notification_16pmy.notification-manager__notification_16pmy {
|
|
23
27
|
position: static;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
.notification-
|
|
30
|
+
.notification-manager__enter_16pmy {
|
|
27
31
|
visibility: hidden;
|
|
28
32
|
transform: translate(0, -500px);
|
|
29
33
|
}
|
|
30
34
|
|
|
31
|
-
.notification-
|
|
35
|
+
.notification-manager__enterActive_16pmy {
|
|
32
36
|
visibility: visible;
|
|
33
37
|
transform: translate(0);
|
|
34
38
|
transition: transform 0.4s ease-out;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
@media (min-width: 600px) {
|
|
38
|
-
.notification-
|
|
42
|
+
.notification-manager__component_16pmy {
|
|
39
43
|
right: var(--gap-4xl);
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
.notification-
|
|
46
|
+
.notification-manager__component_16pmy .notification-manager__notification_16pmy {
|
|
43
47
|
width: auto;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
.notification-
|
|
50
|
+
.notification-manager__enter_16pmy {
|
|
47
51
|
transform: translate(100%, 0);
|
|
48
52
|
}
|
|
49
53
|
|
|
50
|
-
.notification-
|
|
54
|
+
.notification-manager__enterActive_16pmy {
|
|
51
55
|
transform: translate(0);
|
|
52
56
|
}
|
|
53
57
|
}
|
package/modern/component.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ type NotificationManagerProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
21
21
|
* z-index компонента
|
|
22
22
|
*/
|
|
23
23
|
zIndex?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Отступ от верхнего края
|
|
26
|
+
*/
|
|
27
|
+
offset?: number;
|
|
24
28
|
/**
|
|
25
29
|
* Удаление нотификации
|
|
26
30
|
*/
|
|
@@ -50,6 +54,10 @@ declare const NotificationManager: React.ForwardRefExoticComponent<React.HTMLAtt
|
|
|
50
54
|
* z-index компонента
|
|
51
55
|
*/
|
|
52
56
|
zIndex?: number | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Отступ от верхнего края
|
|
59
|
+
*/
|
|
60
|
+
offset?: number | undefined;
|
|
53
61
|
/**
|
|
54
62
|
* Удаление нотификации
|
|
55
63
|
*/
|
package/modern/component.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Portal } from '@alfalab/core-components-portal/modern';
|
|
|
5
5
|
import { Stack, stackingOrder } from '@alfalab/core-components-stack/modern';
|
|
6
6
|
import { Notification } from './components/notification/component.js';
|
|
7
7
|
|
|
8
|
-
const styles = {"component":"notification-
|
|
8
|
+
const styles = {"component":"notification-manager__component_16pmy","notification":"notification-manager__notification_16pmy","withoutMargin":"notification-manager__withoutMargin_16pmy","enter":"notification-manager__enter_16pmy","enterActive":"notification-manager__enterActive_16pmy"};
|
|
9
9
|
require('./index.css')
|
|
10
10
|
|
|
11
11
|
const CSS_TRANSITION_CLASS_NAMES = {
|
|
@@ -16,12 +16,15 @@ const TIMEOUT = {
|
|
|
16
16
|
exit: 0,
|
|
17
17
|
enter: 400,
|
|
18
18
|
};
|
|
19
|
-
const NotificationManager = forwardRef(({ notifications, className, dataTestId, zIndex = stackingOrder.TOAST, style = {}, onRemoveNotification, container, ...restProps }, ref) => (React.createElement(Stack, { value: zIndex }, (computedZIndex) => (React.createElement(Portal, { getPortalContainer: container },
|
|
19
|
+
const NotificationManager = forwardRef(({ notifications, className, dataTestId, zIndex = stackingOrder.TOAST, style = {}, offset, onRemoveNotification, container, ...restProps }, ref) => (React.createElement(Stack, { value: zIndex }, (computedZIndex) => (React.createElement(Portal, { getPortalContainer: container },
|
|
20
20
|
React.createElement("div", { className: cn(styles.component, className), ref: ref, "data-test-id": dataTestId, style: {
|
|
21
21
|
zIndex: computedZIndex,
|
|
22
|
+
top: offset,
|
|
22
23
|
...style,
|
|
23
24
|
}, ...restProps },
|
|
24
|
-
React.createElement(TransitionGroup, null, notifications.map((element) => (React.createElement(CSSTransition, { key: element.props.id, timeout: TIMEOUT, classNames: CSS_TRANSITION_CLASS_NAMES, unmountOnExit: true },
|
|
25
|
-
React.createElement(Notification, { element: element, className: styles.notification,
|
|
25
|
+
React.createElement(TransitionGroup, null, notifications.map((element, index) => (React.createElement(CSSTransition, { key: element.props.id, timeout: TIMEOUT, classNames: CSS_TRANSITION_CLASS_NAMES, unmountOnExit: true },
|
|
26
|
+
React.createElement(Notification, { element: element, className: cn(styles.notification, {
|
|
27
|
+
[styles.withoutMargin]: offset && index === 0,
|
|
28
|
+
}), onRemoveNotification: onRemoveNotification })))))))))));
|
|
26
29
|
|
|
27
30
|
export { NotificationManager };
|
package/modern/index.css
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 15zoi */
|
|
2
2
|
:root {
|
|
3
3
|
--gap-s: 12px;
|
|
4
4
|
--gap-xl: 24px;
|
|
5
5
|
--gap-4xl: 48px;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.notification-
|
|
8
|
+
.notification-manager__component_16pmy {
|
|
9
9
|
position: fixed;
|
|
10
10
|
top: 0;
|
|
11
11
|
right: var(--gap-s);
|
|
@@ -13,41 +13,45 @@
|
|
|
13
13
|
flex-direction: column;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.notification-
|
|
16
|
+
.notification-manager__component_16pmy .notification-manager__notification_16pmy {
|
|
17
17
|
width: calc(100vw - var(--gap-xl));
|
|
18
18
|
margin-top: var(--gap-s);
|
|
19
|
-
will-change: transform
|
|
19
|
+
will-change: transform
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.notification-
|
|
22
|
+
.notification-manager__component_16pmy .notification-manager__notification_16pmy.notification-manager__withoutMargin_16pmy {
|
|
23
|
+
margin-top: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.notification-manager__component_16pmy .notification-manager__notification_16pmy.notification-manager__notification_16pmy {
|
|
23
27
|
position: static;
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
.notification-
|
|
30
|
+
.notification-manager__enter_16pmy {
|
|
27
31
|
visibility: hidden;
|
|
28
32
|
transform: translate(0, -500px);
|
|
29
33
|
}
|
|
30
34
|
|
|
31
|
-
.notification-
|
|
35
|
+
.notification-manager__enterActive_16pmy {
|
|
32
36
|
visibility: visible;
|
|
33
37
|
transform: translate(0);
|
|
34
38
|
transition: transform 0.4s ease-out;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
@media (min-width: 600px) {
|
|
38
|
-
.notification-
|
|
42
|
+
.notification-manager__component_16pmy {
|
|
39
43
|
right: var(--gap-4xl);
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
.notification-
|
|
46
|
+
.notification-manager__component_16pmy .notification-manager__notification_16pmy {
|
|
43
47
|
width: auto;
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
.notification-
|
|
50
|
+
.notification-manager__enter_16pmy {
|
|
47
51
|
transform: translate(100%, 0);
|
|
48
52
|
}
|
|
49
53
|
|
|
50
|
-
.notification-
|
|
54
|
+
.notification-manager__enterActive_16pmy {
|
|
51
55
|
transform: translate(0);
|
|
52
56
|
}
|
|
53
57
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-notification-manager",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "Notification manager",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"react": "^16.9.0 || ^17.0.1 || ^18.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@alfalab/core-components-notification": "^6.2.
|
|
17
|
+
"@alfalab/core-components-notification": "^6.2.20",
|
|
18
18
|
"@alfalab/core-components-portal": "^3.2.0",
|
|
19
19
|
"@alfalab/core-components-stack": "^4.1.0",
|
|
20
20
|
"classnames": "^2.3.1",
|
package/src/component.tsx
CHANGED
|
@@ -31,6 +31,11 @@ export type NotificationManagerProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
31
31
|
*/
|
|
32
32
|
zIndex?: number;
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Отступ от верхнего края
|
|
36
|
+
*/
|
|
37
|
+
offset?: number;
|
|
38
|
+
|
|
34
39
|
/**
|
|
35
40
|
* Удаление нотификации
|
|
36
41
|
*/
|
|
@@ -62,6 +67,7 @@ export const NotificationManager = forwardRef<HTMLDivElement, NotificationManage
|
|
|
62
67
|
dataTestId,
|
|
63
68
|
zIndex = stackingOrder.TOAST,
|
|
64
69
|
style = {},
|
|
70
|
+
offset,
|
|
65
71
|
onRemoveNotification,
|
|
66
72
|
container,
|
|
67
73
|
...restProps
|
|
@@ -77,12 +83,13 @@ export const NotificationManager = forwardRef<HTMLDivElement, NotificationManage
|
|
|
77
83
|
data-test-id={dataTestId}
|
|
78
84
|
style={{
|
|
79
85
|
zIndex: computedZIndex,
|
|
86
|
+
top: offset,
|
|
80
87
|
...style,
|
|
81
88
|
}}
|
|
82
89
|
{...restProps}
|
|
83
90
|
>
|
|
84
91
|
<TransitionGroup>
|
|
85
|
-
{notifications.map((element) => (
|
|
92
|
+
{notifications.map((element, index) => (
|
|
86
93
|
<CSSTransition
|
|
87
94
|
key={element.props.id}
|
|
88
95
|
timeout={TIMEOUT}
|
|
@@ -91,7 +98,9 @@ export const NotificationManager = forwardRef<HTMLDivElement, NotificationManage
|
|
|
91
98
|
>
|
|
92
99
|
<Notification
|
|
93
100
|
element={element}
|
|
94
|
-
className={styles.notification
|
|
101
|
+
className={cn(styles.notification, {
|
|
102
|
+
[styles.withoutMargin]: offset && index === 0,
|
|
103
|
+
})}
|
|
95
104
|
onRemoveNotification={onRemoveNotification}
|
|
96
105
|
/>
|
|
97
106
|
</CSSTransition>
|