@skbkontur/side-menu 3.4.9 → 3.5.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 +17 -0
- package/package.json +3 -2
- package/src/SideMenuNotifications/BellWidget.d.ts +2 -1
- package/src/SideMenuNotifications/BellWidget.js +3 -2
- package/src/SideMenuNotifications/SideMenuNotifications.d.ts +6 -2
- package/src/SideMenuNotifications/SideMenuNotifications.js +2 -2
- package/src/SideMenuNotifications/SideMenuNotifications.md +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
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
|
+
# [3.5.0](https://git.skbkontur.ru/ui/ui-parking-2/compare/@skbkontur/side-menu@3.4.8...@skbkontur/side-menu@3.5.0) (2026-03-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **SideMenu:** add `aria-current="page"` to active menu item ([76a5e37](https://git.skbkontur.ru/ui/ui-parking-2/commits/76a5e3794cf8331d2970cf852354030774827824))
|
|
12
|
+
* **SideMenu:** render RightBorder icon on top of scrollbar ([8ee36f4](https://git.skbkontur.ru/ui/ui-parking-2/commits/8ee36f43b1449d95df3d094baf87654902174d08))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **SideMenu:** add redirect prop to SideMenu.Notifications ([521c5ac](https://git.skbkontur.ru/ui/ui-parking-2/commits/521c5acd2714c014642756e6c9010845e3792c6e))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
## [3.4.9](https://git.skbkontur.ru/ui/ui-parking-2/compare/@skbkontur/side-menu@3.4.8...@skbkontur/side-menu@3.4.9) (2025-12-25)
|
|
7
24
|
|
|
8
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skbkontur/side-menu",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@skbkontur/react-ui": "^5.0.0",
|
|
23
|
+
"@skbkontur/ui-cdn-components": "^1.9.0",
|
|
23
24
|
"typescript": "5.8.3"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"@skbkontur/bell-widget-npm-loader": "^0.
|
|
27
|
+
"@skbkontur/bell-widget-npm-loader": "^0.3.0",
|
|
27
28
|
"@skbkontur/empty-state": "^1.1.4",
|
|
28
29
|
"@skbkontur/icons": "^1.20.2",
|
|
29
30
|
"@skbkontur/react-ui-addons": "^5.3.3",
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { OperationResult } from '@skbkontur/operation-result';
|
|
3
|
-
import type { ImportFaults, WidgetApi, RenderFault, RenderDisposeFault } from '@skbkontur/bell-widget-npm-loader' assert { 'resolution-mode': 'import' };
|
|
3
|
+
import type { ImportFaults, WidgetApi, RenderFault, RenderDisposeFault, Redirect } from '@skbkontur/bell-widget-npm-loader' assert { 'resolution-mode': 'import' };
|
|
4
4
|
export interface BellWidgetProps {
|
|
5
5
|
widgetApi: Promise<OperationResult<ImportFaults, WidgetApi>>;
|
|
6
6
|
onClose(): void;
|
|
7
7
|
onError?: (error: ImportFaults | RenderFault | RenderDisposeFault) => void;
|
|
8
8
|
renderErrorButton?: (error: ImportFaults | RenderFault, retryRender: () => void) => React.ReactNode;
|
|
9
9
|
renderErrorMessage?: (error: ImportFaults | RenderFault, retryRender: () => void) => React.ReactNode;
|
|
10
|
+
redirect?: Redirect | null;
|
|
10
11
|
}
|
|
11
12
|
export declare const BellWidget: React.FC<BellWidgetProps>;
|
|
@@ -20,7 +20,7 @@ var getBtnTopPosition = function () {
|
|
|
20
20
|
return (_a = bellDropDownItem === null || bellDropDownItem === void 0 ? void 0 : bellDropDownItem.offsetTop) !== null && _a !== void 0 ? _a : 0;
|
|
21
21
|
};
|
|
22
22
|
export var BellWidget = function (props) {
|
|
23
|
-
var widgetApi = props.widgetApi, onClose = props.onClose, renderErrorButton = props.renderErrorButton, renderErrorMessage = props.renderErrorMessage, onError = props.onError;
|
|
23
|
+
var widgetApi = props.widgetApi, onClose = props.onClose, renderErrorButton = props.renderErrorButton, renderErrorMessage = props.renderErrorMessage, onError = props.onError, redirect = props.redirect;
|
|
24
24
|
var btnTopPosition = getBtnTopPosition();
|
|
25
25
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
26
26
|
var hasCustomWrapperHeight = theme.sideMenuNotificationsWrapperHeight !== SideMenuTheme.sideMenuNotificationsWrapperHeight;
|
|
@@ -32,6 +32,7 @@ export var BellWidget = function (props) {
|
|
|
32
32
|
case 1:
|
|
33
33
|
api = _a.sent();
|
|
34
34
|
if (isFailure(api)) {
|
|
35
|
+
onError === null || onError === void 0 ? void 0 : onError(api.fault);
|
|
35
36
|
return [2 /*return*/, createFailure(api.fault)];
|
|
36
37
|
}
|
|
37
38
|
wrapper = container.parentElement;
|
|
@@ -39,7 +40,7 @@ export var BellWidget = function (props) {
|
|
|
39
40
|
wrapper.classList.add(jsStyles.widgetWrapper());
|
|
40
41
|
}
|
|
41
42
|
container.style.height = '100%';
|
|
42
|
-
return [4 /*yield*/, api.value.render({ container: container })];
|
|
43
|
+
return [4 /*yield*/, api.value.render({ container: container, redirect: redirect })];
|
|
43
44
|
case 2:
|
|
44
45
|
renderResult = _a.sent();
|
|
45
46
|
if (isFailure(renderResult)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { OperationResult } from '@skbkontur/operation-result';
|
|
3
|
-
import type { ImportFaults, WidgetApi, RenderFault, RenderDisposeFault } from '@skbkontur/bell-widget-npm-loader' assert { 'resolution-mode': 'import' };
|
|
3
|
+
import type { ImportFaults, WidgetApi, RenderFault, RenderDisposeFault, Redirect } from '@skbkontur/bell-widget-npm-loader' assert { 'resolution-mode': 'import' };
|
|
4
4
|
import { type SideMenuDropdownProps } from '../SideMenuDropdown/SideMenuDropdown';
|
|
5
5
|
export interface NotificationApiProps extends Omit<SideMenuDropdownProps, 'icon' | 'marker' | 'subCaption'> {
|
|
6
6
|
/**
|
|
@@ -22,13 +22,17 @@ export interface NotificationApiProps extends Omit<SideMenuDropdownProps, 'icon'
|
|
|
22
22
|
*/
|
|
23
23
|
renderErrorButton?: (error: ImportFaults | RenderFault, retryRender: () => void) => React.ReactNode;
|
|
24
24
|
/**
|
|
25
|
-
* Полностью переопределяет отображение экрана
|
|
25
|
+
* Полностью переопределяет отображение экрана ошибки виджета. retryRender - предоставляет возможность повторить загрузку виджета, работает только при ошибке рендера виджета
|
|
26
26
|
*/
|
|
27
27
|
renderErrorMessage?: (error: ImportFaults | RenderFault, retryRender: () => void) => React.ReactNode;
|
|
28
28
|
/**
|
|
29
29
|
* Типы ошибок брать из '@skbkontur/bell-widget-npm-loader'
|
|
30
30
|
*/
|
|
31
31
|
onError?: (error: ImportFaults | RenderFault | RenderDisposeFault) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Используется когда необходимо открыть ссылку в той же вкладке. Подробнее смотреть в документации Колокольчика - https://wiki.skbkontur.ru/pages/viewpage.action?pageId=1040164041
|
|
34
|
+
*/
|
|
35
|
+
redirect?: Redirect | null;
|
|
32
36
|
}
|
|
33
37
|
export declare const BELL_SIDE_MENU_DATA_ITEM = "bell_side-menu-button";
|
|
34
38
|
/**
|
|
@@ -12,7 +12,7 @@ import { BellWidget } from './BellWidget';
|
|
|
12
12
|
import { getMarker } from './utils/getMarker';
|
|
13
13
|
export var BELL_SIDE_MENU_DATA_ITEM = 'bell_side-menu-button';
|
|
14
14
|
var SideMenuNotificationsInner = forwardRef(function (_a, ref) {
|
|
15
|
-
var children = _a.children, _b = _a.positions, positions = _b === void 0 ? ['right top'] : _b, widgetApi = _a.widgetApi, count = _a.count, showDivider = _a.showDivider, onClose = _a.onClose, renderErrorButton = _a.renderErrorButton, renderErrorMessage = _a.renderErrorMessage, onError = _a.onError, rest = __rest(_a, ["children", "positions", "widgetApi", "count", "showDivider", "onClose", "renderErrorButton", "renderErrorMessage", "onError"]);
|
|
15
|
+
var children = _a.children, _b = _a.positions, positions = _b === void 0 ? ['right top'] : _b, widgetApi = _a.widgetApi, count = _a.count, showDivider = _a.showDivider, onClose = _a.onClose, renderErrorButton = _a.renderErrorButton, renderErrorMessage = _a.renderErrorMessage, onError = _a.onError, redirect = _a.redirect, rest = __rest(_a, ["children", "positions", "widgetApi", "count", "showDivider", "onClose", "renderErrorButton", "renderErrorMessage", "onError", "redirect"]);
|
|
16
16
|
var marker = getMarker(count);
|
|
17
17
|
var currentIcon = marker ? React.createElement(NotificationBellAlarmIcon24Regular, null) : React.createElement(NotificationBellIcon24Regular, null);
|
|
18
18
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
@@ -33,7 +33,7 @@ var SideMenuNotificationsInner = forwardRef(function (_a, ref) {
|
|
|
33
33
|
menuScrollContainerContentWrapperPaddingY: '0px',
|
|
34
34
|
sideMenuMarkerBg: theme.sideMenuNotificationsMarkerBg,
|
|
35
35
|
}, theme) },
|
|
36
|
-
React.createElement(SideMenuDropdown, __assign({ ref: ref, icon: currentIcon, marker: marker, positions: positions, "data-tid": SideMenuDataTids.bellSideMenuDropdownButton, "data-item": BELL_SIDE_MENU_DATA_ITEM, caption: "\u0423\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F", onClose: handleClose }, rest), children !== null && children !== void 0 ? children : (React.createElement(BellWidget, { widgetApi: widgetApi, onClose: function () { return bellDropDownButton === null || bellDropDownButton === void 0 ? void 0 : bellDropDownButton.click(); }, renderErrorButton: renderErrorButton, renderErrorMessage: renderErrorMessage, onError: onError }))),
|
|
36
|
+
React.createElement(SideMenuDropdown, __assign({ ref: ref, icon: currentIcon, marker: marker, positions: positions, "data-tid": SideMenuDataTids.bellSideMenuDropdownButton, "data-item": BELL_SIDE_MENU_DATA_ITEM, caption: "\u0423\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F", onClose: handleClose }, rest), children !== null && children !== void 0 ? children : (React.createElement(BellWidget, { widgetApi: widgetApi, onClose: function () { return bellDropDownButton === null || bellDropDownButton === void 0 ? void 0 : bellDropDownButton.click(); }, renderErrorButton: renderErrorButton, renderErrorMessage: renderErrorMessage, onError: onError, redirect: redirect }))),
|
|
37
37
|
showDivider && React.createElement(SideMenu.Divider, null)));
|
|
38
38
|
});
|
|
39
39
|
/**
|
|
@@ -30,7 +30,7 @@ const renderErrorButton = (error: ImportFaults | RenderFault, retryRender: () =>
|
|
|
30
30
|
<SideMenu.Notifications renderErrorButton={renderErrorButton} />;
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Проп `renderErrorMessage` — добавляет возможность полностью переопределить отображение экрана
|
|
33
|
+
Проп `renderErrorMessage` — добавляет возможность полностью переопределить отображение экрана ошибки виджета. retryRender - предоставляет возможность повторить загрузку виджета, работает только при ошибке рендера виджета.
|
|
34
34
|
|
|
35
35
|
```jsx harmony
|
|
36
36
|
import type { ImportFaults, RenderFault } from '@skbkontur/bell-widget-npm-loader';
|
|
@@ -63,6 +63,19 @@ import { SideMenu, SideMenuThemeIn } from '@skbkontur/side-menu';
|
|
|
63
63
|
</SideMenu>
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
Проп `redirect` используется когда необходимо открыть ссылку в той же вкладке. Подробнее смотреть в документации Колокольчика - https://wiki.skbkontur.ru/pages/viewpage.action?pageId=1040164041
|
|
67
|
+
|
|
68
|
+
```jsx static
|
|
69
|
+
import { createSuccess, createFailure } from '@skbkontur/operation-result';
|
|
70
|
+
import { SideMenu } from '@skbkontur/side-menu';
|
|
71
|
+
|
|
72
|
+
const handleOpenLink = async (to, options) => {
|
|
73
|
+
// ...
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
<SideMenu.Notifications redirect={handleOpenLink} />;
|
|
77
|
+
```
|
|
78
|
+
|
|
66
79
|
## Переменные кастомизации (см. [ThemeContext](https://tech.skbkontur.ru/react-ui/#/Customization/ThemeContext))
|
|
67
80
|
|
|
68
81
|
```js
|