@snack-uikit/notification 0.6.17-preview-135ad6d6.0 → 0.6.17
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 +11 -0
- package/README.md +13 -29
- package/dist/components/NotificationCard/NotificationCard.d.ts +1 -6
- package/dist/components/NotificationCard/NotificationCard.js +3 -5
- package/dist/components/NotificationCard/constants.d.ts +0 -2
- package/dist/components/NotificationCard/constants.js +0 -2
- package/dist/components/NotificationCard/styles.module.css +0 -6
- package/dist/components/NotificationPanel/NotificationPanel.d.ts +7 -13
- package/dist/components/NotificationPanel/NotificationPanel.js +4 -7
- package/dist/components/NotificationPanel/components/NotificationPanelBlank/NotificationPanelBlank.d.ts +16 -3
- package/dist/components/NotificationPanel/components/NotificationPanelBlank/NotificationPanelBlank.js +7 -5
- package/dist/components/NotificationPanel/components/NotificationPanelBlank/styles.module.css +25 -1
- package/dist/components/NotificationPanel/constants.d.ts +5 -0
- package/dist/components/NotificationPanel/constants.js +5 -0
- package/dist/components/NotificationPanel/styles.module.css +4 -18
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +0 -1
- package/dist/{components → helperComponents}/NotificationPanelPopover/NotificationPanelPopover.d.ts +2 -4
- package/dist/{components → helperComponents}/NotificationPanelPopover/NotificationPanelPopover.js +0 -1
- package/dist/helperComponents/index.js +1 -0
- package/package.json +10 -10
- package/src/components/NotificationCard/NotificationCard.tsx +1 -35
- package/src/components/NotificationCard/constants.ts +0 -2
- package/src/components/NotificationCard/styles.module.scss +0 -6
- package/src/components/NotificationPanel/NotificationPanel.tsx +60 -63
- package/src/components/NotificationPanel/components/NotificationPanelBlank/NotificationPanelBlank.tsx +46 -12
- package/src/components/NotificationPanel/components/NotificationPanelBlank/styles.module.scss +27 -1
- package/src/components/NotificationPanel/constants.ts +5 -0
- package/src/components/NotificationPanel/styles.module.scss +5 -19
- package/src/components/index.ts +0 -1
- package/src/{components → helperComponents}/NotificationPanelPopover/NotificationPanelPopover.tsx +2 -4
- package/src/helperComponents/NotificationPanelPopover/index.ts +1 -0
- package/src/helperComponents/index.ts +1 -0
- package/dist/components/NotificationPanel/components/NotificationPanelDivider/NotificationPanelDivider.d.ts +0 -8
- package/dist/components/NotificationPanel/components/NotificationPanelDivider/NotificationPanelDivider.js +0 -21
- package/dist/components/NotificationPanel/components/NotificationPanelDivider/index.d.ts +0 -1
- package/dist/components/NotificationPanel/components/NotificationPanelDivider/index.js +0 -1
- package/dist/components/NotificationPanel/components/NotificationPanelDivider/styles.module.css +0 -10
- package/src/components/NotificationPanel/components/NotificationPanelDivider/NotificationPanelDivider.tsx +0 -21
- package/src/components/NotificationPanel/components/NotificationPanelDivider/index.ts +0 -1
- package/src/components/NotificationPanel/components/NotificationPanelDivider/styles.module.scss +0 -14
- /package/dist/{components → helperComponents}/NotificationPanelPopover/index.d.ts +0 -0
- /package/dist/{components → helperComponents}/NotificationPanelPopover/index.js +0 -0
- /package/dist/{components → helperComponents}/NotificationPanelPopover/styles.module.css +0 -0
- /package/{src/components/NotificationPanelPopover/index.ts → dist/helperComponents/index.d.ts} +0 -0
- /package/src/{components → helperComponents}/NotificationPanelPopover/styles.module.scss +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.6.17 (2024-02-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **FF-4297:** apply system-layer tokens ([7c8fd4b](https://github.com/cloud-ru-tech/snack-uikit/commit/7c8fd4b5334360b2fc31da92973b6835ffa287af))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 0.6.16 (2024-02-13)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
package/README.md
CHANGED
|
@@ -91,8 +91,6 @@ const cards = [
|
|
|
91
91
|
| link | `Omit<LinkProps, "data-test-id" \| "appearance" \| "size" \| "textMode">` | - | Ссылка |
|
|
92
92
|
| onClick | `MouseEventHandler<HTMLDivElement>` | - | Колбэк клика по карточке |
|
|
93
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
94
|
| actions | `Action[]` | - | Дополнительные действия у карточки |
|
|
97
95
|
| className | `string` | - | CSS-класс |
|
|
98
96
|
## NotificationPanel
|
|
@@ -100,39 +98,15 @@ const cards = [
|
|
|
100
98
|
### Props
|
|
101
99
|
| name | type | default value | description |
|
|
102
100
|
|------|------|---------------|-------------|
|
|
101
|
+
| triggerElement* | `ReactNode \| ChildrenFunction` | - | Элемент для открытия панели |
|
|
103
102
|
| title* | `string` | - | Заголовок панели |
|
|
104
103
|
| settings | `NotificationPanelSettingsProps` | - | Кнопка настроек и выпадающий список |
|
|
105
104
|
| chips | `Omit<ChipToggleProps, "data-test-id" \| "size">[]` | - | Чипы для фильтрации |
|
|
106
105
|
| readAllButton | `Omit<ButtonFunctionProps, "data-test-id"> & { onClick: MouseEventHandler<HTMLElement>; }` | - | Кнопка в "шапке" панели |
|
|
107
106
|
| footerButton | `{ label: string; onClick: MouseEventHandler<HTMLButtonElement>; }` | - | Кнопка внизу панели |
|
|
108
|
-
| className | `string` | - | CSS-класс |
|
|
109
107
|
| loading | `boolean` | - | Состояние загрузки |
|
|
110
108
|
| content | `ReactNode` | - | Контент для отрисовки (e.g NotificationCard \| NotificationPanel.Blank) |
|
|
111
109
|
| skeletonsAmount | `number` | 2 | Количество скелетонов карточек для отображения при загрузке |
|
|
112
|
-
| scrollEndRef | `RefObject<HTMLDivElement>` | - | Ссылка на элемент, обозначающий самый конец прокручиваемого списка |
|
|
113
|
-
| scrollContainerRef | `RefObject<HTMLElement>` | - | Ссылка на контейнер, который скроллится |
|
|
114
|
-
## NotificationPanel.Blank
|
|
115
|
-
### Props
|
|
116
|
-
| name | type | default value | description |
|
|
117
|
-
|------|------|---------------|-------------|
|
|
118
|
-
| title | `string` | - | Заголовок |
|
|
119
|
-
| className | `string` | - | CSS-класс |
|
|
120
|
-
| icon | `Pick<IconPredefinedProps, "appearance" \| "icon" \| "decor">` | - | Иконка |
|
|
121
|
-
| description | `string` | - | Подзаголовок |
|
|
122
|
-
## NotificationPanel.Divider
|
|
123
|
-
### Props
|
|
124
|
-
| name | type | default value | description |
|
|
125
|
-
|------|------|---------------|-------------|
|
|
126
|
-
| text* | `string` | - | Текст разделителя |
|
|
127
|
-
| className | `string` | - | CSS-класс |
|
|
128
|
-
## NotificationPanelPopover
|
|
129
|
-
Компонент-обёртка для NotificationPanel для использования как выпадающий элемент
|
|
130
|
-
### Props
|
|
131
|
-
| name | type | default value | description |
|
|
132
|
-
|------|------|---------------|-------------|
|
|
133
|
-
| children* | `ReactNode \| ChildrenFunction` | - | Триггер поповера (подробнее читайте ниже) |
|
|
134
|
-
| content* | `ReactElement<NotificationPanelProps, typeof NotificationPanel>` | - | |
|
|
135
|
-
| contentClassName | `string` | - | CSS-класс для элемента содержащего контент |
|
|
136
110
|
| className | `string` | - | CSS-класс |
|
|
137
111
|
| triggerClassName | `string` | - | CSS-класс триггера |
|
|
138
112
|
| open | `boolean` | - | Управляет состоянием показан/не показан. |
|
|
@@ -143,8 +117,18 @@ const cards = [
|
|
|
143
117
|
| closeOnEscapeKey | `boolean` | true | Закрывать ли по нажатию на кнопку `Esc` |
|
|
144
118
|
| triggerClickByKeys | `boolean` | true | Вызывается ли попоповер по нажатию клавиш Enter/Space (при trigger = `click`) |
|
|
145
119
|
| triggerRef | `ForwardedRef<HTMLElement \| ReferenceType>` | - | Ref ссылка на триггер |
|
|
146
|
-
| trigger | enum Trigger: `"click"`, `"hover"`, `"focusVisible"`, `"focus"`, `"hoverAndFocusVisible"`, `"hoverAndFocus"`, `"clickAndFocusVisible"` |
|
|
147
|
-
| placement | enum Placement: `"left"`, `"left-start"`, `"left-end"`, `"right"`, `"right-start"`, `"right-end"`, `"top"`, `"top-start"`, `"top-end"`, `"bottom"`, `"bottom-start"`, `"bottom-end"` |
|
|
120
|
+
| trigger | enum Trigger: `"click"`, `"hover"`, `"focusVisible"`, `"focus"`, `"hoverAndFocusVisible"`, `"hoverAndFocus"`, `"clickAndFocusVisible"` | - | Условие отображения поповера: <br> - `click` - открывать по клику <br> - `hover` - открывать по ховеру <br> - `focusVisible` - открывать по focus-visible <br> - `focus` - открывать по фокусу <br> - `hoverAndFocusVisible` - открывать по ховеру и focus-visible <br> - `hoverAndFocus` - открывать по ховеру и фокусу <br> - `clickAndFocusVisible` - открывать по клику и focus-visible |
|
|
121
|
+
| placement | enum Placement: `"left"`, `"left-start"`, `"left-end"`, `"right"`, `"right-start"`, `"right-end"`, `"top"`, `"top-start"`, `"top-end"`, `"bottom"`, `"bottom-start"`, `"bottom-end"` | top | Положение поповера относительно своего триггера (children). |
|
|
122
|
+
| contentClassName | `string` | - | CSS-класс для элемента содержащего контент |
|
|
123
|
+
## NotificationPanel.Blank
|
|
124
|
+
### Props
|
|
125
|
+
| name | type | default value | description |
|
|
126
|
+
|------|------|---------------|-------------|
|
|
127
|
+
| title* | `ReactNode` | - | Заголовок |
|
|
128
|
+
| description | `ReactNode` | - | Описание |
|
|
129
|
+
| icon | `JSXElementConstructor<{ size?: number; className?: string; }>` | - | Иконка |
|
|
130
|
+
| iconAppearance | enum Appearance: `"neutral"`, `"primary"`, `"red"`, `"orange"`, `"yellow"`, `"green"`, `"blue"`, `"violet"`, `"pink"` | - | Цвет обводки для иконки |
|
|
131
|
+
| className | `string` | - | CSS-класс |
|
|
148
132
|
|
|
149
133
|
|
|
150
134
|
[//]: DOCUMENTATION_SECTION_END
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MouseEventHandler, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { ButtonSimpleProps, ButtonTonalProps } from '@snack-uikit/button';
|
|
3
2
|
import { LinkProps } from '@snack-uikit/link';
|
|
4
3
|
import { BaseItemProps } from '@snack-uikit/list';
|
|
5
4
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
@@ -29,15 +28,11 @@ export type NotificationCardProps = WithSupportProps<{
|
|
|
29
28
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
30
29
|
/** Колбэк при попадании карточки в область видимости на 80% */
|
|
31
30
|
onVisible?(cardId: string): void;
|
|
32
|
-
/** Кнопка главного действия у карточки */
|
|
33
|
-
primaryButton?: Omit<ButtonTonalProps, 'size' | 'appearance' | 'data-test-id'>;
|
|
34
|
-
/** Кнопка второстепенного действия у карточки */
|
|
35
|
-
secondaryButton?: Omit<ButtonSimpleProps, 'size' | 'appearance' | 'data-test-id'>;
|
|
36
31
|
/** Дополнительные действия у карточки */
|
|
37
32
|
actions?: Action[];
|
|
38
33
|
/** CSS-класс */
|
|
39
34
|
className?: string;
|
|
40
35
|
}>;
|
|
41
36
|
/** Компонент карточки уведомления */
|
|
42
|
-
export declare function NotificationCard({ id, appearance, label, unread, title, content, link, date, onClick,
|
|
37
|
+
export declare function NotificationCard({ id, appearance, label, unread, title, content, link, date, onClick, actions, onVisible, className, ...rest }: NotificationCardProps): import("react/jsx-runtime").JSX.Element;
|
|
43
38
|
export {};
|
|
@@ -12,7 +12,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import cn from 'classnames';
|
|
14
14
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
15
|
-
import { ButtonSimple, ButtonTonal } from '@snack-uikit/button';
|
|
16
15
|
import { Link } from '@snack-uikit/link';
|
|
17
16
|
import { TruncateString } from '@snack-uikit/truncate-string';
|
|
18
17
|
import { Typography } from '@snack-uikit/typography';
|
|
@@ -23,11 +22,10 @@ import { getIcon } from './helpers';
|
|
|
23
22
|
import styles from './styles.module.css';
|
|
24
23
|
/** Компонент карточки уведомления */
|
|
25
24
|
export function NotificationCard(_a) {
|
|
26
|
-
var { id, appearance = APPEARANCE.Neutral, label, unread, title, content, link, date, onClick,
|
|
27
|
-
const { icon, linkOnColor
|
|
25
|
+
var { id, appearance = APPEARANCE.Neutral, label, unread, title, content, link, date, onClick, actions, onVisible, className } = _a, rest = __rest(_a, ["id", "appearance", "label", "unread", "title", "content", "link", "date", "onClick", "actions", "onVisible", "className"]);
|
|
26
|
+
const { icon, linkOnColor } = useMemo(() => ({
|
|
28
27
|
icon: getIcon(appearance),
|
|
29
28
|
linkOnColor: appearance === APPEARANCE.ErrorCritical ? 'red' : undefined,
|
|
30
|
-
buttonAppearance: appearance === APPEARANCE.ErrorCritical ? 'destructive' : 'primary',
|
|
31
29
|
}), [appearance]);
|
|
32
30
|
const [isDroplistOpen, setDroplistOpen] = useState(false);
|
|
33
31
|
const cardRef = useRef(null);
|
|
@@ -57,5 +55,5 @@ export function NotificationCard(_a) {
|
|
|
57
55
|
e.stopPropagation();
|
|
58
56
|
(_a = link === null || link === void 0 ? void 0 : link.onClick) === null || _a === void 0 ? void 0 : _a.call(link, e);
|
|
59
57
|
};
|
|
60
|
-
return (_jsxs("div", Object.assign({ ref: cardRef, role: 'button', onClick: onClick, tabIndex: 0 }, extractSupportProps(rest), { "data-appearance": appearance, "data-unread": unread || undefined, "data-clickable": Boolean(onClick) || undefined, "data-droplist-open": isDroplistOpen || undefined, className: cn(styles.notificationCard, className), children: [(actions === null || actions === void 0 ? void 0 : actions.length) && (_jsx(NotificationCardFunction, { actions: actions, open: isDroplistOpen, setDroplistOpen: setDroplistOpen })), label && (_jsx(Typography.LightLabelS, { tag: 'div', className: styles.notificationCardLabel, children: _jsx(TruncateString, { maxLines: 1, text: label, "data-test-id": TEST_IDS.label }) })), _jsxs("div", { className: styles.notificationCardTitle, children: [_jsx("div", { className: styles.notificationCardTitleIcon, children: icon }), _jsx(Typography.SansTitleS, { tag: 'div', className: styles.notificationCardTitleText, children: _jsx(TruncateString, { maxLines: 2, text: title, "data-test-id": TEST_IDS.title }) })] }), content && (_jsx(Typography.SansBodyS, { tag: 'div', className: styles.notificationCardContent, "data-test-id": TEST_IDS.content, children: content })),
|
|
58
|
+
return (_jsxs("div", Object.assign({ ref: cardRef, role: 'button', onClick: onClick, tabIndex: 0 }, extractSupportProps(rest), { "data-appearance": appearance, "data-unread": unread || undefined, "data-clickable": Boolean(onClick) || undefined, "data-droplist-open": isDroplistOpen || undefined, className: cn(styles.notificationCard, className), children: [(actions === null || actions === void 0 ? void 0 : actions.length) && (_jsx(NotificationCardFunction, { actions: actions, open: isDroplistOpen, setDroplistOpen: setDroplistOpen })), label && (_jsx(Typography.LightLabelS, { tag: 'div', className: styles.notificationCardLabel, children: _jsx(TruncateString, { maxLines: 1, text: label, "data-test-id": TEST_IDS.label }) })), _jsxs("div", { className: styles.notificationCardTitle, children: [_jsx("div", { className: styles.notificationCardTitleIcon, children: icon }), _jsx(Typography.SansTitleS, { tag: 'div', className: styles.notificationCardTitleText, children: _jsx(TruncateString, { maxLines: 2, text: title, "data-test-id": TEST_IDS.title }) })] }), content && (_jsx(Typography.SansBodyS, { tag: 'div', className: styles.notificationCardContent, "data-test-id": TEST_IDS.content, children: content })), showFooter && (_jsxs("div", { className: styles.notificationCardFooter, children: [link && (_jsx(Link, Object.assign({}, link, { onClick: handleLinkClick, appearance: linkOnColor, textMode: 'default', size: 's', "data-test-id": TEST_IDS.link }))), date && (_jsx(Typography.LightLabelS, { className: styles.notificationCardDate, "data-test-id": TEST_IDS.date, children: date }))] }))] })));
|
|
61
59
|
}
|
|
@@ -17,6 +17,4 @@ export const TEST_IDS = {
|
|
|
17
17
|
droplistTrigger: 'notification-card__droplist-trigger',
|
|
18
18
|
droplistAction: 'notification-card__droplist-action',
|
|
19
19
|
},
|
|
20
|
-
primaryButton: 'notification-card__primary-button',
|
|
21
|
-
secondaryButton: 'notification-card__secondary-button',
|
|
22
20
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { MouseEventHandler, ReactNode
|
|
1
|
+
import { MouseEventHandler, ReactNode } from 'react';
|
|
2
2
|
import { ButtonFunctionProps } from '@snack-uikit/button';
|
|
3
3
|
import { ChipToggleProps } from '@snack-uikit/chips';
|
|
4
|
-
import {
|
|
4
|
+
import { NotificationPanelPopoverProps } from '../../helperComponents';
|
|
5
5
|
import { NotificationPanelBlank, NotificationPanelBlankProps, NotificationPanelSettingsProps } from './components';
|
|
6
|
-
import { NotificationPanelDivider, NotificationPanelDividerProps } from './components/NotificationPanelDivider';
|
|
7
6
|
export type { NotificationPanelBlankProps };
|
|
8
|
-
export type NotificationPanelProps =
|
|
7
|
+
export type NotificationPanelProps = {
|
|
9
8
|
/** Заголовок панели */
|
|
10
9
|
title: string;
|
|
11
10
|
/** Кнопка настроек и выпадающий список */
|
|
@@ -16,28 +15,23 @@ export type NotificationPanelProps = WithSupportProps<{
|
|
|
16
15
|
readAllButton?: Omit<ButtonFunctionProps, 'data-test-id'> & {
|
|
17
16
|
onClick: ButtonFunctionProps['onClick'];
|
|
18
17
|
};
|
|
18
|
+
/** Элемент для открытия панели */
|
|
19
|
+
triggerElement: NotificationPanelPopoverProps['children'];
|
|
19
20
|
/** Кнопка внизу панели */
|
|
20
21
|
footerButton?: {
|
|
21
22
|
label: string;
|
|
22
23
|
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
23
24
|
};
|
|
24
|
-
className?: string;
|
|
25
25
|
/** Состояние загрузки */
|
|
26
26
|
loading?: boolean;
|
|
27
27
|
/** Контент для отрисовки (e.g NotificationCard | NotificationPanel.Blank) */
|
|
28
28
|
content?: ReactNode;
|
|
29
29
|
/** Количество скелетонов карточек для отображения при загрузке */
|
|
30
30
|
skeletonsAmount?: number;
|
|
31
|
-
|
|
32
|
-
scrollEndRef?: RefObject<HTMLDivElement>;
|
|
33
|
-
/** Ссылка на контейнер, который скроллится */
|
|
34
|
-
scrollContainerRef?: RefObject<HTMLElement>;
|
|
35
|
-
}>;
|
|
31
|
+
} & Omit<NotificationPanelPopoverProps, 'children' | 'content'>;
|
|
36
32
|
/** Компонент панели для уведомлений */
|
|
37
|
-
export declare function NotificationPanel({ title, settings, chips, readAllButton, footerButton, content, loading, skeletonsAmount,
|
|
33
|
+
export declare function NotificationPanel({ title, triggerElement, settings, chips, readAllButton, footerButton, content, loading, skeletonsAmount, ...rest }: NotificationPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
38
34
|
export declare namespace NotificationPanel {
|
|
39
35
|
const Blank: typeof NotificationPanelBlank;
|
|
40
36
|
type BlankProps = NotificationPanelBlankProps;
|
|
41
|
-
const Divider: typeof NotificationPanelDivider;
|
|
42
|
-
type DividerProps = NotificationPanelDividerProps;
|
|
43
37
|
}
|
|
@@ -10,8 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { createElement as _createElement } from "react";
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import cn from 'classnames';
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
14
|
import { useMemo } from 'react';
|
|
16
15
|
import { ButtonFunction } from '@snack-uikit/button';
|
|
17
16
|
import { ChipToggle } from '@snack-uikit/chips';
|
|
@@ -19,19 +18,17 @@ import { Scroll } from '@snack-uikit/scroll';
|
|
|
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';
|
|
22
|
-
import {
|
|
21
|
+
import { NotificationPanelPopover } from '../../helperComponents';
|
|
23
22
|
import { NotificationCardSkeleton } from '../NotificationCard/components';
|
|
24
23
|
import { NotificationPanelBlank, NotificationPanelSettings, } from './components';
|
|
25
|
-
import { NotificationPanelDivider } from './components/NotificationPanelDivider';
|
|
26
24
|
import { TEST_IDS } from './constants';
|
|
27
25
|
import styles from './styles.module.css';
|
|
28
26
|
/** Компонент панели для уведомлений */
|
|
29
27
|
export function NotificationPanel(_a) {
|
|
30
|
-
var { title, settings, chips, readAllButton, footerButton, content, loading, skeletonsAmount = 2
|
|
28
|
+
var { title, triggerElement, settings, chips, readAllButton, footerButton, content, loading, skeletonsAmount = 2 } = _a, rest = __rest(_a, ["title", "triggerElement", "settings", "chips", "readAllButton", "footerButton", "content", "loading", "skeletonsAmount"]);
|
|
31
29
|
const skeletons = useMemo(() => Array.from({ length: skeletonsAmount }, (_, i) => i), [skeletonsAmount]);
|
|
32
|
-
return (
|
|
30
|
+
return (_jsx(NotificationPanelPopover, Object.assign({}, rest, { content: _jsxs(_Fragment, { 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: chips === null || chips === void 0 ? void 0 : chips.map(chip => (_createElement(ChipToggle, Object.assign({}, chip, { key: chip.label, "data-test-id": `${TEST_IDS.chip}-${chip.label}`, size: 'xs', disabled: chip.disabled || loading })))) }), readAllButton && (_jsx(ButtonFunction, Object.assign({}, readAllButton, { disabled: readAllButton.disabled || loading, "data-test-id": TEST_IDS.readAll })))] })] }), _jsx(Scroll, { size: 'm', className: styles.notificationPanelBody, children: loading ? (_jsx(SkeletonContextProvider, { loading: loading || false, children: skeletons.map(skeleton => (_jsx(WithSkeleton, { skeleton: _jsx(NotificationCardSkeleton, {}) }, skeleton))) })) : (content) }), !loading && footerButton && (_jsx("button", { className: styles.notificationPanelFooterButton, "data-test-id": TEST_IDS.footerButton, children: _jsx(Typography.SansLabelS, { children: footerButton.label }) }))] }), children: triggerElement })));
|
|
33
31
|
}
|
|
34
32
|
(function (NotificationPanel) {
|
|
35
33
|
NotificationPanel.Blank = NotificationPanelBlank;
|
|
36
|
-
NotificationPanel.Divider = NotificationPanelDivider;
|
|
37
34
|
})(NotificationPanel || (NotificationPanel = {}));
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { IconPredefinedProps } from '@snack-uikit/icon-predefined';
|
|
3
|
+
import { WithSupportProps } from '@snack-uikit/utils';
|
|
4
|
+
export type NotificationPanelBlankProps = WithSupportProps<{
|
|
5
|
+
/** Заголовок */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** Описание */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** Иконка */
|
|
10
|
+
icon?: IconPredefinedProps['icon'];
|
|
11
|
+
/** Цвет обводки для иконки */
|
|
12
|
+
iconAppearance?: IconPredefinedProps['appearance'];
|
|
13
|
+
/** CSS-класс */
|
|
14
|
+
className?: string;
|
|
15
|
+
}>;
|
|
3
16
|
/** Компонента для "заглушки" вместо карточек в панели */
|
|
4
|
-
export declare function NotificationPanelBlank({ icon, className, ...
|
|
17
|
+
export declare function NotificationPanelBlank({ icon, iconAppearance, title, description, className, ...rest }: NotificationPanelBlankProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,13 +9,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx,
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import cn from 'classnames';
|
|
14
|
-
import {
|
|
14
|
+
import { IconPredefined } from '@snack-uikit/icon-predefined';
|
|
15
|
+
import { Typography } from '@snack-uikit/typography';
|
|
16
|
+
import { extractSupportProps } from '@snack-uikit/utils';
|
|
17
|
+
import { TEST_IDS } from '../../constants';
|
|
15
18
|
import styles from './styles.module.css';
|
|
16
19
|
/** Компонента для "заглушки" вместо карточек в панели */
|
|
17
20
|
export function NotificationPanelBlank(_a) {
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
return (_jsx(_Fragment, { children: _jsx(InfoBlock, Object.assign({}, props, { icon: icon ? Object.assign(Object.assign({}, icon), { appearance: (_b = icon.appearance) !== null && _b !== void 0 ? _b : 'neutral' }) : undefined, size: 'l', align: 'vertical', className: cn(styles.notificationPanelBlank, className) })) }));
|
|
21
|
+
var { icon, iconAppearance = 'neutral', title, description, className } = _a, rest = __rest(_a, ["icon", "iconAppearance", "title", "description", "className"]);
|
|
22
|
+
return (_jsxs("div", Object.assign({ className: cn(styles.notificationPanelBlank, className) }, extractSupportProps(rest), { children: [icon && _jsx(IconPredefined, { icon: icon, appearance: iconAppearance, size: 'l', "data-test-id": TEST_IDS.blank.icon }), _jsxs("div", { className: styles.notificationPanelBlankContent, children: [_jsx(Typography.SansTitleS, { tag: 'div', className: styles.notificationPanelBlankTitle, "data-test-id": TEST_IDS.blank.title, children: title }), _jsx(Typography.SansBodyM, { tag: 'div', className: styles.notificationPanelBlankDescription, "data-test-id": TEST_IDS.blank.description, children: description })] })] })));
|
|
21
23
|
}
|
package/dist/components/NotificationPanel/components/NotificationPanelBlank/styles.module.css
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
1
|
.notificationPanelBlank{
|
|
2
|
-
|
|
2
|
+
gap:var(--space-notification-panel-blank-gap, 16px);
|
|
3
|
+
padding-top:var(--space-notification-panel-blank-vertical-padding, 24px);
|
|
4
|
+
padding-bottom:var(--space-notification-panel-blank-vertical-padding, 24px);
|
|
5
|
+
display:flex;
|
|
6
|
+
flex-direction:column;
|
|
7
|
+
align-items:center;
|
|
8
|
+
box-sizing:border-box;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.notificationPanelBlankContent{
|
|
12
|
+
gap:var(--space-notification-panel-blank-text-gap, 4px);
|
|
13
|
+
display:flex;
|
|
14
|
+
flex-direction:column;
|
|
15
|
+
align-items:center;
|
|
16
|
+
box-sizing:border-box;
|
|
17
|
+
text-align:center;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.notificationPanelBlankTitle{
|
|
21
|
+
color:var(--sys-neutral-text-main, #33333b);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.notificationPanelBlankDescription{
|
|
25
|
+
color:var(--sys-neutral-text-support, #656771);
|
|
26
|
+
white-space:pre-line;
|
|
3
27
|
}
|
|
@@ -8,5 +8,10 @@ export const TEST_IDS = {
|
|
|
8
8
|
},
|
|
9
9
|
readAll: 'notification-panel__readAll',
|
|
10
10
|
footerButton: 'notification-panel__footerButton',
|
|
11
|
+
blank: {
|
|
12
|
+
icon: 'notification-panel__blank__icon',
|
|
13
|
+
title: 'notification-panel__blank__title',
|
|
14
|
+
description: 'notification-panel__blank__description',
|
|
15
|
+
},
|
|
11
16
|
skeleton: 'notification-panel__skeleton',
|
|
12
17
|
};
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
border-radius:inherit;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.
|
|
28
|
+
.notificationPanelChips{
|
|
29
|
+
gap:var(--space-notification-panel-header-chips-gap, 8px);
|
|
29
30
|
display:flex;
|
|
30
31
|
align-items:center;
|
|
31
|
-
justify-content:space-between;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.
|
|
35
|
-
gap:var(--space-notification-panel-header-chips-gap, 8px);
|
|
34
|
+
.notificationPanelHeaderFunctions{
|
|
36
35
|
display:flex;
|
|
37
36
|
align-items:center;
|
|
37
|
+
justify-content:space-between;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
.notificationPanelHeadline{
|
|
@@ -94,18 +94,4 @@
|
|
|
94
94
|
.notificationPanelFooterButton:active{
|
|
95
95
|
color:var(--sys-neutral-text-main, #33333b);
|
|
96
96
|
border-color:var(--sys-neutral-decor-default, #dfe2ec);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.wrapper{
|
|
100
|
-
box-sizing:border-box;
|
|
101
|
-
width:100%;
|
|
102
|
-
height:100%;
|
|
103
|
-
display:flex;
|
|
104
|
-
flex-direction:column;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.scrollStub{
|
|
108
|
-
height:calc(var(--dimension-025m, 2px) / 2);
|
|
109
|
-
margin-top:calc(var(--dimension-025m, 2px) / -2);
|
|
110
|
-
background:transparent;
|
|
111
97
|
}
|
package/dist/components/index.js
CHANGED
package/dist/{components → helperComponents}/NotificationPanelPopover/NotificationPanelPopover.d.ts
RENAMED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { PopoverPrivateProps } from '@snack-uikit/popover-private';
|
|
3
3
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
4
|
-
import { NotificationPanel, NotificationPanelProps } from '../NotificationPanel';
|
|
5
4
|
export type NotificationPanelPopoverProps = WithSupportProps<{
|
|
6
|
-
content:
|
|
5
|
+
content: ReactNode;
|
|
7
6
|
/** CSS-класс для элемента содержащего контент */
|
|
8
7
|
contentClassName?: string;
|
|
9
8
|
} & Pick<PopoverPrivateProps, 'className' | 'triggerClassName' | 'open' | 'onOpenChange' | 'hoverDelayOpen' | 'hoverDelayClose' | 'offset' | 'children' | 'closeOnEscapeKey' | 'triggerClickByKeys' | 'triggerRef'> & Partial<Pick<PopoverPrivateProps, 'trigger' | 'placement'>>>;
|
|
10
|
-
/** Компонент-обёртка для NotificationPanel для использования как выпадающий элемент */
|
|
11
9
|
export declare function NotificationPanelPopover({ content, trigger, placement, children, contentClassName, ...otherProps }: NotificationPanelPopoverProps): import("react/jsx-runtime").JSX.Element | null;
|
package/dist/{components → helperComponents}/NotificationPanelPopover/NotificationPanelPopover.js
RENAMED
|
@@ -13,7 +13,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import cn from 'classnames';
|
|
14
14
|
import { PopoverPrivate } from '@snack-uikit/popover-private';
|
|
15
15
|
import styles from './styles.module.css';
|
|
16
|
-
/** Компонент-обёртка для NotificationPanel для использования как выпадающий элемент */
|
|
17
16
|
export function NotificationPanelPopover(_a) {
|
|
18
17
|
var { content, trigger = 'click', placement = 'bottom-end', children, contentClassName } = _a, otherProps = __rest(_a, ["content", "trigger", "placement", "children", "contentClassName"]);
|
|
19
18
|
if (!children) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './NotificationPanelPopover';
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Notification",
|
|
7
|
-
"version": "0.6.17
|
|
7
|
+
"version": "0.6.17",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -32,20 +32,20 @@
|
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"scripts": {},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@snack-uikit/button": "0.16.
|
|
36
|
-
"@snack-uikit/chips": "0.11.
|
|
35
|
+
"@snack-uikit/button": "0.16.1",
|
|
36
|
+
"@snack-uikit/chips": "0.11.7",
|
|
37
|
+
"@snack-uikit/icon-predefined": "0.4.2",
|
|
37
38
|
"@snack-uikit/icons": "0.20.1",
|
|
38
|
-
"@snack-uikit/
|
|
39
|
-
"@snack-uikit/
|
|
40
|
-
"@snack-uikit/list": "0.3.3",
|
|
39
|
+
"@snack-uikit/link": "0.11.2",
|
|
40
|
+
"@snack-uikit/list": "0.3.4",
|
|
41
41
|
"@snack-uikit/popover-private": "0.13.0",
|
|
42
42
|
"@snack-uikit/scroll": "0.5.1",
|
|
43
|
-
"@snack-uikit/skeleton": "0.3.
|
|
44
|
-
"@snack-uikit/tag": "0.7.
|
|
45
|
-
"@snack-uikit/truncate-string": "0.4.
|
|
43
|
+
"@snack-uikit/skeleton": "0.3.3",
|
|
44
|
+
"@snack-uikit/tag": "0.7.4",
|
|
45
|
+
"@snack-uikit/truncate-string": "0.4.8",
|
|
46
46
|
"@snack-uikit/typography": "0.6.1",
|
|
47
47
|
"@snack-uikit/utils": "3.2.0",
|
|
48
48
|
"classnames": "2.3.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "fd079dd3acbfe935d0b88d9efd863047f25e5824"
|
|
51
51
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
2
|
import { MouseEventHandler, ReactElement, ReactNode, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
|
|
4
|
-
import { ButtonSimple, ButtonSimpleProps, ButtonTonal, ButtonTonalProps } from '@snack-uikit/button';
|
|
5
4
|
import { Link, LinkProps } from '@snack-uikit/link';
|
|
6
5
|
import { BaseItemProps } from '@snack-uikit/list';
|
|
7
6
|
import { TruncateString } from '@snack-uikit/truncate-string';
|
|
@@ -40,10 +39,6 @@ export type NotificationCardProps = WithSupportProps<{
|
|
|
40
39
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
41
40
|
/** Колбэк при попадании карточки в область видимости на 80% */
|
|
42
41
|
onVisible?(cardId: string): void;
|
|
43
|
-
/** Кнопка главного действия у карточки */
|
|
44
|
-
primaryButton?: Omit<ButtonTonalProps, 'size' | 'appearance' | 'data-test-id'>;
|
|
45
|
-
/** Кнопка второстепенного действия у карточки */
|
|
46
|
-
secondaryButton?: Omit<ButtonSimpleProps, 'size' | 'appearance' | 'data-test-id'>;
|
|
47
42
|
/** Дополнительные действия у карточки */
|
|
48
43
|
actions?: Action[];
|
|
49
44
|
/** CSS-класс */
|
|
@@ -61,22 +56,15 @@ export function NotificationCard({
|
|
|
61
56
|
link,
|
|
62
57
|
date,
|
|
63
58
|
onClick,
|
|
64
|
-
primaryButton,
|
|
65
|
-
secondaryButton,
|
|
66
59
|
actions,
|
|
67
60
|
onVisible,
|
|
68
61
|
className,
|
|
69
62
|
...rest
|
|
70
63
|
}: NotificationCardProps) {
|
|
71
|
-
const { icon, linkOnColor
|
|
72
|
-
icon: ReturnType<typeof getIcon>;
|
|
73
|
-
linkOnColor: LinkProps['appearance'];
|
|
74
|
-
buttonAppearance: ButtonTonalProps['appearance'];
|
|
75
|
-
}>(
|
|
64
|
+
const { icon, linkOnColor } = useMemo<{ icon: ReturnType<typeof getIcon>; linkOnColor: LinkProps['appearance'] }>(
|
|
76
65
|
() => ({
|
|
77
66
|
icon: getIcon(appearance),
|
|
78
67
|
linkOnColor: appearance === APPEARANCE.ErrorCritical ? 'red' : undefined,
|
|
79
|
-
buttonAppearance: appearance === APPEARANCE.ErrorCritical ? 'destructive' : 'primary',
|
|
80
68
|
}),
|
|
81
69
|
[appearance],
|
|
82
70
|
);
|
|
@@ -156,28 +144,6 @@ export function NotificationCard({
|
|
|
156
144
|
</Typography.SansBodyS>
|
|
157
145
|
)}
|
|
158
146
|
|
|
159
|
-
{(primaryButton || secondaryButton) && (
|
|
160
|
-
<div className={styles.notificationCardButtons}>
|
|
161
|
-
{secondaryButton && (
|
|
162
|
-
<ButtonSimple
|
|
163
|
-
{...secondaryButton}
|
|
164
|
-
appearance={buttonAppearance}
|
|
165
|
-
size='s'
|
|
166
|
-
data-test-id={TEST_IDS.primaryButton}
|
|
167
|
-
/>
|
|
168
|
-
)}
|
|
169
|
-
|
|
170
|
-
{primaryButton && (
|
|
171
|
-
<ButtonTonal
|
|
172
|
-
{...primaryButton}
|
|
173
|
-
appearance={buttonAppearance}
|
|
174
|
-
size='s'
|
|
175
|
-
data-test-id={TEST_IDS.secondaryButton}
|
|
176
|
-
/>
|
|
177
|
-
)}
|
|
178
|
-
</div>
|
|
179
|
-
)}
|
|
180
|
-
|
|
181
147
|
{showFooter && (
|
|
182
148
|
<div className={styles.notificationCardFooter}>
|
|
183
149
|
{link && (
|
|
@@ -18,6 +18,4 @@ export const TEST_IDS = {
|
|
|
18
18
|
droplistTrigger: 'notification-card__droplist-trigger',
|
|
19
19
|
droplistAction: 'notification-card__droplist-action',
|
|
20
20
|
},
|
|
21
|
-
primaryButton: 'notification-card__primary-button',
|
|
22
|
-
secondaryButton: 'notification-card__secondary-button',
|
|
23
21
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { MouseEventHandler, ReactNode, RefObject, useMemo } from 'react';
|
|
1
|
+
import { MouseEventHandler, ReactNode, useMemo } from 'react';
|
|
3
2
|
|
|
4
3
|
import { ButtonFunction, ButtonFunctionProps } from '@snack-uikit/button';
|
|
5
4
|
import { ChipToggle, ChipToggleProps } from '@snack-uikit/chips';
|
|
@@ -7,8 +6,8 @@ import { Scroll } from '@snack-uikit/scroll';
|
|
|
7
6
|
import { SkeletonContextProvider, WithSkeleton } from '@snack-uikit/skeleton';
|
|
8
7
|
import { TruncateString } from '@snack-uikit/truncate-string';
|
|
9
8
|
import { Typography } from '@snack-uikit/typography';
|
|
10
|
-
import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
11
9
|
|
|
10
|
+
import { NotificationPanelPopover, NotificationPanelPopoverProps } from '../../helperComponents';
|
|
12
11
|
import { NotificationCardSkeleton } from '../NotificationCard/components';
|
|
13
12
|
import {
|
|
14
13
|
NotificationPanelBlank,
|
|
@@ -16,13 +15,12 @@ import {
|
|
|
16
15
|
NotificationPanelSettings,
|
|
17
16
|
NotificationPanelSettingsProps,
|
|
18
17
|
} from './components';
|
|
19
|
-
import { NotificationPanelDivider, NotificationPanelDividerProps } from './components/NotificationPanelDivider';
|
|
20
18
|
import { TEST_IDS } from './constants';
|
|
21
19
|
import styles from './styles.module.scss';
|
|
22
20
|
|
|
23
21
|
export type { NotificationPanelBlankProps };
|
|
24
22
|
|
|
25
|
-
export type NotificationPanelProps =
|
|
23
|
+
export type NotificationPanelProps = {
|
|
26
24
|
/** Заголовок панели */
|
|
27
25
|
title: string;
|
|
28
26
|
/** Кнопка настроек и выпадающий список */
|
|
@@ -33,27 +31,25 @@ export type NotificationPanelProps = WithSupportProps<{
|
|
|
33
31
|
readAllButton?: Omit<ButtonFunctionProps, 'data-test-id'> & {
|
|
34
32
|
onClick: ButtonFunctionProps['onClick'];
|
|
35
33
|
};
|
|
34
|
+
/** Элемент для открытия панели */
|
|
35
|
+
triggerElement: NotificationPanelPopoverProps['children'];
|
|
36
36
|
/** Кнопка внизу панели */
|
|
37
37
|
footerButton?: {
|
|
38
38
|
label: string;
|
|
39
39
|
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
40
40
|
};
|
|
41
|
-
className?: string;
|
|
42
41
|
/** Состояние загрузки */
|
|
43
42
|
loading?: boolean;
|
|
44
43
|
/** Контент для отрисовки (e.g NotificationCard | NotificationPanel.Blank) */
|
|
45
44
|
content?: ReactNode;
|
|
46
45
|
/** Количество скелетонов карточек для отображения при загрузке */
|
|
47
46
|
skeletonsAmount?: number;
|
|
48
|
-
|
|
49
|
-
scrollEndRef?: RefObject<HTMLDivElement>;
|
|
50
|
-
/** Ссылка на контейнер, который скроллится */
|
|
51
|
-
scrollContainerRef?: RefObject<HTMLElement>;
|
|
52
|
-
}>;
|
|
47
|
+
} & Omit<NotificationPanelPopoverProps, 'children' | 'content'>;
|
|
53
48
|
|
|
54
49
|
/** Компонент панели для уведомлений */
|
|
55
50
|
export function NotificationPanel({
|
|
56
51
|
title,
|
|
52
|
+
triggerElement,
|
|
57
53
|
settings,
|
|
58
54
|
chips,
|
|
59
55
|
readAllButton,
|
|
@@ -61,72 +57,73 @@ export function NotificationPanel({
|
|
|
61
57
|
content,
|
|
62
58
|
loading,
|
|
63
59
|
skeletonsAmount = 2,
|
|
64
|
-
scrollEndRef,
|
|
65
|
-
scrollContainerRef,
|
|
66
|
-
className,
|
|
67
60
|
...rest
|
|
68
61
|
}: NotificationPanelProps) {
|
|
69
62
|
const skeletons = useMemo(() => Array.from({ length: skeletonsAmount }, (_, i) => i), [skeletonsAmount]);
|
|
70
63
|
|
|
71
64
|
return (
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
65
|
+
<NotificationPanelPopover
|
|
66
|
+
{...rest}
|
|
67
|
+
content={
|
|
68
|
+
<>
|
|
69
|
+
<div className={styles.notificationPanelHeader}>
|
|
70
|
+
<div className={styles.notificationPanelHeadline}>
|
|
71
|
+
<Typography.SansHeadlineS className={styles.notificationPanelTitle}>
|
|
72
|
+
<TruncateString text={title} data-test-id={TEST_IDS.title} />
|
|
73
|
+
</Typography.SansHeadlineS>
|
|
78
74
|
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
{settings && <NotificationPanelSettings {...settings} />}
|
|
76
|
+
</div>
|
|
81
77
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
{readAllButton && (
|
|
96
|
-
<ButtonFunction
|
|
97
|
-
{...readAllButton}
|
|
98
|
-
disabled={readAllButton.disabled || loading}
|
|
99
|
-
data-test-id={TEST_IDS.readAll}
|
|
100
|
-
/>
|
|
101
|
-
)}
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
78
|
+
<div className={styles.notificationPanelHeaderFunctions}>
|
|
79
|
+
<div className={styles.notificationPanelChips}>
|
|
80
|
+
{chips?.map(chip => (
|
|
81
|
+
<ChipToggle
|
|
82
|
+
{...chip}
|
|
83
|
+
key={chip.label}
|
|
84
|
+
data-test-id={`${TEST_IDS.chip}-${chip.label}`}
|
|
85
|
+
size='xs'
|
|
86
|
+
disabled={chip.disabled || loading}
|
|
87
|
+
/>
|
|
88
|
+
))}
|
|
89
|
+
</div>
|
|
104
90
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
91
|
+
{readAllButton && (
|
|
92
|
+
<ButtonFunction
|
|
93
|
+
{...readAllButton}
|
|
94
|
+
disabled={readAllButton.disabled || loading}
|
|
95
|
+
data-test-id={TEST_IDS.readAll}
|
|
96
|
+
/>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
114
100
|
|
|
115
|
-
|
|
116
|
-
|
|
101
|
+
<Scroll size='m' className={styles.notificationPanelBody}>
|
|
102
|
+
{loading ? (
|
|
103
|
+
<SkeletonContextProvider loading={loading || false}>
|
|
104
|
+
{skeletons.map(skeleton => (
|
|
105
|
+
<WithSkeleton key={skeleton} skeleton={<NotificationCardSkeleton />} />
|
|
106
|
+
))}
|
|
107
|
+
</SkeletonContextProvider>
|
|
108
|
+
) : (
|
|
109
|
+
content
|
|
110
|
+
)}
|
|
111
|
+
</Scroll>
|
|
117
112
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
113
|
+
{!loading && footerButton && (
|
|
114
|
+
<button className={styles.notificationPanelFooterButton} data-test-id={TEST_IDS.footerButton}>
|
|
115
|
+
<Typography.SansLabelS>{footerButton.label}</Typography.SansLabelS>
|
|
116
|
+
</button>
|
|
117
|
+
)}
|
|
118
|
+
</>
|
|
119
|
+
}
|
|
120
|
+
>
|
|
121
|
+
{triggerElement}
|
|
122
|
+
</NotificationPanelPopover>
|
|
124
123
|
);
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
export namespace NotificationPanel {
|
|
128
127
|
export const Blank: typeof NotificationPanelBlank = NotificationPanelBlank;
|
|
129
128
|
export type BlankProps = NotificationPanelBlankProps;
|
|
130
|
-
export const Divider: typeof NotificationPanelDivider = NotificationPanelDivider;
|
|
131
|
-
export type DividerProps = NotificationPanelDividerProps;
|
|
132
129
|
}
|
|
@@ -1,22 +1,56 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import { IconPredefined, IconPredefinedProps } from '@snack-uikit/icon-predefined';
|
|
5
|
+
import { Typography } from '@snack-uikit/typography';
|
|
6
|
+
import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
4
7
|
|
|
8
|
+
import { TEST_IDS } from '../../constants';
|
|
5
9
|
import styles from './styles.module.scss';
|
|
6
10
|
|
|
7
|
-
export type NotificationPanelBlankProps =
|
|
11
|
+
export type NotificationPanelBlankProps = WithSupportProps<{
|
|
12
|
+
/** Заголовок */
|
|
13
|
+
title: ReactNode;
|
|
14
|
+
/** Описание */
|
|
15
|
+
description?: ReactNode;
|
|
16
|
+
/** Иконка */
|
|
17
|
+
icon?: IconPredefinedProps['icon'];
|
|
18
|
+
/** Цвет обводки для иконки */
|
|
19
|
+
iconAppearance?: IconPredefinedProps['appearance'];
|
|
20
|
+
/** CSS-класс */
|
|
21
|
+
className?: string;
|
|
22
|
+
}>;
|
|
8
23
|
|
|
9
24
|
/** Компонента для "заглушки" вместо карточек в панели */
|
|
10
|
-
export function NotificationPanelBlank({
|
|
25
|
+
export function NotificationPanelBlank({
|
|
26
|
+
icon,
|
|
27
|
+
iconAppearance = 'neutral',
|
|
28
|
+
title,
|
|
29
|
+
description,
|
|
30
|
+
className,
|
|
31
|
+
...rest
|
|
32
|
+
}: NotificationPanelBlankProps) {
|
|
11
33
|
return (
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
34
|
+
<div className={cn(styles.notificationPanelBlank, className)} {...extractSupportProps(rest)}>
|
|
35
|
+
{icon && <IconPredefined icon={icon} appearance={iconAppearance} size='l' data-test-id={TEST_IDS.blank.icon} />}
|
|
36
|
+
|
|
37
|
+
<div className={styles.notificationPanelBlankContent}>
|
|
38
|
+
<Typography.SansTitleS
|
|
39
|
+
tag='div'
|
|
40
|
+
className={styles.notificationPanelBlankTitle}
|
|
41
|
+
data-test-id={TEST_IDS.blank.title}
|
|
42
|
+
>
|
|
43
|
+
{title}
|
|
44
|
+
</Typography.SansTitleS>
|
|
45
|
+
|
|
46
|
+
<Typography.SansBodyM
|
|
47
|
+
tag='div'
|
|
48
|
+
className={styles.notificationPanelBlankDescription}
|
|
49
|
+
data-test-id={TEST_IDS.blank.description}
|
|
50
|
+
>
|
|
51
|
+
{description}
|
|
52
|
+
</Typography.SansBodyM>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
21
55
|
);
|
|
22
56
|
}
|
package/src/components/NotificationPanel/components/NotificationPanelBlank/styles.module.scss
CHANGED
|
@@ -2,5 +2,31 @@
|
|
|
2
2
|
@import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-element';
|
|
3
3
|
|
|
4
4
|
.notificationPanelBlank {
|
|
5
|
-
@include composite-var($notification-panel-
|
|
5
|
+
@include composite-var($notification-panel-blank-container);
|
|
6
|
+
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
align-items: center;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.notificationPanelBlankContent {
|
|
14
|
+
@include composite-var($notification-panel-blank-text);
|
|
15
|
+
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
align-items: center;
|
|
19
|
+
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
|
|
22
|
+
text-align: center;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.notificationPanelBlankTitle {
|
|
26
|
+
color: $sys-neutral-text-main;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.notificationPanelBlankDescription {
|
|
30
|
+
color: $sys-neutral-text-support;
|
|
31
|
+
white-space: pre-line;
|
|
6
32
|
}
|
|
@@ -8,5 +8,10 @@ export const TEST_IDS = {
|
|
|
8
8
|
},
|
|
9
9
|
readAll: 'notification-panel__readAll',
|
|
10
10
|
footerButton: 'notification-panel__footerButton',
|
|
11
|
+
blank: {
|
|
12
|
+
icon: 'notification-panel__blank__icon',
|
|
13
|
+
title: 'notification-panel__blank__title',
|
|
14
|
+
description: 'notification-panel__blank__description',
|
|
15
|
+
},
|
|
11
16
|
skeleton: 'notification-panel__skeleton',
|
|
12
17
|
};
|
|
@@ -29,20 +29,20 @@
|
|
|
29
29
|
border-radius: inherit;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
+
.notificationPanelChips {
|
|
33
|
+
@include composite-var($notification-panel-header-chips);
|
|
32
34
|
|
|
33
|
-
.notificationPanelHeaderFunctions {
|
|
34
35
|
display: flex;
|
|
35
36
|
align-items: center;
|
|
36
|
-
justify-content: space-between;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.
|
|
40
|
-
@include composite-var($notification-panel-header-chips);
|
|
41
|
-
|
|
39
|
+
.notificationPanelHeaderFunctions {
|
|
42
40
|
display: flex;
|
|
43
41
|
align-items: center;
|
|
42
|
+
justify-content: space-between;
|
|
44
43
|
}
|
|
45
44
|
|
|
45
|
+
|
|
46
46
|
.notificationPanelHeadline {
|
|
47
47
|
@include composite-var($notification-panel-header-headline);
|
|
48
48
|
|
|
@@ -107,17 +107,3 @@
|
|
|
107
107
|
border-color: $sys-neutral-decor-default;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
.wrapper {
|
|
112
|
-
box-sizing: border-box;
|
|
113
|
-
width: 100%;
|
|
114
|
-
height: 100%;
|
|
115
|
-
display: flex;
|
|
116
|
-
flex-direction: column;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.scrollStub {
|
|
120
|
-
height: calc($dimension-025m / 2);
|
|
121
|
-
margin-top: calc($dimension-025m / -2);
|
|
122
|
-
background: transparent;
|
|
123
|
-
}
|
package/src/components/index.ts
CHANGED
package/src/{components → helperComponents}/NotificationPanelPopover/NotificationPanelPopover.tsx
RENAMED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
|
-
import {
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
import { PopoverPrivate, PopoverPrivateProps } from '@snack-uikit/popover-private';
|
|
5
5
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
6
6
|
|
|
7
|
-
import { NotificationPanel, NotificationPanelProps } from '../NotificationPanel';
|
|
8
7
|
import styles from './styles.module.scss';
|
|
9
8
|
|
|
10
9
|
export type NotificationPanelPopoverProps = WithSupportProps<
|
|
11
10
|
{
|
|
12
|
-
content:
|
|
11
|
+
content: ReactNode;
|
|
13
12
|
/** CSS-класс для элемента содержащего контент */
|
|
14
13
|
contentClassName?: string;
|
|
15
14
|
} & Pick<
|
|
@@ -29,7 +28,6 @@ export type NotificationPanelPopoverProps = WithSupportProps<
|
|
|
29
28
|
Partial<Pick<PopoverPrivateProps, 'trigger' | 'placement'>>
|
|
30
29
|
>;
|
|
31
30
|
|
|
32
|
-
/** Компонент-обёртка для NotificationPanel для использования как выпадающий элемент */
|
|
33
31
|
export function NotificationPanelPopover({
|
|
34
32
|
content,
|
|
35
33
|
trigger = 'click',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './NotificationPanelPopover';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './NotificationPanelPopover';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { WithSupportProps } from '@snack-uikit/utils';
|
|
2
|
-
export type NotificationPanelDividerProps = WithSupportProps<{
|
|
3
|
-
/** Текст разделителя */
|
|
4
|
-
text: string;
|
|
5
|
-
className?: string;
|
|
6
|
-
}>;
|
|
7
|
-
/** Разделитель для группировки или разделения карточек в списке */
|
|
8
|
-
export declare function NotificationPanelDivider({ text, className, ...rest }: NotificationPanelDividerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import cn from 'classnames';
|
|
14
|
-
import { Typography } from '@snack-uikit/typography';
|
|
15
|
-
import { extractSupportProps } from '@snack-uikit/utils';
|
|
16
|
-
import styles from './styles.module.css';
|
|
17
|
-
/** Разделитель для группировки или разделения карточек в списке */
|
|
18
|
-
export function NotificationPanelDivider(_a) {
|
|
19
|
-
var { text, className } = _a, rest = __rest(_a, ["text", "className"]);
|
|
20
|
-
return (_jsx(Typography.LightLabelS, Object.assign({ className: cn(styles.notificationPanelDivider, className) }, extractSupportProps(rest), { children: text })));
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './NotificationPanelDivider';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './NotificationPanelDivider';
|
package/dist/components/NotificationPanel/components/NotificationPanelDivider/styles.module.css
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
.notificationPanelDivider{
|
|
2
|
-
height:var(--size-notification-panel-readed-divider, 32px);
|
|
3
|
-
border-bottom-width:var(--border-width-notification-panel-container, 1px);
|
|
4
|
-
display:flex;
|
|
5
|
-
align-items:center;
|
|
6
|
-
justify-content:center;
|
|
7
|
-
color:var(--sys-neutral-text-light, #868892);
|
|
8
|
-
border-bottom-color:var(--sys-neutral-decor-default, #dfe2ec);
|
|
9
|
-
border-bottom-style:solid;
|
|
10
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import cn from 'classnames';
|
|
2
|
-
|
|
3
|
-
import { Typography } from '@snack-uikit/typography';
|
|
4
|
-
import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
5
|
-
|
|
6
|
-
import styles from './styles.module.scss';
|
|
7
|
-
|
|
8
|
-
export type NotificationPanelDividerProps = WithSupportProps<{
|
|
9
|
-
/** Текст разделителя */
|
|
10
|
-
text: string;
|
|
11
|
-
className?: string;
|
|
12
|
-
}>;
|
|
13
|
-
|
|
14
|
-
/** Разделитель для группировки или разделения карточек в списке */
|
|
15
|
-
export function NotificationPanelDivider({ text, className, ...rest }: NotificationPanelDividerProps) {
|
|
16
|
-
return (
|
|
17
|
-
<Typography.LightLabelS className={cn(styles.notificationPanelDivider, className)} {...extractSupportProps(rest)}>
|
|
18
|
-
{text}
|
|
19
|
-
</Typography.LightLabelS>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './NotificationPanelDivider';
|
package/src/components/NotificationPanel/components/NotificationPanelDivider/styles.module.scss
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
@import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-notification-notificationPanel';
|
|
2
|
-
|
|
3
|
-
.notificationPanelDivider {
|
|
4
|
-
@include composite-var($notification-panel-readed-divider);
|
|
5
|
-
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
|
|
10
|
-
color: $sys-neutral-text-light;
|
|
11
|
-
|
|
12
|
-
border-bottom-color: $sys-neutral-decor-default;
|
|
13
|
-
border-bottom-style: solid;
|
|
14
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{src/components/NotificationPanelPopover/index.ts → dist/helperComponents/index.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|