@cloud-ru/ds-uikit-product-notification 2.0.31 → 2.0.32-preview-04e34550.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.
Files changed (29) hide show
  1. package/README.md +7 -1
  2. package/dist/cjs/components/NotificationCard/NotificationCard.d.ts +3 -2
  3. package/dist/cjs/components/NotificationCard/NotificationCard.js +2 -2
  4. package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.d.ts +3 -2
  5. package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.js +2 -2
  6. package/dist/cjs/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettings.d.ts +3 -2
  7. package/dist/cjs/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettings.js +2 -2
  8. package/dist/cjs/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.d.ts +3 -2
  9. package/dist/cjs/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.js +2 -2
  10. package/dist/cjs/helperComponents/ActionsButton/ActionsButton.d.ts +3 -2
  11. package/dist/cjs/helperComponents/ActionsButton/ActionsButton.js +2 -2
  12. package/dist/esm/components/NotificationCard/NotificationCard.d.ts +3 -2
  13. package/dist/esm/components/NotificationCard/NotificationCard.js +2 -2
  14. package/dist/esm/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.d.ts +3 -2
  15. package/dist/esm/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.js +2 -2
  16. package/dist/esm/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettings.d.ts +3 -2
  17. package/dist/esm/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettings.js +2 -2
  18. package/dist/esm/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.d.ts +3 -2
  19. package/dist/esm/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.js +2 -2
  20. package/dist/esm/helperComponents/ActionsButton/ActionsButton.d.ts +3 -2
  21. package/dist/esm/helperComponents/ActionsButton/ActionsButton.js +2 -2
  22. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  23. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  24. package/package.json +19 -19
  25. package/src/components/NotificationCard/NotificationCard.tsx +41 -34
  26. package/src/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.tsx +21 -14
  27. package/src/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettings.tsx +17 -3
  28. package/src/components/NotificationPanel/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.tsx +10 -3
  29. package/src/helperComponents/ActionsButton/ActionsButton.tsx +6 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-ru/ds-uikit-product-notification",
3
- "version": "2.0.31",
3
+ "version": "2.0.32-preview-04e34550.0",
4
4
  "description": "Пакет уведомлений — карточка NotificationCard, лента NotificationPanelContent со стеками и группами и адаптивная обёртка NotificationPanel (drawer на desktop, bottom-sheet на mobile).",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,24 +34,24 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "classnames": "^2.5.1",
37
- "@cloud-ru/ds-adaptive": "^1.0.2",
38
- "@cloud-ru/ds-button": "^1.0.4",
39
- "@cloud-ru/ds-chips": "^1.1.12",
40
- "@cloud-ru/ds-drawer": "^2.1.2",
41
- "@cloud-ru/ds-icons": "^1.6.0",
42
- "@cloud-ru/ds-link": "^1.0.15",
43
- "@cloud-ru/ds-info-block": "^1.0.3",
44
- "@cloud-ru/ds-list": "^2.3.6",
45
- "@cloud-ru/ds-materials": "^2.0.1",
46
- "@cloud-ru/ds-scroll": "^1.0.5",
47
- "@cloud-ru/ds-status": "^1.1.10",
48
- "@cloud-ru/ds-skeleton": "^1.0.2",
49
- "@cloud-ru/ds-tag": "^1.1.14",
50
- "@cloud-ru/ds-segment-control": "^1.0.15",
51
- "@cloud-ru/ds-truncate-string": "^1.0.14",
52
- "@cloud-ru/ds-typography": "^1.0.2",
53
- "@cloud-ru/ds-tooltip": "^1.0.13",
54
- "@cloud-ru/ds-utils": "^1.2.0"
37
+ "@cloud-ru/ds-adaptive": "1.0.2",
38
+ "@cloud-ru/ds-button": "1.0.4",
39
+ "@cloud-ru/ds-icons": "1.6.0",
40
+ "@cloud-ru/ds-drawer": "2.1.2",
41
+ "@cloud-ru/ds-info-block": "1.0.3",
42
+ "@cloud-ru/ds-chips": "1.1.13-preview-04e34550.0",
43
+ "@cloud-ru/ds-link": "1.0.15",
44
+ "@cloud-ru/ds-list": "2.3.7-preview-04e34550.0",
45
+ "@cloud-ru/ds-materials": "2.0.1",
46
+ "@cloud-ru/ds-segment-control": "1.0.15",
47
+ "@cloud-ru/ds-scroll": "1.0.5",
48
+ "@cloud-ru/ds-skeleton": "1.0.2",
49
+ "@cloud-ru/ds-status": "1.1.10",
50
+ "@cloud-ru/ds-tag": "1.1.14",
51
+ "@cloud-ru/ds-tooltip": "1.0.13",
52
+ "@cloud-ru/ds-truncate-string": "1.0.14",
53
+ "@cloud-ru/ds-typography": "1.0.2",
54
+ "@cloud-ru/ds-utils": "1.2.0"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"
@@ -1,6 +1,7 @@
1
1
  import { Button, ButtonProps } from '@cloud-ru/ds-button';
2
2
  import { KebabSVG } from '@cloud-ru/ds-icons/interface/system';
3
3
  import { Link, PickLinkProps } from '@cloud-ru/ds-link';
4
+ import { DroplistProps } from '@cloud-ru/ds-list';
4
5
  import { StatusIndicator } from '@cloud-ru/ds-status';
5
6
  import { TruncateString } from '@cloud-ru/ds-truncate-string';
6
7
  import { Typography } from '@cloud-ru/ds-typography';
@@ -17,40 +18,42 @@ import styles from './styles.module.scss';
17
18
 
18
19
  type NotificationButtonProps = Omit<ButtonProps, 'size' | 'appearance' | 'view' | 'data-test-id'>;
19
20
 
20
- export type NotificationCardProps = WithSupportProps<{
21
- /** Идентификатор уведомления */
22
- id: string;
23
- /** Тип уведомления */
24
- appearance?: Appearance;
25
- /** Лейбл перед заголовком */
26
- label?: string;
27
- /** Управление состоянием прочитано/не прочитано */
28
- unread?: boolean;
29
- /** Заголовок уведомления */
30
- title: string;
31
- /** Описание уведомления — вторичный текст под заголовком */
32
- description?: ReactNode;
33
- /** Ссылка (рендерится как `<a href>` через `@cloud-ru/ds-link`) */
34
- link?: PickLinkProps<'a', 'label' | 'insideText' | 'truncateVariant'>;
35
- /** Дата уведомления */
36
- date: string;
37
- /**
38
- * Колбэк клика по карточке. Делает карточку кликабельной (`role='button'`, фокус с клавиатуры).
39
- * Активация по карточке срабатывает только при фокусе на самой карточке — вложенные кнопки,
40
- * ссылка и меню действий активируются независимо.
41
- */
42
- onClick?: MouseEventHandler<HTMLDivElement>;
43
- /** Колбэк при попадании карточки в область видимости на 80% */
44
- onVisible?(cardId: string): void;
45
- /** Кнопка главного действия у карточки (рендерится как Button view='tonal') */
46
- primaryButton?: NotificationButtonProps;
47
- /** Кнопка второстепенного действия у карточки (рендерится как Button view='simple') */
48
- secondaryButton?: NotificationButtonProps;
49
- /** Дополнительные действия у карточки */
50
- actions?: Action[];
51
- /** CSS-класс */
52
- className?: string;
53
- }>;
21
+ export type NotificationCardProps = WithSupportProps<
22
+ {
23
+ /** Идентификатор уведомления */
24
+ id: string;
25
+ /** Тип уведомления */
26
+ appearance?: Appearance;
27
+ /** Лейбл перед заголовком */
28
+ label?: string;
29
+ /** Управление состоянием прочитано/не прочитано */
30
+ unread?: boolean;
31
+ /** Заголовок уведомления */
32
+ title: string;
33
+ /** Описание уведомления — вторичный текст под заголовком */
34
+ description?: ReactNode;
35
+ /** Ссылка (рендерится как `<a href>` через `@cloud-ru/ds-link`) */
36
+ link?: PickLinkProps<'a', 'label' | 'insideText' | 'truncateVariant'>;
37
+ /** Дата уведомления */
38
+ date: string;
39
+ /**
40
+ * Колбэк клика по карточке. Делает карточку кликабельной (`role='button'`, фокус с клавиатуры).
41
+ * Активация по карточке срабатывает только при фокусе на самой карточке — вложенные кнопки,
42
+ * ссылка и меню действий активируются независимо.
43
+ */
44
+ onClick?: MouseEventHandler<HTMLDivElement>;
45
+ /** Колбэк при попадании карточки в область видимости на 80% */
46
+ onVisible?(cardId: string): void;
47
+ /** Кнопка главного действия у карточки (рендерится как Button view='tonal') */
48
+ primaryButton?: NotificationButtonProps;
49
+ /** Кнопка второстепенного действия у карточки (рендерится как Button view='simple') */
50
+ secondaryButton?: NotificationButtonProps;
51
+ /** Дополнительные действия у карточки */
52
+ actions?: Action[];
53
+ /** CSS-класс */
54
+ className?: string;
55
+ } & Pick<DroplistProps, 'itemRender' | 'groupItemRender'>
56
+ >;
54
57
 
55
58
  const VISIBILITY_THRESHOLD = 0.8;
56
59
 
@@ -70,6 +73,8 @@ export function NotificationCard({
70
73
  actions,
71
74
  onVisible,
72
75
  className,
76
+ itemRender,
77
+ groupItemRender,
73
78
  ...rest
74
79
  }: NotificationCardProps) {
75
80
  const icon = useMemo(() => getIcon(appearance), [appearance]);
@@ -165,6 +170,8 @@ export function NotificationCard({
165
170
  icon={<KebabSVG />}
166
171
  triggerAriaLabel='Действия с уведомлением'
167
172
  testIds={TEST_IDS.card.actions}
173
+ itemRender={itemRender}
174
+ groupItemRender={groupItemRender}
168
175
  />
169
176
  ) : null}
170
177
 
@@ -1,5 +1,6 @@
1
1
  import { Button } from '@cloud-ru/ds-button';
2
2
  import { ChevronDownSVG, ChevronUpSVG, KebabSVG } from '@cloud-ru/ds-icons/interface/system';
3
+ import { DroplistProps } from '@cloud-ru/ds-list';
3
4
  import { TruncateString } from '@cloud-ru/ds-truncate-string';
4
5
  import { Typography } from '@cloud-ru/ds-typography';
5
6
  import { extractSupportProps, WithSupportProps } from '@cloud-ru/ds-utils';
@@ -15,20 +16,22 @@ import { cloneCard } from './utils';
15
16
 
16
17
  const ANIMATION_DURATION = 0.3;
17
18
 
18
- export type NotificationCardStackProps = WithSupportProps<{
19
- /** Заголовок стопки карточек */
20
- title: string;
21
- /** Состояние открыт/закрыт по умолчанию */
22
- defaultOpen?: boolean;
23
- /** Колбек смены состояния открыт/закрыт */
24
- onOpenChanged?(open: boolean): void;
25
- /** Карточки в стопке, видна первая карточка, остальные схлопываются под нее. */
26
- children: Iterable<ReactNode>;
27
- /** Список действий в выпадающем меню */
28
- actions?: Action[];
29
- /** Состояние непрочитанных карточек */
30
- unread?: boolean;
31
- }>;
19
+ export type NotificationCardStackProps = WithSupportProps<
20
+ {
21
+ /** Заголовок стопки карточек */
22
+ title: string;
23
+ /** Состояние открыт/закрыт по умолчанию */
24
+ defaultOpen?: boolean;
25
+ /** Колбек смены состояния открыт/закрыт */
26
+ onOpenChanged?(open: boolean): void;
27
+ /** Карточки в стопке, видна первая карточка, остальные схлопываются под нее. */
28
+ children: Iterable<ReactNode>;
29
+ /** Список действий в выпадающем меню */
30
+ actions?: Action[];
31
+ /** Состояние непрочитанных карточек */
32
+ unread?: boolean;
33
+ } & Pick<DroplistProps, 'itemRender' | 'groupItemRender'>
34
+ >;
32
35
 
33
36
  export function NotificationCardStack({
34
37
  children,
@@ -37,6 +40,8 @@ export function NotificationCardStack({
37
40
  title,
38
41
  actions,
39
42
  unread,
43
+ itemRender,
44
+ groupItemRender,
40
45
  ...rest
41
46
  }: NotificationCardStackProps) {
42
47
  const [actionsOpen, setActionsOpen] = useState(false);
@@ -96,6 +101,8 @@ export function NotificationCardStack({
96
101
  icon={<KebabSVG />}
97
102
  triggerAriaLabel='Действия со стопкой'
98
103
  testIds={TEST_IDS.panel.cardStack.actions}
104
+ itemRender={itemRender}
105
+ groupItemRender={groupItemRender}
99
106
  />
100
107
  )}
101
108
 
@@ -1,5 +1,6 @@
1
1
  import { Button, ButtonProps } from '@cloud-ru/ds-button';
2
2
  import { SettingsSVG } from '@cloud-ru/ds-icons/interface/system';
3
+ import { DroplistProps } from '@cloud-ru/ds-list';
3
4
  import { ElementType } from 'react';
4
5
 
5
6
  import { TEST_IDS } from '../../../../constants';
@@ -12,10 +13,16 @@ export type NotificationPanelSettingsProps = {
12
13
  /** Кнопка дополнительного действия панели */
13
14
  button?: Omit<ButtonProps<ElementType>, 'label' | 'size' | 'view' | 'data-test-id'>;
14
15
  size?: 's' | 'm';
15
- };
16
+ } & Pick<DroplistProps, 'itemRender' | 'groupItemRender'>;
16
17
 
17
18
  /** Кнопка настроек панели уведомлений (с выпадающим списком действий, если переданы). */
18
- export function NotificationPanelSettings({ actions, button, size = 'm' }: NotificationPanelSettingsProps) {
19
+ export function NotificationPanelSettings({
20
+ actions,
21
+ button,
22
+ size = 'm',
23
+ itemRender,
24
+ groupItemRender,
25
+ }: NotificationPanelSettingsProps) {
19
26
  const buttonProps: ButtonProps<ElementType> = {
20
27
  ...button,
21
28
  view: 'function',
@@ -30,5 +37,12 @@ export function NotificationPanelSettings({ actions, button, size = 'm' }: Notif
30
37
  return <Button {...buttonProps} />;
31
38
  }
32
39
 
33
- return <NotificationPanelSettingsDroplist actions={actions} button={buttonProps} />;
40
+ return (
41
+ <NotificationPanelSettingsDroplist
42
+ actions={actions}
43
+ button={buttonProps}
44
+ itemRender={itemRender}
45
+ groupItemRender={groupItemRender}
46
+ />
47
+ );
34
48
  }
@@ -1,5 +1,5 @@
1
1
  import { Button, ButtonProps } from '@cloud-ru/ds-button';
2
- import { Droplist } from '@cloud-ru/ds-list';
2
+ import { Droplist, DroplistProps } from '@cloud-ru/ds-list';
3
3
  import { Tag } from '@cloud-ru/ds-tag';
4
4
  import { ElementType, useState } from 'react';
5
5
 
@@ -10,9 +10,14 @@ import styles from '../../styles.module.scss';
10
10
  type NotificationPanelSettingsDroplistProps = {
11
11
  actions: Action[];
12
12
  button: ButtonProps<ElementType>;
13
- };
13
+ } & Pick<DroplistProps, 'itemRender' | 'groupItemRender'>;
14
14
 
15
- export function NotificationPanelSettingsDroplist({ actions, button }: NotificationPanelSettingsDroplistProps) {
15
+ export function NotificationPanelSettingsDroplist({
16
+ actions,
17
+ button,
18
+ itemRender,
19
+ groupItemRender,
20
+ }: NotificationPanelSettingsDroplistProps) {
16
21
  const [isDroplistOpen, setDroplistOpen] = useState(false);
17
22
 
18
23
  return (
@@ -36,6 +41,8 @@ export function NotificationPanelSettingsDroplist({ actions, button }: Notificat
36
41
  afterContent: tagLabel ? <Tag label={tagLabel} /> : undefined,
37
42
  'data-test-id': `${TEST_IDS.panel.settings.droplistAction}-${index}`,
38
43
  }))}
44
+ itemRender={itemRender}
45
+ groupItemRender={groupItemRender}
39
46
  >
40
47
  <Button {...button} />
41
48
  </Droplist>
@@ -1,5 +1,5 @@
1
1
  import { Button } from '@cloud-ru/ds-button';
2
- import { Droplist } from '@cloud-ru/ds-list';
2
+ import { Droplist, DroplistProps } from '@cloud-ru/ds-list';
3
3
  import { Tag } from '@cloud-ru/ds-tag';
4
4
  import cn from 'classnames';
5
5
  import { Dispatch, ReactElement, SetStateAction } from 'react';
@@ -24,7 +24,7 @@ export type ActionsButtonProps = {
24
24
  triggerAriaLabel: string;
25
25
  testIds: ActionsButtonTestIds;
26
26
  className?: string;
27
- };
27
+ } & Pick<DroplistProps, 'itemRender' | 'groupItemRender'>;
28
28
 
29
29
  export function ActionsButton({
30
30
  actions,
@@ -34,6 +34,8 @@ export function ActionsButton({
34
34
  triggerAriaLabel,
35
35
  testIds,
36
36
  className,
37
+ itemRender,
38
+ groupItemRender,
37
39
  }: ActionsButtonProps) {
38
40
  return (
39
41
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
@@ -58,6 +60,8 @@ export function ActionsButton({
58
60
  'data-test-id': `${testIds.droplistAction}-${index}`,
59
61
  }))}
60
62
  triggerClassName={styles.inlineFlex}
63
+ itemRender={itemRender}
64
+ groupItemRender={groupItemRender}
61
65
  >
62
66
  <Button
63
67
  view='function'