@snack-uikit/notification 0.10.19-preview-9ca6ecbf.0 → 0.10.19

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/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 0.10.19 (2025-03-03)
7
+
8
+ ### Only dependencies have been changed
9
+ * [@snack-uikit/chips@0.25.4](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/chips/CHANGELOG.md)
10
+
11
+
12
+
13
+
14
+
6
15
  ## 0.10.18 (2025-02-25)
7
16
 
8
17
  ### Only dependencies have been changed
package/README.md CHANGED
@@ -81,24 +81,70 @@ const cards = [
81
81
  ### Props
82
82
  | name | type | default value | description |
83
83
  |------|------|---------------|-------------|
84
+ | date* | `string` | - | Дата уведомления |
85
+ | content* | `ReactNode` | - | Контент уведомления |
86
+ | title* | `string` | - | Заголовок уведомления |
87
+ | id* | `string` | - | Идентификатор уведомления |
88
+ | appearance | enum Appearance: `"neutral"`, `"error"`, `"errorCritical"`, `"warning"`, `"success"` | neutral | Тип уведомления |
89
+ | label | `string` | - | Лейбл перед заголовком |
90
+ | unread | `boolean` | - | Управление состоянием прочитано/не прочитано |
91
+ | link | `Omit<LinkProps, "data-test-id" \| "appearance" \| "size" \| "textMode">` | - | Ссылка |
92
+ | onClick | `MouseEventHandler<HTMLDivElement>` | - | Колбэк клика по карточке |
93
+ | onVisible | `(cardId: string) => void` | - | Колбэк при попадании карточки в область видимости на 80% |
94
+ | primaryButton | `Omit<ButtonTonalProps, "data-test-id" \| "appearance" \| "size">` | - | Кнопка главного действия у карточки |
95
+ | secondaryButton | `Omit<ButtonSimpleProps, "data-test-id" \| "appearance" \| "size">` | - | Кнопка второстепенного действия у карточки |
96
+ | actions | `Action[]` | - | Дополнительные действия у карточки |
97
+ | className | `string` | - | CSS-класс |
84
98
  ## NotificationPanel
85
99
  Компонент панели для уведомлений
86
100
  ### Props
87
101
  | name | type | default value | description |
88
102
  |------|------|---------------|-------------|
103
+ | title* | `string` | - | Заголовок панели |
104
+ | settings | `NotificationPanelSettingsProps` | - | Кнопка настроек и выпадающий список |
105
+ | chips | `Omit<ChipToggleProps, "data-test-id" \| "size">[]` | - | Чипы для фильтрации |
106
+ | readAllButton | `Omit<ButtonFunctionProps, "data-test-id"> & { onClick: MouseEventHandler<HTMLElement>; }` | - | Кнопка в "шапке" панели |
107
+ | footerButton | `{ label: string; onClick: MouseEventHandler<HTMLButtonElement>; }` | - | Кнопка внизу панели |
108
+ | className | `string` | - | CSS-класс |
109
+ | loading | `boolean` | - | Состояние загрузки |
110
+ | content | `ReactNode` | - | Контент для отрисовки (e.g NotificationCard \| NotificationPanel.Blank) |
111
+ | skeletonsAmount | `number` | 2 | Количество скелетонов карточек для отображения при загрузке |
112
+ | scrollEndRef | `RefObject<HTMLDivElement>` | - | Ссылка на элемент, обозначающий самый конец прокручиваемого списка |
113
+ | scrollContainerRef | `RefObject<HTMLElement>` | - | Ссылка на контейнер, который скроллится |
89
114
  ## NotificationPanel.Blank
90
115
  ### Props
91
116
  | name | type | default value | description |
92
117
  |------|------|---------------|-------------|
118
+ | title | `string` | - | Заголовок |
119
+ | className | `string` | - | CSS-класс |
120
+ | icon | `Pick<IconPredefinedProps, "appearance" \| "icon" \| "decor">` | - | Иконка |
121
+ | description | `ReactNode` | - | Подзаголовок |
93
122
  ## NotificationPanel.Divider
94
123
  ### Props
95
124
  | name | type | default value | description |
96
125
  |------|------|---------------|-------------|
126
+ | text* | `string` | - | Текст разделителя |
127
+ | className | `string` | - | CSS-класс |
97
128
  ## NotificationPanelPopover
98
129
  Компонент-обёртка для NotificationPanel для использования как выпадающий элемент
99
130
  ### Props
100
131
  | name | type | default value | description |
101
132
  |------|------|---------------|-------------|
133
+ | content* | `ReactElement<NotificationPanelProps, typeof NotificationPanel>` | - | |
134
+ | contentClassName | `string` | - | CSS-класс для элемента содержащего контент |
135
+ | className | `string` | - | CSS-класс |
136
+ | triggerClassName | `string` | - | CSS-класс триггера |
137
+ | open | `boolean` | - | Управляет состоянием показан/не показан. |
138
+ | onOpenChange | `(isOpen: boolean) => void` | - | Колбек отображения компонента. Срабатывает при изменении состояния open. |
139
+ | hoverDelayOpen | `number` | - | Задержка открытия по ховеру |
140
+ | hoverDelayClose | `number` | - | Задержка закрытия по ховеру |
141
+ | offset | `number` | 0 | Отступ поповера от его триггер-элемента (в пикселях). |
142
+ | children | `ReactNode \| ChildrenFunction` | - | Триггер поповера (подробнее читайте ниже) |
143
+ | closeOnEscapeKey | `boolean` | true | Закрывать ли по нажатию на кнопку `Esc` |
144
+ | triggerClickByKeys | `boolean` | true | Вызывается ли попоповер по нажатию клавиш Enter/Space (при trigger = `click`) |
145
+ | triggerRef | `ForwardedRef<HTMLElement \| ReferenceType>` | - | Ref ссылка на триггер |
146
+ | trigger | enum Trigger: `"click"`, `"hover"`, `"focusVisible"`, `"focus"`, `"hoverAndFocusVisible"`, `"hoverAndFocus"`, `"clickAndFocusVisible"` | click | Условие отображения поповера: <br> - `click` - открывать по клику <br> - `hover` - открывать по ховеру <br> - `focusVisible` - открывать по focus-visible <br> - `focus` - открывать по фокусу <br> - `hoverAndFocusVisible` - открывать по ховеру и focus-visible <br> - `hoverAndFocus` - открывать по ховеру и фокусу <br> - `clickAndFocusVisible` - открывать по клику и focus-visible |
147
+ | placement | enum Placement: `"left"`, `"left-start"`, `"left-end"`, `"right"`, `"right-start"`, `"right-end"`, `"top"`, `"top-start"`, `"top-end"`, `"bottom"`, `"bottom-start"`, `"bottom-end"` | bottom-end | Положение поповера относительно своего триггера (children). |
102
148
 
103
149
 
104
150
  [//]: DOCUMENTATION_SECTION_END
@@ -1,6 +1,6 @@
1
- import { ElementType, MouseEventHandler, ReactElement, ReactNode } from 'react';
1
+ import { MouseEventHandler, ReactElement, ReactNode } from 'react';
2
2
  import { ButtonSimpleProps, ButtonTonalProps } from '@snack-uikit/button';
3
- import { PickLinkProps } from '@snack-uikit/link';
3
+ import { LinkProps } 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<LinkElement extends ElementType = 'a'> = WithSupportProps<{
11
+ export type NotificationCardProps = WithSupportProps<{
12
12
  /** Идентификатор уведомления */
13
13
  id: string;
14
14
  /** Тип уведомления */
@@ -22,7 +22,7 @@ export type NotificationCardProps<LinkElement extends ElementType = 'a'> = WithS
22
22
  /** Контент уведомления */
23
23
  content: ReactNode;
24
24
  /** Ссылка */
25
- link?: PickLinkProps<LinkElement, 'text' | 'insideText' | 'truncateVariant'>;
25
+ link?: Omit<LinkProps, 'size' | 'appearance' | 'textMode' | 'data-test-id'>;
26
26
  /** Дата уведомления */
27
27
  date: string;
28
28
  /** Колбэк клика по карточке */
@@ -39,5 +39,5 @@ export type NotificationCardProps<LinkElement extends ElementType = 'a'> = WithS
39
39
  className?: string;
40
40
  }>;
41
41
  /** Компонент карточки уведомления */
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;
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;
43
43
  export {};
@@ -1,6 +1,6 @@
1
- import { ElementType, MouseEventHandler, ReactElement, ReactNode } from 'react';
1
+ import { MouseEventHandler, ReactElement, ReactNode } from 'react';
2
2
  import { ButtonSimpleProps, ButtonTonalProps } from '@snack-uikit/button';
3
- import { PickLinkProps } from '@snack-uikit/link';
3
+ import { LinkProps } 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<LinkElement extends ElementType = 'a'> = WithSupportProps<{
11
+ export type NotificationCardProps = WithSupportProps<{
12
12
  /** Идентификатор уведомления */
13
13
  id: string;
14
14
  /** Тип уведомления */
@@ -22,7 +22,7 @@ export type NotificationCardProps<LinkElement extends ElementType = 'a'> = WithS
22
22
  /** Контент уведомления */
23
23
  content: ReactNode;
24
24
  /** Ссылка */
25
- link?: PickLinkProps<LinkElement, 'text' | 'insideText' | 'truncateVariant'>;
25
+ link?: Omit<LinkProps, 'size' | 'appearance' | 'textMode' | 'data-test-id'>;
26
26
  /** Дата уведомления */
27
27
  date: string;
28
28
  /** Колбэк клика по карточке */
@@ -39,5 +39,5 @@ export type NotificationCardProps<LinkElement extends ElementType = 'a'> = WithS
39
39
  className?: string;
40
40
  }>;
41
41
  /** Компонент карточки уведомления */
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;
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;
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.19-preview-9ca6ecbf.0",
7
+ "version": "0.10.19",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -37,10 +37,10 @@
37
37
  "scripts": {},
38
38
  "dependencies": {
39
39
  "@snack-uikit/button": "0.19.7",
40
- "@snack-uikit/chips": "0.25.3",
40
+ "@snack-uikit/chips": "0.25.4",
41
41
  "@snack-uikit/icons": "0.24.2",
42
42
  "@snack-uikit/info-block": "0.6.13",
43
- "@snack-uikit/link": "0.15.10-preview-9ca6ecbf.0",
43
+ "@snack-uikit/link": "0.15.9",
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": "5997fdf5027fd7d355a1e0396b3cedcb86795b6d"
54
+ "gitHead": "b7485df8da9869f0fe2b2e22974a06d9a04e0835"
55
55
  }
@@ -1,8 +1,8 @@
1
1
  import cn from 'classnames';
2
- import { ElementType, MouseEventHandler, ReactElement, ReactNode, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { 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, PickLinkProps } from '@snack-uikit/link';
5
+ import { Link, LinkProps } 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<LinkElement extends ElementType = 'a'> = WithSupportProps<{
22
+ export type NotificationCardProps = WithSupportProps<{
23
23
  /** Идентификатор уведомления */
24
24
  id: string;
25
25
  /** Тип уведомления */
@@ -33,7 +33,7 @@ export type NotificationCardProps<LinkElement extends ElementType = 'a'> = WithS
33
33
  /** Контент уведомления */
34
34
  content: ReactNode;
35
35
  /** Ссылка */
36
- link?: PickLinkProps<LinkElement, 'text' | 'insideText' | 'truncateVariant'>;
36
+ link?: Omit<LinkProps, 'size' | 'appearance' | 'textMode' | 'data-test-id'>;
37
37
  /** Дата уведомления */
38
38
  date: string;
39
39
  /** Колбэк клика по карточке */
@@ -51,7 +51,7 @@ export type NotificationCardProps<LinkElement extends ElementType = 'a'> = WithS
51
51
  }>;
52
52
 
53
53
  /** Компонент карточки уведомления */
54
- export function NotificationCard<LinkElement extends ElementType = 'a'>({
54
+ export function NotificationCard({
55
55
  id,
56
56
  appearance = APPEARANCE.Neutral,
57
57
  label,
@@ -67,7 +67,7 @@ export function NotificationCard<LinkElement extends ElementType = 'a'>({
67
67
  onVisible,
68
68
  className,
69
69
  ...rest
70
- }: NotificationCardProps<LinkElement>) {
70
+ }: NotificationCardProps) {
71
71
  const { icon, linkOnColor, buttonAppearance } = useMemo<{
72
72
  icon: ReturnType<typeof getIcon>;
73
73
  linkOnColor: LinkProps['appearance'];