@snack-uikit/notification 0.13.26-preview-115f396e.0 → 0.13.27
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 +24 -0
- package/README.md +2 -2
- package/dist/cjs/components/NotificationCard/NotificationCard.d.ts +1 -1
- package/dist/cjs/components/NotificationCard/NotificationCard.js +8 -6
- package/dist/cjs/components/NotificationCard/helpers.d.ts +1 -3
- package/dist/cjs/components/NotificationCard/helpers.js +4 -4
- package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.d.ts +2 -3
- package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.js +2 -2
- package/dist/cjs/components/NotificationPanel/components/NotificationCardStack/hooks.d.ts +1 -1
- package/dist/cjs/helperComponents/{Actions/Actions.d.ts → ActionsButton/ActionsButton.d.ts} +1 -1
- package/dist/cjs/helperComponents/ActionsButton/ActionsButton.js +72 -0
- package/dist/cjs/helperComponents/ActionsButton/index.d.ts +1 -0
- package/dist/cjs/helperComponents/{Actions → ActionsButton}/index.js +1 -1
- package/dist/esm/components/NotificationCard/NotificationCard.d.ts +1 -1
- package/dist/esm/components/NotificationCard/NotificationCard.js +5 -3
- package/dist/esm/components/NotificationCard/helpers.d.ts +1 -3
- package/dist/esm/components/NotificationCard/helpers.js +3 -3
- package/dist/esm/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.d.ts +2 -3
- package/dist/esm/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.js +2 -2
- package/dist/esm/components/NotificationPanel/components/NotificationCardStack/hooks.d.ts +1 -1
- package/dist/esm/helperComponents/{Actions/Actions.d.ts → ActionsButton/ActionsButton.d.ts} +1 -1
- package/dist/esm/helperComponents/{Actions/Actions.js → ActionsButton/ActionsButton.js} +6 -4
- package/dist/esm/helperComponents/ActionsButton/index.d.ts +1 -0
- package/dist/esm/helperComponents/ActionsButton/index.js +1 -0
- package/package.json +10 -10
- package/src/components/NotificationCard/NotificationCard.tsx +5 -4
- package/src/components/NotificationCard/helpers.tsx +3 -3
- package/src/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.tsx +3 -4
- package/src/components/NotificationPanel/components/NotificationCardStack/hooks.ts +1 -1
- package/src/components/NotificationPanel/components/NotificationCardStack/styles.module.scss +14 -14
- package/src/helperComponents/{Actions/Actions.tsx → ActionsButton/ActionsButton.tsx} +15 -3
- package/src/helperComponents/ActionsButton/index.ts +1 -0
- package/src/helperComponents/{Actions → ActionsButton}/styles.module.scss +1 -1
- package/dist/cjs/helperComponents/Actions/Actions.js +0 -69
- package/dist/cjs/helperComponents/Actions/index.d.ts +0 -1
- package/dist/esm/helperComponents/Actions/index.d.ts +0 -1
- package/dist/esm/helperComponents/Actions/index.js +0 -1
- package/src/helperComponents/Actions/index.ts +0 -1
- /package/dist/cjs/helperComponents/{Actions → ActionsButton}/styles.module.css +0 -0
- /package/dist/esm/helperComponents/{Actions → ActionsButton}/styles.module.css +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## <small>0.13.27 (2026-02-18)</small>
|
|
7
|
+
|
|
8
|
+
### Only dependencies have been changed
|
|
9
|
+
* [@snack-uikit/icons@0.27.6]($PUBLIC_PROJECT_URL/blob/master/packages/icons/CHANGELOG.md)
|
|
10
|
+
* [@snack-uikit/info-block@0.6.37]($PUBLIC_PROJECT_URL/blob/master/packages/info-block/CHANGELOG.md)
|
|
11
|
+
* [@snack-uikit/link@0.17.17]($PUBLIC_PROJECT_URL/blob/master/packages/link/CHANGELOG.md)
|
|
12
|
+
* [@snack-uikit/list@0.32.13]($PUBLIC_PROJECT_URL/blob/master/packages/list/CHANGELOG.md)
|
|
13
|
+
* [@snack-uikit/segmented-control@0.6.17]($PUBLIC_PROJECT_URL/blob/master/packages/segmented-control/CHANGELOG.md)
|
|
14
|
+
* [@snack-uikit/tag@0.15.14]($PUBLIC_PROJECT_URL/blob/master/packages/tag/CHANGELOG.md)
|
|
15
|
+
* [@snack-uikit/tooltip@0.18.9]($PUBLIC_PROJECT_URL/blob/master/packages/tooltip/CHANGELOG.md)
|
|
16
|
+
* [@snack-uikit/truncate-string@0.7.8]($PUBLIC_PROJECT_URL/blob/master/packages/truncate-string/CHANGELOG.md)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## <small>0.13.26 (2026-01-29)</small>
|
|
23
|
+
|
|
24
|
+
* feat(PDS-3356): add notification card stack ([06a2d74](https://github.com/cloud-ru-tech/snack-uikit/commit/06a2d74))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## <small>0.13.25 (2026-01-19)</small>
|
|
7
31
|
|
|
8
32
|
* chore(FF-6693): migrate tests from TestCafe to Playwright ([f32aff8](https://github.com/cloud-ru-tech/snack-uikit/commit/f32aff8))
|
package/README.md
CHANGED
|
@@ -288,9 +288,9 @@ function NotificationPanelStackExample() {
|
|
|
288
288
|
| name | type | default value | description |
|
|
289
289
|
|------|------|---------------|-------------|
|
|
290
290
|
| children* | `Iterable<ReactNode>` | - | Карточки в стопке, видна первая карточка, остальные схлопываются под нее. |
|
|
291
|
-
| title* | `string` | - | Заголовок стопки
|
|
291
|
+
| title* | `string` | - | Заголовок стопки карточек |
|
|
292
292
|
| defaultOpen | `boolean` | false | Состояние открыт/закрыт по умолчанию |
|
|
293
|
-
| onOpenChanged | `(open: boolean) => void` | - | Колбек смены состояния открыт/закрыт
|
|
293
|
+
| onOpenChanged | `(open: boolean) => void` | - | Колбек смены состояния открыт/закрыт |
|
|
294
294
|
| actions | `Action[]` | - | Список действий в выпадающем меню |
|
|
295
295
|
## NotificationPanelPopover
|
|
296
296
|
Компонент-обёртка для NotificationPanel для использования как выпадающий элемент
|
|
@@ -2,7 +2,7 @@ import { ElementType, MouseEventHandler, ReactNode } from 'react';
|
|
|
2
2
|
import { ButtonSimpleProps, ButtonTonalProps } from '@snack-uikit/button';
|
|
3
3
|
import { PickLinkProps } from '@snack-uikit/link';
|
|
4
4
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
5
|
-
import { type Action } from '../../helperComponents/
|
|
5
|
+
import { type Action } from '../../helperComponents/ActionsButton';
|
|
6
6
|
import { Appearance } from './types';
|
|
7
7
|
export type NotificationCardProps<LinkElement extends ElementType = 'a'> = WithSupportProps<{
|
|
8
8
|
/** Идентификатор уведомления */
|
|
@@ -26,7 +26,7 @@ const link_1 = require("@snack-uikit/link");
|
|
|
26
26
|
const truncate_string_1 = require("@snack-uikit/truncate-string");
|
|
27
27
|
const typography_1 = require("@snack-uikit/typography");
|
|
28
28
|
const utils_1 = require("@snack-uikit/utils");
|
|
29
|
-
const
|
|
29
|
+
const ActionsButton_1 = require("../../helperComponents/ActionsButton");
|
|
30
30
|
const constants_1 = require("./constants");
|
|
31
31
|
const helpers_1 = require("./helpers");
|
|
32
32
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
@@ -89,7 +89,7 @@ function NotificationCard(_a) {
|
|
|
89
89
|
"data-clickable": Boolean(onClick) || undefined,
|
|
90
90
|
"data-droplist-open": isDroplistOpen || undefined,
|
|
91
91
|
className: (0, classnames_1.default)(styles_module_scss_1.default.notificationCard, className),
|
|
92
|
-
children: [(actions === null || actions === void 0 ? void 0 : actions.length) && (0, jsx_runtime_1.jsx)(
|
|
92
|
+
children: [(actions === null || actions === void 0 ? void 0 : actions.length) && (0, jsx_runtime_1.jsx)(ActionsButton_1.ActionsButton, {
|
|
93
93
|
className: styles_module_scss_1.default.notificationCardFunction,
|
|
94
94
|
actions: actions,
|
|
95
95
|
open: isDroplistOpen,
|
|
@@ -123,9 +123,11 @@ function NotificationCard(_a) {
|
|
|
123
123
|
className: styles_module_scss_1.default.notificationCardContent,
|
|
124
124
|
"data-test-id": constants_1.TEST_IDS.content,
|
|
125
125
|
children: content
|
|
126
|
-
}), (primaryButton || secondaryButton) &&
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
}), (primaryButton || secondaryButton) &&
|
|
127
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
128
|
+
(0, jsx_runtime_1.jsxs)("div", {
|
|
129
|
+
className: styles_module_scss_1.default.notificationCardButtons,
|
|
130
|
+
onClick: helpers_1.stopPropagationClick,
|
|
129
131
|
children: [secondaryButton && (0, jsx_runtime_1.jsx)(button_1.ButtonSimple, Object.assign({}, secondaryButton, {
|
|
130
132
|
appearance: 'neutral',
|
|
131
133
|
size: 's',
|
|
@@ -135,7 +137,7 @@ function NotificationCard(_a) {
|
|
|
135
137
|
size: 's',
|
|
136
138
|
"data-test-id": constants_1.TEST_IDS.secondaryButton
|
|
137
139
|
}))]
|
|
138
|
-
})
|
|
140
|
+
}), showFooter && (0, jsx_runtime_1.jsxs)("div", {
|
|
139
141
|
className: styles_module_scss_1.default.notificationCardFooter,
|
|
140
142
|
children: [link && (0, jsx_runtime_1.jsx)(link_1.Link, Object.assign({}, link, {
|
|
141
143
|
onClick: handleLinkClick,
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { MouseEvent } from 'react';
|
|
2
2
|
import { Appearance } from './types';
|
|
3
3
|
export declare function getIcon(appearance: Appearance): import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
-
export declare
|
|
5
|
-
onClick: (e: MouseEvent<HTMLElement>) => void;
|
|
6
|
-
};
|
|
4
|
+
export declare function stopPropagationClick(e: MouseEvent<HTMLElement>): void;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.stopPropagation = void 0;
|
|
7
6
|
exports.getIcon = getIcon;
|
|
7
|
+
exports.stopPropagationClick = stopPropagationClick;
|
|
8
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
9
|
const icons_1 = require("@snack-uikit/icons");
|
|
10
10
|
const constants_1 = require("./constants");
|
|
@@ -31,6 +31,6 @@ function getIcon(appearance) {
|
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
34
|
+
function stopPropagationClick(e) {
|
|
35
|
+
e.stopPropagation();
|
|
36
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Action } from '../../../../helperComponents/
|
|
2
|
+
import { Action } from '../../../../helperComponents/ActionsButton';
|
|
3
3
|
export type NotificationCardStackProps = {
|
|
4
4
|
/**
|
|
5
|
-
* Заголовок стопки
|
|
5
|
+
* Заголовок стопки карточек
|
|
6
6
|
*/
|
|
7
7
|
title: string;
|
|
8
8
|
/**
|
|
@@ -13,7 +13,6 @@ export type NotificationCardStackProps = {
|
|
|
13
13
|
/**
|
|
14
14
|
* Колбек смены состояния открыт/закрыт
|
|
15
15
|
* @type (open: boolean) => void
|
|
16
|
-
* @param open Новое состояние открыт/закрыт
|
|
17
16
|
*/
|
|
18
17
|
onOpenChanged?: (open: boolean) => void;
|
|
19
18
|
/**
|
|
@@ -13,7 +13,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
13
13
|
const react_1 = require("react");
|
|
14
14
|
const button_1 = require("@snack-uikit/button");
|
|
15
15
|
const icons_1 = require("@snack-uikit/icons");
|
|
16
|
-
const
|
|
16
|
+
const ActionsButton_1 = require("../../../../helperComponents/ActionsButton");
|
|
17
17
|
const constants_1 = require("../../constants");
|
|
18
18
|
const StackTail_1 = require("../../helperComponents/StackTail");
|
|
19
19
|
const hooks_1 = require("./hooks");
|
|
@@ -66,7 +66,7 @@ function NotificationCardStack(_ref) {
|
|
|
66
66
|
children: title
|
|
67
67
|
}), (0, jsx_runtime_1.jsxs)("div", {
|
|
68
68
|
className: styles_module_scss_1.default.right,
|
|
69
|
-
children: [actions && actions.length > 0 && (0, jsx_runtime_1.jsx)(
|
|
69
|
+
children: [actions && actions.length > 0 && (0, jsx_runtime_1.jsx)(ActionsButton_1.ActionsButton, {
|
|
70
70
|
actions: actions,
|
|
71
71
|
open: actionsOpen,
|
|
72
72
|
setDroplistOpen: setActionsOpen,
|
|
@@ -6,7 +6,7 @@ type UseAnimatedOpeningProps = {
|
|
|
6
6
|
type UseAnimatedOpeningResult = {
|
|
7
7
|
open: boolean;
|
|
8
8
|
isVisible: boolean;
|
|
9
|
-
toggleOpen
|
|
9
|
+
toggleOpen(): void;
|
|
10
10
|
};
|
|
11
11
|
export declare function useAnimatedOpening({ defaultOpen, onOpenChanged, duration, }: UseAnimatedOpeningProps): UseAnimatedOpeningResult;
|
|
12
12
|
export {};
|
|
@@ -13,4 +13,4 @@ export type NotificationCardFunctionProps = Required<Pick<NotificationCardProps,
|
|
|
13
13
|
icon: ReactElement;
|
|
14
14
|
className?: string;
|
|
15
15
|
};
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function ActionsButton({ actions, open, setDroplistOpen, size, icon, className, }: NotificationCardFunctionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
4
|
+
return mod && mod.__esModule ? mod : {
|
|
5
|
+
"default": mod
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
exports.ActionsButton = ActionsButton;
|
|
12
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
13
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
14
|
+
const button_1 = require("@snack-uikit/button");
|
|
15
|
+
const list_1 = require("@snack-uikit/list");
|
|
16
|
+
const tag_1 = require("@snack-uikit/tag");
|
|
17
|
+
const constants_1 = require("../../components/NotificationCard/constants");
|
|
18
|
+
const helpers_1 = require("../../components/NotificationCard/helpers");
|
|
19
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
20
|
+
function ActionsButton(_ref) {
|
|
21
|
+
let {
|
|
22
|
+
actions,
|
|
23
|
+
open,
|
|
24
|
+
setDroplistOpen,
|
|
25
|
+
size,
|
|
26
|
+
icon,
|
|
27
|
+
className
|
|
28
|
+
} = _ref;
|
|
29
|
+
return (
|
|
30
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
31
|
+
(0, jsx_runtime_1.jsx)("div", {
|
|
32
|
+
className: (0, classnames_1.default)(styles_module_scss_1.default.container, className),
|
|
33
|
+
"data-test-id": constants_1.TEST_IDS.actions.wrapper,
|
|
34
|
+
onClick: helpers_1.stopPropagationClick,
|
|
35
|
+
children: (0, jsx_runtime_1.jsx)(list_1.Droplist, {
|
|
36
|
+
trigger: 'clickAndFocusVisible',
|
|
37
|
+
open: open,
|
|
38
|
+
onOpenChange: setDroplistOpen,
|
|
39
|
+
placement: 'bottom-end',
|
|
40
|
+
scroll: true,
|
|
41
|
+
"data-test-id": constants_1.TEST_IDS.actions.droplist,
|
|
42
|
+
items: actions.map(_ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
onClick,
|
|
45
|
+
disabled,
|
|
46
|
+
content,
|
|
47
|
+
tagLabel,
|
|
48
|
+
icon
|
|
49
|
+
} = _ref2;
|
|
50
|
+
return {
|
|
51
|
+
onClick: e => {
|
|
52
|
+
setDroplistOpen(false);
|
|
53
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
54
|
+
},
|
|
55
|
+
disabled,
|
|
56
|
+
content,
|
|
57
|
+
beforeContent: icon,
|
|
58
|
+
afterContent: tagLabel ? (0, jsx_runtime_1.jsx)(tag_1.Tag, {
|
|
59
|
+
label: tagLabel
|
|
60
|
+
}) : undefined,
|
|
61
|
+
'data-test-id': constants_1.TEST_IDS.actions.droplistAction
|
|
62
|
+
};
|
|
63
|
+
}),
|
|
64
|
+
children: (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
|
|
65
|
+
size: size,
|
|
66
|
+
icon: icon,
|
|
67
|
+
"data-test-id": constants_1.TEST_IDS.actions.droplistTrigger
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActionsButton';
|
|
@@ -2,7 +2,7 @@ import { ElementType, MouseEventHandler, ReactNode } from 'react';
|
|
|
2
2
|
import { ButtonSimpleProps, ButtonTonalProps } from '@snack-uikit/button';
|
|
3
3
|
import { PickLinkProps } from '@snack-uikit/link';
|
|
4
4
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
5
|
-
import { type Action } from '../../helperComponents/
|
|
5
|
+
import { type Action } from '../../helperComponents/ActionsButton';
|
|
6
6
|
import { Appearance } from './types';
|
|
7
7
|
export type NotificationCardProps<LinkElement extends ElementType = 'a'> = WithSupportProps<{
|
|
8
8
|
/** Идентификатор уведомления */
|
|
@@ -18,9 +18,9 @@ import { Link } from '@snack-uikit/link';
|
|
|
18
18
|
import { TruncateString } from '@snack-uikit/truncate-string';
|
|
19
19
|
import { Typography } from '@snack-uikit/typography';
|
|
20
20
|
import { extractSupportProps } from '@snack-uikit/utils';
|
|
21
|
-
import {
|
|
21
|
+
import { ActionsButton } from '../../helperComponents/ActionsButton';
|
|
22
22
|
import { APPEARANCE, TEST_IDS } from './constants';
|
|
23
|
-
import { getIcon,
|
|
23
|
+
import { getIcon, stopPropagationClick } from './helpers';
|
|
24
24
|
import styles from './styles.module.css';
|
|
25
25
|
/** Компонент карточки уведомления */
|
|
26
26
|
export function NotificationCard(_a) {
|
|
@@ -54,5 +54,7 @@ export function NotificationCard(_a) {
|
|
|
54
54
|
e.stopPropagation();
|
|
55
55
|
(_a = link === null || link === void 0 ? void 0 : link.onClick) === null || _a === void 0 ? void 0 : _a.call(link, e);
|
|
56
56
|
};
|
|
57
|
-
return (_jsxs("div", Object.assign({ ref: cardRef, role: 'button', onClick: onClick, tabIndex: 0 }, extractSupportProps(rest), { "data-appearance": appearance, "data-unread": unread || undefined, "data-clickable": Boolean(onClick) || undefined, "data-droplist-open": isDroplistOpen || undefined, className: cn(styles.notificationCard, className), children: [(actions === null || actions === void 0 ? void 0 : actions.length) && (_jsx(
|
|
57
|
+
return (_jsxs("div", Object.assign({ ref: cardRef, role: 'button', onClick: onClick, tabIndex: 0 }, extractSupportProps(rest), { "data-appearance": appearance, "data-unread": unread || undefined, "data-clickable": Boolean(onClick) || undefined, "data-droplist-open": isDroplistOpen || undefined, className: cn(styles.notificationCard, className), children: [(actions === null || actions === void 0 ? void 0 : actions.length) && (_jsx(ActionsButton, { className: styles.notificationCardFunction, actions: actions, open: isDroplistOpen, setDroplistOpen: setDroplistOpen, size: 's', icon: _jsx(KebabSVG, {}) })), label && (_jsx(Typography.LightLabelS, { tag: 'div', className: styles.notificationCardLabel, children: _jsx(TruncateString, { maxLines: 1, text: label, "data-test-id": TEST_IDS.label }) })), _jsxs("div", { className: styles.notificationCardTitle, children: [_jsx("div", { className: styles.notificationCardTitleIcon, children: icon }), _jsx(Typography.SansTitleS, { tag: 'div', className: styles.notificationCardTitleText, children: _jsx(TruncateString, { maxLines: 2, text: title, "data-test-id": TEST_IDS.title }) })] }), content && (_jsx(Typography.SansBodyS, { tag: 'div', className: styles.notificationCardContent, "data-test-id": TEST_IDS.content, children: content })), (primaryButton || secondaryButton) && (
|
|
58
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
59
|
+
_jsxs("div", { className: styles.notificationCardButtons, onClick: stopPropagationClick, children: [secondaryButton && (_jsx(ButtonSimple, Object.assign({}, secondaryButton, { appearance: 'neutral', size: 's', "data-test-id": TEST_IDS.primaryButton }))), primaryButton && (_jsx(ButtonTonal, Object.assign({}, primaryButton, { appearance: 'neutral', size: 's', "data-test-id": TEST_IDS.secondaryButton })))] })), showFooter && (_jsxs("div", { className: styles.notificationCardFooter, children: [link && (_jsx(Link, Object.assign({}, link, { onClick: handleLinkClick, appearance: 'primary', textMode: 'accent', size: 's', "data-test-id": TEST_IDS.link }))), date && (_jsx(Typography.LightLabelS, { className: styles.notificationCardDate, "data-test-id": TEST_IDS.date, children: date }))] }))] })));
|
|
58
60
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { MouseEvent } from 'react';
|
|
2
2
|
import { Appearance } from './types';
|
|
3
3
|
export declare function getIcon(appearance: Appearance): import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
-
export declare
|
|
5
|
-
onClick: (e: MouseEvent<HTMLElement>) => void;
|
|
6
|
-
};
|
|
4
|
+
export declare function stopPropagationClick(e: MouseEvent<HTMLElement>): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Action } from '../../../../helperComponents/
|
|
2
|
+
import { Action } from '../../../../helperComponents/ActionsButton';
|
|
3
3
|
export type NotificationCardStackProps = {
|
|
4
4
|
/**
|
|
5
|
-
* Заголовок стопки
|
|
5
|
+
* Заголовок стопки карточек
|
|
6
6
|
*/
|
|
7
7
|
title: string;
|
|
8
8
|
/**
|
|
@@ -13,7 +13,6 @@ export type NotificationCardStackProps = {
|
|
|
13
13
|
/**
|
|
14
14
|
* Колбек смены состояния открыт/закрыт
|
|
15
15
|
* @type (open: boolean) => void
|
|
16
|
-
* @param open Новое состояние открыт/закрыт
|
|
17
16
|
*/
|
|
18
17
|
onOpenChanged?: (open: boolean) => void;
|
|
19
18
|
/**
|
|
@@ -2,7 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { Children, useMemo, useState } from 'react';
|
|
3
3
|
import { ButtonFunction } from '@snack-uikit/button';
|
|
4
4
|
import { ChevronDownSVG, ChevronUpSVG, KebabSVG } from '@snack-uikit/icons';
|
|
5
|
-
import {
|
|
5
|
+
import { ActionsButton } from '../../../../helperComponents/ActionsButton';
|
|
6
6
|
import { TEST_IDS } from '../../constants';
|
|
7
7
|
import { StackTail } from '../../helperComponents/StackTail';
|
|
8
8
|
import { useAnimatedOpening } from './hooks';
|
|
@@ -24,5 +24,5 @@ export function NotificationCardStack({ children, defaultOpen, onOpenChanged, ti
|
|
|
24
24
|
return _jsx(_Fragment, { children: first });
|
|
25
25
|
}
|
|
26
26
|
const firstCardElement = open ? first : cloneCard(first, { onClick: toggleOpen });
|
|
27
|
-
return (_jsxs("div", { className: styles.container, style: { '--snack-notification-stack-animation-duration': `${ANIMATION_DURATION}s` }, "data-test-id": TEST_IDS.cardStack.wrapper, children: [_jsxs("div", { className: styles.header, "data-test-id": TEST_IDS.cardStack.headline, children: [_jsx("label", { className: styles.title, onClick: toggleOpen, "data-test-id": TEST_IDS.cardStack.title, children: title }), _jsxs("div", { className: styles.right, children: [actions && actions.length > 0 && (_jsx(
|
|
27
|
+
return (_jsxs("div", { className: styles.container, style: { '--snack-notification-stack-animation-duration': `${ANIMATION_DURATION}s` }, "data-test-id": TEST_IDS.cardStack.wrapper, children: [_jsxs("div", { className: styles.header, "data-test-id": TEST_IDS.cardStack.headline, children: [_jsx("label", { className: styles.title, onClick: toggleOpen, "data-test-id": TEST_IDS.cardStack.title, children: title }), _jsxs("div", { className: styles.right, children: [actions && actions.length > 0 && (_jsx(ActionsButton, { actions: actions, open: actionsOpen, setDroplistOpen: setActionsOpen, size: 'xs', icon: _jsx(KebabSVG, {}) })), _jsx(ButtonFunction, { size: 'xs', onClick: toggleOpen, "data-test-id": TEST_IDS.cardStack.openButton, icon: open ? _jsx(ChevronUpSVG, {}) : _jsx(ChevronDownSVG, {}) })] })] }), _jsxs("div", { className: styles.cards, children: [_jsxs("div", { className: styles.first, children: [_jsx(StackTail, { open: open, count: stack.length }), firstCardElement] }), _jsx("div", { className: styles.stack, "data-open": open || undefined, "data-tail-size": stack.length, children: _jsx("div", { className: styles.animationContainer, children: isVisible ? stack : [] }) })] })] }));
|
|
28
28
|
}
|
|
@@ -6,7 +6,7 @@ type UseAnimatedOpeningProps = {
|
|
|
6
6
|
type UseAnimatedOpeningResult = {
|
|
7
7
|
open: boolean;
|
|
8
8
|
isVisible: boolean;
|
|
9
|
-
toggleOpen
|
|
9
|
+
toggleOpen(): void;
|
|
10
10
|
};
|
|
11
11
|
export declare function useAnimatedOpening({ defaultOpen, onOpenChanged, duration, }: UseAnimatedOpeningProps): UseAnimatedOpeningResult;
|
|
12
12
|
export {};
|
|
@@ -13,4 +13,4 @@ export type NotificationCardFunctionProps = Required<Pick<NotificationCardProps,
|
|
|
13
13
|
icon: ReactElement;
|
|
14
14
|
className?: string;
|
|
15
15
|
};
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function ActionsButton({ actions, open, setDroplistOpen, size, icon, className, }: NotificationCardFunctionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,10 +4,12 @@ import { ButtonFunction } from '@snack-uikit/button';
|
|
|
4
4
|
import { Droplist } from '@snack-uikit/list';
|
|
5
5
|
import { Tag } from '@snack-uikit/tag';
|
|
6
6
|
import { TEST_IDS } from '../../components/NotificationCard/constants';
|
|
7
|
-
import {
|
|
7
|
+
import { stopPropagationClick } from '../../components/NotificationCard/helpers';
|
|
8
8
|
import styles from './styles.module.css';
|
|
9
|
-
export function
|
|
10
|
-
return (
|
|
9
|
+
export function ActionsButton({ actions, open, setDroplistOpen, size, icon, className, }) {
|
|
10
|
+
return (
|
|
11
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
12
|
+
_jsx("div", { className: cn(styles.container, className), "data-test-id": TEST_IDS.actions.wrapper, onClick: stopPropagationClick, children: _jsx(Droplist, { trigger: 'clickAndFocusVisible', open: open, onOpenChange: setDroplistOpen, placement: 'bottom-end', scroll: true, "data-test-id": TEST_IDS.actions.droplist, items: actions.map(({ onClick, disabled, content, tagLabel, icon }) => ({
|
|
11
13
|
onClick: e => {
|
|
12
14
|
setDroplistOpen(false);
|
|
13
15
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
@@ -17,5 +19,5 @@ export function Actions({ actions, open, setDroplistOpen, size, icon, className
|
|
|
17
19
|
beforeContent: icon,
|
|
18
20
|
afterContent: tagLabel ? _jsx(Tag, { label: tagLabel }) : undefined,
|
|
19
21
|
'data-test-id': TEST_IDS.actions.droplistAction,
|
|
20
|
-
})), children: _jsx(ButtonFunction, { size: size, icon: icon, "data-test-id": TEST_IDS.actions.droplistTrigger }) }) }))
|
|
22
|
+
})), children: _jsx(ButtonFunction, { size: size, icon: icon, "data-test-id": TEST_IDS.actions.droplistTrigger }) }) }));
|
|
21
23
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActionsButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActionsButton';
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Notification",
|
|
7
|
-
"version": "0.13.
|
|
7
|
+
"version": "0.13.27",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
"scripts": {},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@snack-uikit/button": "0.19.17",
|
|
40
|
-
"@snack-uikit/icons": "0.27.
|
|
41
|
-
"@snack-uikit/info-block": "0.6.
|
|
42
|
-
"@snack-uikit/link": "0.17.
|
|
43
|
-
"@snack-uikit/list": "0.32.
|
|
40
|
+
"@snack-uikit/icons": "0.27.6",
|
|
41
|
+
"@snack-uikit/info-block": "0.6.37",
|
|
42
|
+
"@snack-uikit/link": "0.17.17",
|
|
43
|
+
"@snack-uikit/list": "0.32.13",
|
|
44
44
|
"@snack-uikit/popover-private": "0.15.4",
|
|
45
45
|
"@snack-uikit/scroll": "0.10.6",
|
|
46
|
-
"@snack-uikit/segmented-control": "0.6.
|
|
46
|
+
"@snack-uikit/segmented-control": "0.6.17",
|
|
47
47
|
"@snack-uikit/skeleton": "0.6.10",
|
|
48
|
-
"@snack-uikit/tag": "0.15.
|
|
49
|
-
"@snack-uikit/tooltip": "0.18.
|
|
50
|
-
"@snack-uikit/truncate-string": "0.7.
|
|
48
|
+
"@snack-uikit/tag": "0.15.14",
|
|
49
|
+
"@snack-uikit/tooltip": "0.18.9",
|
|
50
|
+
"@snack-uikit/truncate-string": "0.7.8",
|
|
51
51
|
"@snack-uikit/typography": "0.8.12",
|
|
52
52
|
"@snack-uikit/utils": "4.0.1",
|
|
53
53
|
"classnames": "2.5.1",
|
|
54
54
|
"uncontrollable": "9.0.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "17b72086167d3d6503e4e74142358765230478c8"
|
|
57
57
|
}
|
|
@@ -8,9 +8,9 @@ import { TruncateString } from '@snack-uikit/truncate-string';
|
|
|
8
8
|
import { Typography } from '@snack-uikit/typography';
|
|
9
9
|
import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
10
10
|
|
|
11
|
-
import { type Action,
|
|
11
|
+
import { type Action, ActionsButton } from '../../helperComponents/ActionsButton';
|
|
12
12
|
import { APPEARANCE, TEST_IDS } from './constants';
|
|
13
|
-
import { getIcon,
|
|
13
|
+
import { getIcon, stopPropagationClick } from './helpers';
|
|
14
14
|
import styles from './styles.module.scss';
|
|
15
15
|
import { Appearance } from './types';
|
|
16
16
|
|
|
@@ -117,7 +117,7 @@ export function NotificationCard<LinkElement extends ElementType = 'a'>({
|
|
|
117
117
|
className={cn(styles.notificationCard, className)}
|
|
118
118
|
>
|
|
119
119
|
{actions?.length && (
|
|
120
|
-
<
|
|
120
|
+
<ActionsButton
|
|
121
121
|
className={styles.notificationCardFunction}
|
|
122
122
|
actions={actions}
|
|
123
123
|
open={isDroplistOpen}
|
|
@@ -148,7 +148,8 @@ export function NotificationCard<LinkElement extends ElementType = 'a'>({
|
|
|
148
148
|
)}
|
|
149
149
|
|
|
150
150
|
{(primaryButton || secondaryButton) && (
|
|
151
|
-
|
|
151
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
152
|
+
<div className={styles.notificationCardButtons} onClick={stopPropagationClick}>
|
|
152
153
|
{secondaryButton && (
|
|
153
154
|
<ButtonSimple {...secondaryButton} appearance='neutral' size='s' data-test-id={TEST_IDS.primaryButton} />
|
|
154
155
|
)}
|
|
@@ -21,6 +21,6 @@ export function getIcon(appearance: Appearance) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
}
|
|
24
|
+
export function stopPropagationClick(e: MouseEvent<HTMLElement>) {
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
}
|
package/src/components/NotificationPanel/components/NotificationCardStack/NotificationCardStack.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { Children, ReactNode, useMemo, useState } from 'react';
|
|
|
3
3
|
import { ButtonFunction } from '@snack-uikit/button';
|
|
4
4
|
import { ChevronDownSVG, ChevronUpSVG, KebabSVG } from '@snack-uikit/icons';
|
|
5
5
|
|
|
6
|
-
import { Action,
|
|
6
|
+
import { Action, ActionsButton } from '../../../../helperComponents/ActionsButton';
|
|
7
7
|
import { TEST_IDS } from '../../constants';
|
|
8
8
|
import { StackTail } from '../../helperComponents/StackTail';
|
|
9
9
|
import { useAnimatedOpening } from './hooks';
|
|
@@ -12,7 +12,7 @@ import { cloneCard } from './utils';
|
|
|
12
12
|
|
|
13
13
|
export type NotificationCardStackProps = {
|
|
14
14
|
/**
|
|
15
|
-
* Заголовок стопки
|
|
15
|
+
* Заголовок стопки карточек
|
|
16
16
|
*/
|
|
17
17
|
title: string;
|
|
18
18
|
/**
|
|
@@ -23,7 +23,6 @@ export type NotificationCardStackProps = {
|
|
|
23
23
|
/**
|
|
24
24
|
* Колбек смены состояния открыт/закрыт
|
|
25
25
|
* @type (open: boolean) => void
|
|
26
|
-
* @param open Новое состояние открыт/закрыт
|
|
27
26
|
*/
|
|
28
27
|
onOpenChanged?: (open: boolean) => void;
|
|
29
28
|
/**
|
|
@@ -77,7 +76,7 @@ export function NotificationCardStack({
|
|
|
77
76
|
</label>
|
|
78
77
|
<div className={styles.right}>
|
|
79
78
|
{actions && actions.length > 0 && (
|
|
80
|
-
<
|
|
79
|
+
<ActionsButton
|
|
81
80
|
actions={actions}
|
|
82
81
|
open={actionsOpen}
|
|
83
82
|
setDroplistOpen={setActionsOpen}
|
package/src/components/NotificationPanel/components/NotificationCardStack/styles.module.scss
CHANGED
|
@@ -44,14 +44,14 @@ $duration: var(--snack-notification-stack-animation-duration);
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
.stack {
|
|
47
|
-
|
|
47
|
+
position: relative;
|
|
48
48
|
overflow: visible;
|
|
49
|
-
|
|
49
|
+
height: auto;
|
|
50
50
|
transition: overflow $duration allow-discrete step-end;
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
&:not([data-open]) {
|
|
53
53
|
overflow: hidden;
|
|
54
|
-
|
|
54
|
+
transition:
|
|
55
55
|
height $duration allow-discrete step-end;
|
|
56
56
|
|
|
57
57
|
&[data-tail-size] {
|
|
@@ -61,29 +61,29 @@ $duration: var(--snack-notification-stack-animation-duration);
|
|
|
61
61
|
&[data-tail-size="1"] {
|
|
62
62
|
height: 4px;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
.animationContainer {
|
|
68
68
|
translate: 0 -100%;
|
|
69
69
|
scale: 0.98;
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
gap: tokens.$space-notification-panel-container-body-stack-cards;
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
margin-top: tokens.$space-notification-panel-container-body-stack-cards;
|
|
76
76
|
|
|
77
77
|
opacity: 0;
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
transition:
|
|
80
80
|
scale $duration,
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
translate $duration,
|
|
82
|
+
opacity $duration;
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
[data-open] & {
|
|
85
85
|
translate: 0 0;
|
|
86
86
|
scale: 1;
|
|
87
87
|
opacity: 1;
|
|
88
|
-
|
|
88
|
+
}
|
|
89
89
|
}
|
|
@@ -6,7 +6,7 @@ import { BaseItemProps, Droplist } from '@snack-uikit/list';
|
|
|
6
6
|
import { Tag } from '@snack-uikit/tag';
|
|
7
7
|
|
|
8
8
|
import { TEST_IDS } from '../../components/NotificationCard/constants';
|
|
9
|
-
import {
|
|
9
|
+
import { stopPropagationClick } from '../../components/NotificationCard/helpers';
|
|
10
10
|
import { NotificationCardProps } from '../../components/NotificationCard/NotificationCard';
|
|
11
11
|
import styles from './styles.module.scss';
|
|
12
12
|
|
|
@@ -24,9 +24,21 @@ export type NotificationCardFunctionProps = Required<Pick<NotificationCardProps,
|
|
|
24
24
|
className?: string;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export function
|
|
27
|
+
export function ActionsButton({
|
|
28
|
+
actions,
|
|
29
|
+
open,
|
|
30
|
+
setDroplistOpen,
|
|
31
|
+
size,
|
|
32
|
+
icon,
|
|
33
|
+
className,
|
|
34
|
+
}: NotificationCardFunctionProps) {
|
|
28
35
|
return (
|
|
29
|
-
|
|
36
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
37
|
+
<div
|
|
38
|
+
className={cn(styles.container, className)}
|
|
39
|
+
data-test-id={TEST_IDS.actions.wrapper}
|
|
40
|
+
onClick={stopPropagationClick}
|
|
41
|
+
>
|
|
30
42
|
<Droplist
|
|
31
43
|
trigger='clickAndFocusVisible'
|
|
32
44
|
open={open}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ActionsButton';
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
4
|
-
return mod && mod.__esModule ? mod : {
|
|
5
|
-
"default": mod
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", {
|
|
9
|
-
value: true
|
|
10
|
-
});
|
|
11
|
-
exports.Actions = Actions;
|
|
12
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
13
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
14
|
-
const button_1 = require("@snack-uikit/button");
|
|
15
|
-
const list_1 = require("@snack-uikit/list");
|
|
16
|
-
const tag_1 = require("@snack-uikit/tag");
|
|
17
|
-
const constants_1 = require("../../components/NotificationCard/constants");
|
|
18
|
-
const helpers_1 = require("../../components/NotificationCard/helpers");
|
|
19
|
-
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
20
|
-
function Actions(_ref) {
|
|
21
|
-
let {
|
|
22
|
-
actions,
|
|
23
|
-
open,
|
|
24
|
-
setDroplistOpen,
|
|
25
|
-
size,
|
|
26
|
-
icon,
|
|
27
|
-
className
|
|
28
|
-
} = _ref;
|
|
29
|
-
return (0, jsx_runtime_1.jsx)("div", Object.assign({
|
|
30
|
-
className: (0, classnames_1.default)(styles_module_scss_1.default.container, className),
|
|
31
|
-
"data-test-id": constants_1.TEST_IDS.actions.wrapper
|
|
32
|
-
}, helpers_1.stopPropagation, {
|
|
33
|
-
children: (0, jsx_runtime_1.jsx)(list_1.Droplist, {
|
|
34
|
-
trigger: 'clickAndFocusVisible',
|
|
35
|
-
open: open,
|
|
36
|
-
onOpenChange: setDroplistOpen,
|
|
37
|
-
placement: 'bottom-end',
|
|
38
|
-
scroll: true,
|
|
39
|
-
"data-test-id": constants_1.TEST_IDS.actions.droplist,
|
|
40
|
-
items: actions.map(_ref2 => {
|
|
41
|
-
let {
|
|
42
|
-
onClick,
|
|
43
|
-
disabled,
|
|
44
|
-
content,
|
|
45
|
-
tagLabel,
|
|
46
|
-
icon
|
|
47
|
-
} = _ref2;
|
|
48
|
-
return {
|
|
49
|
-
onClick: e => {
|
|
50
|
-
setDroplistOpen(false);
|
|
51
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
52
|
-
},
|
|
53
|
-
disabled,
|
|
54
|
-
content,
|
|
55
|
-
beforeContent: icon,
|
|
56
|
-
afterContent: tagLabel ? (0, jsx_runtime_1.jsx)(tag_1.Tag, {
|
|
57
|
-
label: tagLabel
|
|
58
|
-
}) : undefined,
|
|
59
|
-
'data-test-id': constants_1.TEST_IDS.actions.droplistAction
|
|
60
|
-
};
|
|
61
|
-
}),
|
|
62
|
-
children: (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
|
|
63
|
-
size: size,
|
|
64
|
-
icon: icon,
|
|
65
|
-
"data-test-id": constants_1.TEST_IDS.actions.droplistTrigger
|
|
66
|
-
})
|
|
67
|
-
})
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Actions';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Actions';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Actions';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Actions';
|
|
File without changes
|
|
File without changes
|