@alfalab/core-components-notification 6.1.26 → 6.2.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/esm/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: 10aat */
1
+ /* hash: 1t2l8 */
2
2
  :root {
3
3
  } /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
4
4
  } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -21,7 +21,7 @@
21
21
  } :root {
22
22
  } :root {
23
23
  --notification-desktop-content-width: 278px;
24
- } .notification__notificationComponent_q8bv2 {
24
+ } .notification__notificationComponent_16r84 {
25
25
  visibility: hidden;
26
26
  position: fixed;
27
27
  right: var(--gap-s);
@@ -32,24 +32,24 @@
32
32
  -webkit-user-select: none;
33
33
  user-select: none;
34
34
  transition: transform 0.4s ease-out
35
- } @media screen and (min-width: 600px) { .notification__notificationComponent_q8bv2 {
35
+ } @media screen and (min-width: 600px) { .notification__notificationComponent_16r84 {
36
36
  right: var(--gap-4xl);
37
37
  width: auto;
38
38
  transform: translate(calc(100% + var(--gap-4xl)), 0)
39
39
  }
40
- } .notification__notificationComponent_q8bv2.notification__isVisible_q8bv2 {
40
+ } .notification__notificationComponent_16r84.notification__isVisible_16r84 {
41
41
  visibility: visible;
42
42
  transform: translate(0, 0);
43
- } .notification__notificationComponent_q8bv2.notification__isClosing_q8bv2 {
43
+ } .notification__notificationComponent_16r84.notification__isClosing_16r84 {
44
44
  transition: transform 0.1s ease-out;
45
45
  transform: translate(100vw, 0)
46
- } @media screen and (min-width: 600px) { .notification__notificationComponent_q8bv2.notification__isClosing_q8bv2 {
46
+ } @media screen and (min-width: 600px) { .notification__notificationComponent_16r84.notification__isClosing_16r84 {
47
47
  transform: translate(calc(100% + var(--gap-4xl)), 0)
48
48
  }
49
- } @media screen and (min-width: 600px) { .notification__toastContent_q8bv2 {
49
+ } @media screen and (min-width: 600px) { .notification__toastContent_16r84 {
50
50
  width: var(--notification-desktop-content-width)
51
51
  }
52
- } .notification__actionSection_q8bv2 {
52
+ } .notification__actionSection_16r84 {
53
53
  min-width: 104px;
54
54
  min-height: 48px;
55
55
  padding: 0 var(--gap-xs);
package/esm/index.js CHANGED
@@ -7,5 +7,5 @@ import 'classnames';
7
7
  import 'element-closest';
8
8
  import '@alfalab/core-components-portal/esm';
9
9
  import '@alfalab/core-components-stack/esm';
10
- import '@alfalab/core-components-toast-plate/esm';
10
+ import '@alfalab/core-components-toast-plate/esm/desktop';
11
11
  import './utils/index.js';
@@ -0,0 +1,95 @@
1
+ import { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, ReactNode } from 'react';
2
+ type StyleColors = {
3
+ default: {
4
+ [key: string]: string;
5
+ };
6
+ inverted: {
7
+ [key: string]: string;
8
+ };
9
+ };
10
+ type ComponentProps = {
11
+ /**
12
+ * Тип кнопки
13
+ * @default secondary
14
+ */
15
+ view?: 'accent' | 'primary' | 'secondary' | 'tertiary' | 'outlined' | 'filled' | 'transparent' | 'link' | 'ghost';
16
+ /**
17
+ * Слот слева
18
+ */
19
+ leftAddons?: ReactNode;
20
+ /**
21
+ * Слот справа
22
+ */
23
+ rightAddons?: ReactNode;
24
+ /**
25
+ * Размер компонента
26
+ * @default m
27
+ */
28
+ size?: 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';
29
+ /**
30
+ * Растягивает компонент на ширину контейнера
31
+ * @default false
32
+ */
33
+ block?: boolean;
34
+ /**
35
+ * Дополнительный класс
36
+ */
37
+ className?: string;
38
+ /**
39
+ * Дополнительный класс для спиннера
40
+ */
41
+ spinnerClassName?: string;
42
+ /**
43
+ * Выводит ссылку в виде кнопки
44
+ */
45
+ href?: string;
46
+ /**
47
+ * Позволяет использовать кастомный компонент для кнопки (например Link из роутера)
48
+ */
49
+ Component?: ElementType;
50
+ /**
51
+ * Идентификатор для систем автоматизированного тестирования
52
+ */
53
+ dataTestId?: string;
54
+ /**
55
+ * Показать лоадер
56
+ * @default false
57
+ */
58
+ loading?: boolean;
59
+ /**
60
+ * Не переносить текст кнопки на новую строку
61
+ * @default false
62
+ */
63
+ nowrap?: boolean;
64
+ /**
65
+ * Набор цветов для компонента
66
+ */
67
+ colors?: 'default' | 'inverted';
68
+ /**
69
+ * Дочерние элементы.
70
+ */
71
+ children?: ReactNode;
72
+ /**
73
+ * Основные стили компонента.
74
+ */
75
+ styles: {
76
+ [key: string]: string;
77
+ };
78
+ /**
79
+ * Стили компонента для default и inverted режима.
80
+ */
81
+ colorStylesMap: StyleColors;
82
+ };
83
+ type AnchorBaseButtonProps = ComponentProps & AnchorHTMLAttributes<HTMLAnchorElement>;
84
+ type NativeBaseButtonProps = ComponentProps & ButtonHTMLAttributes<HTMLButtonElement>;
85
+ type BaseButtonProps = Partial<AnchorBaseButtonProps | NativeBaseButtonProps>;
86
+ type AnchorButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & AnchorHTMLAttributes<HTMLAnchorElement>;
87
+ type NativeButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & ButtonHTMLAttributes<HTMLButtonElement>;
88
+ type ButtonProps = Partial<AnchorButtonProps | NativeButtonProps> & {
89
+ /**
90
+ * Контрольная точка, с нее начинается desktop версия
91
+ * @default 1024
92
+ */
93
+ breakpoint?: number;
94
+ };
95
+ export { StyleColors, ComponentProps, AnchorBaseButtonProps, NativeBaseButtonProps, BaseButtonProps, AnchorButtonProps, NativeButtonProps, ButtonProps };
package/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: 10aat */
1
+ /* hash: 1t2l8 */
2
2
  :root {
3
3
  } /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
4
4
  } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -21,7 +21,7 @@
21
21
  } :root {
22
22
  } :root {
23
23
  --notification-desktop-content-width: 278px;
24
- } .notification__notificationComponent_q8bv2 {
24
+ } .notification__notificationComponent_16r84 {
25
25
  visibility: hidden;
26
26
  position: fixed;
27
27
  right: var(--gap-s);
@@ -32,24 +32,24 @@
32
32
  -webkit-user-select: none;
33
33
  user-select: none;
34
34
  transition: transform 0.4s ease-out
35
- } @media screen and (min-width: 600px) { .notification__notificationComponent_q8bv2 {
35
+ } @media screen and (min-width: 600px) { .notification__notificationComponent_16r84 {
36
36
  right: var(--gap-4xl);
37
37
  width: auto;
38
38
  transform: translate(calc(100% + var(--gap-4xl)), 0)
39
39
  }
40
- } .notification__notificationComponent_q8bv2.notification__isVisible_q8bv2 {
40
+ } .notification__notificationComponent_16r84.notification__isVisible_16r84 {
41
41
  visibility: visible;
42
42
  transform: translate(0, 0);
43
- } .notification__notificationComponent_q8bv2.notification__isClosing_q8bv2 {
43
+ } .notification__notificationComponent_16r84.notification__isClosing_16r84 {
44
44
  transition: transform 0.1s ease-out;
45
45
  transform: translate(100vw, 0)
46
- } @media screen and (min-width: 600px) { .notification__notificationComponent_q8bv2.notification__isClosing_q8bv2 {
46
+ } @media screen and (min-width: 600px) { .notification__notificationComponent_16r84.notification__isClosing_16r84 {
47
47
  transform: translate(calc(100% + var(--gap-4xl)), 0)
48
48
  }
49
- } @media screen and (min-width: 600px) { .notification__toastContent_q8bv2 {
49
+ } @media screen and (min-width: 600px) { .notification__toastContent_16r84 {
50
50
  width: var(--notification-desktop-content-width)
51
51
  }
52
- } .notification__actionSection_q8bv2 {
52
+ } .notification__actionSection_16r84 {
53
53
  min-width: 104px;
54
54
  min-height: 48px;
55
55
  padding: 0 var(--gap-xs);
package/index.js CHANGED
@@ -11,7 +11,7 @@ require('classnames');
11
11
  require('element-closest');
12
12
  require('@alfalab/core-components-portal');
13
13
  require('@alfalab/core-components-stack');
14
- require('@alfalab/core-components-toast-plate');
14
+ require('@alfalab/core-components-toast-plate/desktop');
15
15
  require('./utils/index.js');
16
16
 
17
17
 
@@ -0,0 +1,40 @@
1
+ /// <reference types="react" />
2
+ import React from "react";
3
+ import { FC } from "react";
4
+ import { BaseButtonProps } from "./typings-9211a437";
5
+ type SpinnerProps = {
6
+ /**
7
+ * Управление видимостью компонента
8
+ */
9
+ visible?: boolean;
10
+ /**
11
+ * Размер компонента
12
+ */
13
+ size?: "xs" | "s" | "m";
14
+ /**
15
+ * Дополнительный класс
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Идентификатор компонента в DOM
20
+ */
21
+ id?: string;
22
+ /**
23
+ * Идентификатор для систем автоматизированного тестирования
24
+ */
25
+ dataTestId?: string;
26
+ /**
27
+ * Палитра, в контексте которой используется спиннер
28
+ */
29
+ colors?: "default" | "inverted";
30
+ };
31
+ declare const Spinner: FC<SpinnerProps>;
32
+ declare const isClient: () => boolean;
33
+ declare const getDataTestId: (dataTestId?: string, element?: string) => string | undefined;
34
+ /**
35
+ * Минимальное время отображения лоадера - 500мс,
36
+ * чтобы при быстрых ответах от сервера кнопка не «моргала».
37
+ */
38
+ declare const LOADER_MIN_DISPLAY_INTERVAL = 500;
39
+ declare const BaseButton: React.ForwardRefExoticComponent<BaseButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
40
+ export { SpinnerProps, Spinner, isClient, getDataTestId, LOADER_MIN_DISPLAY_INTERVAL, BaseButton };
@@ -1,8 +1,93 @@
1
1
  /// <reference types="react" />
2
2
  import React from 'react';
3
- import { MouseEvent } from "react";
4
- import { ToastPlateProps } from "@alfalab/core-components-toast-plate";
5
- type NotificationProps = ToastPlateProps & {
3
+ import { MouseEvent, HTMLAttributes, ReactNode } from "react";
4
+ type BadgeIcons = {
5
+ negative: JSX.Element;
6
+ positive: JSX.Element;
7
+ attention: JSX.Element;
8
+ };
9
+ type BaseToastPlateProps = HTMLAttributes<HTMLDivElement> & {
10
+ /**
11
+ * Дополнительный класс
12
+ */
13
+ className?: string;
14
+ /**
15
+ * Дополнительный класс для заголовка
16
+ */
17
+ titleClassName?: string;
18
+ /**
19
+ * Дополнительный класс для контентной области
20
+ */
21
+ contentClassName?: string;
22
+ /**
23
+ * Дополнительный класс для области с кнопкой действия
24
+ */
25
+ actionSectionClassName?: string;
26
+ /**
27
+ * Дочерние элементы
28
+ */
29
+ children?: ReactNode;
30
+ /**
31
+ * Заголовок компонента
32
+ */
33
+ title?: ReactNode;
34
+ /**
35
+ * Вид бэйджа
36
+ */
37
+ badge?: "negative" | "positive" | "attention";
38
+ /**
39
+ * Слот слева, заменяет стандартную иконку
40
+ */
41
+ leftAddons?: ReactNode;
42
+ /**
43
+ * Кнопка действия
44
+ */
45
+ actionButton?: ReactNode;
46
+ /**
47
+ * Идентификатор для систем автоматизированного тестирования
48
+ */
49
+ dataTestId?: string;
50
+ /**
51
+ * Управляет отображением кнопки закрытия уведомления
52
+ */
53
+ hasCloser?: boolean;
54
+ /**
55
+ * Доп. класс враппера кнопки "закрыть".
56
+ */
57
+ closerWrapperClassName?: string;
58
+ /**
59
+ * Доп. класс кнопки "закрыть".
60
+ */
61
+ closerClassName?: string;
62
+ /**
63
+ * Растягивает компонент на ширину контейнера
64
+ */
65
+ block?: boolean;
66
+ /**
67
+ * Обработчик клика по крестику
68
+ */
69
+ onClose?: (event?: MouseEvent<HTMLButtonElement>) => void;
70
+ /**
71
+ * Функция, с помощью которой можно переопределить иконки в Badge
72
+ */
73
+ getBadgeIcons?: (icons: BadgeIcons) => BadgeIcons;
74
+ /**
75
+ * Набор цветов для компонента
76
+ */
77
+ colors?: "default" | "inverted";
78
+ /**
79
+ * Положение кнопки под заголовком компонента
80
+ */
81
+ bottomButtonPosition?: boolean;
82
+ /**
83
+ * Основные стили компонента.
84
+ */
85
+ styles?: {
86
+ [key: string]: string;
87
+ };
88
+ };
89
+ type ToastPlateDesktopProps = Omit<BaseToastPlateProps, "styles" | "bottomButtonPosition">;
90
+ type NotificationProps = ToastPlateDesktopProps & {
6
91
  /**
7
92
  * Управление видимостью компонента
8
93
  */
@@ -40,25 +125,7 @@ type NotificationProps = ToastPlateProps & {
40
125
  */
41
126
  onClickOutside?: (event?: MouseEvent<any>) => void;
42
127
  };
43
- declare const Notification: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
44
- className?: string | undefined;
45
- titleClassName?: string | undefined;
46
- contentClassName?: string | undefined;
47
- actionSectionClassName?: string | undefined;
48
- children?: React.ReactNode;
49
- title?: React.ReactNode;
50
- badge?: "attention" | "positive" | "negative" | undefined;
51
- leftAddons?: React.ReactNode;
52
- actionButton?: React.ReactNode;
53
- dataTestId?: string | undefined;
54
- hasCloser?: boolean | undefined;
55
- closerWrapperClassName?: string | undefined;
56
- closerClassName?: string | undefined;
57
- block?: boolean | undefined;
58
- onClose?: ((event?: React.MouseEvent<HTMLButtonElement, globalThis.MouseEvent> | undefined) => void) | undefined;
59
- getBadgeIcons?: ((icons: import("@alfalab/core-components-toast-plate").BadgeIcons) => import("@alfalab/core-components-toast-plate").BadgeIcons) | undefined;
60
- colors?: "default" | "inverted" | undefined;
61
- } & {
128
+ declare const Notification: React.ForwardRefExoticComponent<ToastPlateDesktopProps & {
62
129
  /**
63
130
  * Управление видимостью компонента
64
131
  */
@@ -5,10 +5,10 @@ import cn from 'classnames';
5
5
  import elementClosest from 'element-closest';
6
6
  import { Portal } from '@alfalab/core-components-portal/modern';
7
7
  import { Stack, stackingOrder } from '@alfalab/core-components-stack/modern';
8
- import { ToastPlate } from '@alfalab/core-components-toast-plate/modern';
8
+ import { ToastPlateDesktop } from '@alfalab/core-components-toast-plate/modern/desktop';
9
9
  import { useClickOutside } from './utils/index.js';
10
10
 
11
- const styles = {"notificationComponent":"notification__notificationComponent_q8bv2","isVisible":"notification__isVisible_q8bv2","isClosing":"notification__isClosing_q8bv2","toastContent":"notification__toastContent_q8bv2","actionSection":"notification__actionSection_q8bv2"};
11
+ const styles = {"notificationComponent":"notification__notificationComponent_16r84","isVisible":"notification__isVisible_16r84","isClosing":"notification__isClosing_16r84","toastContent":"notification__toastContent_16r84","actionSection":"notification__actionSection_16r84"};
12
12
  require('./index.css')
13
13
 
14
14
  const notificationClassNameSelector = `.${styles.notificationComponent}`;
@@ -82,7 +82,7 @@ const Notification = forwardRef(({ className, actionSectionClassName, children,
82
82
  const Wrapper = usePortal ? Portal : Fragment;
83
83
  return (React.createElement(Stack, { value: zIndex }, (computedZIndex) => (React.createElement(Wrapper, null,
84
84
  React.createElement("div", { ...swipeableHandlers },
85
- React.createElement(ToastPlate, { className: cn(styles.notificationComponent, {
85
+ React.createElement(ToastPlateDesktop, { className: cn(styles.notificationComponent, {
86
86
  [styles.isVisible]: visible,
87
87
  [styles.isClosing]: isClosing,
88
88
  }, className), contentClassName: styles.toastContent, actionSectionClassName: cn(actionSectionClassName, styles.actionSection), style: {
package/modern/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: 10aat */
1
+ /* hash: 1t2l8 */
2
2
  :root {
3
3
  } /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
4
4
  } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -21,7 +21,7 @@
21
21
  } :root {
22
22
  } :root {
23
23
  --notification-desktop-content-width: 278px;
24
- } .notification__notificationComponent_q8bv2 {
24
+ } .notification__notificationComponent_16r84 {
25
25
  visibility: hidden;
26
26
  position: fixed;
27
27
  right: var(--gap-s);
@@ -32,24 +32,24 @@
32
32
  -webkit-user-select: none;
33
33
  user-select: none;
34
34
  transition: transform 0.4s ease-out
35
- } @media screen and (min-width: 600px) { .notification__notificationComponent_q8bv2 {
35
+ } @media screen and (min-width: 600px) { .notification__notificationComponent_16r84 {
36
36
  right: var(--gap-4xl);
37
37
  width: auto;
38
38
  transform: translate(calc(100% + var(--gap-4xl)), 0)
39
39
  }
40
- } .notification__notificationComponent_q8bv2.notification__isVisible_q8bv2 {
40
+ } .notification__notificationComponent_16r84.notification__isVisible_16r84 {
41
41
  visibility: visible;
42
42
  transform: translate(0, 0);
43
- } .notification__notificationComponent_q8bv2.notification__isClosing_q8bv2 {
43
+ } .notification__notificationComponent_16r84.notification__isClosing_16r84 {
44
44
  transition: transform 0.1s ease-out;
45
45
  transform: translate(100vw, 0)
46
- } @media screen and (min-width: 600px) { .notification__notificationComponent_q8bv2.notification__isClosing_q8bv2 {
46
+ } @media screen and (min-width: 600px) { .notification__notificationComponent_16r84.notification__isClosing_16r84 {
47
47
  transform: translate(calc(100% + var(--gap-4xl)), 0)
48
48
  }
49
- } @media screen and (min-width: 600px) { .notification__toastContent_q8bv2 {
49
+ } @media screen and (min-width: 600px) { .notification__toastContent_16r84 {
50
50
  width: var(--notification-desktop-content-width)
51
51
  }
52
- } .notification__actionSection_q8bv2 {
52
+ } .notification__actionSection_16r84 {
53
53
  min-width: 104px;
54
54
  min-height: 48px;
55
55
  padding: 0 var(--gap-xs);
package/modern/index.js CHANGED
@@ -6,5 +6,5 @@ import 'classnames';
6
6
  import 'element-closest';
7
7
  import '@alfalab/core-components-portal/modern';
8
8
  import '@alfalab/core-components-stack/modern';
9
- import '@alfalab/core-components-toast-plate/modern';
9
+ import '@alfalab/core-components-toast-plate/modern/desktop';
10
10
  import './utils/index.js';
@@ -0,0 +1,95 @@
1
+ import { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, ReactNode } from 'react';
2
+ type StyleColors = {
3
+ default: {
4
+ [key: string]: string;
5
+ };
6
+ inverted: {
7
+ [key: string]: string;
8
+ };
9
+ };
10
+ type ComponentProps = {
11
+ /**
12
+ * Тип кнопки
13
+ * @default secondary
14
+ */
15
+ view?: 'accent' | 'primary' | 'secondary' | 'tertiary' | 'outlined' | 'filled' | 'transparent' | 'link' | 'ghost';
16
+ /**
17
+ * Слот слева
18
+ */
19
+ leftAddons?: ReactNode;
20
+ /**
21
+ * Слот справа
22
+ */
23
+ rightAddons?: ReactNode;
24
+ /**
25
+ * Размер компонента
26
+ * @default m
27
+ */
28
+ size?: 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';
29
+ /**
30
+ * Растягивает компонент на ширину контейнера
31
+ * @default false
32
+ */
33
+ block?: boolean;
34
+ /**
35
+ * Дополнительный класс
36
+ */
37
+ className?: string;
38
+ /**
39
+ * Дополнительный класс для спиннера
40
+ */
41
+ spinnerClassName?: string;
42
+ /**
43
+ * Выводит ссылку в виде кнопки
44
+ */
45
+ href?: string;
46
+ /**
47
+ * Позволяет использовать кастомный компонент для кнопки (например Link из роутера)
48
+ */
49
+ Component?: ElementType;
50
+ /**
51
+ * Идентификатор для систем автоматизированного тестирования
52
+ */
53
+ dataTestId?: string;
54
+ /**
55
+ * Показать лоадер
56
+ * @default false
57
+ */
58
+ loading?: boolean;
59
+ /**
60
+ * Не переносить текст кнопки на новую строку
61
+ * @default false
62
+ */
63
+ nowrap?: boolean;
64
+ /**
65
+ * Набор цветов для компонента
66
+ */
67
+ colors?: 'default' | 'inverted';
68
+ /**
69
+ * Дочерние элементы.
70
+ */
71
+ children?: ReactNode;
72
+ /**
73
+ * Основные стили компонента.
74
+ */
75
+ styles: {
76
+ [key: string]: string;
77
+ };
78
+ /**
79
+ * Стили компонента для default и inverted режима.
80
+ */
81
+ colorStylesMap: StyleColors;
82
+ };
83
+ type AnchorBaseButtonProps = ComponentProps & AnchorHTMLAttributes<HTMLAnchorElement>;
84
+ type NativeBaseButtonProps = ComponentProps & ButtonHTMLAttributes<HTMLButtonElement>;
85
+ type BaseButtonProps = Partial<AnchorBaseButtonProps | NativeBaseButtonProps>;
86
+ type AnchorButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & AnchorHTMLAttributes<HTMLAnchorElement>;
87
+ type NativeButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & ButtonHTMLAttributes<HTMLButtonElement>;
88
+ type ButtonProps = Partial<AnchorButtonProps | NativeButtonProps> & {
89
+ /**
90
+ * Контрольная точка, с нее начинается desktop версия
91
+ * @default 1024
92
+ */
93
+ breakpoint?: number;
94
+ };
95
+ export { StyleColors, ComponentProps, AnchorBaseButtonProps, NativeBaseButtonProps, BaseButtonProps, AnchorButtonProps, NativeButtonProps, ButtonProps };
package/package.json CHANGED
@@ -1,14 +1,11 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-notification",
3
- "version": "6.1.26",
3
+ "version": "6.2.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
7
7
  "main": "index.js",
8
8
  "module": "./esm/index.js",
9
- "scripts": {
10
- "postinstall": "node -e \"if (require('fs').existsSync('./send-stats.js')){require('./send-stats.js')} \""
11
- },
12
9
  "publishConfig": {
13
10
  "access": "public",
14
11
  "directory": "dist"
@@ -17,9 +14,9 @@
17
14
  "react": "^16.9.0 || ^17.0.1 || ^18.0.0"
18
15
  },
19
16
  "dependencies": {
20
- "@alfalab/core-components-portal": "^3.1.4",
21
- "@alfalab/core-components-stack": "^4.0.4",
22
- "@alfalab/core-components-toast-plate": "^5.1.23",
17
+ "@alfalab/core-components-portal": "^3.2.0",
18
+ "@alfalab/core-components-stack": "^4.1.0",
19
+ "@alfalab/core-components-toast-plate": "^6.0.0",
23
20
  "classnames": "^2.3.1",
24
21
  "element-closest": "^3.0.2",
25
22
  "react-merge-refs": "^1.1.0",