@alfalab/core-components-notification-manager 7.0.3 → 7.0.4
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 +6 -6
- package/components/notification/component.d.ts +2 -2
- package/components/notification/component.js.map +1 -1
- package/cssm/component.d.ts +6 -6
- package/cssm/components/notification/component.d.ts +2 -2
- package/cssm/components/notification/component.js.map +1 -1
- package/esm/component.d.ts +6 -6
- package/esm/components/notification/component.d.ts +2 -2
- package/esm/components/notification/component.js.map +1 -1
- package/esm/index.css +10 -10
- package/esm/index.module.css.js +1 -1
- package/esm/index.module.css.js.map +1 -1
- package/index.css +10 -10
- package/index.module.css.js +1 -1
- package/index.module.css.js.map +1 -1
- package/modern/component.d.ts +6 -6
- package/modern/components/notification/component.d.ts +2 -2
- package/modern/components/notification/component.js.map +1 -1
- package/modern/index.css +10 -10
- package/modern/index.module.css.js +1 -1
- package/modern/index.module.css.js.map +1 -1
- package/moderncssm/component.d.ts +6 -6
- package/moderncssm/components/notification/component.d.ts +2 -2
- package/moderncssm/components/notification/component.js.map +1 -1
- package/package.json +3 -3
- package/src/index.module.css +1 -1
package/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';
|
|
3
3
|
import { type NotificationElement } from './components';
|
|
4
|
-
export
|
|
4
|
+
export type NotificationManagerProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
5
|
/**
|
|
6
6
|
* Массив нотификаций.
|
|
7
7
|
* В нотификации обязательно передавайте id.
|
|
@@ -43,19 +43,19 @@ export declare const NotificationManager: React.ForwardRefExoticComponent<React.
|
|
|
43
43
|
/**
|
|
44
44
|
* Дополнительный класс (native prop)
|
|
45
45
|
*/
|
|
46
|
-
className?: string
|
|
46
|
+
className?: string;
|
|
47
47
|
/**
|
|
48
48
|
* Идентификатор для систем автоматизированного тестирования
|
|
49
49
|
*/
|
|
50
|
-
dataTestId?: string
|
|
50
|
+
dataTestId?: string;
|
|
51
51
|
/**
|
|
52
52
|
* z-index компонента
|
|
53
53
|
*/
|
|
54
|
-
zIndex?: number
|
|
54
|
+
zIndex?: number;
|
|
55
55
|
/**
|
|
56
56
|
* Отступ от верхнего края
|
|
57
57
|
*/
|
|
58
|
-
offset?: number
|
|
58
|
+
offset?: number;
|
|
59
59
|
/**
|
|
60
60
|
* Удаление нотификации
|
|
61
61
|
*/
|
|
@@ -65,5 +65,5 @@ export declare const NotificationManager: React.ForwardRefExoticComponent<React.
|
|
|
65
65
|
*
|
|
66
66
|
* Контейнер к которому будут добавляться порталы
|
|
67
67
|
*/
|
|
68
|
-
container?: PortalProps[
|
|
68
|
+
container?: PortalProps["getPortalContainer"];
|
|
69
69
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type FC, type ReactElement, type RefObject } from 'react';
|
|
2
2
|
import { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';
|
|
3
|
-
export
|
|
3
|
+
export type NotificationElement = ReactElement<CoreNotificationProps & {
|
|
4
4
|
id: string;
|
|
5
5
|
}>;
|
|
6
|
-
|
|
6
|
+
type NotificationProps = {
|
|
7
7
|
element: NotificationElement;
|
|
8
8
|
className: string;
|
|
9
9
|
onRemoveNotification: (id: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../src/components/notification/component.ts"],"sourcesContent":["import {\n cloneElement,\n type FC,\n type ReactElement,\n type RefObject,\n useCallback,\n useMemo,\n} from 'react';\nimport cn from 'classnames';\n\nimport { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';\n\nexport type NotificationElement = ReactElement<CoreNotificationProps & { id: string }>;\n\ntype NotificationProps = {\n element: NotificationElement;\n className: string;\n onRemoveNotification: (id: string) => void;\n containerRef: RefObject<HTMLDivElement>;\n};\n\nexport const Notification: FC<NotificationProps> = ({\n element,\n className,\n onRemoveNotification,\n containerRef,\n}) => {\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,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, handleClose, handleCloseTimeout, containerRef],\n );\n\n return cloneElement(element, notificationProps);\n};\n"],"names":["useCallback","useMemo","__assign","cn","cloneElement"],"mappings":";;;;;;;;;;;;AAqBO,IAAM,YAAY,GAA0B,UAAC,EAKnD,EAAA;QAJG,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,oBAAoB,GAAA,EAAA,CAAA,oBAAA,EACpB,YAAY,GAAA,EAAA,CAAA,YAAA;IAEN,IAAA,EAAA,GAA8B,OAAO,CAAC,KAAK,EAAzC,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,cAAc,GAAA,EAAA,CAAA,cAAkB;IAEjD,IAAM,WAAW,GAAGA,iBAAW,CAAC,YAAA;
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../src/components/notification/component.ts"],"sourcesContent":["import {\n cloneElement,\n type FC,\n type ReactElement,\n type RefObject,\n useCallback,\n useMemo,\n} from 'react';\nimport cn from 'classnames';\n\nimport { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';\n\nexport type NotificationElement = ReactElement<CoreNotificationProps & { id: string }>;\n\ntype NotificationProps = {\n element: NotificationElement;\n className: string;\n onRemoveNotification: (id: string) => void;\n containerRef: RefObject<HTMLDivElement>;\n};\n\nexport const Notification: FC<NotificationProps> = ({\n element,\n className,\n onRemoveNotification,\n containerRef,\n}) => {\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,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, handleClose, handleCloseTimeout, containerRef],\n );\n\n return cloneElement(element, notificationProps);\n};\n"],"names":["useCallback","useMemo","__assign","cn","cloneElement"],"mappings":";;;;;;;;;;;;AAqBO,IAAM,YAAY,GAA0B,UAAC,EAKnD,EAAA;QAJG,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,oBAAoB,GAAA,EAAA,CAAA,oBAAA,EACpB,YAAY,GAAA,EAAA,CAAA,YAAA;IAEN,IAAA,EAAA,GAA8B,OAAO,CAAC,KAAK,EAAzC,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,cAAc,GAAA,EAAA,CAAA,cAAkB;IAEjD,IAAM,WAAW,GAAGA,iBAAW,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,GAAGA,iBAAW,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,GAAGC,aAAO,CAC7B,cAAM,QAAAC,cAAA,CAAAA,cAAA,CAAA,EAAA,EACC,OAAO,CAAC,KAAK,CAAA,EAAA,EAChB,OAAO,EAAE,IAAI,EACb,SAAS,EAAEC,mBAAE,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,EAAA,YAAA,EACd,CAAA,EAAA,EAAA;;IAEF,CAAC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,CAAC,CAC3D;AAED,IAAA,OAAOC,kBAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC;AACnD;;;;"}
|
package/cssm/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/cssm';
|
|
3
3
|
import { type NotificationElement } from './components';
|
|
4
|
-
export
|
|
4
|
+
export type NotificationManagerProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
5
|
/**
|
|
6
6
|
* Массив нотификаций.
|
|
7
7
|
* В нотификации обязательно передавайте id.
|
|
@@ -43,19 +43,19 @@ export declare const NotificationManager: React.ForwardRefExoticComponent<React.
|
|
|
43
43
|
/**
|
|
44
44
|
* Дополнительный класс (native prop)
|
|
45
45
|
*/
|
|
46
|
-
className?: string
|
|
46
|
+
className?: string;
|
|
47
47
|
/**
|
|
48
48
|
* Идентификатор для систем автоматизированного тестирования
|
|
49
49
|
*/
|
|
50
|
-
dataTestId?: string
|
|
50
|
+
dataTestId?: string;
|
|
51
51
|
/**
|
|
52
52
|
* z-index компонента
|
|
53
53
|
*/
|
|
54
|
-
zIndex?: number
|
|
54
|
+
zIndex?: number;
|
|
55
55
|
/**
|
|
56
56
|
* Отступ от верхнего края
|
|
57
57
|
*/
|
|
58
|
-
offset?: number
|
|
58
|
+
offset?: number;
|
|
59
59
|
/**
|
|
60
60
|
* Удаление нотификации
|
|
61
61
|
*/
|
|
@@ -65,5 +65,5 @@ export declare const NotificationManager: React.ForwardRefExoticComponent<React.
|
|
|
65
65
|
*
|
|
66
66
|
* Контейнер к которому будут добавляться порталы
|
|
67
67
|
*/
|
|
68
|
-
container?: PortalProps[
|
|
68
|
+
container?: PortalProps["getPortalContainer"];
|
|
69
69
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type FC, type ReactElement, type RefObject } from 'react';
|
|
2
2
|
import { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification/cssm';
|
|
3
|
-
export
|
|
3
|
+
export type NotificationElement = ReactElement<CoreNotificationProps & {
|
|
4
4
|
id: string;
|
|
5
5
|
}>;
|
|
6
|
-
|
|
6
|
+
type NotificationProps = {
|
|
7
7
|
element: NotificationElement;
|
|
8
8
|
className: string;
|
|
9
9
|
onRemoveNotification: (id: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/notification/component.ts"],"sourcesContent":["import {\n cloneElement,\n type FC,\n type ReactElement,\n type RefObject,\n useCallback,\n useMemo,\n} from 'react';\nimport cn from 'classnames';\n\nimport { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';\n\nexport type NotificationElement = ReactElement<CoreNotificationProps & { id: string }>;\n\ntype NotificationProps = {\n element: NotificationElement;\n className: string;\n onRemoveNotification: (id: string) => void;\n containerRef: RefObject<HTMLDivElement>;\n};\n\nexport const Notification: FC<NotificationProps> = ({\n element,\n className,\n onRemoveNotification,\n containerRef,\n}) => {\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,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, handleClose, handleCloseTimeout, containerRef],\n );\n\n return cloneElement(element, notificationProps);\n};\n"],"names":["useCallback","useMemo","__assign","cn","cloneElement"],"mappings":";;;;;;;;;;;;AAqBO,IAAM,YAAY,GAA0B,UAAC,EAKnD,EAAA;QAJG,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,oBAAoB,GAAA,EAAA,CAAA,oBAAA,EACpB,YAAY,GAAA,EAAA,CAAA,YAAA;IAEN,IAAA,EAAA,GAA8B,OAAO,CAAC,KAAK,EAAzC,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,cAAc,GAAA,EAAA,CAAA,cAAkB;IAEjD,IAAM,WAAW,GAAGA,iBAAW,CAAC,YAAA;
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/notification/component.ts"],"sourcesContent":["import {\n cloneElement,\n type FC,\n type ReactElement,\n type RefObject,\n useCallback,\n useMemo,\n} from 'react';\nimport cn from 'classnames';\n\nimport { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';\n\nexport type NotificationElement = ReactElement<CoreNotificationProps & { id: string }>;\n\ntype NotificationProps = {\n element: NotificationElement;\n className: string;\n onRemoveNotification: (id: string) => void;\n containerRef: RefObject<HTMLDivElement>;\n};\n\nexport const Notification: FC<NotificationProps> = ({\n element,\n className,\n onRemoveNotification,\n containerRef,\n}) => {\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,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, handleClose, handleCloseTimeout, containerRef],\n );\n\n return cloneElement(element, notificationProps);\n};\n"],"names":["useCallback","useMemo","__assign","cn","cloneElement"],"mappings":";;;;;;;;;;;;AAqBO,IAAM,YAAY,GAA0B,UAAC,EAKnD,EAAA;QAJG,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,oBAAoB,GAAA,EAAA,CAAA,oBAAA,EACpB,YAAY,GAAA,EAAA,CAAA,YAAA;IAEN,IAAA,EAAA,GAA8B,OAAO,CAAC,KAAK,EAAzC,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,cAAc,GAAA,EAAA,CAAA,cAAkB;IAEjD,IAAM,WAAW,GAAGA,iBAAW,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,GAAGA,iBAAW,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,GAAGC,aAAO,CAC7B,cAAM,QAAAC,cAAA,CAAAA,cAAA,CAAA,EAAA,EACC,OAAO,CAAC,KAAK,CAAA,EAAA,EAChB,OAAO,EAAE,IAAI,EACb,SAAS,EAAEC,mBAAE,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,EAAA,YAAA,EACd,CAAA,EAAA,EAAA;;IAEF,CAAC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,CAAC,CAC3D;AAED,IAAA,OAAOC,kBAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC;AACnD;;;;"}
|
package/esm/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/esm';
|
|
3
3
|
import { type NotificationElement } from './components';
|
|
4
|
-
export
|
|
4
|
+
export type NotificationManagerProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
5
|
/**
|
|
6
6
|
* Массив нотификаций.
|
|
7
7
|
* В нотификации обязательно передавайте id.
|
|
@@ -43,19 +43,19 @@ export declare const NotificationManager: React.ForwardRefExoticComponent<React.
|
|
|
43
43
|
/**
|
|
44
44
|
* Дополнительный класс (native prop)
|
|
45
45
|
*/
|
|
46
|
-
className?: string
|
|
46
|
+
className?: string;
|
|
47
47
|
/**
|
|
48
48
|
* Идентификатор для систем автоматизированного тестирования
|
|
49
49
|
*/
|
|
50
|
-
dataTestId?: string
|
|
50
|
+
dataTestId?: string;
|
|
51
51
|
/**
|
|
52
52
|
* z-index компонента
|
|
53
53
|
*/
|
|
54
|
-
zIndex?: number
|
|
54
|
+
zIndex?: number;
|
|
55
55
|
/**
|
|
56
56
|
* Отступ от верхнего края
|
|
57
57
|
*/
|
|
58
|
-
offset?: number
|
|
58
|
+
offset?: number;
|
|
59
59
|
/**
|
|
60
60
|
* Удаление нотификации
|
|
61
61
|
*/
|
|
@@ -65,5 +65,5 @@ export declare const NotificationManager: React.ForwardRefExoticComponent<React.
|
|
|
65
65
|
*
|
|
66
66
|
* Контейнер к которому будут добавляться порталы
|
|
67
67
|
*/
|
|
68
|
-
container?: PortalProps[
|
|
68
|
+
container?: PortalProps["getPortalContainer"];
|
|
69
69
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type FC, type ReactElement, type RefObject } from 'react';
|
|
2
2
|
import { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification/esm';
|
|
3
|
-
export
|
|
3
|
+
export type NotificationElement = ReactElement<CoreNotificationProps & {
|
|
4
4
|
id: string;
|
|
5
5
|
}>;
|
|
6
|
-
|
|
6
|
+
type NotificationProps = {
|
|
7
7
|
element: NotificationElement;
|
|
8
8
|
className: string;
|
|
9
9
|
onRemoveNotification: (id: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/notification/component.ts"],"sourcesContent":["import {\n cloneElement,\n type FC,\n type ReactElement,\n type RefObject,\n useCallback,\n useMemo,\n} from 'react';\nimport cn from 'classnames';\n\nimport { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';\n\nexport type NotificationElement = ReactElement<CoreNotificationProps & { id: string }>;\n\ntype NotificationProps = {\n element: NotificationElement;\n className: string;\n onRemoveNotification: (id: string) => void;\n containerRef: RefObject<HTMLDivElement>;\n};\n\nexport const Notification: FC<NotificationProps> = ({\n element,\n className,\n onRemoveNotification,\n containerRef,\n}) => {\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,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, handleClose, handleCloseTimeout, containerRef],\n );\n\n return cloneElement(element, notificationProps);\n};\n"],"names":[],"mappings":";;;;AAqBO,IAAM,YAAY,GAA0B,UAAC,EAKnD,EAAA;QAJG,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,oBAAoB,GAAA,EAAA,CAAA,oBAAA,EACpB,YAAY,GAAA,EAAA,CAAA,YAAA;IAEN,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;
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/notification/component.ts"],"sourcesContent":["import {\n cloneElement,\n type FC,\n type ReactElement,\n type RefObject,\n useCallback,\n useMemo,\n} from 'react';\nimport cn from 'classnames';\n\nimport { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';\n\nexport type NotificationElement = ReactElement<CoreNotificationProps & { id: string }>;\n\ntype NotificationProps = {\n element: NotificationElement;\n className: string;\n onRemoveNotification: (id: string) => void;\n containerRef: RefObject<HTMLDivElement>;\n};\n\nexport const Notification: FC<NotificationProps> = ({\n element,\n className,\n onRemoveNotification,\n containerRef,\n}) => {\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,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, handleClose, handleCloseTimeout, containerRef],\n );\n\n return cloneElement(element, notificationProps);\n};\n"],"names":[],"mappings":";;;;AAqBO,IAAM,YAAY,GAA0B,UAAC,EAKnD,EAAA;QAJG,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,oBAAoB,GAAA,EAAA,CAAA,oBAAA,EACpB,YAAY,GAAA,EAAA,CAAA,YAAA;IAEN,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,EAAA,YAAA,EACd,CAAA,EAAA,EAAA;;IAEF,CAAC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,CAAC,CAC3D;AAED,IAAA,OAAO,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC;AACnD;;;;"}
|
package/esm/index.css
CHANGED
|
@@ -7,47 +7,47 @@
|
|
|
7
7
|
--gap-24: var(--gap-xl);
|
|
8
8
|
--gap-48: var(--gap-4xl);
|
|
9
9
|
}
|
|
10
|
-
.notification-
|
|
10
|
+
.notification-manager__component_1an0j {
|
|
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_1an0j .notification-manager__notification_1an0j {
|
|
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_1an0j .notification-manager__notification_1an0j.notification-manager__withoutMargin_1an0j {
|
|
23
23
|
margin-top: var(--gap-0);
|
|
24
24
|
}
|
|
25
|
-
.notification-
|
|
25
|
+
.notification-manager__component_1an0j .notification-manager__notification_1an0j.notification-manager__notification_1an0j {
|
|
26
26
|
position: static;
|
|
27
27
|
}
|
|
28
|
-
.notification-
|
|
28
|
+
.notification-manager__enter_1an0j {
|
|
29
29
|
visibility: hidden;
|
|
30
30
|
transform: translate(0, -500px);
|
|
31
31
|
}
|
|
32
|
-
.notification-
|
|
32
|
+
.notification-manager__enterActive_1an0j {
|
|
33
33
|
visibility: visible;
|
|
34
34
|
transform: translate(0);
|
|
35
35
|
transition: transform 0.4s ease-out;
|
|
36
36
|
}
|
|
37
37
|
@media (min-width: 600px) {
|
|
38
|
-
.notification-
|
|
38
|
+
.notification-manager__component_1an0j {
|
|
39
39
|
right: var(--gap-48);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.notification-
|
|
42
|
+
.notification-manager__component_1an0j .notification-manager__notification_1an0j {
|
|
43
43
|
width: auto;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.notification-
|
|
46
|
+
.notification-manager__enter_1an0j {
|
|
47
47
|
transform: translate(100%, 0);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.notification-
|
|
50
|
+
.notification-manager__enterActive_1an0j {
|
|
51
51
|
transform: translate(0);
|
|
52
52
|
}
|
|
53
53
|
}
|
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_1an0j","notification":"notification-manager__notification_1an0j","withoutMargin":"notification-manager__withoutMargin_1an0j","enter":"notification-manager__enter_1an0j","enterActive":"notification-manager__enterActive_1an0j"};
|
|
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/
|
|
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.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 .component {\n right: var(--gap-48);\n }\n\n .component .notification {\n width: auto;\n }\n\n .enter {\n transform: translate(100%, 0);\n }\n\n .enterActive {\n transform: translate(0);\n }\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,WAAW,CAAC,uCAAuC,CAAC,cAAc,CAAC,0CAA0C,CAAC,eAAe,CAAC,2CAA2C,CAAC,OAAO,CAAC,mCAAmC,CAAC,aAAa,CAAC,yCAAyC,CAAC;;;;"}
|
package/index.css
CHANGED
|
@@ -7,47 +7,47 @@
|
|
|
7
7
|
--gap-24: var(--gap-xl);
|
|
8
8
|
--gap-48: var(--gap-4xl);
|
|
9
9
|
}
|
|
10
|
-
.notification-
|
|
10
|
+
.notification-manager__component_1an0j {
|
|
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_1an0j .notification-manager__notification_1an0j {
|
|
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_1an0j .notification-manager__notification_1an0j.notification-manager__withoutMargin_1an0j {
|
|
23
23
|
margin-top: var(--gap-0);
|
|
24
24
|
}
|
|
25
|
-
.notification-
|
|
25
|
+
.notification-manager__component_1an0j .notification-manager__notification_1an0j.notification-manager__notification_1an0j {
|
|
26
26
|
position: static;
|
|
27
27
|
}
|
|
28
|
-
.notification-
|
|
28
|
+
.notification-manager__enter_1an0j {
|
|
29
29
|
visibility: hidden;
|
|
30
30
|
transform: translate(0, -500px);
|
|
31
31
|
}
|
|
32
|
-
.notification-
|
|
32
|
+
.notification-manager__enterActive_1an0j {
|
|
33
33
|
visibility: visible;
|
|
34
34
|
transform: translate(0);
|
|
35
35
|
transition: transform 0.4s ease-out;
|
|
36
36
|
}
|
|
37
37
|
@media (min-width: 600px) {
|
|
38
|
-
.notification-
|
|
38
|
+
.notification-manager__component_1an0j {
|
|
39
39
|
right: var(--gap-48);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.notification-
|
|
42
|
+
.notification-manager__component_1an0j .notification-manager__notification_1an0j {
|
|
43
43
|
width: auto;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.notification-
|
|
46
|
+
.notification-manager__enter_1an0j {
|
|
47
47
|
transform: translate(100%, 0);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.notification-
|
|
50
|
+
.notification-manager__enterActive_1an0j {
|
|
51
51
|
transform: translate(0);
|
|
52
52
|
}
|
|
53
53
|
}
|
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_1an0j","notification":"notification-manager__notification_1an0j","withoutMargin":"notification-manager__withoutMargin_1an0j","enter":"notification-manager__enter_1an0j","enterActive":"notification-manager__enterActive_1an0j"};
|
|
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/
|
|
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.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 .component {\n right: var(--gap-48);\n }\n\n .component .notification {\n width: auto;\n }\n\n .enter {\n transform: translate(100%, 0);\n }\n\n .enterActive {\n transform: translate(0);\n }\n}\n"],"names":[],"mappings":";;;;AAEgB,aAAe,CAAC,WAAW,CAAC,uCAAuC,CAAC,cAAc,CAAC,0CAA0C,CAAC,eAAe,CAAC,2CAA2C,CAAC,OAAO,CAAC,mCAAmC,CAAC,aAAa,CAAC,yCAAyC,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 type NotificationManagerProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
5
|
/**
|
|
6
6
|
* Массив нотификаций.
|
|
7
7
|
* В нотификации обязательно передавайте id.
|
|
@@ -43,19 +43,19 @@ export declare const NotificationManager: React.ForwardRefExoticComponent<React.
|
|
|
43
43
|
/**
|
|
44
44
|
* Дополнительный класс (native prop)
|
|
45
45
|
*/
|
|
46
|
-
className?: string
|
|
46
|
+
className?: string;
|
|
47
47
|
/**
|
|
48
48
|
* Идентификатор для систем автоматизированного тестирования
|
|
49
49
|
*/
|
|
50
|
-
dataTestId?: string
|
|
50
|
+
dataTestId?: string;
|
|
51
51
|
/**
|
|
52
52
|
* z-index компонента
|
|
53
53
|
*/
|
|
54
|
-
zIndex?: number
|
|
54
|
+
zIndex?: number;
|
|
55
55
|
/**
|
|
56
56
|
* Отступ от верхнего края
|
|
57
57
|
*/
|
|
58
|
-
offset?: number
|
|
58
|
+
offset?: number;
|
|
59
59
|
/**
|
|
60
60
|
* Удаление нотификации
|
|
61
61
|
*/
|
|
@@ -65,5 +65,5 @@ export declare const NotificationManager: React.ForwardRefExoticComponent<React.
|
|
|
65
65
|
*
|
|
66
66
|
* Контейнер к которому будут добавляться порталы
|
|
67
67
|
*/
|
|
68
|
-
container?: PortalProps[
|
|
68
|
+
container?: PortalProps["getPortalContainer"];
|
|
69
69
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type FC, type ReactElement, type RefObject } from 'react';
|
|
2
2
|
import { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification/modern';
|
|
3
|
-
export
|
|
3
|
+
export type NotificationElement = ReactElement<CoreNotificationProps & {
|
|
4
4
|
id: string;
|
|
5
5
|
}>;
|
|
6
|
-
|
|
6
|
+
type NotificationProps = {
|
|
7
7
|
element: NotificationElement;
|
|
8
8
|
className: string;
|
|
9
9
|
onRemoveNotification: (id: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/notification/component.ts"],"sourcesContent":["import {\n cloneElement,\n type FC,\n type ReactElement,\n type RefObject,\n useCallback,\n useMemo,\n} from 'react';\nimport cn from 'classnames';\n\nimport { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';\n\nexport type NotificationElement = ReactElement<CoreNotificationProps & { id: string }>;\n\ntype NotificationProps = {\n element: NotificationElement;\n className: string;\n onRemoveNotification: (id: string) => void;\n containerRef: RefObject<HTMLDivElement>;\n};\n\nexport const Notification: FC<NotificationProps> = ({\n element,\n className,\n onRemoveNotification,\n containerRef,\n}) => {\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,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, handleClose, handleCloseTimeout, containerRef],\n );\n\n return cloneElement(element, notificationProps);\n};\n"],"names":[],"mappings":";;;AAqBO,MAAM,YAAY,GAA0B,CAAC,EAChD,OAAO,EACP,SAAS,EACT,oBAAoB,EACpB,YAAY,GACf,KAAI;IACD,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,KAAK;AAEjD,IAAA,MAAM,WAAW,GAAG,WAAW,CAAC,MAAK;
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/notification/component.ts"],"sourcesContent":["import {\n cloneElement,\n type FC,\n type ReactElement,\n type RefObject,\n useCallback,\n useMemo,\n} from 'react';\nimport cn from 'classnames';\n\nimport { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';\n\nexport type NotificationElement = ReactElement<CoreNotificationProps & { id: string }>;\n\ntype NotificationProps = {\n element: NotificationElement;\n className: string;\n onRemoveNotification: (id: string) => void;\n containerRef: RefObject<HTMLDivElement>;\n};\n\nexport const Notification: FC<NotificationProps> = ({\n element,\n className,\n onRemoveNotification,\n containerRef,\n}) => {\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,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, handleClose, handleCloseTimeout, containerRef],\n );\n\n return cloneElement(element, notificationProps);\n};\n"],"names":[],"mappings":";;;AAqBO,MAAM,YAAY,GAA0B,CAAC,EAChD,OAAO,EACP,SAAS,EACT,oBAAoB,EACpB,YAAY,GACf,KAAI;IACD,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;QAClC,YAAY;KACf,CAAC;;IAEF,CAAC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,CAAC,CAC3D;AAED,IAAA,OAAO,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC;AACnD;;;;"}
|
package/modern/index.css
CHANGED
|
@@ -7,47 +7,47 @@
|
|
|
7
7
|
--gap-24: var(--gap-xl);
|
|
8
8
|
--gap-48: var(--gap-4xl);
|
|
9
9
|
}
|
|
10
|
-
.notification-
|
|
10
|
+
.notification-manager__component_1an0j {
|
|
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_1an0j .notification-manager__notification_1an0j {
|
|
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_1an0j .notification-manager__notification_1an0j.notification-manager__withoutMargin_1an0j {
|
|
23
23
|
margin-top: var(--gap-0);
|
|
24
24
|
}
|
|
25
|
-
.notification-
|
|
25
|
+
.notification-manager__component_1an0j .notification-manager__notification_1an0j.notification-manager__notification_1an0j {
|
|
26
26
|
position: static;
|
|
27
27
|
}
|
|
28
|
-
.notification-
|
|
28
|
+
.notification-manager__enter_1an0j {
|
|
29
29
|
visibility: hidden;
|
|
30
30
|
transform: translate(0, -500px);
|
|
31
31
|
}
|
|
32
|
-
.notification-
|
|
32
|
+
.notification-manager__enterActive_1an0j {
|
|
33
33
|
visibility: visible;
|
|
34
34
|
transform: translate(0);
|
|
35
35
|
transition: transform 0.4s ease-out;
|
|
36
36
|
}
|
|
37
37
|
@media (min-width: 600px) {
|
|
38
|
-
.notification-
|
|
38
|
+
.notification-manager__component_1an0j {
|
|
39
39
|
right: var(--gap-48);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.notification-
|
|
42
|
+
.notification-manager__component_1an0j .notification-manager__notification_1an0j {
|
|
43
43
|
width: auto;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.notification-
|
|
46
|
+
.notification-manager__enter_1an0j {
|
|
47
47
|
transform: translate(100%, 0);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.notification-
|
|
50
|
+
.notification-manager__enterActive_1an0j {
|
|
51
51
|
transform: translate(0);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"component":"notification-
|
|
3
|
+
const styles = {"component":"notification-manager__component_1an0j","notification":"notification-manager__notification_1an0j","withoutMargin":"notification-manager__withoutMargin_1an0j","enter":"notification-manager__enter_1an0j","enterActive":"notification-manager__enterActive_1an0j"};
|
|
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/
|
|
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.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 .component {\n right: var(--gap-48);\n }\n\n .component .notification {\n width: auto;\n }\n\n .enter {\n transform: translate(100%, 0);\n }\n\n .enterActive {\n transform: translate(0);\n }\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,WAAW,CAAC,uCAAuC,CAAC,cAAc,CAAC,0CAA0C,CAAC,eAAe,CAAC,2CAA2C,CAAC,OAAO,CAAC,mCAAmC,CAAC,aAAa,CAAC,yCAAyC,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 type NotificationManagerProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
5
|
/**
|
|
6
6
|
* Массив нотификаций.
|
|
7
7
|
* В нотификации обязательно передавайте id.
|
|
@@ -43,19 +43,19 @@ export declare const NotificationManager: React.ForwardRefExoticComponent<React.
|
|
|
43
43
|
/**
|
|
44
44
|
* Дополнительный класс (native prop)
|
|
45
45
|
*/
|
|
46
|
-
className?: string
|
|
46
|
+
className?: string;
|
|
47
47
|
/**
|
|
48
48
|
* Идентификатор для систем автоматизированного тестирования
|
|
49
49
|
*/
|
|
50
|
-
dataTestId?: string
|
|
50
|
+
dataTestId?: string;
|
|
51
51
|
/**
|
|
52
52
|
* z-index компонента
|
|
53
53
|
*/
|
|
54
|
-
zIndex?: number
|
|
54
|
+
zIndex?: number;
|
|
55
55
|
/**
|
|
56
56
|
* Отступ от верхнего края
|
|
57
57
|
*/
|
|
58
|
-
offset?: number
|
|
58
|
+
offset?: number;
|
|
59
59
|
/**
|
|
60
60
|
* Удаление нотификации
|
|
61
61
|
*/
|
|
@@ -65,5 +65,5 @@ export declare const NotificationManager: React.ForwardRefExoticComponent<React.
|
|
|
65
65
|
*
|
|
66
66
|
* Контейнер к которому будут добавляться порталы
|
|
67
67
|
*/
|
|
68
|
-
container?: PortalProps[
|
|
68
|
+
container?: PortalProps["getPortalContainer"];
|
|
69
69
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type FC, type ReactElement, type RefObject } from 'react';
|
|
2
2
|
import { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification/moderncssm';
|
|
3
|
-
export
|
|
3
|
+
export type NotificationElement = ReactElement<CoreNotificationProps & {
|
|
4
4
|
id: string;
|
|
5
5
|
}>;
|
|
6
|
-
|
|
6
|
+
type NotificationProps = {
|
|
7
7
|
element: NotificationElement;
|
|
8
8
|
className: string;
|
|
9
9
|
onRemoveNotification: (id: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/notification/component.ts"],"sourcesContent":["import {\n cloneElement,\n type FC,\n type ReactElement,\n type RefObject,\n useCallback,\n useMemo,\n} from 'react';\nimport cn from 'classnames';\n\nimport { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';\n\nexport type NotificationElement = ReactElement<CoreNotificationProps & { id: string }>;\n\ntype NotificationProps = {\n element: NotificationElement;\n className: string;\n onRemoveNotification: (id: string) => void;\n containerRef: RefObject<HTMLDivElement>;\n};\n\nexport const Notification: FC<NotificationProps> = ({\n element,\n className,\n onRemoveNotification,\n containerRef,\n}) => {\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,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, handleClose, handleCloseTimeout, containerRef],\n );\n\n return cloneElement(element, notificationProps);\n};\n"],"names":[],"mappings":";;;AAqBO,MAAM,YAAY,GAA0B,CAAC,EAChD,OAAO,EACP,SAAS,EACT,oBAAoB,EACpB,YAAY,GACf,KAAI;IACD,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,KAAK;AAEjD,IAAA,MAAM,WAAW,GAAG,WAAW,CAAC,MAAK;
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/notification/component.ts"],"sourcesContent":["import {\n cloneElement,\n type FC,\n type ReactElement,\n type RefObject,\n useCallback,\n useMemo,\n} from 'react';\nimport cn from 'classnames';\n\nimport { type NotificationProps as CoreNotificationProps } from '@alfalab/core-components-notification';\n\nexport type NotificationElement = ReactElement<CoreNotificationProps & { id: string }>;\n\ntype NotificationProps = {\n element: NotificationElement;\n className: string;\n onRemoveNotification: (id: string) => void;\n containerRef: RefObject<HTMLDivElement>;\n};\n\nexport const Notification: FC<NotificationProps> = ({\n element,\n className,\n onRemoveNotification,\n containerRef,\n}) => {\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,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [element, handleClose, handleCloseTimeout, containerRef],\n );\n\n return cloneElement(element, notificationProps);\n};\n"],"names":[],"mappings":";;;AAqBO,MAAM,YAAY,GAA0B,CAAC,EAChD,OAAO,EACP,SAAS,EACT,oBAAoB,EACpB,YAAY,GACf,KAAI;IACD,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;QAClC,YAAY;KACf,CAAC;;IAEF,CAAC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,YAAY,CAAC,CAC3D;AAED,IAAA,OAAO,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC;AACnD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-notification-manager",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.4",
|
|
4
4
|
"description": "Notification manager",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"main": "index.js",
|
|
11
11
|
"module": "./esm/index.js",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@alfalab/core-components-notification": "^9.0.
|
|
13
|
+
"@alfalab/core-components-notification": "^9.0.4",
|
|
14
14
|
"@alfalab/core-components-portal": "^5.0.1",
|
|
15
15
|
"@alfalab/core-components-stack": "^7.0.1",
|
|
16
16
|
"classnames": "^2.5.1",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"directory": "dist"
|
|
28
28
|
},
|
|
29
29
|
"themesVersion": "15.0.2",
|
|
30
|
-
"varsVersion": "11.0.
|
|
30
|
+
"varsVersion": "11.0.2"
|
|
31
31
|
}
|
package/src/index.module.css
CHANGED