@cloud-ru/ds-uikit-product-notification 1.0.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/CHANGELOG.md +8 -0
- package/LICENSE +201 -0
- package/README.md +728 -0
- package/dist/cjs/components/NotificationCard/NotificationCard.d.ts +43 -0
- package/dist/cjs/components/NotificationCard/NotificationCard.js +80 -0
- package/dist/cjs/components/NotificationCard/NotificationCardSkeleton.d.ts +7 -0
- package/dist/cjs/components/NotificationCard/NotificationCardSkeleton.js +16 -0
- package/dist/cjs/components/NotificationCard/helpers.d.ts +4 -0
- package/dist/cjs/components/NotificationCard/helpers.js +31 -0
- package/dist/cjs/components/NotificationCard/index.d.ts +2 -0
- package/dist/cjs/components/NotificationCard/index.js +18 -0
- package/dist/cjs/components/NotificationCard/styles.module.css +216 -0
- package/dist/cjs/components/NotificationPanel/NotificationPanel.d.ts +22 -0
- package/dist/cjs/components/NotificationPanel/NotificationPanel.js +23 -0
- package/dist/cjs/components/NotificationPanel/index.d.ts +1 -0
- package/dist/cjs/components/NotificationPanel/index.js +17 -0
- package/dist/cjs/components/NotificationPanel/styles.module.css +10 -0
- package/dist/cjs/components/NotificationPanelContent/NotificationPanelContent.d.ts +45 -0
- package/dist/cjs/components/NotificationPanelContent/NotificationPanelContent.js +43 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationCardStack/NotificationCardStack.d.ts +18 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationCardStack/NotificationCardStack.js +43 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationCardStack/hooks.d.ts +17 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationCardStack/hooks.js +22 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationCardStack/index.d.ts +1 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationCardStack/index.js +17 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationCardStack/styles.module.css +69 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationCardStack/utils.d.ts +4 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationCardStack/utils.js +11 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelBlank/NotificationPanelBlank.d.ts +4 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelBlank/NotificationPanelBlank.js +15 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelBlank/index.d.ts +1 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelBlank/index.js +17 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelBlank/styles.module.css +3 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelGroup/NotificationPanelGroup.d.ts +12 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelGroup/NotificationPanelGroup.js +17 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelGroup/index.d.ts +1 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelGroup/index.js +17 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelGroup/styles.module.css +35 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelSettings/NotificationPanelSettings.d.ts +12 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelSettings/NotificationPanelSettings.js +24 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.d.ts +9 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.js +27 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelSettings/index.d.ts +1 -0
- package/dist/cjs/components/NotificationPanelContent/components/NotificationPanelSettings/index.js +17 -0
- package/dist/cjs/components/NotificationPanelContent/components/index.d.ts +4 -0
- package/dist/cjs/components/NotificationPanelContent/components/index.js +20 -0
- package/dist/cjs/components/NotificationPanelContent/helperComponents/StackTail/StackTail.d.ts +6 -0
- package/dist/cjs/components/NotificationPanelContent/helperComponents/StackTail/StackTail.js +11 -0
- package/dist/cjs/components/NotificationPanelContent/helperComponents/StackTail/index.d.ts +1 -0
- package/dist/cjs/components/NotificationPanelContent/helperComponents/StackTail/index.js +17 -0
- package/dist/cjs/components/NotificationPanelContent/helperComponents/StackTail/styles.module.css +49 -0
- package/dist/cjs/components/NotificationPanelContent/helperComponents/index.d.ts +1 -0
- package/dist/cjs/components/NotificationPanelContent/helperComponents/index.js +17 -0
- package/dist/cjs/components/NotificationPanelContent/index.d.ts +2 -0
- package/dist/cjs/components/NotificationPanelContent/index.js +18 -0
- package/dist/cjs/components/NotificationPanelContent/styles.module.css +98 -0
- package/dist/cjs/components/index.d.ts +3 -0
- package/dist/cjs/components/index.js +19 -0
- package/dist/cjs/constants.d.ts +57 -0
- package/dist/cjs/constants.js +60 -0
- package/dist/cjs/helperComponents/ActionsButton/ActionsButton.d.ts +19 -0
- package/dist/cjs/helperComponents/ActionsButton/ActionsButton.js +28 -0
- package/dist/cjs/helperComponents/ActionsButton/index.d.ts +1 -0
- package/dist/cjs/helperComponents/ActionsButton/index.js +17 -0
- package/dist/cjs/helperComponents/ActionsButton/styles.module.css +3 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +22 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/style.css +483 -0
- package/dist/cjs/types.d.ts +12 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/utils.d.ts +3 -0
- package/dist/cjs/utils.js +7 -0
- package/dist/esm/components/NotificationCard/NotificationCard.d.ts +43 -0
- package/dist/esm/components/NotificationCard/NotificationCard.js +74 -0
- package/dist/esm/components/NotificationCard/NotificationCardSkeleton.d.ts +7 -0
- package/dist/esm/components/NotificationCard/NotificationCardSkeleton.js +10 -0
- package/dist/esm/components/NotificationCard/helpers.d.ts +4 -0
- package/dist/esm/components/NotificationCard/helpers.js +27 -0
- package/dist/esm/components/NotificationCard/index.d.ts +2 -0
- package/dist/esm/components/NotificationCard/index.js +2 -0
- package/dist/esm/components/NotificationCard/styles.module.css +216 -0
- package/dist/esm/components/NotificationPanel/NotificationPanel.d.ts +22 -0
- package/dist/esm/components/NotificationPanel/NotificationPanel.js +17 -0
- 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 +10 -0
- package/dist/esm/components/NotificationPanelContent/NotificationPanelContent.d.ts +45 -0
- package/dist/esm/components/NotificationPanelContent/NotificationPanelContent.js +37 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationCardStack/NotificationCardStack.d.ts +18 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationCardStack/NotificationCardStack.js +37 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationCardStack/hooks.d.ts +17 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationCardStack/hooks.js +19 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationCardStack/index.d.ts +1 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationCardStack/index.js +1 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationCardStack/styles.module.css +69 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationCardStack/utils.d.ts +4 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationCardStack/utils.js +7 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelBlank/NotificationPanelBlank.d.ts +4 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelBlank/NotificationPanelBlank.js +9 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelBlank/index.d.ts +1 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelBlank/index.js +1 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelBlank/styles.module.css +3 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelGroup/NotificationPanelGroup.d.ts +12 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelGroup/NotificationPanelGroup.js +11 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelGroup/index.d.ts +1 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelGroup/index.js +1 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelGroup/styles.module.css +35 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelSettings/NotificationPanelSettings.d.ts +12 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelSettings/NotificationPanelSettings.js +21 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.d.ts +9 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.js +21 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelSettings/index.d.ts +1 -0
- package/dist/esm/components/NotificationPanelContent/components/NotificationPanelSettings/index.js +1 -0
- package/dist/esm/components/NotificationPanelContent/components/index.d.ts +4 -0
- package/dist/esm/components/NotificationPanelContent/components/index.js +4 -0
- package/dist/esm/components/NotificationPanelContent/helperComponents/StackTail/StackTail.d.ts +6 -0
- package/dist/esm/components/NotificationPanelContent/helperComponents/StackTail/StackTail.js +5 -0
- package/dist/esm/components/NotificationPanelContent/helperComponents/StackTail/index.d.ts +1 -0
- package/dist/esm/components/NotificationPanelContent/helperComponents/StackTail/index.js +1 -0
- package/dist/esm/components/NotificationPanelContent/helperComponents/StackTail/styles.module.css +49 -0
- package/dist/esm/components/NotificationPanelContent/helperComponents/index.d.ts +1 -0
- package/dist/esm/components/NotificationPanelContent/helperComponents/index.js +1 -0
- package/dist/esm/components/NotificationPanelContent/index.d.ts +2 -0
- package/dist/esm/components/NotificationPanelContent/index.js +2 -0
- package/dist/esm/components/NotificationPanelContent/styles.module.css +98 -0
- package/dist/esm/components/index.d.ts +3 -0
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/constants.d.ts +57 -0
- package/dist/esm/constants.js +57 -0
- package/dist/esm/helperComponents/ActionsButton/ActionsButton.d.ts +19 -0
- package/dist/esm/helperComponents/ActionsButton/ActionsButton.js +22 -0
- package/dist/esm/helperComponents/ActionsButton/index.d.ts +1 -0
- package/dist/esm/helperComponents/ActionsButton/index.js +1 -0
- package/dist/esm/helperComponents/ActionsButton/styles.module.css +3 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/style.css +483 -0
- package/dist/esm/types.d.ts +12 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/utils.d.ts +3 -0
- package/dist/esm/utils.js +4 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +60 -0
- package/src/components/NotificationCard/NotificationCard.tsx +252 -0
- package/src/components/NotificationCard/NotificationCardSkeleton.tsx +40 -0
- package/src/components/NotificationCard/helpers.tsx +36 -0
- package/src/components/NotificationCard/index.ts +2 -0
- package/src/components/NotificationCard/styles.module.scss +165 -0
- package/src/components/NotificationPanel/NotificationPanel.tsx +56 -0
- package/src/components/NotificationPanel/index.ts +1 -0
- package/src/components/NotificationPanel/styles.module.scss +15 -0
- package/src/components/NotificationPanelContent/NotificationPanelContent.tsx +168 -0
- package/src/components/NotificationPanelContent/components/NotificationCardStack/NotificationCardStack.tsx +128 -0
- package/src/components/NotificationPanelContent/components/NotificationCardStack/hooks.ts +45 -0
- package/src/components/NotificationPanelContent/components/NotificationCardStack/index.ts +1 -0
- package/src/components/NotificationPanelContent/components/NotificationCardStack/styles.module.scss +90 -0
- package/src/components/NotificationPanelContent/components/NotificationCardStack/utils.ts +11 -0
- package/src/components/NotificationPanelContent/components/NotificationPanelBlank/NotificationPanelBlank.tsx +21 -0
- package/src/components/NotificationPanelContent/components/NotificationPanelBlank/index.ts +1 -0
- package/src/components/NotificationPanelContent/components/NotificationPanelBlank/styles.module.scss +5 -0
- package/src/components/NotificationPanelContent/components/NotificationPanelGroup/NotificationPanelGroup.tsx +31 -0
- package/src/components/NotificationPanelContent/components/NotificationPanelGroup/index.ts +1 -0
- package/src/components/NotificationPanelContent/components/NotificationPanelGroup/styles.module.scss +45 -0
- package/src/components/NotificationPanelContent/components/NotificationPanelSettings/NotificationPanelSettings.tsx +34 -0
- package/src/components/NotificationPanelContent/components/NotificationPanelSettings/NotificationPanelSettingsDroplist.tsx +43 -0
- package/src/components/NotificationPanelContent/components/NotificationPanelSettings/index.ts +1 -0
- package/src/components/NotificationPanelContent/components/index.ts +4 -0
- package/src/components/NotificationPanelContent/helperComponents/StackTail/StackTail.tsx +17 -0
- package/src/components/NotificationPanelContent/helperComponents/StackTail/index.ts +1 -0
- package/src/components/NotificationPanelContent/helperComponents/StackTail/styles.module.scss +85 -0
- package/src/components/NotificationPanelContent/helperComponents/index.ts +1 -0
- package/src/components/NotificationPanelContent/index.ts +2 -0
- package/src/components/NotificationPanelContent/styles.module.scss +116 -0
- package/src/components/index.ts +3 -0
- package/src/constants.ts +58 -0
- package/src/helperComponents/ActionsButton/ActionsButton.tsx +73 -0
- package/src/helperComponents/ActionsButton/index.ts +1 -0
- package/src/helperComponents/ActionsButton/styles.module.scss +3 -0
- package/src/index.ts +4 -0
- package/src/types.ts +15 -0
- package/src/utils.ts +6 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { isMobileLayout, useAdaptiveLayout } from '@cloud-ru/ds-adaptive';
|
|
2
|
+
import { Button, ButtonProps } from '@cloud-ru/ds-button';
|
|
3
|
+
import { ChipToggle } from '@cloud-ru/ds-chips';
|
|
4
|
+
import { Divider } from '@cloud-ru/ds-divider';
|
|
5
|
+
import { DecorCheckedSVG } from '@cloud-ru/ds-icons/interface/product';
|
|
6
|
+
import { Scroll } from '@cloud-ru/ds-scroll';
|
|
7
|
+
import { SegmentControl, SegmentControlProps } from '@cloud-ru/ds-segment-control';
|
|
8
|
+
import { SkeletonContextProvider, WithSkeleton } from '@cloud-ru/ds-skeleton';
|
|
9
|
+
import { TooltipProps, WithTooltip } from '@cloud-ru/ds-tooltip';
|
|
10
|
+
import { TruncateString } from '@cloud-ru/ds-truncate-string';
|
|
11
|
+
import { Typography } from '@cloud-ru/ds-typography';
|
|
12
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
13
|
+
import cn from 'classnames';
|
|
14
|
+
import { ReactNode, RefObject, useMemo } from 'react';
|
|
15
|
+
|
|
16
|
+
import { TEST_IDS } from '../../constants';
|
|
17
|
+
import { NotificationCardSkeleton } from '../NotificationCard/NotificationCardSkeleton';
|
|
18
|
+
import {
|
|
19
|
+
NotificationCardStack,
|
|
20
|
+
NotificationCardStackProps,
|
|
21
|
+
NotificationPanelBlank,
|
|
22
|
+
NotificationPanelBlankProps,
|
|
23
|
+
NotificationPanelGroup,
|
|
24
|
+
NotificationPanelGroupProps,
|
|
25
|
+
NotificationPanelSettings,
|
|
26
|
+
NotificationPanelSettingsProps,
|
|
27
|
+
} from './components';
|
|
28
|
+
import styles from './styles.module.scss';
|
|
29
|
+
|
|
30
|
+
export type NotificationPanelContentProps = WithSupportProps<{
|
|
31
|
+
/** Заголовок панели */
|
|
32
|
+
title: string;
|
|
33
|
+
/** Кнопка настроек и выпадающий список */
|
|
34
|
+
settings?: NotificationPanelSettingsProps;
|
|
35
|
+
/** Сегменты для фильтрации */
|
|
36
|
+
segments?: Omit<SegmentControlProps, 'size' | 'data-test-id'>;
|
|
37
|
+
/** Переключатель для фильтрации */
|
|
38
|
+
chipToggle?: {
|
|
39
|
+
label: string;
|
|
40
|
+
checked: boolean;
|
|
41
|
+
onChange(checked: boolean): void;
|
|
42
|
+
};
|
|
43
|
+
/** Кнопка в "шапке" панели */
|
|
44
|
+
readAllButton?: Omit<ButtonProps, 'data-test-id' | 'size'> & {
|
|
45
|
+
tooltip?: TooltipProps;
|
|
46
|
+
};
|
|
47
|
+
className?: string;
|
|
48
|
+
/** Состояние загрузки */
|
|
49
|
+
loading?: boolean;
|
|
50
|
+
/** Контент для отрисовки (e.g NotificationCard | NotificationPanelContent.Blank) */
|
|
51
|
+
content?: ReactNode;
|
|
52
|
+
/** Количество скелетонов карточек для отображения при загрузке */
|
|
53
|
+
skeletonsAmount?: number;
|
|
54
|
+
/** Ссылка на элемент, обозначающий самый конец прокручиваемого списка */
|
|
55
|
+
scrollEndRef?: RefObject<HTMLDivElement>;
|
|
56
|
+
/** Ссылка на контейнер, который скроллится */
|
|
57
|
+
scrollContainerRef?: RefObject<HTMLElement>;
|
|
58
|
+
}>;
|
|
59
|
+
|
|
60
|
+
const DEFAULT_SKELETONS_AMOUNT = 2;
|
|
61
|
+
|
|
62
|
+
/** Контент панели уведомлений (header + scrollable body + footer). Помещается в обёртку `NotificationPanel`. */
|
|
63
|
+
export function NotificationPanelContent({
|
|
64
|
+
title,
|
|
65
|
+
settings,
|
|
66
|
+
segments,
|
|
67
|
+
readAllButton,
|
|
68
|
+
content,
|
|
69
|
+
loading,
|
|
70
|
+
skeletonsAmount = DEFAULT_SKELETONS_AMOUNT,
|
|
71
|
+
scrollEndRef,
|
|
72
|
+
scrollContainerRef,
|
|
73
|
+
className,
|
|
74
|
+
chipToggle,
|
|
75
|
+
...rest
|
|
76
|
+
}: NotificationPanelContentProps) {
|
|
77
|
+
const { layoutType } = useAdaptiveLayout();
|
|
78
|
+
|
|
79
|
+
const skeletons = useMemo(() => Array.from({ length: skeletonsAmount }, (_, i) => i), [skeletonsAmount]);
|
|
80
|
+
|
|
81
|
+
const { tooltip: readAllTooltip, ...readAllButtonProps } = readAllButton ?? {};
|
|
82
|
+
|
|
83
|
+
const isMobile = isMobileLayout(layoutType);
|
|
84
|
+
|
|
85
|
+
const buttonSize = isMobile ? 's' : 'm';
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div data-layout-type={layoutType} className={cn(styles.wrapper, className)} {...extractSupportProps(rest)}>
|
|
89
|
+
<div className={styles.notificationPanelHeader}>
|
|
90
|
+
<div className={styles.notificationPanelHeadline}>
|
|
91
|
+
<Typography variant='headline' size='s' as='h2' className={styles.notificationPanelTitle}>
|
|
92
|
+
<TruncateString text={title} data-test-id={TEST_IDS.panel.title} />
|
|
93
|
+
</Typography>
|
|
94
|
+
|
|
95
|
+
<div className={styles.notificationPanelHeaderActions}>
|
|
96
|
+
{readAllButton && (
|
|
97
|
+
<WithTooltip tooltip={readAllTooltip}>
|
|
98
|
+
<Button
|
|
99
|
+
{...readAllButtonProps}
|
|
100
|
+
icon={readAllButtonProps.icon || <DecorCheckedSVG />}
|
|
101
|
+
view='function'
|
|
102
|
+
appearance='neutral'
|
|
103
|
+
size={buttonSize}
|
|
104
|
+
disabled={readAllButtonProps.disabled || loading}
|
|
105
|
+
data-test-id={TEST_IDS.panel.readAll}
|
|
106
|
+
/>
|
|
107
|
+
</WithTooltip>
|
|
108
|
+
)}
|
|
109
|
+
|
|
110
|
+
{settings && <NotificationPanelSettings {...settings} size={buttonSize} />}
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<div className={styles.actionsRow}>
|
|
115
|
+
{segments && (
|
|
116
|
+
<SegmentControl
|
|
117
|
+
{...segments}
|
|
118
|
+
size='s'
|
|
119
|
+
items={segments.items.map(item => ({
|
|
120
|
+
...item,
|
|
121
|
+
disabled: item.disabled || loading,
|
|
122
|
+
}))}
|
|
123
|
+
data-test-id={TEST_IDS.panel.segments}
|
|
124
|
+
/>
|
|
125
|
+
)}
|
|
126
|
+
|
|
127
|
+
{!isMobile && chipToggle && (
|
|
128
|
+
<ChipToggle
|
|
129
|
+
size='s'
|
|
130
|
+
disabled={loading}
|
|
131
|
+
label={chipToggle.label}
|
|
132
|
+
onChange={chipToggle.onChange}
|
|
133
|
+
checked={chipToggle.checked}
|
|
134
|
+
data-test-id={TEST_IDS.panel.chipToggle}
|
|
135
|
+
/>
|
|
136
|
+
)}
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
{isMobile && <Divider />}
|
|
141
|
+
|
|
142
|
+
<Scroll size='m' className={styles.scrollArea} ref={scrollContainerRef}>
|
|
143
|
+
<div className={styles.notificationPanelBody} aria-busy={loading || undefined}>
|
|
144
|
+
{content}
|
|
145
|
+
|
|
146
|
+
{loading && (
|
|
147
|
+
<SkeletonContextProvider loading={Boolean(loading)}>
|
|
148
|
+
{skeletons.map(skeleton => (
|
|
149
|
+
<WithSkeleton key={skeleton} skeleton={<NotificationCardSkeleton />} />
|
|
150
|
+
))}
|
|
151
|
+
</SkeletonContextProvider>
|
|
152
|
+
)}
|
|
153
|
+
|
|
154
|
+
<div className={styles.scrollStub} ref={scrollEndRef} />
|
|
155
|
+
</div>
|
|
156
|
+
</Scroll>
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export namespace NotificationPanelContent {
|
|
162
|
+
export const Blank: typeof NotificationPanelBlank = NotificationPanelBlank;
|
|
163
|
+
export type BlankProps = NotificationPanelBlankProps;
|
|
164
|
+
export const Stack: typeof NotificationCardStack = NotificationCardStack;
|
|
165
|
+
export type StackProps = NotificationCardStackProps;
|
|
166
|
+
export const Group: typeof NotificationPanelGroup = NotificationPanelGroup;
|
|
167
|
+
export type GroupProps = NotificationPanelGroupProps;
|
|
168
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Button } from '@cloud-ru/ds-button';
|
|
2
|
+
import { ChevronDownSVG, ChevronUpSVG, KebabSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
3
|
+
import { TruncateString } from '@cloud-ru/ds-truncate-string';
|
|
4
|
+
import { Typography } from '@cloud-ru/ds-typography';
|
|
5
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
6
|
+
import { Children, CSSProperties, ReactNode, useMemo, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { TEST_IDS } from '../../../../constants';
|
|
9
|
+
import { ActionsButton } from '../../../../helperComponents/ActionsButton';
|
|
10
|
+
import { Action } from '../../../../types';
|
|
11
|
+
import { StackTail } from '../../helperComponents/StackTail';
|
|
12
|
+
import { useAnimatedOpening } from './hooks';
|
|
13
|
+
import styles from './styles.module.scss';
|
|
14
|
+
import { cloneCard } from './utils';
|
|
15
|
+
|
|
16
|
+
const ANIMATION_DURATION = 0.3;
|
|
17
|
+
|
|
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
|
+
}>;
|
|
32
|
+
|
|
33
|
+
export function NotificationCardStack({
|
|
34
|
+
children,
|
|
35
|
+
defaultOpen,
|
|
36
|
+
onOpenChanged,
|
|
37
|
+
title,
|
|
38
|
+
actions,
|
|
39
|
+
unread,
|
|
40
|
+
...rest
|
|
41
|
+
}: NotificationCardStackProps) {
|
|
42
|
+
const [actionsOpen, setActionsOpen] = useState(false);
|
|
43
|
+
const { open, toggleOpen, isVisible } = useAnimatedOpening({
|
|
44
|
+
defaultOpen,
|
|
45
|
+
onOpenChanged,
|
|
46
|
+
duration: ANIMATION_DURATION * 1000,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const [first, ...stack] = useMemo(() => Children.toArray(children), [children]);
|
|
50
|
+
|
|
51
|
+
if (!first) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!stack.length) {
|
|
56
|
+
return (
|
|
57
|
+
<div data-test-id={TEST_IDS.panel.cardStack.wrapper} {...extractSupportProps(rest)}>
|
|
58
|
+
{first}
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const firstCardElement = open
|
|
64
|
+
? first
|
|
65
|
+
: cloneCard(first, componentProps => ({
|
|
66
|
+
...componentProps,
|
|
67
|
+
onClick: toggleOpen,
|
|
68
|
+
unread: unread || componentProps.unread,
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div
|
|
73
|
+
className={styles.container}
|
|
74
|
+
style={{ '--snack-notification-stack-animation-duration': `${ANIMATION_DURATION}s` } as CSSProperties}
|
|
75
|
+
data-test-id={TEST_IDS.panel.cardStack.wrapper}
|
|
76
|
+
{...extractSupportProps(rest)}
|
|
77
|
+
>
|
|
78
|
+
<div className={styles.header} data-test-id={TEST_IDS.panel.cardStack.headline}>
|
|
79
|
+
<Typography
|
|
80
|
+
variant='label'
|
|
81
|
+
size='l'
|
|
82
|
+
as='div'
|
|
83
|
+
className={styles.title}
|
|
84
|
+
onClick={toggleOpen}
|
|
85
|
+
aria-expanded={open}
|
|
86
|
+
>
|
|
87
|
+
<TruncateString data-test-id={TEST_IDS.panel.cardStack.title} text={title} />
|
|
88
|
+
</Typography>
|
|
89
|
+
|
|
90
|
+
<div className={styles.right}>
|
|
91
|
+
{actions && actions.length > 0 && (
|
|
92
|
+
<ActionsButton
|
|
93
|
+
actions={actions}
|
|
94
|
+
open={actionsOpen}
|
|
95
|
+
setDroplistOpen={setActionsOpen}
|
|
96
|
+
icon={<KebabSVG />}
|
|
97
|
+
triggerAriaLabel='Действия со стопкой'
|
|
98
|
+
testIds={TEST_IDS.panel.cardStack.actions}
|
|
99
|
+
/>
|
|
100
|
+
)}
|
|
101
|
+
|
|
102
|
+
<Button
|
|
103
|
+
view='function'
|
|
104
|
+
appearance='neutral'
|
|
105
|
+
size='m'
|
|
106
|
+
onClick={toggleOpen}
|
|
107
|
+
aria-label={open ? 'Свернуть стопку' : 'Развернуть стопку'}
|
|
108
|
+
aria-expanded={open}
|
|
109
|
+
data-test-id={TEST_IDS.panel.cardStack.openButton}
|
|
110
|
+
icon={open ? <ChevronUpSVG /> : <ChevronDownSVG />}
|
|
111
|
+
/>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<div className={styles.cards}>
|
|
116
|
+
<div className={styles.first}>
|
|
117
|
+
{/* column-reverse: хвост стопки рисуется под первой карточкой, но её
|
|
118
|
+
focus-outline остаётся поверх хвоста */}
|
|
119
|
+
<StackTail open={open} count={stack.length} />
|
|
120
|
+
{firstCardElement}
|
|
121
|
+
</div>
|
|
122
|
+
<div className={styles.stack} data-open={open || undefined} data-tail-size={stack.length}>
|
|
123
|
+
<div className={styles.animationContainer}>{isVisible ? stack : []}</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useUncontrolledProp } from '@cloud-ru/ds-utils';
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
type UseAnimatedOpeningProps = {
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
onOpenChanged?(open: boolean): void;
|
|
7
|
+
/** Длительность анимации раскрытия/схлопывания, мс. */
|
|
8
|
+
duration: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
type UseAnimatedOpeningResult = {
|
|
12
|
+
open: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Карточки стопки остаются в DOM на время анимации схлопывания, чтобы успел
|
|
15
|
+
* проиграться transition. Сбрасывается в `false` через `duration` после закрытия.
|
|
16
|
+
*/
|
|
17
|
+
isVisible: boolean;
|
|
18
|
+
toggleOpen(): void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export function useAnimatedOpening({
|
|
22
|
+
defaultOpen = false,
|
|
23
|
+
onOpenChanged,
|
|
24
|
+
duration,
|
|
25
|
+
}: UseAnimatedOpeningProps): UseAnimatedOpeningResult {
|
|
26
|
+
const [open, setOpen] = useUncontrolledProp(undefined, defaultOpen, onOpenChanged);
|
|
27
|
+
const [isVisible, setIsVisible] = useState(open);
|
|
28
|
+
const timeout = useRef<ReturnType<typeof setTimeout>>();
|
|
29
|
+
|
|
30
|
+
const toggleOpen = useCallback(() => setOpen(!open), [open, setOpen]);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
clearTimeout(timeout.current);
|
|
34
|
+
|
|
35
|
+
if (open) {
|
|
36
|
+
setIsVisible(true);
|
|
37
|
+
} else {
|
|
38
|
+
timeout.current = setTimeout(() => setIsVisible(false), duration);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return () => clearTimeout(timeout.current);
|
|
42
|
+
}, [open, duration]);
|
|
43
|
+
|
|
44
|
+
return { open, isVisible, toggleOpen };
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './NotificationCardStack';
|
package/src/components/NotificationPanelContent/components/NotificationCardStack/styles.module.scss
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
|
|
3
|
+
$duration: var(--snack-notification-stack-animation-duration);
|
|
4
|
+
|
|
5
|
+
.container {
|
|
6
|
+
position: relative;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: base.$sn-primitive-dimension-8;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.header {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: space-between;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.title {
|
|
19
|
+
cursor: default;
|
|
20
|
+
flex: 1 1 auto;
|
|
21
|
+
min-width: 0;
|
|
22
|
+
color: base.$sn-theme-color-available-version-textMain;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.right {
|
|
26
|
+
display: flex;
|
|
27
|
+
gap: base.$sn-primitive-dimension-4;
|
|
28
|
+
align-items: center;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.cards {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.first {
|
|
37
|
+
position: relative;
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column-reverse;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Контейнер реальной стопки. В открытом состоянии высота `auto`, в закрытом
|
|
43
|
+
// схлопывается до высоты «корешка» хвоста (8px / 4px), в которую плавно
|
|
44
|
+
// уезжает StackTail. `step-end` держит высоту на большем значении до конца
|
|
45
|
+
// перехода, чтобы карточки не обрезались, пока проигрывается сдвиг/затухание
|
|
46
|
+
// внутреннего `.animationContainer`. `allow-discrete` разрешает переход в/из
|
|
47
|
+
// дискретных значений (`auto`, `hidden`).
|
|
48
|
+
.stack {
|
|
49
|
+
position: relative;
|
|
50
|
+
overflow: visible;
|
|
51
|
+
height: auto;
|
|
52
|
+
transition: overflow $duration allow-discrete step-end;
|
|
53
|
+
|
|
54
|
+
&:not([data-open]) {
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
transition: height $duration allow-discrete step-end;
|
|
57
|
+
|
|
58
|
+
&[data-tail-size] {
|
|
59
|
+
height: base.$sn-primitive-dimension-8;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&[data-tail-size='1'] {
|
|
63
|
+
height: base.$sn-primitive-dimension-4;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.animationContainer {
|
|
69
|
+
translate: 0 -100%;
|
|
70
|
+
scale: 0.98;
|
|
71
|
+
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
gap: base.$sn-primitive-dimension-8;
|
|
75
|
+
|
|
76
|
+
margin-top: base.$sn-primitive-dimension-8;
|
|
77
|
+
|
|
78
|
+
opacity: 0;
|
|
79
|
+
|
|
80
|
+
transition:
|
|
81
|
+
translate $duration,
|
|
82
|
+
scale $duration,
|
|
83
|
+
opacity $duration;
|
|
84
|
+
|
|
85
|
+
[data-open] & {
|
|
86
|
+
translate: 0 0;
|
|
87
|
+
scale: 1;
|
|
88
|
+
opacity: 1;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { cloneElement, isValidElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type ComponentProps = Record<string, unknown>;
|
|
4
|
+
|
|
5
|
+
export const cloneCard = (element: ReactNode, props: (componentProps: ComponentProps) => ComponentProps) => {
|
|
6
|
+
if (!isValidElement(element)) {
|
|
7
|
+
return element;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return cloneElement(element, props(element.props as ComponentProps));
|
|
11
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InfoBlock, InfoBlockProps } from '@cloud-ru/ds-info-block';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { TEST_IDS } from '../../../../constants';
|
|
5
|
+
import styles from './styles.module.scss';
|
|
6
|
+
|
|
7
|
+
export type NotificationPanelBlankProps = Omit<InfoBlockProps, 'footer' | 'align' | 'size'>;
|
|
8
|
+
|
|
9
|
+
/** Заглушка вместо карточек в панели */
|
|
10
|
+
export function NotificationPanelBlank({ icon, className, ...props }: NotificationPanelBlankProps) {
|
|
11
|
+
return (
|
|
12
|
+
<InfoBlock
|
|
13
|
+
{...props}
|
|
14
|
+
icon={icon ? { ...icon, appearance: icon.appearance ?? 'neutral' } : undefined}
|
|
15
|
+
size='l'
|
|
16
|
+
align='vertical'
|
|
17
|
+
className={cn(styles.notificationPanelBlank, className)}
|
|
18
|
+
data-test-id={props['data-test-id'] ?? TEST_IDS.panel.blank}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './NotificationPanelBlank';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TruncateString } from '@cloud-ru/ds-truncate-string';
|
|
2
|
+
import { Typography } from '@cloud-ru/ds-typography';
|
|
3
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/ds-utils';
|
|
4
|
+
import cn from 'classnames';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
import { TEST_IDS } from '../../../../constants';
|
|
8
|
+
import styles from './styles.module.scss';
|
|
9
|
+
|
|
10
|
+
export type NotificationPanelGroupProps = WithSupportProps<{
|
|
11
|
+
/** Заголовок группы */
|
|
12
|
+
title: string;
|
|
13
|
+
/** Содержимое группы */
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/** CSS-класс */
|
|
16
|
+
className?: string;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
/** Группа уведомлений с заголовком внутри панели */
|
|
20
|
+
export function NotificationPanelGroup({ title, children, className, ...rest }: NotificationPanelGroupProps) {
|
|
21
|
+
return (
|
|
22
|
+
<div className={cn(styles.root, className)} data-test-id={TEST_IDS.panel.group.root} {...extractSupportProps(rest)}>
|
|
23
|
+
<div className={styles.title} data-test-id={TEST_IDS.panel.group.title}>
|
|
24
|
+
<Typography variant='label' size='s' weight='thin' as='span' className={styles.text}>
|
|
25
|
+
<TruncateString text={title} />
|
|
26
|
+
</Typography>
|
|
27
|
+
</div>
|
|
28
|
+
<div className={styles.content}>{children}</div>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './NotificationPanelGroup';
|
package/src/components/NotificationPanelContent/components/NotificationPanelGroup/styles.module.scss
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: base.$sn-primitive-dimension-8;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.title {
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
|
|
12
|
+
position: sticky;
|
|
13
|
+
z-index: 1;
|
|
14
|
+
top: base.$sn-primitive-dimension-4;
|
|
15
|
+
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.text {
|
|
21
|
+
pointer-events: initial;
|
|
22
|
+
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
|
|
27
|
+
min-height: base.$sn-primitive-dimension-20;
|
|
28
|
+
|
|
29
|
+
color: base.$sn-theme-color-available-version-textDisabled;
|
|
30
|
+
|
|
31
|
+
background-color: base.$sn-theme-color-neutral-background1Level;
|
|
32
|
+
|
|
33
|
+
// повышаем специфичность селектора, чтобы не создавать лишнюю обертку
|
|
34
|
+
&[data-size][data-weight][data-variant] {
|
|
35
|
+
padding-inline: base.$sn-primitive-dimension-8;
|
|
36
|
+
border: base.$sn-primitive-strokeWeight-strokeRegular solid base.$sn-theme-color-neutral-decorTransparent;
|
|
37
|
+
border-radius: base.$sn-density-radius-xl;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.content {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
gap: base.$sn-primitive-dimension-8;
|
|
45
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Button, ButtonProps } from '@cloud-ru/ds-button';
|
|
2
|
+
import { SettingsSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
3
|
+
import { ElementType } from 'react';
|
|
4
|
+
|
|
5
|
+
import { TEST_IDS } from '../../../../constants';
|
|
6
|
+
import { Action } from '../../../../types';
|
|
7
|
+
import { NotificationPanelSettingsDroplist } from './NotificationPanelSettingsDroplist';
|
|
8
|
+
|
|
9
|
+
export type NotificationPanelSettingsProps = {
|
|
10
|
+
/** Дополнительные действия панели */
|
|
11
|
+
actions?: Action[];
|
|
12
|
+
/** Кнопка дополнительного действия панели */
|
|
13
|
+
button?: Omit<ButtonProps<ElementType>, 'label' | 'size' | 'view' | 'data-test-id'>;
|
|
14
|
+
size?: 's' | 'm';
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** Кнопка настроек панели уведомлений (с выпадающим списком действий, если переданы). */
|
|
18
|
+
export function NotificationPanelSettings({ actions, button, size = 'm' }: NotificationPanelSettingsProps) {
|
|
19
|
+
const buttonProps: ButtonProps<ElementType> = {
|
|
20
|
+
...button,
|
|
21
|
+
view: 'function',
|
|
22
|
+
appearance: 'neutral',
|
|
23
|
+
size,
|
|
24
|
+
icon: button?.icon || <SettingsSVG />,
|
|
25
|
+
'aria-label': button?.['aria-label'] ?? 'Настройки уведомлений',
|
|
26
|
+
'data-test-id': TEST_IDS.panel.settings.droplistTrigger,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
if (!actions?.length) {
|
|
30
|
+
return <Button {...buttonProps} />;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return <NotificationPanelSettingsDroplist actions={actions} button={buttonProps} />;
|
|
34
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Button, ButtonProps } from '@cloud-ru/ds-button';
|
|
2
|
+
import { Droplist } from '@cloud-ru/ds-list';
|
|
3
|
+
import { Tag } from '@cloud-ru/ds-tag';
|
|
4
|
+
import { ElementType, useState } from 'react';
|
|
5
|
+
|
|
6
|
+
import { TEST_IDS } from '../../../../constants';
|
|
7
|
+
import { Action } from '../../../../types';
|
|
8
|
+
import styles from '../../styles.module.scss';
|
|
9
|
+
|
|
10
|
+
type NotificationPanelSettingsDroplistProps = {
|
|
11
|
+
actions: Action[];
|
|
12
|
+
button: ButtonProps<ElementType>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export function NotificationPanelSettingsDroplist({ actions, button }: NotificationPanelSettingsDroplistProps) {
|
|
16
|
+
const [isDroplistOpen, setDroplistOpen] = useState(false);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Droplist
|
|
20
|
+
trigger='click'
|
|
21
|
+
open={isDroplistOpen}
|
|
22
|
+
onOpenChange={setDroplistOpen}
|
|
23
|
+
scroll
|
|
24
|
+
placement='bottom-end'
|
|
25
|
+
size='m'
|
|
26
|
+
data-test-id={TEST_IDS.panel.settings.droplist}
|
|
27
|
+
triggerClassName={styles.inlineFlex}
|
|
28
|
+
items={actions.map(({ icon, content, tagLabel, disabled, onClick }, index) => ({
|
|
29
|
+
onClick: e => {
|
|
30
|
+
setDroplistOpen(false);
|
|
31
|
+
onClick?.(e);
|
|
32
|
+
},
|
|
33
|
+
disabled,
|
|
34
|
+
content,
|
|
35
|
+
beforeContent: icon,
|
|
36
|
+
afterContent: tagLabel ? <Tag label={tagLabel} /> : undefined,
|
|
37
|
+
'data-test-id': `${TEST_IDS.panel.settings.droplistAction}-${index}`,
|
|
38
|
+
}))}
|
|
39
|
+
>
|
|
40
|
+
<Button {...button} />
|
|
41
|
+
</Droplist>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './NotificationPanelSettings';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import styles from './styles.module.scss';
|
|
2
|
+
|
|
3
|
+
type StackTailProps = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
count: number;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function StackTail({ open, count }: StackTailProps) {
|
|
9
|
+
return (
|
|
10
|
+
<div className={styles.container} data-open={open || undefined}>
|
|
11
|
+
<div className={styles.animationContainer}>
|
|
12
|
+
{count > 1 && <div className={styles.card} data-level='3' />}
|
|
13
|
+
<div className={styles.card} data-level='2' />
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './StackTail';
|