@alfalab/core-components-notification-manager 7.0.4 → 7.0.5
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 +3 -35
- package/component.js +3 -13
- package/component.js.map +1 -1
- package/components/notification/component.d.ts +5 -4
- package/components/notification/component.js +16 -4
- package/components/notification/component.js.map +1 -1
- package/components/notification/index.css +18 -0
- package/components/notification/index.module.css.js +8 -0
- package/components/notification/index.module.css.js.map +1 -0
- package/cssm/component.d.ts +3 -35
- package/cssm/component.js +3 -13
- package/cssm/component.js.map +1 -1
- package/cssm/components/notification/component.d.ts +5 -4
- package/cssm/components/notification/component.js +17 -4
- package/cssm/components/notification/component.js.map +1 -1
- package/cssm/components/notification/index.module.css +18 -0
- package/cssm/index.module.css +0 -17
- package/esm/component.d.ts +3 -35
- package/esm/component.js +5 -15
- package/esm/component.js.map +1 -1
- package/esm/components/notification/component.d.ts +5 -4
- package/esm/components/notification/component.js +16 -5
- package/esm/components/notification/component.js.map +1 -1
- package/esm/components/notification/index.css +18 -0
- package/esm/components/notification/index.module.css.js +6 -0
- package/esm/components/notification/index.module.css.js.map +1 -0
- package/esm/index.css +6 -23
- package/esm/index.module.css.js +1 -1
- package/esm/index.module.css.js.map +1 -1
- package/index.css +6 -23
- package/index.module.css.js +1 -1
- package/index.module.css.js.map +1 -1
- package/modern/component.d.ts +3 -35
- package/modern/component.js +11 -23
- package/modern/component.js.map +1 -1
- package/modern/components/notification/component.d.ts +5 -4
- package/modern/components/notification/component.js +16 -5
- package/modern/components/notification/component.js.map +1 -1
- package/modern/components/notification/index.css +18 -0
- package/modern/components/notification/index.module.css.js +6 -0
- package/modern/components/notification/index.module.css.js.map +1 -0
- package/modern/index.css +6 -23
- package/modern/index.module.css.js +1 -1
- package/modern/index.module.css.js.map +1 -1
- package/moderncssm/component.d.ts +3 -35
- package/moderncssm/component.js +11 -23
- package/moderncssm/component.js.map +1 -1
- package/moderncssm/components/notification/component.d.ts +5 -4
- package/moderncssm/components/notification/component.js +16 -5
- package/moderncssm/components/notification/component.js.map +1 -1
- package/moderncssm/components/notification/index.module.css +22 -0
- package/moderncssm/index.module.css +0 -19
- package/package.json +2 -2
- package/src/component.tsx +36 -58
- package/src/components/notification/{component.ts → component.tsx} +45 -9
- package/src/components/notification/index.module.css +22 -0
- package/src/index.module.css +0 -19
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { type FC, type ReactElement
|
|
1
|
+
import { type FC, type ReactElement } from 'react';
|
|
2
|
+
import { type CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
2
3
|
import { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification/esm';
|
|
3
4
|
export type NotificationElement = ReactElement<CoreNotificationProps & {
|
|
4
5
|
id: string;
|
|
5
6
|
}>;
|
|
6
|
-
type
|
|
7
|
+
type NotificationTransitionProps = Partial<Pick<CSSTransitionProps<HTMLDivElement>, 'in' | 'onExited' | 'appear' | 'enter' | 'exit'>>;
|
|
8
|
+
interface NotificationProps extends NotificationTransitionProps {
|
|
7
9
|
element: NotificationElement;
|
|
8
10
|
className: string;
|
|
9
11
|
onRemoveNotification: (id: string) => void;
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
+
}
|
|
12
13
|
export declare const Notification: FC<NotificationProps>;
|
|
13
14
|
export {};
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { __assign } from 'tslib';
|
|
2
|
-
import { useCallback, useMemo, cloneElement } from 'react';
|
|
2
|
+
import React, { useRef, useCallback, useMemo, cloneElement } from 'react';
|
|
3
|
+
import { CSSTransition } from 'react-transition-group';
|
|
3
4
|
import cn from 'classnames';
|
|
5
|
+
import styles from './index.module.css.js';
|
|
4
6
|
|
|
7
|
+
var TIMEOUT = {
|
|
8
|
+
exit: 0,
|
|
9
|
+
enter: 400,
|
|
10
|
+
};
|
|
11
|
+
var CSS_TRANSITION_CLASS_NAMES = {
|
|
12
|
+
enter: styles.enter,
|
|
13
|
+
enterActive: styles.enterActive,
|
|
14
|
+
};
|
|
5
15
|
var Notification = function (_a) {
|
|
6
|
-
var
|
|
16
|
+
var inProp = _a.in, onExited = _a.onExited, appear = _a.appear, enter = _a.enter, exit = _a.exit, element = _a.element, className = _a.className, onRemoveNotification = _a.onRemoveNotification;
|
|
17
|
+
var nodeRef = useRef(null);
|
|
7
18
|
var _b = element.props, onClose = _b.onClose, onCloseTimeout = _b.onCloseTimeout;
|
|
8
19
|
var handleClose = useCallback(function () {
|
|
9
20
|
if (onClose) {
|
|
@@ -17,10 +28,10 @@ var Notification = function (_a) {
|
|
|
17
28
|
}
|
|
18
29
|
onRemoveNotification(element.props.id);
|
|
19
30
|
}, [element.props.id, onCloseTimeout, onRemoveNotification]);
|
|
20
|
-
var notificationProps = useMemo(function () { return (__assign(__assign({}, element.props), { visible: true, className: cn(className, element.props.className), usePortal: false, offset: 0, onClose: handleClose, onCloseTimeout: handleCloseTimeout, containerRef:
|
|
31
|
+
var notificationProps = useMemo(function () { return (__assign(__assign({}, element.props), { visible: true, className: cn(className, element.props.className), usePortal: false, offset: 0, onClose: handleClose, onCloseTimeout: handleCloseTimeout, containerRef: nodeRef })); },
|
|
21
32
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
22
|
-
[element, handleClose, handleCloseTimeout,
|
|
23
|
-
return cloneElement(element, notificationProps);
|
|
33
|
+
[element, handleClose, handleCloseTimeout, className]);
|
|
34
|
+
return (React.createElement(CSSTransition, { in: inProp, onExited: onExited, appear: appear, enter: enter, exit: exit, timeout: TIMEOUT, classNames: CSS_TRANSITION_CLASS_NAMES, unmountOnExit: true, nodeRef: nodeRef }, cloneElement(element, notificationProps)));
|
|
24
35
|
};
|
|
25
36
|
|
|
26
37
|
export { Notification };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/notification/component.
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/notification/component.tsx"],"sourcesContent":["import React, {\n cloneElement,\n type FC,\n type ReactElement,\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport { type CSSTransitionProps } from 'react-transition-group/CSSTransition';\nimport cn from 'classnames';\n\nimport { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';\n\nimport styles from './index.module.css';\n\nexport type NotificationElement = ReactElement<CoreNotificationProps & { id: string }>;\n\nconst TIMEOUT = {\n exit: 0,\n enter: 400,\n};\n\nconst CSS_TRANSITION_CLASS_NAMES = {\n enter: styles.enter,\n enterActive: styles.enterActive,\n};\n\ntype NotificationTransitionProps = Partial<\n Pick<CSSTransitionProps<HTMLDivElement>, 'in' | 'onExited' | 'appear' | 'enter' | 'exit'>\n>;\n\ninterface NotificationProps extends NotificationTransitionProps {\n element: NotificationElement;\n className: string;\n onRemoveNotification: (id: string) => void;\n}\n\nexport const Notification: FC<NotificationProps> = ({\n in: inProp,\n onExited,\n appear,\n enter,\n exit,\n element,\n className,\n onRemoveNotification,\n}) => {\n const nodeRef = useRef<HTMLDivElement>(null);\n const { onClose, onCloseTimeout } = element.props;\n\n const handleClose = useCallback(() => {\n if (onClose) {\n onClose();\n }\n\n onRemoveNotification(element.props.id);\n }, [onClose, onRemoveNotification, element.props.id]);\n\n const handleCloseTimeout = useCallback(() => {\n if (onCloseTimeout) {\n onCloseTimeout();\n }\n\n onRemoveNotification(element.props.id);\n }, [element.props.id, onCloseTimeout, onRemoveNotification]);\n\n const notificationProps = useMemo<CoreNotificationProps>(\n () => ({\n ...element.props,\n visible: true,\n className: cn(className, element.props.className),\n usePortal: false,\n offset: 0,\n onClose: handleClose,\n onCloseTimeout: handleCloseTimeout,\n containerRef: nodeRef,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, handleClose, handleCloseTimeout, className],\n );\n\n return (\n <CSSTransition<HTMLDivElement>\n in={inProp}\n onExited={onExited}\n appear={appear}\n enter={enter}\n exit={exit}\n timeout={TIMEOUT}\n classNames={CSS_TRANSITION_CLASS_NAMES}\n unmountOnExit={true}\n nodeRef={nodeRef}\n >\n {cloneElement(element, notificationProps)}\n </CSSTransition>\n );\n};\n"],"names":[],"mappings":";;;;;;AAkBA,IAAM,OAAO,GAAG;AACZ,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,KAAK,EAAE,GAAG;CACb;AAED,IAAM,0BAA0B,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;IACnB,WAAW,EAAE,MAAM,CAAC,WAAW;CAClC;AAYM,IAAM,YAAY,GAA0B,UAAC,EASnD,EAAA;QARO,MAAM,GAAA,EAAA,CAAA,EAAA,EACV,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,IAAI,GAAA,EAAA,CAAA,IAAA,EACJ,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,oBAAoB,GAAA,EAAA,CAAA,oBAAA;AAEpB,IAAA,IAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC;IACtC,IAAA,EAAA,GAA8B,OAAO,CAAC,KAAK,EAAzC,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,cAAc,GAAA,EAAA,CAAA,cAAkB;IAEjD,IAAM,WAAW,GAAG,WAAW,CAAC,YAAA;QAC5B,IAAI,OAAO,EAAE;AACT,YAAA,OAAO,EAAE;;AAGb,QAAA,oBAAoB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1C,KAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAErD,IAAM,kBAAkB,GAAG,WAAW,CAAC,YAAA;QACnC,IAAI,cAAc,EAAE;AAChB,YAAA,cAAc,EAAE;;AAGpB,QAAA,oBAAoB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1C,KAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,cAAc,EAAE,oBAAoB,CAAC,CAAC;IAE5D,IAAM,iBAAiB,GAAG,OAAO,CAC7B,cAAM,QAAA,QAAA,CAAA,QAAA,CAAA,EAAA,EACC,OAAO,CAAC,KAAK,CAAA,EAAA,EAChB,OAAO,EAAE,IAAI,EACb,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,EACjD,SAAS,EAAE,KAAK,EAChB,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,WAAW,EACpB,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,OAAO,EACvB,CAAA,EAAA,EAAA;;IAEF,CAAC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,SAAS,CAAC,CACxD;IAED,QACI,oBAAC,aAAa,EAAA,EACV,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,0BAA0B,EACtC,aAAa,EAAE,IAAI,EACnB,OAAO,EAAE,OAAO,EAAA,EAEf,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAC7B;AAExB;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.notification-manager__enter_4ws0s {
|
|
2
|
+
visibility: hidden;
|
|
3
|
+
transform: translate(0, -500px);
|
|
4
|
+
}
|
|
5
|
+
.notification-manager__enterActive_4ws0s {
|
|
6
|
+
visibility: visible;
|
|
7
|
+
transform: translate(0);
|
|
8
|
+
transition: transform 0.4s ease-out;
|
|
9
|
+
}
|
|
10
|
+
@media (min-width: 600px) {
|
|
11
|
+
.notification-manager__enter_4ws0s {
|
|
12
|
+
transform: translate(100%, 0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.notification-manager__enterActive_4ws0s {
|
|
16
|
+
transform: translate(0);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/notification/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.enter {\n visibility: hidden;\n transform: translate(0, -500px);\n}\n\n.enterActive {\n visibility: visible;\n transform: translate(0);\n transition: transform 0.4s ease-out;\n}\n\n@media (--tablet-s) {\n .enter {\n transform: translate(100%, 0);\n }\n\n .enterActive {\n transform: translate(0);\n }\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,OAAO,CAAC,mCAAmC,CAAC,aAAa,CAAC,yCAAyC,CAAC;;;;"}
|
package/esm/index.css
CHANGED
|
@@ -7,47 +7,30 @@
|
|
|
7
7
|
--gap-24: var(--gap-xl);
|
|
8
8
|
--gap-48: var(--gap-4xl);
|
|
9
9
|
}
|
|
10
|
-
.notification-
|
|
10
|
+
.notification-manager__component_8dpq7 {
|
|
11
11
|
position: fixed;
|
|
12
12
|
top: var(--gap-0);
|
|
13
13
|
right: var(--gap-12);
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
}
|
|
17
|
-
.notification-
|
|
17
|
+
.notification-manager__component_8dpq7 .notification-manager__notification_8dpq7 {
|
|
18
18
|
width: calc(100vw - var(--gap-24));
|
|
19
19
|
margin-top: var(--gap-12);
|
|
20
20
|
will-change: transform;
|
|
21
21
|
}
|
|
22
|
-
.notification-
|
|
22
|
+
.notification-manager__component_8dpq7 .notification-manager__notification_8dpq7.notification-manager__withoutMargin_8dpq7 {
|
|
23
23
|
margin-top: var(--gap-0);
|
|
24
24
|
}
|
|
25
|
-
.notification-
|
|
25
|
+
.notification-manager__component_8dpq7 .notification-manager__notification_8dpq7.notification-manager__notification_8dpq7 {
|
|
26
26
|
position: static;
|
|
27
27
|
}
|
|
28
|
-
.notification-manager__enter_1an0j {
|
|
29
|
-
visibility: hidden;
|
|
30
|
-
transform: translate(0, -500px);
|
|
31
|
-
}
|
|
32
|
-
.notification-manager__enterActive_1an0j {
|
|
33
|
-
visibility: visible;
|
|
34
|
-
transform: translate(0);
|
|
35
|
-
transition: transform 0.4s ease-out;
|
|
36
|
-
}
|
|
37
28
|
@media (min-width: 600px) {
|
|
38
|
-
.notification-
|
|
29
|
+
.notification-manager__component_8dpq7 {
|
|
39
30
|
right: var(--gap-48);
|
|
40
31
|
}
|
|
41
32
|
|
|
42
|
-
.notification-
|
|
33
|
+
.notification-manager__component_8dpq7 .notification-manager__notification_8dpq7 {
|
|
43
34
|
width: auto;
|
|
44
35
|
}
|
|
45
|
-
|
|
46
|
-
.notification-manager__enter_1an0j {
|
|
47
|
-
transform: translate(100%, 0);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.notification-manager__enterActive_1an0j {
|
|
51
|
-
transform: translate(0);
|
|
52
|
-
}
|
|
53
36
|
}
|
package/esm/index.module.css.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
var styles = {"component":"notification-
|
|
3
|
+
var styles = {"component":"notification-manager__component_8dpq7","notification":"notification-manager__notification_8dpq7","withoutMargin":"notification-manager__withoutMargin_8dpq7"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n position: fixed;\n top: var(--gap-0);\n right: var(--gap-12);\n display: flex;\n flex-direction: column;\n}\n\n.component .notification {\n width: calc(100vw - var(--gap-24));\n margin-top: var(--gap-12);\n will-change: transform;\n\n &.withoutMargin {\n margin-top: var(--gap-0);\n }\n}\n\n.component .notification.notification {\n position: static;\n}\n\n
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n position: fixed;\n top: var(--gap-0);\n right: var(--gap-12);\n display: flex;\n flex-direction: column;\n}\n\n.component .notification {\n width: calc(100vw - var(--gap-24));\n margin-top: var(--gap-12);\n will-change: transform;\n\n &.withoutMargin {\n margin-top: var(--gap-0);\n }\n}\n\n.component .notification.notification {\n position: static;\n}\n\n@media (--tablet-s) {\n .component {\n right: var(--gap-48);\n }\n\n .component .notification {\n width: auto;\n }\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,WAAW,CAAC,uCAAuC,CAAC,cAAc,CAAC,0CAA0C,CAAC,eAAe,CAAC,2CAA2C,CAAC;;;;"}
|
package/index.css
CHANGED
|
@@ -7,47 +7,30 @@
|
|
|
7
7
|
--gap-24: var(--gap-xl);
|
|
8
8
|
--gap-48: var(--gap-4xl);
|
|
9
9
|
}
|
|
10
|
-
.notification-
|
|
10
|
+
.notification-manager__component_8dpq7 {
|
|
11
11
|
position: fixed;
|
|
12
12
|
top: var(--gap-0);
|
|
13
13
|
right: var(--gap-12);
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
}
|
|
17
|
-
.notification-
|
|
17
|
+
.notification-manager__component_8dpq7 .notification-manager__notification_8dpq7 {
|
|
18
18
|
width: calc(100vw - var(--gap-24));
|
|
19
19
|
margin-top: var(--gap-12);
|
|
20
20
|
will-change: transform;
|
|
21
21
|
}
|
|
22
|
-
.notification-
|
|
22
|
+
.notification-manager__component_8dpq7 .notification-manager__notification_8dpq7.notification-manager__withoutMargin_8dpq7 {
|
|
23
23
|
margin-top: var(--gap-0);
|
|
24
24
|
}
|
|
25
|
-
.notification-
|
|
25
|
+
.notification-manager__component_8dpq7 .notification-manager__notification_8dpq7.notification-manager__notification_8dpq7 {
|
|
26
26
|
position: static;
|
|
27
27
|
}
|
|
28
|
-
.notification-manager__enter_1an0j {
|
|
29
|
-
visibility: hidden;
|
|
30
|
-
transform: translate(0, -500px);
|
|
31
|
-
}
|
|
32
|
-
.notification-manager__enterActive_1an0j {
|
|
33
|
-
visibility: visible;
|
|
34
|
-
transform: translate(0);
|
|
35
|
-
transition: transform 0.4s ease-out;
|
|
36
|
-
}
|
|
37
28
|
@media (min-width: 600px) {
|
|
38
|
-
.notification-
|
|
29
|
+
.notification-manager__component_8dpq7 {
|
|
39
30
|
right: var(--gap-48);
|
|
40
31
|
}
|
|
41
32
|
|
|
42
|
-
.notification-
|
|
33
|
+
.notification-manager__component_8dpq7 .notification-manager__notification_8dpq7 {
|
|
43
34
|
width: auto;
|
|
44
35
|
}
|
|
45
|
-
|
|
46
|
-
.notification-manager__enter_1an0j {
|
|
47
|
-
transform: translate(100%, 0);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.notification-manager__enterActive_1an0j {
|
|
51
|
-
transform: translate(0);
|
|
52
|
-
}
|
|
53
36
|
}
|
package/index.module.css.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require('./index.css');
|
|
4
4
|
|
|
5
|
-
var styles = {"component":"notification-
|
|
5
|
+
var styles = {"component":"notification-manager__component_8dpq7","notification":"notification-manager__notification_8dpq7","withoutMargin":"notification-manager__withoutMargin_8dpq7"};
|
|
6
6
|
|
|
7
7
|
module.exports = styles;
|
|
8
8
|
//# sourceMappingURL=index.module.css.js.map
|
package/index.module.css.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n position: fixed;\n top: var(--gap-0);\n right: var(--gap-12);\n display: flex;\n flex-direction: column;\n}\n\n.component .notification {\n width: calc(100vw - var(--gap-24));\n margin-top: var(--gap-12);\n will-change: transform;\n\n &.withoutMargin {\n margin-top: var(--gap-0);\n }\n}\n\n.component .notification.notification {\n position: static;\n}\n\n
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n position: fixed;\n top: var(--gap-0);\n right: var(--gap-12);\n display: flex;\n flex-direction: column;\n}\n\n.component .notification {\n width: calc(100vw - var(--gap-24));\n margin-top: var(--gap-12);\n will-change: transform;\n\n &.withoutMargin {\n margin-top: var(--gap-0);\n }\n}\n\n.component .notification.notification {\n position: static;\n}\n\n@media (--tablet-s) {\n .component {\n right: var(--gap-48);\n }\n\n .component .notification {\n width: auto;\n }\n}\n"],"names":[],"mappings":";;;;AAEgB,aAAe,CAAC,WAAW,CAAC,uCAAuC,CAAC,cAAc,CAAC,0CAA0C,CAAC,eAAe,CAAC,2CAA2C,CAAC;;;;"}
|
package/modern/component.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { type HTMLAttributes } from 'react';
|
|
2
2
|
import { type PortalProps } from '@alfalab/core-components-portal/modern';
|
|
3
3
|
import { type NotificationElement } from './components';
|
|
4
|
-
export
|
|
4
|
+
export interface NotificationManagerProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
/**
|
|
6
6
|
* Массив нотификаций.
|
|
7
7
|
* В нотификации обязательно передавайте id.
|
|
@@ -33,37 +33,5 @@ export type NotificationManagerProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
33
33
|
* Контейнер к которому будут добавляться порталы
|
|
34
34
|
*/
|
|
35
35
|
container?: PortalProps['getPortalContainer'];
|
|
36
|
-
}
|
|
37
|
-
export declare const NotificationManager: React.ForwardRefExoticComponent<React.
|
|
38
|
-
/**
|
|
39
|
-
* Массив нотификаций.
|
|
40
|
-
* В нотификации обязательно передавайте id.
|
|
41
|
-
*/
|
|
42
|
-
notifications: NotificationElement[];
|
|
43
|
-
/**
|
|
44
|
-
* Дополнительный класс (native prop)
|
|
45
|
-
*/
|
|
46
|
-
className?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Идентификатор для систем автоматизированного тестирования
|
|
49
|
-
*/
|
|
50
|
-
dataTestId?: string;
|
|
51
|
-
/**
|
|
52
|
-
* z-index компонента
|
|
53
|
-
*/
|
|
54
|
-
zIndex?: number;
|
|
55
|
-
/**
|
|
56
|
-
* Отступ от верхнего края
|
|
57
|
-
*/
|
|
58
|
-
offset?: number;
|
|
59
|
-
/**
|
|
60
|
-
* Удаление нотификации
|
|
61
|
-
*/
|
|
62
|
-
onRemoveNotification: (id: string) => void;
|
|
63
|
-
/**
|
|
64
|
-
* Нода, компонент или функция возвращающая их
|
|
65
|
-
*
|
|
66
|
-
* Контейнер к которому будут добавляться порталы
|
|
67
|
-
*/
|
|
68
|
-
container?: PortalProps["getPortalContainer"];
|
|
69
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
}
|
|
37
|
+
export declare const NotificationManager: React.ForwardRefExoticComponent<NotificationManagerProps & React.RefAttributes<HTMLDivElement>>;
|
package/modern/component.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { forwardRef
|
|
2
|
-
import { TransitionGroup
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { TransitionGroup } from 'react-transition-group';
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import { Portal } from '@alfalab/core-components-portal/modern';
|
|
5
5
|
import { Stack } from '@alfalab/core-components-stack/modern';
|
|
@@ -7,27 +7,15 @@ import { stackingOrder } from '@alfalab/core-components-stack-context/modern';
|
|
|
7
7
|
import { Notification } from './components/notification/component.js';
|
|
8
8
|
import styles from './index.module.css.js';
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const nodeRef = useRef(null);
|
|
20
|
-
return (React.createElement(Stack, { value: zIndex }, (computedZIndex) => (React.createElement(Portal, { getPortalContainer: container },
|
|
21
|
-
React.createElement("div", { className: cn(styles.component, className), ref: ref, "data-test-id": dataTestId, style: {
|
|
22
|
-
zIndex: computedZIndex,
|
|
23
|
-
top: offset,
|
|
24
|
-
...style,
|
|
25
|
-
}, ...restProps },
|
|
26
|
-
React.createElement(TransitionGroup, null, notifications.map((element, index) => (React.createElement(CSSTransition, { key: element.props.id, timeout: TIMEOUT, classNames: CSS_TRANSITION_CLASS_NAMES, unmountOnExit: true, nodeRef: nodeRef },
|
|
27
|
-
React.createElement(Notification, { containerRef: nodeRef, element: element, className: cn(styles.notification, {
|
|
28
|
-
[styles.withoutMargin]: offset && index === 0,
|
|
29
|
-
}), onRemoveNotification: onRemoveNotification }))))))))));
|
|
30
|
-
});
|
|
10
|
+
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 },
|
|
11
|
+
React.createElement("div", { className: cn(styles.component, className), ref: ref, "data-test-id": dataTestId, style: {
|
|
12
|
+
zIndex: computedZIndex,
|
|
13
|
+
top: offset,
|
|
14
|
+
...style,
|
|
15
|
+
}, ...restProps },
|
|
16
|
+
React.createElement(TransitionGroup, null, notifications.map((element, index) => (React.createElement(Notification, { key: element.props.id, element: element, onRemoveNotification: onRemoveNotification, className: cn(styles.notification, {
|
|
17
|
+
[styles.withoutMargin]: offset && index === 0,
|
|
18
|
+
}) }))))))))));
|
|
31
19
|
NotificationManager.displayName = 'NotificationManager';
|
|
32
20
|
|
|
33
21
|
export { NotificationManager };
|
package/modern/component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../src/component.tsx"],"sourcesContent":["import React, { forwardRef, type HTMLAttributes
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../src/component.tsx"],"sourcesContent":["import React, { forwardRef, type HTMLAttributes } from 'react';\nimport { TransitionGroup } from 'react-transition-group';\nimport cn from 'classnames';\n\nimport { Portal, type PortalProps } from '@alfalab/core-components-portal';\nimport { Stack } from '@alfalab/core-components-stack';\nimport { stackingOrder } from '@alfalab/core-components-stack-context';\n\nimport { Notification, type NotificationElement } from './components';\n\nimport styles from './index.module.css';\n\nexport interface NotificationManagerProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Массив нотификаций.\n * В нотификации обязательно передавайте id.\n */\n notifications: NotificationElement[];\n\n /**\n * Дополнительный класс (native prop)\n */\n className?: string;\n\n /**\n * Идентификатор для систем автоматизированного тестирования\n */\n dataTestId?: string;\n\n /**\n * z-index компонента\n */\n zIndex?: number;\n\n /**\n * Отступ от верхнего края\n */\n offset?: number;\n\n /**\n * Удаление нотификации\n */\n onRemoveNotification: (id: string) => void;\n\n /**\n * Нода, компонент или функция возвращающая их\n *\n * Контейнер к которому будут добавляться порталы\n */\n container?: PortalProps['getPortalContainer'];\n}\n\nexport const NotificationManager = forwardRef<HTMLDivElement, NotificationManagerProps>(\n (\n {\n notifications,\n className,\n dataTestId,\n zIndex = stackingOrder.TOAST,\n style = {},\n offset,\n onRemoveNotification,\n container,\n ...restProps\n },\n ref,\n ) => (\n <Stack value={zIndex}>\n {(computedZIndex) => (\n <Portal getPortalContainer={container}>\n <div\n className={cn(styles.component, className)}\n ref={ref}\n data-test-id={dataTestId}\n style={{\n zIndex: computedZIndex,\n top: offset,\n ...style,\n }}\n {...restProps}\n >\n <TransitionGroup>\n {notifications.map((element, index) => (\n <Notification\n key={element.props.id}\n element={element}\n onRemoveNotification={onRemoveNotification}\n className={cn(styles.notification, {\n [styles.withoutMargin]: offset && index === 0,\n })}\n />\n ))}\n </TransitionGroup>\n </div>\n </Portal>\n )}\n </Stack>\n ),\n);\n\nNotificationManager.displayName = 'NotificationManager';\n"],"names":[],"mappings":";;;;;;;;;AAoDa,MAAA,mBAAmB,GAAG,UAAU,CACzC,CACI,EACI,aAAa,EACb,SAAS,EACT,UAAU,EACV,MAAM,GAAG,aAAa,CAAC,KAAK,EAC5B,KAAK,GAAG,EAAE,EACV,MAAM,EACN,oBAAoB,EACpB,SAAS,EACT,GAAG,SAAS,EACf,EACD,GAAG,MAEH,KAAC,CAAA,aAAA,CAAA,KAAK,EAAC,EAAA,KAAK,EAAE,MAAM,EACf,EAAA,CAAC,cAAc,MACZ,KAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,kBAAkB,EAAE,SAAS,EAAA;AACjC,IAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,EAC1C,GAAG,EAAE,GAAG,kBACM,UAAU,EACxB,KAAK,EAAE;AACH,YAAA,MAAM,EAAE,cAAc;AACtB,YAAA,GAAG,EAAE,MAAM;AACX,YAAA,GAAG,KAAK;AACX,SAAA,EAAA,GACG,SAAS,EAAA;AAEb,QAAA,KAAA,CAAA,aAAA,CAAC,eAAe,EACX,IAAA,EAAA,aAAa,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,MAC9B,oBAAC,YAAY,EAAA,EACT,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EACrB,OAAO,EAAE,OAAO,EAChB,oBAAoB,EAAE,oBAAoB,EAC1C,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE;gBAC/B,CAAC,MAAM,CAAC,aAAa,GAAG,MAAM,IAAI,KAAK,KAAK,CAAC;aAChD,CAAC,EAAA,CACJ,CACL,CAAC,CACY,CAChB,CACD,CACZ,CACG,CACX;AAGL,mBAAmB,CAAC,WAAW,GAAG,qBAAqB;;;;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { type FC, type ReactElement
|
|
1
|
+
import { type FC, type ReactElement } from 'react';
|
|
2
|
+
import { type CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
2
3
|
import { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification/modern';
|
|
3
4
|
export type NotificationElement = ReactElement<CoreNotificationProps & {
|
|
4
5
|
id: string;
|
|
5
6
|
}>;
|
|
6
|
-
type
|
|
7
|
+
type NotificationTransitionProps = Partial<Pick<CSSTransitionProps<HTMLDivElement>, 'in' | 'onExited' | 'appear' | 'enter' | 'exit'>>;
|
|
8
|
+
interface NotificationProps extends NotificationTransitionProps {
|
|
7
9
|
element: NotificationElement;
|
|
8
10
|
className: string;
|
|
9
11
|
onRemoveNotification: (id: string) => void;
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
+
}
|
|
12
13
|
export declare const Notification: FC<NotificationProps>;
|
|
13
14
|
export {};
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
import { useCallback, useMemo, cloneElement } from 'react';
|
|
1
|
+
import React, { useRef, useCallback, useMemo, cloneElement } from 'react';
|
|
2
|
+
import { CSSTransition } from 'react-transition-group';
|
|
2
3
|
import cn from 'classnames';
|
|
4
|
+
import styles from './index.module.css.js';
|
|
3
5
|
|
|
4
|
-
const
|
|
6
|
+
const TIMEOUT = {
|
|
7
|
+
exit: 0,
|
|
8
|
+
enter: 400,
|
|
9
|
+
};
|
|
10
|
+
const CSS_TRANSITION_CLASS_NAMES = {
|
|
11
|
+
enter: styles.enter,
|
|
12
|
+
enterActive: styles.enterActive,
|
|
13
|
+
};
|
|
14
|
+
const Notification = ({ in: inProp, onExited, appear, enter, exit, element, className, onRemoveNotification, }) => {
|
|
15
|
+
const nodeRef = useRef(null);
|
|
5
16
|
const { onClose, onCloseTimeout } = element.props;
|
|
6
17
|
const handleClose = useCallback(() => {
|
|
7
18
|
if (onClose) {
|
|
@@ -23,11 +34,11 @@ const Notification = ({ element, className, onRemoveNotification, containerRef,
|
|
|
23
34
|
offset: 0,
|
|
24
35
|
onClose: handleClose,
|
|
25
36
|
onCloseTimeout: handleCloseTimeout,
|
|
26
|
-
containerRef,
|
|
37
|
+
containerRef: nodeRef,
|
|
27
38
|
}),
|
|
28
39
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
|
-
[element, handleClose, handleCloseTimeout,
|
|
30
|
-
return cloneElement(element, notificationProps);
|
|
40
|
+
[element, handleClose, handleCloseTimeout, className]);
|
|
41
|
+
return (React.createElement(CSSTransition, { in: inProp, onExited: onExited, appear: appear, enter: enter, exit: exit, timeout: TIMEOUT, classNames: CSS_TRANSITION_CLASS_NAMES, unmountOnExit: true, nodeRef: nodeRef }, cloneElement(element, notificationProps)));
|
|
31
42
|
};
|
|
32
43
|
|
|
33
44
|
export { Notification };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/notification/component.
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/notification/component.tsx"],"sourcesContent":["import React, {\n cloneElement,\n type FC,\n type ReactElement,\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport { CSSTransition } from 'react-transition-group';\nimport { type CSSTransitionProps } from 'react-transition-group/CSSTransition';\nimport cn from 'classnames';\n\nimport { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';\n\nimport styles from './index.module.css';\n\nexport type NotificationElement = ReactElement<CoreNotificationProps & { id: string }>;\n\nconst TIMEOUT = {\n exit: 0,\n enter: 400,\n};\n\nconst CSS_TRANSITION_CLASS_NAMES = {\n enter: styles.enter,\n enterActive: styles.enterActive,\n};\n\ntype NotificationTransitionProps = Partial<\n Pick<CSSTransitionProps<HTMLDivElement>, 'in' | 'onExited' | 'appear' | 'enter' | 'exit'>\n>;\n\ninterface NotificationProps extends NotificationTransitionProps {\n element: NotificationElement;\n className: string;\n onRemoveNotification: (id: string) => void;\n}\n\nexport const Notification: FC<NotificationProps> = ({\n in: inProp,\n onExited,\n appear,\n enter,\n exit,\n element,\n className,\n onRemoveNotification,\n}) => {\n const nodeRef = useRef<HTMLDivElement>(null);\n const { onClose, onCloseTimeout } = element.props;\n\n const handleClose = useCallback(() => {\n if (onClose) {\n onClose();\n }\n\n onRemoveNotification(element.props.id);\n }, [onClose, onRemoveNotification, element.props.id]);\n\n const handleCloseTimeout = useCallback(() => {\n if (onCloseTimeout) {\n onCloseTimeout();\n }\n\n onRemoveNotification(element.props.id);\n }, [element.props.id, onCloseTimeout, onRemoveNotification]);\n\n const notificationProps = useMemo<CoreNotificationProps>(\n () => ({\n ...element.props,\n visible: true,\n className: cn(className, element.props.className),\n usePortal: false,\n offset: 0,\n onClose: handleClose,\n onCloseTimeout: handleCloseTimeout,\n containerRef: nodeRef,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, handleClose, handleCloseTimeout, className],\n );\n\n return (\n <CSSTransition<HTMLDivElement>\n in={inProp}\n onExited={onExited}\n appear={appear}\n enter={enter}\n exit={exit}\n timeout={TIMEOUT}\n classNames={CSS_TRANSITION_CLASS_NAMES}\n unmountOnExit={true}\n nodeRef={nodeRef}\n >\n {cloneElement(element, notificationProps)}\n </CSSTransition>\n );\n};\n"],"names":[],"mappings":";;;;;AAkBA,MAAM,OAAO,GAAG;AACZ,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,KAAK,EAAE,GAAG;CACb;AAED,MAAM,0BAA0B,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;IACnB,WAAW,EAAE,MAAM,CAAC,WAAW;CAClC;AAYY,MAAA,YAAY,GAA0B,CAAC,EAChD,EAAE,EAAE,MAAM,EACV,QAAQ,EACR,MAAM,EACN,KAAK,EACL,IAAI,EACJ,OAAO,EACP,SAAS,EACT,oBAAoB,GACvB,KAAI;AACD,IAAA,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC;IAC5C,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,KAAK;AAEjD,IAAA,MAAM,WAAW,GAAG,WAAW,CAAC,MAAK;QACjC,IAAI,OAAO,EAAE;AACT,YAAA,OAAO,EAAE;;AAGb,QAAA,oBAAoB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1C,KAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAErD,IAAA,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAK;QACxC,IAAI,cAAc,EAAE;AAChB,YAAA,cAAc,EAAE;;AAGpB,QAAA,oBAAoB,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;AAC1C,KAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,cAAc,EAAE,oBAAoB,CAAC,CAAC;AAE5D,IAAA,MAAM,iBAAiB,GAAG,OAAO,CAC7B,OAAO;QACH,GAAG,OAAO,CAAC,KAAK;AAChB,QAAA,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;AACjD,QAAA,SAAS,EAAE,KAAK;AAChB,QAAA,MAAM,EAAE,CAAC;AACT,QAAA,OAAO,EAAE,WAAW;AACpB,QAAA,cAAc,EAAE,kBAAkB;AAClC,QAAA,YAAY,EAAE,OAAO;KACxB,CAAC;;IAEF,CAAC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,SAAS,CAAC,CACxD;IAED,QACI,oBAAC,aAAa,EAAA,EACV,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,0BAA0B,EACtC,aAAa,EAAE,IAAI,EACnB,OAAO,EAAE,OAAO,EAAA,EAEf,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAC7B;AAExB;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.notification-manager__enter_4ws0s {
|
|
2
|
+
visibility: hidden;
|
|
3
|
+
transform: translate(0, -500px);
|
|
4
|
+
}
|
|
5
|
+
.notification-manager__enterActive_4ws0s {
|
|
6
|
+
visibility: visible;
|
|
7
|
+
transform: translate(0);
|
|
8
|
+
transition: transform 0.4s ease-out;
|
|
9
|
+
}
|
|
10
|
+
@media (min-width: 600px) {
|
|
11
|
+
.notification-manager__enter_4ws0s {
|
|
12
|
+
transform: translate(100%, 0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.notification-manager__enterActive_4ws0s {
|
|
16
|
+
transform: translate(0);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/notification/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.enter {\n visibility: hidden;\n transform: translate(0, -500px);\n}\n\n.enterActive {\n visibility: visible;\n transform: translate(0);\n transition: transform 0.4s ease-out;\n}\n\n@media (--tablet-s) {\n .enter {\n transform: translate(100%, 0);\n }\n\n .enterActive {\n transform: translate(0);\n }\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,OAAO,CAAC,mCAAmC,CAAC,aAAa,CAAC,yCAAyC,CAAC;;;;"}
|
package/modern/index.css
CHANGED
|
@@ -7,47 +7,30 @@
|
|
|
7
7
|
--gap-24: var(--gap-xl);
|
|
8
8
|
--gap-48: var(--gap-4xl);
|
|
9
9
|
}
|
|
10
|
-
.notification-
|
|
10
|
+
.notification-manager__component_8dpq7 {
|
|
11
11
|
position: fixed;
|
|
12
12
|
top: var(--gap-0);
|
|
13
13
|
right: var(--gap-12);
|
|
14
14
|
display: flex;
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
}
|
|
17
|
-
.notification-
|
|
17
|
+
.notification-manager__component_8dpq7 .notification-manager__notification_8dpq7 {
|
|
18
18
|
width: calc(100vw - var(--gap-24));
|
|
19
19
|
margin-top: var(--gap-12);
|
|
20
20
|
will-change: transform;
|
|
21
21
|
}
|
|
22
|
-
.notification-
|
|
22
|
+
.notification-manager__component_8dpq7 .notification-manager__notification_8dpq7.notification-manager__withoutMargin_8dpq7 {
|
|
23
23
|
margin-top: var(--gap-0);
|
|
24
24
|
}
|
|
25
|
-
.notification-
|
|
25
|
+
.notification-manager__component_8dpq7 .notification-manager__notification_8dpq7.notification-manager__notification_8dpq7 {
|
|
26
26
|
position: static;
|
|
27
27
|
}
|
|
28
|
-
.notification-manager__enter_1an0j {
|
|
29
|
-
visibility: hidden;
|
|
30
|
-
transform: translate(0, -500px);
|
|
31
|
-
}
|
|
32
|
-
.notification-manager__enterActive_1an0j {
|
|
33
|
-
visibility: visible;
|
|
34
|
-
transform: translate(0);
|
|
35
|
-
transition: transform 0.4s ease-out;
|
|
36
|
-
}
|
|
37
28
|
@media (min-width: 600px) {
|
|
38
|
-
.notification-
|
|
29
|
+
.notification-manager__component_8dpq7 {
|
|
39
30
|
right: var(--gap-48);
|
|
40
31
|
}
|
|
41
32
|
|
|
42
|
-
.notification-
|
|
33
|
+
.notification-manager__component_8dpq7 .notification-manager__notification_8dpq7 {
|
|
43
34
|
width: auto;
|
|
44
35
|
}
|
|
45
|
-
|
|
46
|
-
.notification-manager__enter_1an0j {
|
|
47
|
-
transform: translate(100%, 0);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.notification-manager__enterActive_1an0j {
|
|
51
|
-
transform: translate(0);
|
|
52
|
-
}
|
|
53
36
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"component":"notification-
|
|
3
|
+
const styles = {"component":"notification-manager__component_8dpq7","notification":"notification-manager__notification_8dpq7","withoutMargin":"notification-manager__withoutMargin_8dpq7"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n position: fixed;\n top: var(--gap-0);\n right: var(--gap-12);\n display: flex;\n flex-direction: column;\n}\n\n.component .notification {\n width: calc(100vw - var(--gap-24));\n margin-top: var(--gap-12);\n will-change: transform;\n\n &.withoutMargin {\n margin-top: var(--gap-0);\n }\n}\n\n.component .notification.notification {\n position: static;\n}\n\n
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.component {\n position: fixed;\n top: var(--gap-0);\n right: var(--gap-12);\n display: flex;\n flex-direction: column;\n}\n\n.component .notification {\n width: calc(100vw - var(--gap-24));\n margin-top: var(--gap-12);\n will-change: transform;\n\n &.withoutMargin {\n margin-top: var(--gap-0);\n }\n}\n\n.component .notification.notification {\n position: static;\n}\n\n@media (--tablet-s) {\n .component {\n right: var(--gap-48);\n }\n\n .component .notification {\n width: auto;\n }\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,WAAW,CAAC,uCAAuC,CAAC,cAAc,CAAC,0CAA0C,CAAC,eAAe,CAAC,2CAA2C,CAAC;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { type HTMLAttributes } from 'react';
|
|
2
2
|
import { type PortalProps } from '@alfalab/core-components-portal/moderncssm';
|
|
3
3
|
import { type NotificationElement } from './components';
|
|
4
|
-
export
|
|
4
|
+
export interface NotificationManagerProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
/**
|
|
6
6
|
* Массив нотификаций.
|
|
7
7
|
* В нотификации обязательно передавайте id.
|
|
@@ -33,37 +33,5 @@ export type NotificationManagerProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
33
33
|
* Контейнер к которому будут добавляться порталы
|
|
34
34
|
*/
|
|
35
35
|
container?: PortalProps['getPortalContainer'];
|
|
36
|
-
}
|
|
37
|
-
export declare const NotificationManager: React.ForwardRefExoticComponent<React.
|
|
38
|
-
/**
|
|
39
|
-
* Массив нотификаций.
|
|
40
|
-
* В нотификации обязательно передавайте id.
|
|
41
|
-
*/
|
|
42
|
-
notifications: NotificationElement[];
|
|
43
|
-
/**
|
|
44
|
-
* Дополнительный класс (native prop)
|
|
45
|
-
*/
|
|
46
|
-
className?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Идентификатор для систем автоматизированного тестирования
|
|
49
|
-
*/
|
|
50
|
-
dataTestId?: string;
|
|
51
|
-
/**
|
|
52
|
-
* z-index компонента
|
|
53
|
-
*/
|
|
54
|
-
zIndex?: number;
|
|
55
|
-
/**
|
|
56
|
-
* Отступ от верхнего края
|
|
57
|
-
*/
|
|
58
|
-
offset?: number;
|
|
59
|
-
/**
|
|
60
|
-
* Удаление нотификации
|
|
61
|
-
*/
|
|
62
|
-
onRemoveNotification: (id: string) => void;
|
|
63
|
-
/**
|
|
64
|
-
* Нода, компонент или функция возвращающая их
|
|
65
|
-
*
|
|
66
|
-
* Контейнер к которому будут добавляться порталы
|
|
67
|
-
*/
|
|
68
|
-
container?: PortalProps["getPortalContainer"];
|
|
69
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
}
|
|
37
|
+
export declare const NotificationManager: React.ForwardRefExoticComponent<NotificationManagerProps & React.RefAttributes<HTMLDivElement>>;
|