@snack-uikit/notification 0.13.16 → 0.13.17-preview-4eb2b89e.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 +14 -59
- package/dist/cjs/components/NotificationPanel/NotificationPanel.d.ts +4 -4
- package/dist/cjs/components/NotificationPanel/NotificationPanel.js +13 -13
- package/dist/cjs/components/NotificationPanel/constants.d.ts +1 -1
- package/dist/cjs/components/NotificationPanel/constants.js +1 -1
- package/dist/esm/components/NotificationPanel/NotificationPanel.d.ts +4 -4
- package/dist/esm/components/NotificationPanel/NotificationPanel.js +3 -4
- package/dist/esm/components/NotificationPanel/constants.d.ts +1 -1
- package/dist/esm/components/NotificationPanel/constants.js +1 -1
- package/package.json +3 -3
- package/src/components/NotificationPanel/NotificationPanel.tsx +16 -14
- package/src/components/NotificationPanel/constants.ts +1 -1
package/README.md
CHANGED
|
@@ -47,18 +47,20 @@ const cards = [
|
|
|
47
47
|
label: 'Mark all as read',
|
|
48
48
|
onClick() {},
|
|
49
49
|
}}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
segments={{
|
|
51
|
+
items: [
|
|
52
|
+
{
|
|
53
|
+
value: 'all',
|
|
54
|
+
label: 'all',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
value: 'unread',
|
|
58
|
+
label: 'unread',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
value: 'all',
|
|
62
|
+
onChange: (value) => { /* */ },
|
|
63
|
+
}}
|
|
62
64
|
content={
|
|
63
65
|
!cards.length ? (
|
|
64
66
|
<NotificationPanel.Blank
|
|
@@ -81,71 +83,24 @@ const cards = [
|
|
|
81
83
|
### Props
|
|
82
84
|
| name | type | default value | description |
|
|
83
85
|
|------|------|---------------|-------------|
|
|
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 | `PickLinkProps<LinkElement, "text" \| "insideText" \| "truncateVariant">` | - | Ссылка |
|
|
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-класс |
|
|
98
86
|
## NotificationPanel
|
|
99
87
|
Компонент панели для уведомлений
|
|
100
88
|
### Props
|
|
101
89
|
| name | type | default value | description |
|
|
102
90
|
|------|------|---------------|-------------|
|
|
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>` | - | Ссылка на контейнер, который скроллится |
|
|
114
91
|
## NotificationPanel.Blank
|
|
115
92
|
### Props
|
|
116
93
|
| name | type | default value | description |
|
|
117
94
|
|------|------|---------------|-------------|
|
|
118
|
-
| title | `string` | - | Заголовок |
|
|
119
|
-
| className | `string` | - | CSS-класс |
|
|
120
|
-
| icon | `Pick<IconPredefinedProps, "appearance" \| "icon" \| "decor">` | - | Иконка |
|
|
121
|
-
| description | `ReactNode` | - | Подзаголовок |
|
|
122
95
|
## NotificationPanel.Divider
|
|
123
96
|
### Props
|
|
124
97
|
| name | type | default value | description |
|
|
125
98
|
|------|------|---------------|-------------|
|
|
126
|
-
| text* | `string` | - | Текст разделителя |
|
|
127
|
-
| className | `string` | - | CSS-класс |
|
|
128
99
|
## NotificationPanelPopover
|
|
129
100
|
Компонент-обёртка для NotificationPanel для использования как выпадающий элемент
|
|
130
101
|
### Props
|
|
131
102
|
| name | type | default value | description |
|
|
132
103
|
|------|------|---------------|-------------|
|
|
133
|
-
| content* | `ReactElement<NotificationPanelProps, typeof NotificationPanel>` | - | |
|
|
134
|
-
| contentClassName | `string` | - | CSS-класс для элемента содержащего контент |
|
|
135
|
-
| className | `string` | - | CSS-класс |
|
|
136
|
-
| children | `ReactNode \| ChildrenFunction` | - | Триггер поповера (подробнее читайте ниже) |
|
|
137
|
-
| triggerClassName | `string` | - | CSS-класс триггера |
|
|
138
|
-
| open | `boolean` | - | Управляет состоянием показан/не показан. |
|
|
139
|
-
| onOpenChange | `(isOpen: boolean) => void` | - | Колбек отображения компонента. Срабатывает при изменении состояния open. |
|
|
140
|
-
| hoverDelayOpen | `number` | - | Задержка открытия по ховеру |
|
|
141
|
-
| hoverDelayClose | `number` | - | Задержка закрытия по ховеру |
|
|
142
|
-
| offset | `number` | 0 | Отступ поповера от его триггер-элемента (в пикселях). |
|
|
143
|
-
| closeOnEscapeKey | `boolean` | true | Закрывать ли по нажатию на кнопку `Esc` |
|
|
144
|
-
| triggerClickByKeys | `boolean` | true | Вызывается ли попоповер по нажатию клавиш Enter/Space (при trigger = `click`) |
|
|
145
|
-
| triggerRef | `ForwardedRef<HTMLElement \| ReferenceType>` | - | Ref ссылка на триггер |
|
|
146
|
-
| closeOnPopstate | `boolean` | - | Закрывать ли поповер при пекреходе по истории браузера |
|
|
147
|
-
| 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 |
|
|
148
|
-
| 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). |
|
|
149
104
|
|
|
150
105
|
|
|
151
106
|
[//]: DOCUMENTATION_SECTION_END
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MouseEventHandler, ReactNode, RefObject } from 'react';
|
|
2
2
|
import { ButtonFunctionProps } from '@snack-uikit/button';
|
|
3
|
-
import {
|
|
3
|
+
import { SegmentedControlProps } from '@snack-uikit/segmented-control';
|
|
4
4
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
5
5
|
import { NotificationPanelBlank, NotificationPanelBlankProps, NotificationPanelSettingsProps } from './components';
|
|
6
6
|
import { NotificationPanelDivider, NotificationPanelDividerProps } from './components/NotificationPanelDivider';
|
|
@@ -10,8 +10,8 @@ export type NotificationPanelProps = WithSupportProps<{
|
|
|
10
10
|
title: string;
|
|
11
11
|
/** Кнопка настроек и выпадающий список */
|
|
12
12
|
settings?: NotificationPanelSettingsProps;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/** Сегменты для фильтрации */
|
|
14
|
+
segments?: Omit<SegmentedControlProps, 'size' | 'data-test-id'>;
|
|
15
15
|
/** Кнопка в "шапке" панели */
|
|
16
16
|
readAllButton?: Omit<ButtonFunctionProps, 'data-test-id'> & {
|
|
17
17
|
onClick: ButtonFunctionProps['onClick'];
|
|
@@ -34,7 +34,7 @@ export type NotificationPanelProps = WithSupportProps<{
|
|
|
34
34
|
scrollContainerRef?: RefObject<HTMLElement>;
|
|
35
35
|
}>;
|
|
36
36
|
/** Компонент панели для уведомлений */
|
|
37
|
-
export declare function NotificationPanel({ title, settings,
|
|
37
|
+
export declare function NotificationPanel({ title, settings, segments, readAllButton, footerButton, content, loading, skeletonsAmount, scrollEndRef, scrollContainerRef, className, ...rest }: NotificationPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
38
38
|
export declare namespace NotificationPanel {
|
|
39
39
|
const Blank: typeof NotificationPanelBlank;
|
|
40
40
|
type BlankProps = NotificationPanelBlankProps;
|
|
@@ -17,13 +17,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
17
|
value: true
|
|
18
18
|
});
|
|
19
19
|
exports.NotificationPanel = NotificationPanel;
|
|
20
|
-
const react_1 = require("react");
|
|
21
20
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
22
21
|
const classnames_1 = __importDefault(require("classnames"));
|
|
23
|
-
const
|
|
22
|
+
const react_1 = require("react");
|
|
24
23
|
const button_1 = require("@snack-uikit/button");
|
|
25
|
-
const chips_1 = require("@snack-uikit/chips");
|
|
26
24
|
const scroll_1 = require("@snack-uikit/scroll");
|
|
25
|
+
const segmented_control_1 = require("@snack-uikit/segmented-control");
|
|
27
26
|
const skeleton_1 = require("@snack-uikit/skeleton");
|
|
28
27
|
const truncate_string_1 = require("@snack-uikit/truncate-string");
|
|
29
28
|
const typography_1 = require("@snack-uikit/typography");
|
|
@@ -38,7 +37,7 @@ function NotificationPanel(_a) {
|
|
|
38
37
|
var {
|
|
39
38
|
title,
|
|
40
39
|
settings,
|
|
41
|
-
|
|
40
|
+
segments,
|
|
42
41
|
readAllButton,
|
|
43
42
|
footerButton,
|
|
44
43
|
content,
|
|
@@ -48,8 +47,8 @@ function NotificationPanel(_a) {
|
|
|
48
47
|
scrollContainerRef,
|
|
49
48
|
className
|
|
50
49
|
} = _a,
|
|
51
|
-
rest = __rest(_a, ["title", "settings", "
|
|
52
|
-
const skeletons = (0,
|
|
50
|
+
rest = __rest(_a, ["title", "settings", "segments", "readAllButton", "footerButton", "content", "loading", "skeletonsAmount", "scrollEndRef", "scrollContainerRef", "className"]);
|
|
51
|
+
const skeletons = (0, react_1.useMemo)(() => Array.from({
|
|
53
52
|
length: skeletonsAmount
|
|
54
53
|
}, (_, i) => i), [skeletonsAmount]);
|
|
55
54
|
return (0, jsx_runtime_1.jsxs)("div", Object.assign({
|
|
@@ -68,14 +67,15 @@ function NotificationPanel(_a) {
|
|
|
68
67
|
}), settings && (0, jsx_runtime_1.jsx)(components_2.NotificationPanelSettings, Object.assign({}, settings))]
|
|
69
68
|
}), (0, jsx_runtime_1.jsxs)("div", {
|
|
70
69
|
className: styles_module_scss_1.default.notificationPanelHeaderFunctions,
|
|
71
|
-
children: [(0, jsx_runtime_1.jsx)("div", {
|
|
70
|
+
children: [segments && (0, jsx_runtime_1.jsx)("div", {
|
|
72
71
|
className: styles_module_scss_1.default.notificationPanelChips,
|
|
73
|
-
children:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
children: (0, jsx_runtime_1.jsx)(segmented_control_1.SegmentedControl, Object.assign({}, segments, {
|
|
73
|
+
size: 's',
|
|
74
|
+
items: segments.items.map(item => Object.assign(Object.assign({}, item), {
|
|
75
|
+
disabled: item.disabled || loading
|
|
76
|
+
})),
|
|
77
|
+
"data-test-id": constants_1.TEST_IDS.segment
|
|
78
|
+
}))
|
|
79
79
|
}), readAllButton && (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, Object.assign({}, readAllButton, {
|
|
80
80
|
size: 'xs',
|
|
81
81
|
disabled: readAllButton.disabled || loading,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.TEST_IDS = void 0;
|
|
7
7
|
exports.TEST_IDS = {
|
|
8
8
|
title: 'notification-panel__title',
|
|
9
|
-
|
|
9
|
+
segment: 'notification-panel__segment',
|
|
10
10
|
settings: {
|
|
11
11
|
droplist: 'notification-panel__settings__droplist',
|
|
12
12
|
droplistTrigger: 'notification-panel__settings__droplist-trigger',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MouseEventHandler, ReactNode, RefObject } from 'react';
|
|
2
2
|
import { ButtonFunctionProps } from '@snack-uikit/button';
|
|
3
|
-
import {
|
|
3
|
+
import { SegmentedControlProps } from '@snack-uikit/segmented-control';
|
|
4
4
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
5
5
|
import { NotificationPanelBlank, NotificationPanelBlankProps, NotificationPanelSettingsProps } from './components';
|
|
6
6
|
import { NotificationPanelDivider, NotificationPanelDividerProps } from './components/NotificationPanelDivider';
|
|
@@ -10,8 +10,8 @@ export type NotificationPanelProps = WithSupportProps<{
|
|
|
10
10
|
title: string;
|
|
11
11
|
/** Кнопка настроек и выпадающий список */
|
|
12
12
|
settings?: NotificationPanelSettingsProps;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/** Сегменты для фильтрации */
|
|
14
|
+
segments?: Omit<SegmentedControlProps, 'size' | 'data-test-id'>;
|
|
15
15
|
/** Кнопка в "шапке" панели */
|
|
16
16
|
readAllButton?: Omit<ButtonFunctionProps, 'data-test-id'> & {
|
|
17
17
|
onClick: ButtonFunctionProps['onClick'];
|
|
@@ -34,7 +34,7 @@ export type NotificationPanelProps = WithSupportProps<{
|
|
|
34
34
|
scrollContainerRef?: RefObject<HTMLElement>;
|
|
35
35
|
}>;
|
|
36
36
|
/** Компонент панели для уведомлений */
|
|
37
|
-
export declare function NotificationPanel({ title, settings,
|
|
37
|
+
export declare function NotificationPanel({ title, settings, segments, readAllButton, footerButton, content, loading, skeletonsAmount, scrollEndRef, scrollContainerRef, className, ...rest }: NotificationPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
38
38
|
export declare namespace NotificationPanel {
|
|
39
39
|
const Blank: typeof NotificationPanelBlank;
|
|
40
40
|
type BlankProps = NotificationPanelBlankProps;
|
|
@@ -9,13 +9,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { createElement as _createElement } from "react";
|
|
13
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
13
|
import cn from 'classnames';
|
|
15
14
|
import { useMemo } from 'react';
|
|
16
15
|
import { ButtonFunction } from '@snack-uikit/button';
|
|
17
|
-
import { ChipToggle } from '@snack-uikit/chips';
|
|
18
16
|
import { Scroll } from '@snack-uikit/scroll';
|
|
17
|
+
import { SegmentedControl } from '@snack-uikit/segmented-control';
|
|
19
18
|
import { SkeletonContextProvider, WithSkeleton } from '@snack-uikit/skeleton';
|
|
20
19
|
import { TruncateString } from '@snack-uikit/truncate-string';
|
|
21
20
|
import { Typography } from '@snack-uikit/typography';
|
|
@@ -27,9 +26,9 @@ import { TEST_IDS } from './constants';
|
|
|
27
26
|
import styles from './styles.module.css';
|
|
28
27
|
/** Компонент панели для уведомлений */
|
|
29
28
|
export function NotificationPanel(_a) {
|
|
30
|
-
var { title, settings,
|
|
29
|
+
var { title, settings, segments, readAllButton, footerButton, content, loading, skeletonsAmount = 2, scrollEndRef, scrollContainerRef, className } = _a, rest = __rest(_a, ["title", "settings", "segments", "readAllButton", "footerButton", "content", "loading", "skeletonsAmount", "scrollEndRef", "scrollContainerRef", "className"]);
|
|
31
30
|
const skeletons = useMemo(() => Array.from({ length: skeletonsAmount }, (_, i) => i), [skeletonsAmount]);
|
|
32
|
-
return (_jsxs("div", Object.assign({ className: cn(styles.wrapper, className) }, extractSupportProps(rest), { children: [_jsxs("div", { className: styles.notificationPanelHeader, children: [_jsxs("div", { className: styles.notificationPanelHeadline, children: [_jsx(Typography.SansHeadlineS, { className: styles.notificationPanelTitle, children: _jsx(TruncateString, { text: title, "data-test-id": TEST_IDS.title }) }), settings && _jsx(NotificationPanelSettings, Object.assign({}, settings))] }), _jsxs("div", { className: styles.notificationPanelHeaderFunctions, children: [_jsx("div", { className: styles.notificationPanelChips, children:
|
|
31
|
+
return (_jsxs("div", Object.assign({ className: cn(styles.wrapper, className) }, extractSupportProps(rest), { children: [_jsxs("div", { className: styles.notificationPanelHeader, children: [_jsxs("div", { className: styles.notificationPanelHeadline, children: [_jsx(Typography.SansHeadlineS, { className: styles.notificationPanelTitle, children: _jsx(TruncateString, { text: title, "data-test-id": TEST_IDS.title }) }), settings && _jsx(NotificationPanelSettings, Object.assign({}, settings))] }), _jsxs("div", { className: styles.notificationPanelHeaderFunctions, children: [segments && (_jsx("div", { className: styles.notificationPanelChips, children: _jsx(SegmentedControl, Object.assign({}, segments, { size: 's', items: segments.items.map(item => (Object.assign(Object.assign({}, item), { disabled: item.disabled || loading }))), "data-test-id": TEST_IDS.segment })) })), readAllButton && (_jsx(ButtonFunction, Object.assign({}, readAllButton, { size: 'xs', disabled: readAllButton.disabled || loading, "data-test-id": TEST_IDS.readAll })))] })] }), _jsxs(Scroll, { size: 'm', className: styles.notificationPanelBody, ref: scrollContainerRef, children: [content, loading && (_jsx(SkeletonContextProvider, { loading: loading || false, children: skeletons.map(skeleton => (_jsx(WithSkeleton, { skeleton: _jsx(NotificationCardSkeleton, {}) }, skeleton))) })), _jsx("div", { className: styles.scrollStub, ref: scrollEndRef })] }), footerButton && (_jsx("button", { type: 'button', onClick: footerButton.onClick, className: styles.notificationPanelFooterButton, "data-test-id": TEST_IDS.footerButton, children: _jsx(Typography.SansLabelS, { children: footerButton.label }) }))] })));
|
|
33
32
|
}
|
|
34
33
|
(function (NotificationPanel) {
|
|
35
34
|
NotificationPanel.Blank = NotificationPanelBlank;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const TEST_IDS = {
|
|
2
2
|
title: 'notification-panel__title',
|
|
3
|
-
|
|
3
|
+
segment: 'notification-panel__segment',
|
|
4
4
|
settings: {
|
|
5
5
|
droplist: 'notification-panel__settings__droplist',
|
|
6
6
|
droplistTrigger: 'notification-panel__settings__droplist-trigger',
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Notification",
|
|
7
|
-
"version": "0.13.
|
|
7
|
+
"version": "0.13.17-preview-4eb2b89e.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"scripts": {},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@snack-uikit/button": "0.19.16",
|
|
40
|
-
"@snack-uikit/chips": "0.28.5",
|
|
41
40
|
"@snack-uikit/icons": "0.27.3",
|
|
42
41
|
"@snack-uikit/info-block": "0.6.33",
|
|
43
42
|
"@snack-uikit/link": "0.17.11",
|
|
44
43
|
"@snack-uikit/list": "0.32.5",
|
|
45
44
|
"@snack-uikit/popover-private": "0.15.3",
|
|
46
45
|
"@snack-uikit/scroll": "0.10.5",
|
|
46
|
+
"@snack-uikit/segmented-control": "0.6.11-preview-4eb2b89e.0",
|
|
47
47
|
"@snack-uikit/skeleton": "0.6.9",
|
|
48
48
|
"@snack-uikit/tag": "0.15.10",
|
|
49
49
|
"@snack-uikit/truncate-string": "0.7.2",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"@snack-uikit/utils": "4.0.0",
|
|
52
52
|
"classnames": "2.5.1"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "d46627c950a04cca650210be851e436e9994ca6a"
|
|
55
55
|
}
|
|
@@ -2,8 +2,8 @@ import cn from 'classnames';
|
|
|
2
2
|
import { MouseEventHandler, ReactNode, RefObject, useMemo } from 'react';
|
|
3
3
|
|
|
4
4
|
import { ButtonFunction, ButtonFunctionProps } from '@snack-uikit/button';
|
|
5
|
-
import { ChipToggle, ChipToggleProps } from '@snack-uikit/chips';
|
|
6
5
|
import { Scroll } from '@snack-uikit/scroll';
|
|
6
|
+
import { SegmentedControl, SegmentedControlProps } from '@snack-uikit/segmented-control';
|
|
7
7
|
import { SkeletonContextProvider, WithSkeleton } from '@snack-uikit/skeleton';
|
|
8
8
|
import { TruncateString } from '@snack-uikit/truncate-string';
|
|
9
9
|
import { Typography } from '@snack-uikit/typography';
|
|
@@ -27,8 +27,8 @@ export type NotificationPanelProps = WithSupportProps<{
|
|
|
27
27
|
title: string;
|
|
28
28
|
/** Кнопка настроек и выпадающий список */
|
|
29
29
|
settings?: NotificationPanelSettingsProps;
|
|
30
|
-
/**
|
|
31
|
-
|
|
30
|
+
/** Сегменты для фильтрации */
|
|
31
|
+
segments?: Omit<SegmentedControlProps, 'size' | 'data-test-id'>;
|
|
32
32
|
/** Кнопка в "шапке" панели */
|
|
33
33
|
readAllButton?: Omit<ButtonFunctionProps, 'data-test-id'> & {
|
|
34
34
|
onClick: ButtonFunctionProps['onClick'];
|
|
@@ -55,7 +55,7 @@ export type NotificationPanelProps = WithSupportProps<{
|
|
|
55
55
|
export function NotificationPanel({
|
|
56
56
|
title,
|
|
57
57
|
settings,
|
|
58
|
-
|
|
58
|
+
segments,
|
|
59
59
|
readAllButton,
|
|
60
60
|
footerButton,
|
|
61
61
|
content,
|
|
@@ -80,17 +80,19 @@ export function NotificationPanel({
|
|
|
80
80
|
</div>
|
|
81
81
|
|
|
82
82
|
<div className={styles.notificationPanelHeaderFunctions}>
|
|
83
|
-
|
|
84
|
-
{
|
|
85
|
-
<
|
|
86
|
-
{...
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
{segments && (
|
|
84
|
+
<div className={styles.notificationPanelChips}>
|
|
85
|
+
<SegmentedControl
|
|
86
|
+
{...segments}
|
|
87
|
+
size='s'
|
|
88
|
+
items={segments.items.map(item => ({
|
|
89
|
+
...item,
|
|
90
|
+
disabled: item.disabled || loading,
|
|
91
|
+
}))}
|
|
92
|
+
data-test-id={TEST_IDS.segment}
|
|
91
93
|
/>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
</div>
|
|
95
|
+
)}
|
|
94
96
|
|
|
95
97
|
{readAllButton && (
|
|
96
98
|
<ButtonFunction
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const TEST_IDS = {
|
|
2
2
|
title: 'notification-panel__title',
|
|
3
|
-
|
|
3
|
+
segment: 'notification-panel__segment',
|
|
4
4
|
settings: {
|
|
5
5
|
droplist: 'notification-panel__settings__droplist',
|
|
6
6
|
droplistTrigger: 'notification-panel__settings__droplist-trigger',
|