@snack-uikit/notification 0.10.18 → 0.10.19-preview-20f136a2.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MouseEventHandler, ReactElement, ReactNode } from 'react';
|
|
1
|
+
import { ElementType, MouseEventHandler, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { ButtonSimpleProps, ButtonTonalProps } from '@snack-uikit/button';
|
|
3
|
-
import {
|
|
3
|
+
import { PickLinkProps } from '@snack-uikit/link';
|
|
4
4
|
import { BaseItemProps } from '@snack-uikit/list';
|
|
5
5
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
6
6
|
import { Appearance } from './types';
|
|
@@ -8,7 +8,7 @@ type Action = {
|
|
|
8
8
|
icon?: ReactElement;
|
|
9
9
|
tagLabel?: string;
|
|
10
10
|
} & Pick<BaseItemProps, 'content' | 'onClick' | 'disabled'>;
|
|
11
|
-
export type NotificationCardProps = WithSupportProps<{
|
|
11
|
+
export type NotificationCardProps<LinkElement extends ElementType = 'a'> = WithSupportProps<{
|
|
12
12
|
/** Идентификатор уведомления */
|
|
13
13
|
id: string;
|
|
14
14
|
/** Тип уведомления */
|
|
@@ -22,7 +22,7 @@ export type NotificationCardProps = WithSupportProps<{
|
|
|
22
22
|
/** Контент уведомления */
|
|
23
23
|
content: ReactNode;
|
|
24
24
|
/** Ссылка */
|
|
25
|
-
link?:
|
|
25
|
+
link?: PickLinkProps<LinkElement, 'text' | 'insideText' | 'truncateVariant'>;
|
|
26
26
|
/** Дата уведомления */
|
|
27
27
|
date: string;
|
|
28
28
|
/** Колбэк клика по карточке */
|
|
@@ -39,5 +39,5 @@ export type NotificationCardProps = WithSupportProps<{
|
|
|
39
39
|
className?: string;
|
|
40
40
|
}>;
|
|
41
41
|
/** Компонент карточки уведомления */
|
|
42
|
-
export declare function NotificationCard({ id, appearance, label, unread, title, content, link, date, onClick, primaryButton, secondaryButton, actions, onVisible, className, ...rest }: NotificationCardProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function NotificationCard<LinkElement extends ElementType = 'a'>({ id, appearance, label, unread, title, content, link, date, onClick, primaryButton, secondaryButton, actions, onVisible, className, ...rest }: NotificationCardProps<LinkElement>): import("react/jsx-runtime").JSX.Element;
|
|
43
43
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MouseEventHandler, ReactElement, ReactNode } from 'react';
|
|
1
|
+
import { ElementType, MouseEventHandler, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { ButtonSimpleProps, ButtonTonalProps } from '@snack-uikit/button';
|
|
3
|
-
import {
|
|
3
|
+
import { PickLinkProps } from '@snack-uikit/link';
|
|
4
4
|
import { BaseItemProps } from '@snack-uikit/list';
|
|
5
5
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
6
6
|
import { Appearance } from './types';
|
|
@@ -8,7 +8,7 @@ type Action = {
|
|
|
8
8
|
icon?: ReactElement;
|
|
9
9
|
tagLabel?: string;
|
|
10
10
|
} & Pick<BaseItemProps, 'content' | 'onClick' | 'disabled'>;
|
|
11
|
-
export type NotificationCardProps = WithSupportProps<{
|
|
11
|
+
export type NotificationCardProps<LinkElement extends ElementType = 'a'> = WithSupportProps<{
|
|
12
12
|
/** Идентификатор уведомления */
|
|
13
13
|
id: string;
|
|
14
14
|
/** Тип уведомления */
|
|
@@ -22,7 +22,7 @@ export type NotificationCardProps = WithSupportProps<{
|
|
|
22
22
|
/** Контент уведомления */
|
|
23
23
|
content: ReactNode;
|
|
24
24
|
/** Ссылка */
|
|
25
|
-
link?:
|
|
25
|
+
link?: PickLinkProps<LinkElement, 'text' | 'insideText' | 'truncateVariant'>;
|
|
26
26
|
/** Дата уведомления */
|
|
27
27
|
date: string;
|
|
28
28
|
/** Колбэк клика по карточке */
|
|
@@ -39,5 +39,5 @@ export type NotificationCardProps = WithSupportProps<{
|
|
|
39
39
|
className?: string;
|
|
40
40
|
}>;
|
|
41
41
|
/** Компонент карточки уведомления */
|
|
42
|
-
export declare function NotificationCard({ id, appearance, label, unread, title, content, link, date, onClick, primaryButton, secondaryButton, actions, onVisible, className, ...rest }: NotificationCardProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export declare function NotificationCard<LinkElement extends ElementType = 'a'>({ id, appearance, label, unread, title, content, link, date, onClick, primaryButton, secondaryButton, actions, onVisible, className, ...rest }: NotificationCardProps<LinkElement>): import("react/jsx-runtime").JSX.Element;
|
|
43
43
|
export {};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Notification",
|
|
7
|
-
"version": "0.10.
|
|
7
|
+
"version": "0.10.19-preview-20f136a2.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@snack-uikit/chips": "0.25.3",
|
|
41
41
|
"@snack-uikit/icons": "0.24.2",
|
|
42
42
|
"@snack-uikit/info-block": "0.6.13",
|
|
43
|
-
"@snack-uikit/link": "0.15.
|
|
43
|
+
"@snack-uikit/link": "0.15.10-preview-20f136a2.0",
|
|
44
44
|
"@snack-uikit/list": "0.26.0",
|
|
45
45
|
"@snack-uikit/popover-private": "0.14.5",
|
|
46
46
|
"@snack-uikit/scroll": "0.9.3",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"@snack-uikit/utils": "3.7.0",
|
|
52
52
|
"classnames": "2.5.1"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "2afee22fbba0763ed576dfe784067231c5bc9af5"
|
|
55
55
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
|
-
import { MouseEventHandler, ReactElement, ReactNode, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { ElementType, MouseEventHandler, ReactElement, ReactNode, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { ButtonSimple, ButtonSimpleProps, ButtonTonal, ButtonTonalProps } from '@snack-uikit/button';
|
|
5
|
-
import { Link, LinkProps } from '@snack-uikit/link';
|
|
5
|
+
import { Link, LinkProps, PickLinkProps } from '@snack-uikit/link';
|
|
6
6
|
import { BaseItemProps } from '@snack-uikit/list';
|
|
7
7
|
import { TruncateString } from '@snack-uikit/truncate-string';
|
|
8
8
|
import { Typography } from '@snack-uikit/typography';
|
|
@@ -19,7 +19,7 @@ type Action = {
|
|
|
19
19
|
tagLabel?: string;
|
|
20
20
|
} & Pick<BaseItemProps, 'content' | 'onClick' | 'disabled'>;
|
|
21
21
|
|
|
22
|
-
export type NotificationCardProps = WithSupportProps<{
|
|
22
|
+
export type NotificationCardProps<LinkElement extends ElementType = 'a'> = WithSupportProps<{
|
|
23
23
|
/** Идентификатор уведомления */
|
|
24
24
|
id: string;
|
|
25
25
|
/** Тип уведомления */
|
|
@@ -33,7 +33,7 @@ export type NotificationCardProps = WithSupportProps<{
|
|
|
33
33
|
/** Контент уведомления */
|
|
34
34
|
content: ReactNode;
|
|
35
35
|
/** Ссылка */
|
|
36
|
-
link?:
|
|
36
|
+
link?: PickLinkProps<LinkElement, 'text' | 'insideText' | 'truncateVariant'>;
|
|
37
37
|
/** Дата уведомления */
|
|
38
38
|
date: string;
|
|
39
39
|
/** Колбэк клика по карточке */
|
|
@@ -51,7 +51,7 @@ export type NotificationCardProps = WithSupportProps<{
|
|
|
51
51
|
}>;
|
|
52
52
|
|
|
53
53
|
/** Компонент карточки уведомления */
|
|
54
|
-
export function NotificationCard({
|
|
54
|
+
export function NotificationCard<LinkElement extends ElementType = 'a'>({
|
|
55
55
|
id,
|
|
56
56
|
appearance = APPEARANCE.Neutral,
|
|
57
57
|
label,
|
|
@@ -67,7 +67,7 @@ export function NotificationCard({
|
|
|
67
67
|
onVisible,
|
|
68
68
|
className,
|
|
69
69
|
...rest
|
|
70
|
-
}: NotificationCardProps) {
|
|
70
|
+
}: NotificationCardProps<LinkElement>) {
|
|
71
71
|
const { icon, linkOnColor, buttonAppearance } = useMemo<{
|
|
72
72
|
icon: ReturnType<typeof getIcon>;
|
|
73
73
|
linkOnColor: LinkProps['appearance'];
|