@cloud-ru/ds-uikit-product-notification 1.0.10 → 1.0.11-preview-9005559b.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 +244 -187
- package/dist/cjs/components/NotificationPanel/NotificationPanel.d.ts +47 -13
- package/dist/cjs/components/NotificationPanel/NotificationPanel.js +38 -8
- package/dist/{esm/components/NotificationPanelContent → cjs/components/NotificationPanel}/components/NotificationPanelBlank/styles.module.css +1 -1
- package/dist/cjs/components/NotificationPanel/index.d.ts +1 -0
- package/dist/cjs/components/NotificationPanel/index.js +1 -0
- package/dist/cjs/components/NotificationPanel/styles.module.css +32 -4
- package/dist/cjs/components/index.d.ts +0 -1
- package/dist/cjs/components/index.js +0 -1
- package/dist/cjs/style.css +11 -81
- package/dist/esm/components/NotificationPanel/NotificationPanel.d.ts +47 -13
- package/dist/esm/components/NotificationPanel/NotificationPanel.js +40 -10
- package/dist/{cjs/components/NotificationPanelContent → esm/components/NotificationPanel}/components/NotificationPanelBlank/styles.module.css +1 -1
- package/dist/esm/components/NotificationPanel/index.d.ts +1 -0
- package/dist/esm/components/NotificationPanel/index.js +1 -0
- package/dist/esm/components/NotificationPanel/styles.module.css +32 -4
- package/dist/esm/components/index.d.ts +0 -1
- package/dist/esm/components/index.js +0 -1
- package/dist/esm/style.css +11 -81
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +19 -20
- package/src/components/NotificationPanel/NotificationPanel.tsx +156 -20
- package/src/components/NotificationPanel/components/NotificationPanelBlank/styles.module.scss +4 -0
- package/src/components/NotificationPanel/index.ts +1 -0
- package/src/components/NotificationPanel/styles.module.scss +35 -7
- package/src/components/index.ts +0 -1
- package/dist/cjs/components/NotificationPanelContent/NotificationPanelContent.d.ts +0 -45
- package/dist/cjs/components/NotificationPanelContent/NotificationPanelContent.js +0 -43
- package/dist/cjs/components/NotificationPanelContent/index.d.ts +0 -2
- package/dist/cjs/components/NotificationPanelContent/index.js +0 -18
- package/dist/cjs/components/NotificationPanelContent/styles.module.css +0 -98
- package/dist/esm/components/NotificationPanelContent/NotificationPanelContent.d.ts +0 -45
- package/dist/esm/components/NotificationPanelContent/NotificationPanelContent.js +0 -37
- package/dist/esm/components/NotificationPanelContent/index.d.ts +0 -2
- package/dist/esm/components/NotificationPanelContent/index.js +0 -2
- package/dist/esm/components/NotificationPanelContent/styles.module.css +0 -98
- package/src/components/NotificationPanelContent/NotificationPanelContent.tsx +0 -168
- package/src/components/NotificationPanelContent/components/NotificationPanelBlank/styles.module.scss +0 -5
- package/src/components/NotificationPanelContent/index.ts +0 -2
- package/src/components/NotificationPanelContent/styles.module.scss +0 -116
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/NotificationCardStack.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/NotificationCardStack.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/hooks.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/hooks.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/index.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/index.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/styles.module.css +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/utils.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/utils.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelBlank/NotificationPanelBlank.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelBlank/NotificationPanelBlank.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelBlank/index.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelBlank/index.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/NotificationPanelGroup.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/NotificationPanelGroup.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/index.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/index.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/styles.module.css +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/NotificationPanelSettings.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/NotificationPanelSettings.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/index.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/index.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/index.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/components/index.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/StackTail.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/StackTail.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/index.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/index.js +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/styles.module.css +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/helperComponents/index.d.ts +0 -0
- /package/dist/cjs/components/{NotificationPanelContent → NotificationPanel}/helperComponents/index.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/NotificationCardStack.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/NotificationCardStack.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/hooks.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/hooks.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/index.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/index.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/styles.module.css +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/utils.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/utils.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelBlank/NotificationPanelBlank.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelBlank/NotificationPanelBlank.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelBlank/index.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelBlank/index.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/NotificationPanelGroup.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/NotificationPanelGroup.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/index.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/index.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/styles.module.css +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/NotificationPanelSettings.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/NotificationPanelSettings.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/index.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/index.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/index.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/components/index.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/StackTail.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/StackTail.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/index.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/index.js +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/styles.module.css +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/helperComponents/index.d.ts +0 -0
- /package/dist/esm/components/{NotificationPanelContent → NotificationPanel}/helperComponents/index.js +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/NotificationCardStack.tsx +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/hooks.ts +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/index.ts +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/styles.module.scss +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationCardStack/utils.ts +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelBlank/NotificationPanelBlank.tsx +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelBlank/index.ts +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/NotificationPanelGroup.tsx +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/index.ts +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelGroup/styles.module.scss +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/NotificationPanelSettings.tsx +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.tsx +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/NotificationPanelSettings/index.ts +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/components/index.ts +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/StackTail.tsx +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/index.ts +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/helperComponents/StackTail/styles.module.scss +0 -0
- /package/src/components/{NotificationPanelContent → NotificationPanel}/helperComponents/index.ts +0 -0
package/README.md
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
# Notification
|
|
2
2
|
|
|
3
|
-
`@cloud-ru/ds-uikit-product-notification` — Пакет уведомлений — карточка NotificationCard
|
|
3
|
+
`@cloud-ru/ds-uikit-product-notification` — Пакет уведомлений — карточка NotificationCard и адаптивная панель NotificationPanel со стеками и группами (drawer на desktop, bottom-sheet на mobile).
|
|
4
4
|
|
|
5
|
-
Пакет `@cloud-ru/ds-uikit-product-notification` собирает ленту уведомлений из
|
|
5
|
+
Пакет `@cloud-ru/ds-uikit-product-notification` собирает ленту уведомлений из двух уровней: одиночная карточка и адаптивная панель, которая открывает ленту в drawer или bottom-sheet.
|
|
6
6
|
|
|
7
7
|
- ****NotificationCard**** — одиночная карточка уведомления: тип (`appearance`), состояние `unread`, ссылка, дата, кнопки действий и меню.
|
|
8
|
-
- ****
|
|
9
|
-
- ****NotificationPanel**** — адаптивная обёртка панели: на desktop открывает её в drawer, на mobile — в bottom-sheet (выбор по `layoutType`).
|
|
8
|
+
- ****NotificationPanel**** — панель ленты: заголовок, фильтры, кнопка «прочитать все», слот-список карточек и состояния `loading` / `blank`. Namespace-субкомпоненты `Group`, `Stack`, `Blank`. На desktop открывается в drawer, на mobile — в bottom-sheet (выбор по `layoutType`).
|
|
10
9
|
|
|
11
10
|
## Установка
|
|
12
11
|
|
|
@@ -15,7 +14,7 @@ pnpm add @cloud-ru/ds-uikit-product-notification
|
|
|
15
14
|
```
|
|
16
15
|
|
|
17
16
|
```ts
|
|
18
|
-
import { NotificationCard,
|
|
17
|
+
import { NotificationCard, NotificationPanel } from '@cloud-ru/ds-uikit-product-notification';
|
|
19
18
|
```
|
|
20
19
|
|
|
21
20
|
## NotificationCard
|
|
@@ -26,7 +25,7 @@ import { NotificationCard, NotificationPanelContent, NotificationPanel } from '@
|
|
|
26
25
|
|
|
27
26
|
### Когда использовать
|
|
28
27
|
|
|
29
|
-
- Элемент ленты внутри **`
|
|
28
|
+
- Элемент ленты внутри **`NotificationPanel`**.
|
|
30
29
|
- Отдельная карточка статуса операции (деплой, бэкап, инцидент) в произвольном контейнере.
|
|
31
30
|
|
|
32
31
|
### Анатомия
|
|
@@ -237,34 +236,49 @@ export function DeployFailureCard() {
|
|
|
237
236
|
| `loading` | `boolean \| undefined` | — | Состояние загрузки |
|
|
238
237
|
| `minWidth` | `boolean \| undefined` | — | Минимальная ширина контейнера (`min-width` из токена размера). По умолчанию `true`. <br/> `false` — кнопка сжимается по контенту вместо фиксированного минимума. |
|
|
239
238
|
|
|
240
|
-
##
|
|
239
|
+
## NotificationPanel
|
|
241
240
|
|
|
242
|
-
|
|
241
|
+
Адаптивная панель уведомлений — заголовок, фильтры, кнопка «прочитать все», лента карточек и состояния loading/blank. На desktop открывается в drawer, на mobile в bottom-sheet.
|
|
243
242
|
|
|
244
|
-
|
|
243
|
+
Панель ленты уведомлений: заголовок, опциональные фильтры (segmented control, chip toggle), кнопка «прочитать все», слот-список карточек и состояния `loading` / `blank`. Собрана на `Drawer`, поэтому поверхность адаптивная: на desktop — боковая панель, на mobile — bottom-sheet.
|
|
245
244
|
|
|
246
|
-
Namespace `
|
|
245
|
+
Namespace `NotificationPanel.{Blank, Group, Stack}` — субкомпоненты-композиции для слота `content`.
|
|
247
246
|
|
|
248
247
|
### Когда использовать
|
|
249
248
|
|
|
250
|
-
- Лента
|
|
251
|
-
-
|
|
249
|
+
- Лента уведомлений, открываемая из иконки в шапке или тулбаре.
|
|
250
|
+
- Один и тот же контент панели на desktop и mobile без дублирования разметки.
|
|
252
251
|
|
|
253
252
|
### Анатомия
|
|
254
253
|
|
|
254
|
+
#### Layout type (default `desktop`)
|
|
255
|
+
|
|
256
|
+
Раскладка приходит из `AdaptiveProvider` и определяет поверхность:
|
|
257
|
+
|
|
258
|
+
- `desktop` — drawer (Figma `notificationDrawer`).
|
|
259
|
+
- `mobile` — bottom-sheet (Figma `notificationBottomSheet`), `chipToggle` в этой раскладке не показывается.
|
|
260
|
+
|
|
261
|
+
#### Position (default `right`)
|
|
262
|
+
|
|
263
|
+
Сторона, с которой выезжает панель. Только desktop.
|
|
264
|
+
|
|
265
|
+
#### Width (default `s`)
|
|
266
|
+
|
|
267
|
+
Ширина панели. Только desktop.
|
|
268
|
+
|
|
255
269
|
#### Panel state
|
|
256
270
|
|
|
257
|
-
Состояния панели (соответствуют Figma variant `content`):
|
|
271
|
+
Состояния тела панели (соответствуют Figma variant `content`):
|
|
258
272
|
|
|
259
273
|
- `content` — стандартный список карточек через слот `content`.
|
|
260
274
|
- `loading` — `loading={true}` показывает скелетоны (`skeletonsAmount`, default `2`).
|
|
261
|
-
- `blank` — `content={<
|
|
275
|
+
- `blank` — `content={<NotificationPanel.Blank />}` для пустого состояния и состояния ошибки.
|
|
262
276
|
|
|
263
277
|
#### Субкомпоненты слота `content`
|
|
264
278
|
|
|
265
|
-
- `
|
|
266
|
-
- `
|
|
267
|
-
- `
|
|
279
|
+
- `NotificationPanel.Group` — группа карточек с заголовком.
|
|
280
|
+
- `NotificationPanel.Stack` — стек схлопывающихся карточек. Стек из одной карточки рендерится без обёртки.
|
|
281
|
+
- `NotificationPanel.Blank` — пустое состояние (используется и для ошибки — с иконкой и текстом).
|
|
268
282
|
|
|
269
283
|
### Примеры использования
|
|
270
284
|
|
|
@@ -273,64 +287,71 @@ Namespace `NotificationPanelContent.{Blank, Group, Stack}` — субкомпо
|
|
|
273
287
|
Список карточек через слот content, readAllButton помечает все прочитанными, onVisible — каждую при прокрутке.
|
|
274
288
|
|
|
275
289
|
```tsx
|
|
276
|
-
import {
|
|
290
|
+
import { Button } from '@cloud-ru/ds-button';
|
|
291
|
+
import { APPEARANCE, NotificationCard, NotificationPanel } from '@cloud-ru/ds-uikit-product-notification';
|
|
277
292
|
import { useState } from 'react';
|
|
278
293
|
|
|
279
294
|
export function PanelBasic() {
|
|
295
|
+
const [open, setOpen] = useState(false);
|
|
280
296
|
const [readIds, setReadIds] = useState<Set<string>>(new Set());
|
|
281
297
|
const markRead = (id: string) => setReadIds(prev => (prev.has(id) ? prev : new Set(prev).add(id)));
|
|
282
298
|
|
|
283
299
|
return (
|
|
284
|
-
<
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
300
|
+
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', alignItems: 'center' }}>
|
|
301
|
+
<Button label='Уведомления' view='outline' appearance='neutral' onClick={() => setOpen(true)} />
|
|
302
|
+
<NotificationPanel
|
|
303
|
+
open={open}
|
|
304
|
+
onClose={() => setOpen(false)}
|
|
305
|
+
title='Уведомления'
|
|
306
|
+
readAllButton={{
|
|
307
|
+
label: 'Прочитать всё',
|
|
308
|
+
onClick: () => setReadIds(new Set(['inc-4821', 'quota-var-data', 'deploy-9217', 'backup-1729'])),
|
|
309
|
+
}}
|
|
310
|
+
content={
|
|
311
|
+
<>
|
|
312
|
+
<NotificationCard
|
|
313
|
+
id='inc-4821'
|
|
314
|
+
label='INC-4821'
|
|
315
|
+
appearance={APPEARANCE.Error}
|
|
316
|
+
title='Кластер k8s-prod-1 деградирован'
|
|
317
|
+
description='3 из 5 нод недоступны последние 6 минут.'
|
|
318
|
+
date='03:14'
|
|
319
|
+
link={{ label: 'Открыть инцидент', href: '/incidents/INC-4821' }}
|
|
320
|
+
unread={!readIds.has('inc-4821')}
|
|
321
|
+
onVisible={markRead}
|
|
322
|
+
/>
|
|
323
|
+
<NotificationCard
|
|
324
|
+
id='quota-var-data'
|
|
325
|
+
label='Storage'
|
|
326
|
+
appearance={APPEARANCE.Warning}
|
|
327
|
+
title='Лимит дисковой квоты'
|
|
328
|
+
description='Использовано 92% /var/data — осталось 38 ГБ из 480 ГБ.'
|
|
329
|
+
date='02:50'
|
|
330
|
+
unread={!readIds.has('quota-var-data')}
|
|
331
|
+
onVisible={markRead}
|
|
332
|
+
/>
|
|
333
|
+
<NotificationCard
|
|
334
|
+
id='deploy-9217'
|
|
335
|
+
label='api-gateway · v2.18.3'
|
|
336
|
+
appearance={APPEARANCE.Error}
|
|
337
|
+
title='Деплой не прошёл health-check'
|
|
338
|
+
description='Readiness probe вернул 503 на 4 из 6 подов.'
|
|
339
|
+
date='вчера · 23:11'
|
|
340
|
+
unread={!readIds.has('deploy-9217')}
|
|
341
|
+
onVisible={markRead}
|
|
342
|
+
/>
|
|
343
|
+
<NotificationCard
|
|
344
|
+
id='backup-1729'
|
|
345
|
+
label='Backup'
|
|
346
|
+
appearance={APPEARANCE.Success}
|
|
347
|
+
title='Резервная копия завершена'
|
|
348
|
+
description='Бэкап БД prod-1 (412 ГБ) загружен в s3://backups-prod/.'
|
|
349
|
+
date='вчера · 14:32'
|
|
350
|
+
/>
|
|
351
|
+
</>
|
|
352
|
+
}
|
|
353
|
+
/>
|
|
354
|
+
</div>
|
|
334
355
|
);
|
|
335
356
|
}
|
|
336
357
|
```
|
|
@@ -340,25 +361,34 @@ export function PanelBasic() {
|
|
|
340
361
|
loading + skeletonsAmount={4} вместо слота content; фильтры и readAllButton остаются на месте.
|
|
341
362
|
|
|
342
363
|
```tsx
|
|
343
|
-
import {
|
|
364
|
+
import { Button } from '@cloud-ru/ds-button';
|
|
365
|
+
import { NotificationPanel } from '@cloud-ru/ds-uikit-product-notification';
|
|
366
|
+
import { useState } from 'react';
|
|
344
367
|
|
|
345
368
|
export function PanelLoading() {
|
|
369
|
+
const [open, setOpen] = useState(false);
|
|
370
|
+
|
|
346
371
|
return (
|
|
347
|
-
<
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
372
|
+
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', alignItems: 'center' }}>
|
|
373
|
+
<Button label='Уведомления' view='outline' appearance='neutral' onClick={() => setOpen(true)} />
|
|
374
|
+
<NotificationPanel
|
|
375
|
+
open={open}
|
|
376
|
+
onClose={() => setOpen(false)}
|
|
377
|
+
title='Уведомления'
|
|
378
|
+
loading
|
|
379
|
+
skeletonsAmount={4}
|
|
380
|
+
segments={{
|
|
381
|
+
items: [
|
|
382
|
+
{ value: 'all', label: 'Все' },
|
|
383
|
+
{ value: 'unread', label: 'Непрочитанные' },
|
|
384
|
+
{ value: 'mentions', label: 'Упоминания' },
|
|
385
|
+
],
|
|
386
|
+
value: 'all',
|
|
387
|
+
onChange: () => {},
|
|
388
|
+
}}
|
|
389
|
+
readAllButton={{ label: 'Прочитать всё', onClick: () => {} }}
|
|
390
|
+
/>
|
|
391
|
+
</div>
|
|
362
392
|
);
|
|
363
393
|
}
|
|
364
394
|
```
|
|
@@ -368,7 +398,8 @@ export function PanelLoading() {
|
|
|
368
398
|
Segments + chipToggle + settings + readAll, Group для критичных, Stack для повторяющихся алертов квоты по нескольким хостам.
|
|
369
399
|
|
|
370
400
|
```tsx
|
|
371
|
-
import {
|
|
401
|
+
import { Button } from '@cloud-ru/ds-button';
|
|
402
|
+
import { APPEARANCE, NotificationCard, NotificationPanel } from '@cloud-ru/ds-uikit-product-notification';
|
|
372
403
|
import { useMemo, useState } from 'react';
|
|
373
404
|
|
|
374
405
|
type Filter = 'all' | 'unread' | 'mentions';
|
|
@@ -376,6 +407,7 @@ type Filter = 'all' | 'unread' | 'mentions';
|
|
|
376
407
|
type CardId = 'inc-4821' | 'deploy-9217' | 'stack-quota' | 'mention-1' | 'backup-1729';
|
|
377
408
|
|
|
378
409
|
export function PanelFull() {
|
|
410
|
+
const [open, setOpen] = useState(false);
|
|
379
411
|
const [filter, setFilter] = useState<Filter>('all');
|
|
380
412
|
const [importantOnly, setImportantOnly] = useState(false);
|
|
381
413
|
const [muted, setMuted] = useState(false);
|
|
@@ -407,21 +439,21 @@ export function PanelFull() {
|
|
|
407
439
|
|
|
408
440
|
const attentionVisible = visible.inc || visible.deploy;
|
|
409
441
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}}
|
|
418
|
-
|
|
419
|
-
/>
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
442
|
+
const panel = muted ? (
|
|
443
|
+
<NotificationPanel
|
|
444
|
+
open={open}
|
|
445
|
+
onClose={() => setOpen(false)}
|
|
446
|
+
title='Уведомления'
|
|
447
|
+
settings={{
|
|
448
|
+
button: { onClick: () => setMuted(false) },
|
|
449
|
+
actions: [{ content: { label: 'Снять заглушение' }, onClick: () => setMuted(false) }],
|
|
450
|
+
}}
|
|
451
|
+
content={<NotificationPanel.Blank />}
|
|
452
|
+
/>
|
|
453
|
+
) : (
|
|
454
|
+
<NotificationPanel
|
|
455
|
+
open={open}
|
|
456
|
+
onClose={() => setOpen(false)}
|
|
425
457
|
title='Уведомления'
|
|
426
458
|
segments={{
|
|
427
459
|
items: [
|
|
@@ -452,7 +484,7 @@ export function PanelFull() {
|
|
|
452
484
|
content={
|
|
453
485
|
<>
|
|
454
486
|
{attentionVisible && (
|
|
455
|
-
<
|
|
487
|
+
<NotificationPanel.Group title='Требуют внимания'>
|
|
456
488
|
{visible.inc && (
|
|
457
489
|
<NotificationCard
|
|
458
490
|
id='inc-4821'
|
|
@@ -483,12 +515,12 @@ export function PanelFull() {
|
|
|
483
515
|
onVisible={markRead}
|
|
484
516
|
/>
|
|
485
517
|
)}
|
|
486
|
-
</
|
|
518
|
+
</NotificationPanel.Group>
|
|
487
519
|
)}
|
|
488
520
|
|
|
489
521
|
{visible.quota && (
|
|
490
522
|
<>
|
|
491
|
-
<
|
|
523
|
+
<NotificationPanel.Stack
|
|
492
524
|
title='Лимит дисковой квоты · 3 хоста'
|
|
493
525
|
unread={isUnread('stack-quota')}
|
|
494
526
|
actions={[
|
|
@@ -521,7 +553,7 @@ export function PanelFull() {
|
|
|
521
553
|
description='Использовано 84% — осталось 76 ГБ из 480 ГБ.'
|
|
522
554
|
date='вчера · 23:50'
|
|
523
555
|
/>
|
|
524
|
-
</
|
|
556
|
+
</NotificationPanel.Stack>
|
|
525
557
|
</>
|
|
526
558
|
)}
|
|
527
559
|
|
|
@@ -555,29 +587,129 @@ export function PanelFull() {
|
|
|
555
587
|
}
|
|
556
588
|
/>
|
|
557
589
|
);
|
|
590
|
+
|
|
591
|
+
return (
|
|
592
|
+
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', alignItems: 'center' }}>
|
|
593
|
+
<Button label='Уведомления' view='outline' appearance='neutral' onClick={() => setOpen(true)} />
|
|
594
|
+
{panel}
|
|
595
|
+
</div>
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
#### Открытие из кнопки в шапке
|
|
601
|
+
|
|
602
|
+
Триггер со счётчиком непрочитанных и useState для open/close.
|
|
603
|
+
|
|
604
|
+
```tsx
|
|
605
|
+
import { Button } from '@cloud-ru/ds-button';
|
|
606
|
+
import { APPEARANCE, NotificationCard, NotificationPanel } from '@cloud-ru/ds-uikit-product-notification';
|
|
607
|
+
import { useMemo, useState } from 'react';
|
|
608
|
+
|
|
609
|
+
export function PanelScenario() {
|
|
610
|
+
const [open, setOpen] = useState(false);
|
|
611
|
+
const [readIds, setReadIds] = useState<Set<string>>(new Set());
|
|
612
|
+
|
|
613
|
+
const unreadCount = useMemo(() => ['inc-4821', 'deploy-9217'].filter(id => !readIds.has(id)).length, [readIds]);
|
|
614
|
+
|
|
615
|
+
const markRead = (id: string) => setReadIds(prev => (prev.has(id) ? prev : new Set(prev).add(id)));
|
|
616
|
+
|
|
617
|
+
return (
|
|
618
|
+
<div
|
|
619
|
+
style={{
|
|
620
|
+
display: 'flex',
|
|
621
|
+
justifyContent: 'flex-end',
|
|
622
|
+
alignItems: 'center',
|
|
623
|
+
padding: '12px 16px',
|
|
624
|
+
minHeight: 56,
|
|
625
|
+
}}
|
|
626
|
+
>
|
|
627
|
+
<Button
|
|
628
|
+
label={unreadCount > 0 ? `Уведомления · ${unreadCount}` : 'Уведомления'}
|
|
629
|
+
view='outline'
|
|
630
|
+
appearance='neutral'
|
|
631
|
+
onClick={() => setOpen(true)}
|
|
632
|
+
/>
|
|
633
|
+
<NotificationPanel
|
|
634
|
+
open={open}
|
|
635
|
+
onClose={() => setOpen(false)}
|
|
636
|
+
title='Уведомления'
|
|
637
|
+
readAllButton={{
|
|
638
|
+
label: 'Прочитать всё',
|
|
639
|
+
onClick: () => setReadIds(new Set(['inc-4821', 'deploy-9217'])),
|
|
640
|
+
}}
|
|
641
|
+
content={
|
|
642
|
+
<>
|
|
643
|
+
<NotificationCard
|
|
644
|
+
id='inc-4821'
|
|
645
|
+
label='INC-4821'
|
|
646
|
+
appearance={APPEARANCE.Error}
|
|
647
|
+
title='Кластер k8s-prod-1 деградирован'
|
|
648
|
+
description='3 из 5 нод недоступны последние 6 минут.'
|
|
649
|
+
date='03:14'
|
|
650
|
+
link={{ label: 'Открыть инцидент', href: '/incidents/INC-4821' }}
|
|
651
|
+
unread={!readIds.has('inc-4821')}
|
|
652
|
+
onVisible={markRead}
|
|
653
|
+
/>
|
|
654
|
+
<NotificationCard
|
|
655
|
+
id='deploy-9217'
|
|
656
|
+
label='api-gateway · v2.18.3'
|
|
657
|
+
appearance={APPEARANCE.Error}
|
|
658
|
+
title='Деплой не прошёл health-check'
|
|
659
|
+
description='Readiness probe вернул 503 на 4 из 6 подов.'
|
|
660
|
+
date='02:50'
|
|
661
|
+
primaryButton={{ label: 'Повторить', onClick: () => markRead('deploy-9217') }}
|
|
662
|
+
secondaryButton={{
|
|
663
|
+
label: 'Логи',
|
|
664
|
+
onClick: () => window.open('/logs/api-gateway/2.18.3', '_blank'),
|
|
665
|
+
}}
|
|
666
|
+
unread={!readIds.has('deploy-9217')}
|
|
667
|
+
onVisible={markRead}
|
|
668
|
+
/>
|
|
669
|
+
<NotificationCard
|
|
670
|
+
id='backup-1729'
|
|
671
|
+
label='Backup'
|
|
672
|
+
appearance={APPEARANCE.Success}
|
|
673
|
+
title='Резервная копия завершена'
|
|
674
|
+
description='prod-1 (412 ГБ) → s3://backups-prod/2026-05-26/'
|
|
675
|
+
date='вчера · 14:32'
|
|
676
|
+
/>
|
|
677
|
+
</>
|
|
678
|
+
}
|
|
679
|
+
/>
|
|
680
|
+
</div>
|
|
681
|
+
);
|
|
558
682
|
}
|
|
559
683
|
```
|
|
560
684
|
|
|
561
685
|
### Props
|
|
562
686
|
|
|
563
|
-
####
|
|
687
|
+
#### NotificationPanel
|
|
564
688
|
|
|
565
|
-
**
|
|
689
|
+
**NotificationPanelProps**
|
|
566
690
|
|
|
567
691
|
| Prop | Type | Default | Description |
|
|
568
692
|
|------|------|---------|-------------|
|
|
569
|
-
| `chipToggle` | `{ label: string; checked: boolean; onChange(checked: boolean): void; }` | — | Переключатель для
|
|
570
|
-
| `className` | `string` | — |
|
|
571
|
-
| `
|
|
693
|
+
| `chipToggle` | `{ label: string; checked: boolean; onChange(checked: boolean): void; }` | — | Переключатель для фильтрации. Только desktop: в мастере bottomSheet его нет. |
|
|
694
|
+
| `className` | `string` | — | CSS-класс для элемента с контентом <br/> CSS-класс |
|
|
695
|
+
| `closeOnPopstate` | `boolean` | — | Закрывать дровер при перемещении по истории браузера |
|
|
696
|
+
| `container` | `string \| HTMLElement` | — | Контейнер в котором будет рендерится Drawer. По-умолчанию - body |
|
|
697
|
+
| `content` | `ReactNode` | — | Контент для отрисовки (e.g NotificationCard \| NotificationPanel.Blank) |
|
|
572
698
|
| `data-test-id` | `string` | — | |
|
|
573
699
|
| `loading` | `boolean` | — | Состояние загрузки |
|
|
700
|
+
| `onClose` | `() => void` | — | Колбэк закрытия |
|
|
701
|
+
| `open` | `boolean` | — | Управление состоянием показан/не показан. |
|
|
702
|
+
| `position` | `"bottom"` \| `"left"` \| `"right"` \| `"top"` | `right` | Расположение |
|
|
574
703
|
| `readAllButton` | `ButtonProps` \| `TooltipProps` | — | Кнопка в "шапке" панели |
|
|
704
|
+
| `rootClassName` | `string` | — | CSS-класс для корневого элемента |
|
|
575
705
|
| `scrollContainerRef` | `RefObject<HTMLElement>` | — | Ссылка на контейнер, который скроллится |
|
|
576
706
|
| `scrollEndRef` | `RefObject<HTMLDivElement>` | — | Ссылка на элемент, обозначающий самый конец прокручиваемого списка |
|
|
577
707
|
| `segments` | `SegmentControlProps` | — | Сегменты для фильтрации |
|
|
578
708
|
| `settings` | `NotificationPanelSettingsProps` | — | Кнопка настроек и выпадающий список |
|
|
709
|
+
| `showBlackout` | `boolean` | `true` | Отображение темной подложки |
|
|
579
710
|
| `skeletonsAmount` | `number` | `2` | Количество скелетонов карточек для отображения при загрузке |
|
|
580
711
|
| `title` | `string` | — | Заголовок панели |
|
|
712
|
+
| `width` | `Width` | `s` | Ширина (только при position: "left" \| "right") |
|
|
581
713
|
|
|
582
714
|
##### Related types
|
|
583
715
|
|
|
@@ -599,7 +731,7 @@ export function PanelFull() {
|
|
|
599
731
|
| `button` | `ButtonProps` | — | Кнопка дополнительного действия панели |
|
|
600
732
|
| `size` | `"m"` \| `"s"` | — | |
|
|
601
733
|
|
|
602
|
-
####
|
|
734
|
+
#### NotificationPanel.Stack
|
|
603
735
|
|
|
604
736
|
**NotificationCardStackProps**
|
|
605
737
|
|
|
@@ -625,7 +757,7 @@ export function PanelFull() {
|
|
|
625
757
|
| `onClick` | `((e: MouseEvent<HTMLElement>) => void) \| undefined` | — | Колбек обработки клика |
|
|
626
758
|
| `tagLabel` | `string \| undefined` | — | Лейбл-тег справа от текста |
|
|
627
759
|
|
|
628
|
-
####
|
|
760
|
+
#### NotificationPanel.Group
|
|
629
761
|
|
|
630
762
|
**NotificationPanelGroupProps**
|
|
631
763
|
|
|
@@ -636,7 +768,7 @@ export function PanelFull() {
|
|
|
636
768
|
| `data-test-id` | `string` | — | |
|
|
637
769
|
| `title` | `string` | — | Заголовок группы |
|
|
638
770
|
|
|
639
|
-
####
|
|
771
|
+
#### NotificationPanel.Blank
|
|
640
772
|
|
|
641
773
|
**NotificationPanelBlankProps**
|
|
642
774
|
|
|
@@ -647,78 +779,3 @@ export function PanelFull() {
|
|
|
647
779
|
| `data-test-id` | `string` | — | |
|
|
648
780
|
| `icon` | `IconPredefinedProps` | — | Иконка |
|
|
649
781
|
| `title` | `string` | — | Заголовок |
|
|
650
|
-
|
|
651
|
-
## NotificationPanel
|
|
652
|
-
|
|
653
|
-
Адаптивная обёртка панели уведомлений — на desktop открывает NotificationPanelContent в drawer, на mobile в bottom-sheet (выбор по layoutType).
|
|
654
|
-
|
|
655
|
-
Адаптивная обёртка **`NotificationPanelContent`**. На desktop открывает панель в drawer, на mobile — в bottom-sheet. Выбор раскладки — по `layoutType` (как у `Widget` / `Toolbar`).
|
|
656
|
-
|
|
657
|
-
Контент передаётся пропом `content` как элемент `<NotificationPanelContent />`, а не как пропсы.
|
|
658
|
-
|
|
659
|
-
### Когда использовать
|
|
660
|
-
|
|
661
|
-
- Лента уведомлений, открываемая из иконки в шапке или тулбаре.
|
|
662
|
-
- Один и тот же контент панели на desktop и mobile без дублирования разметки.
|
|
663
|
-
|
|
664
|
-
### Анатомия
|
|
665
|
-
|
|
666
|
-
#### Layout type (default `desktop`)
|
|
667
|
-
|
|
668
|
-
Тип раскладки определяет обёртку:
|
|
669
|
-
|
|
670
|
-
- `desktop` — drawer (Figma `notificationDrawer`).
|
|
671
|
-
- `mobile` — bottom-sheet (Figma `notificationBottomSheet`).
|
|
672
|
-
|
|
673
|
-
#### Position (default `right`)
|
|
674
|
-
|
|
675
|
-
Сторона, с которой выезжает drawer. Только для `desktop`.
|
|
676
|
-
|
|
677
|
-
#### Width (default `s`)
|
|
678
|
-
|
|
679
|
-
Ширина drawer. Только для `desktop`.
|
|
680
|
-
|
|
681
|
-
### Props
|
|
682
|
-
|
|
683
|
-
**NotificationPanelProps**
|
|
684
|
-
|
|
685
|
-
| Prop | Type | Default | Description |
|
|
686
|
-
|------|------|---------|-------------|
|
|
687
|
-
| `className` | `string` | — | CSS-класс для элемента с контентом |
|
|
688
|
-
| `closeOnPopstate` | `boolean` | — | Закрывать дровер при перемещении по истории браузера |
|
|
689
|
-
| `container` | `string \| HTMLElement` | — | Контейнер в котором будет рендерится Drawer. По-умолчанию - body |
|
|
690
|
-
| `content` | `NotificationPanelContentProps` | — | Контент панели (`NotificationPanelContent`), отображаемый внутри обёртки |
|
|
691
|
-
| `data-test-id` | `string` | — | |
|
|
692
|
-
| `onClose` | `() => void` | — | Колбэк закрытия |
|
|
693
|
-
| `open` | `boolean` | — | Управление состоянием показан/не показан. |
|
|
694
|
-
| `position` | `"bottom"` \| `"left"` \| `"right"` \| `"top"` | `right` | Расположение |
|
|
695
|
-
| `rootClassName` | `string` | — | CSS-класс для корневого элемента |
|
|
696
|
-
| `showBlackout` | `boolean` | `true` | Отображение темной подложки |
|
|
697
|
-
| `width` | `Width` | `s` | Ширина (только при position: "left" \| "right") |
|
|
698
|
-
|
|
699
|
-
##### Related types
|
|
700
|
-
|
|
701
|
-
**NotificationPanelContentProps**
|
|
702
|
-
|
|
703
|
-
| Prop | Type | Default | Description |
|
|
704
|
-
|------|------|---------|-------------|
|
|
705
|
-
| `chipToggle` | `{ label: string; checked: boolean; onChange(checked: boolean): void; } \| undefined` | — | Переключатель для фильтрации |
|
|
706
|
-
| `className` | `string \| undefined` | — | |
|
|
707
|
-
| `content` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | Контент для отрисовки (e.g NotificationCard \| NotificationPanelContent.Blank) |
|
|
708
|
-
| `data-test-id` | `string \| undefined` | — | |
|
|
709
|
-
| `loading` | `boolean \| undefined` | — | Состояние загрузки |
|
|
710
|
-
| `readAllButton` | `ButtonProps` \| `TooltipProps` | — | Кнопка в "шапке" панели |
|
|
711
|
-
| `scrollContainerRef` | `RefObject<HTMLElement> \| undefined` | — | Ссылка на контейнер, который скроллится |
|
|
712
|
-
| `scrollEndRef` | `RefObject<HTMLDivElement> \| undefined` | — | Ссылка на элемент, обозначающий самый конец прокручиваемого списка |
|
|
713
|
-
| `segments` | `SegmentControlProps` | — | Сегменты для фильтрации |
|
|
714
|
-
| `settings` | `NotificationPanelSettingsProps` | — | Кнопка настроек и выпадающий список |
|
|
715
|
-
| `skeletonsAmount` | `number \| undefined` | — | Количество скелетонов карточек для отображения при загрузке |
|
|
716
|
-
| `title` | `string` | — | Заголовок панели |
|
|
717
|
-
|
|
718
|
-
**NotificationPanelSettingsProps**
|
|
719
|
-
|
|
720
|
-
| Prop | Type | Default | Description |
|
|
721
|
-
|------|------|---------|-------------|
|
|
722
|
-
| `actions` | `Action` | — | Дополнительные действия панели |
|
|
723
|
-
| `button` | `ButtonProps` | — | Кнопка дополнительного действия панели |
|
|
724
|
-
| `size` | `"m"` \| `"s"` | — | |
|