@snack-uikit/alert 0.15.16 → 0.15.17-preview-8b563728.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -58,7 +58,7 @@ import { InfoFilledSVG } from '@snack-uikit/icons';
58
58
  | icon | `boolean` | true | Отображать иконку |
59
59
  | title | `string` | - | Заголовок |
60
60
  | truncate | `{ title?: number; }` | '{ <br>title: 1 }' | Максимальное кол-во строк <br> - `title` - в заголовке |
61
- | link | `Pick<LinkProps, "text" \| "target" \| "onClick" \| "href" \| "appearance">` | - | Cсылка |
61
+ | link | `PickLinkProps<LinkElement, "text" \| "appearance" \| "as">` | - | Cсылка |
62
62
  | onClose | `() => void` | - | Колбек закрытия |
63
63
  | appearance | enum Appearance: `"neutral"`, `"primary"`, `"error"`, `"warning"`, `"success"`, `"info"` | neutral | Внешний вид |
64
64
  | outline | `boolean` | - | Внешний бордер |
@@ -74,7 +74,7 @@ import { InfoFilledSVG } from '@snack-uikit/icons';
74
74
  | icon | `boolean` | true | Отображать иконку |
75
75
  | title | `string` | - | Заголовок |
76
76
  | truncate | `{ title?: number; }` | '{ <br>title: 1 }' | Максимальное кол-во строк <br> - `title` - в заголовке |
77
- | link | `Pick<LinkProps, "text" \| "target" \| "onClick" \| "href" \| "appearance">` | - | Cсылка |
77
+ | link | `PickLinkProps<LinkElement, "text" \| "appearance" \| "as">` | - | Cсылка |
78
78
  | action | `AlertButtonProps` | - | Кнопка дополнительного действия |
79
79
  | onClose | `() => void` | - | Колбек закрытия |
80
80
  | appearance | enum Appearance: `"neutral"`, `"primary"`, `"error"`, `"warning"`, `"success"`, `"info"` | neutral | Внешний вид |
@@ -1,9 +1,9 @@
1
- import { ReactNode } from 'react';
2
- import { LinkProps } from '@snack-uikit/link';
1
+ import { ElementType, ReactNode } from 'react';
2
+ import { PickLinkProps } from '@snack-uikit/link';
3
3
  import { WithSupportProps } from '@snack-uikit/utils';
4
4
  import { AlertButtonProps } from '../../helperComponents';
5
5
  import { Appearance, Size } from '../../types';
6
- export type AlertProps = WithSupportProps<{
6
+ export type AlertProps<LinkElement extends ElementType = 'a'> = WithSupportProps<{
7
7
  /** Отображать иконку */
8
8
  icon?: boolean;
9
9
  /** Заголовок */
@@ -19,7 +19,7 @@ export type AlertProps = WithSupportProps<{
19
19
  /** Описание */
20
20
  description: ReactNode;
21
21
  /** Cсылка */
22
- link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'>;
22
+ link?: PickLinkProps<LinkElement, 'text' | 'appearance' | 'as'>;
23
23
  /** Колбек закрытия */
24
24
  onClose?: () => void;
25
25
  /** Внешний вид */
@@ -39,4 +39,4 @@ export type AlertProps = WithSupportProps<{
39
39
  /**
40
40
  * Компонент для отображения уведомления.
41
41
  */
42
- export declare function Alert({ icon, title, truncate, link, description, onClose, appearance, className, actions, outline, size, ...rest }: AlertProps): import("react/jsx-runtime").JSX.Element;
42
+ export declare function Alert<LinkElement extends ElementType = 'a'>({ icon, title, truncate, link, description, onClose, appearance, className, actions, outline, size, ...rest }: AlertProps<LinkElement>): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,9 @@
1
- import { ReactNode } from 'react';
2
- import { LinkProps } from '@snack-uikit/link';
1
+ import { ElementType, ReactNode } from 'react';
2
+ import { PickLinkProps } from '@snack-uikit/link';
3
3
  import { WithSupportProps } from '@snack-uikit/utils';
4
4
  import { AlertButtonProps } from '../../helperComponents';
5
5
  import { Appearance } from '../../types';
6
- export type AlertTopProps = WithSupportProps<{
6
+ export type AlertTopProps<LinkElement extends ElementType = 'a'> = WithSupportProps<{
7
7
  /** Отображать иконку */
8
8
  icon?: boolean;
9
9
  /** Заголовок */
@@ -19,7 +19,7 @@ export type AlertTopProps = WithSupportProps<{
19
19
  /** Описание */
20
20
  description: ReactNode;
21
21
  /** Cсылка */
22
- link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'>;
22
+ link?: PickLinkProps<LinkElement, 'text' | 'appearance' | 'as'>;
23
23
  /** Кнопка дополнительного действия */
24
24
  action?: AlertButtonProps;
25
25
  /** Колбек закрытия */
@@ -32,4 +32,4 @@ export type AlertTopProps = WithSupportProps<{
32
32
  /**
33
33
  * Компонент для отображения уведомления вверху экрана.
34
34
  */
35
- export declare function AlertTop({ icon, title, description, link, onClose, truncate, appearance, action, className, ...rest }: AlertTopProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare function AlertTop<LinkElement extends ElementType = 'a'>({ icon, title, description, link, onClose, truncate, appearance, action, className, ...rest }: AlertTopProps<LinkElement>): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,9 @@
1
- import { ReactNode } from 'react';
2
- import { LinkProps } from '@snack-uikit/link';
1
+ import { ElementType, ReactNode } from 'react';
2
+ import { PickLinkProps } from '@snack-uikit/link';
3
3
  import { WithSupportProps } from '@snack-uikit/utils';
4
4
  import { AlertButtonProps } from '../../helperComponents';
5
5
  import { Appearance, Size } from '../../types';
6
- export type AlertProps = WithSupportProps<{
6
+ export type AlertProps<LinkElement extends ElementType = 'a'> = WithSupportProps<{
7
7
  /** Отображать иконку */
8
8
  icon?: boolean;
9
9
  /** Заголовок */
@@ -19,7 +19,7 @@ export type AlertProps = WithSupportProps<{
19
19
  /** Описание */
20
20
  description: ReactNode;
21
21
  /** Cсылка */
22
- link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'>;
22
+ link?: PickLinkProps<LinkElement, 'text' | 'appearance' | 'as'>;
23
23
  /** Колбек закрытия */
24
24
  onClose?: () => void;
25
25
  /** Внешний вид */
@@ -39,4 +39,4 @@ export type AlertProps = WithSupportProps<{
39
39
  /**
40
40
  * Компонент для отображения уведомления.
41
41
  */
42
- export declare function Alert({ icon, title, truncate, link, description, onClose, appearance, className, actions, outline, size, ...rest }: AlertProps): import("react/jsx-runtime").JSX.Element;
42
+ export declare function Alert<LinkElement extends ElementType = 'a'>({ icon, title, truncate, link, description, onClose, appearance, className, actions, outline, size, ...rest }: AlertProps<LinkElement>): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,9 @@
1
- import { ReactNode } from 'react';
2
- import { LinkProps } from '@snack-uikit/link';
1
+ import { ElementType, ReactNode } from 'react';
2
+ import { PickLinkProps } from '@snack-uikit/link';
3
3
  import { WithSupportProps } from '@snack-uikit/utils';
4
4
  import { AlertButtonProps } from '../../helperComponents';
5
5
  import { Appearance } from '../../types';
6
- export type AlertTopProps = WithSupportProps<{
6
+ export type AlertTopProps<LinkElement extends ElementType = 'a'> = WithSupportProps<{
7
7
  /** Отображать иконку */
8
8
  icon?: boolean;
9
9
  /** Заголовок */
@@ -19,7 +19,7 @@ export type AlertTopProps = WithSupportProps<{
19
19
  /** Описание */
20
20
  description: ReactNode;
21
21
  /** Cсылка */
22
- link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'>;
22
+ link?: PickLinkProps<LinkElement, 'text' | 'appearance' | 'as'>;
23
23
  /** Кнопка дополнительного действия */
24
24
  action?: AlertButtonProps;
25
25
  /** Колбек закрытия */
@@ -32,4 +32,4 @@ export type AlertTopProps = WithSupportProps<{
32
32
  /**
33
33
  * Компонент для отображения уведомления вверху экрана.
34
34
  */
35
- export declare function AlertTop({ icon, title, description, link, onClose, truncate, appearance, action, className, ...rest }: AlertTopProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare function AlertTop<LinkElement extends ElementType = 'a'>({ icon, title, description, link, onClose, truncate, appearance, action, className, ...rest }: AlertTopProps<LinkElement>): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Alert",
7
- "version": "0.15.16",
7
+ "version": "0.15.17-preview-8b563728.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -37,11 +37,11 @@
37
37
  "scripts": {},
38
38
  "dependencies": {
39
39
  "@snack-uikit/icons": "0.25.1",
40
- "@snack-uikit/link": "0.15.13",
40
+ "@snack-uikit/link": "0.15.14-preview-8b563728.0",
41
41
  "@snack-uikit/loaders": "0.9.2",
42
42
  "@snack-uikit/truncate-string": "0.6.13",
43
43
  "@snack-uikit/utils": "3.8.0",
44
44
  "classnames": "2.5.1"
45
45
  },
46
- "gitHead": "245f761e18557fddf0d10e8277e6b2e2740a81a4"
46
+ "gitHead": "e947e71fe68f89c733683c740a544a4b8c36b66f"
47
47
  }
@@ -1,8 +1,8 @@
1
1
  import cn from 'classnames';
2
- import { ReactNode } from 'react';
2
+ import { ElementType, ReactNode } from 'react';
3
3
 
4
4
  import { CrossSVG } from '@snack-uikit/icons';
5
- import { Link, LinkProps } from '@snack-uikit/link';
5
+ import { Link, PickLinkProps } from '@snack-uikit/link';
6
6
  import { TruncateString } from '@snack-uikit/truncate-string';
7
7
  import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
8
8
 
@@ -12,7 +12,7 @@ import { Appearance, Size } from '../../types';
12
12
  import { getIcon } from '../../utils';
13
13
  import styles from './styles.module.scss';
14
14
 
15
- export type AlertProps = WithSupportProps<{
15
+ export type AlertProps<LinkElement extends ElementType = 'a'> = WithSupportProps<{
16
16
  /** Отображать иконку */
17
17
  icon?: boolean;
18
18
  /** Заголовок */
@@ -28,7 +28,7 @@ export type AlertProps = WithSupportProps<{
28
28
  /** Описание */
29
29
  description: ReactNode;
30
30
  /** Cсылка */
31
- link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'>;
31
+ link?: PickLinkProps<LinkElement, 'text' | 'appearance' | 'as'>;
32
32
  /** Колбек закрытия */
33
33
  onClose?: () => void;
34
34
  /** Внешний вид */
@@ -49,7 +49,7 @@ export type AlertProps = WithSupportProps<{
49
49
  /**
50
50
  * Компонент для отображения уведомления.
51
51
  */
52
- export function Alert({
52
+ export function Alert<LinkElement extends ElementType = 'a'>({
53
53
  icon = true,
54
54
  title,
55
55
  truncate,
@@ -62,7 +62,7 @@ export function Alert({
62
62
  outline,
63
63
  size = 'm',
64
64
  ...rest
65
- }: AlertProps) {
65
+ }: AlertProps<LinkElement>) {
66
66
  return (
67
67
  <div
68
68
  className={cn(
@@ -1,8 +1,8 @@
1
1
  import cn from 'classnames';
2
- import { ReactNode } from 'react';
2
+ import { ElementType, ReactNode } from 'react';
3
3
 
4
4
  import { CrossSVG } from '@snack-uikit/icons';
5
- import { Link, LinkProps } from '@snack-uikit/link';
5
+ import { Link, PickLinkProps } from '@snack-uikit/link';
6
6
  import { TruncateString } from '@snack-uikit/truncate-string';
7
7
  import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
8
8
 
@@ -13,7 +13,7 @@ import { getIcon } from '../../utils';
13
13
  import { APPEARANCE_TO_COLOR_MAP_INVERT } from './constants';
14
14
  import styles from './styles.module.scss';
15
15
 
16
- export type AlertTopProps = WithSupportProps<{
16
+ export type AlertTopProps<LinkElement extends ElementType = 'a'> = WithSupportProps<{
17
17
  /** Отображать иконку */
18
18
  icon?: boolean;
19
19
  /** Заголовок */
@@ -29,7 +29,7 @@ export type AlertTopProps = WithSupportProps<{
29
29
  /** Описание */
30
30
  description: ReactNode;
31
31
  /** Cсылка */
32
- link?: Pick<LinkProps, 'text' | 'target' | 'onClick' | 'href' | 'appearance'>;
32
+ link?: PickLinkProps<LinkElement, 'text' | 'appearance' | 'as'>;
33
33
  /** Кнопка дополнительного действия */
34
34
  action?: AlertButtonProps;
35
35
  /** Колбек закрытия */
@@ -43,7 +43,7 @@ export type AlertTopProps = WithSupportProps<{
43
43
  /**
44
44
  * Компонент для отображения уведомления вверху экрана.
45
45
  */
46
- export function AlertTop({
46
+ export function AlertTop<LinkElement extends ElementType = 'a'>({
47
47
  icon = true,
48
48
  title,
49
49
  description,
@@ -54,7 +54,7 @@ export function AlertTop({
54
54
  action,
55
55
  className,
56
56
  ...rest
57
- }: AlertTopProps) {
57
+ }: AlertTopProps<LinkElement>) {
58
58
  return (
59
59
  <div
60
60
  className={cn(styles.alertTop, className)}
@@ -71,7 +71,6 @@ export function AlertTop({
71
71
  {getIcon(appearance, 24)}
72
72
  </div>
73
73
  )}
74
-
75
74
  <div className={styles.contentLayout}>
76
75
  <div className={styles.textLayout}>
77
76
  {title && (