@skbkontur/side-menu 3.3.2 → 3.3.4
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 +22 -0
- package/SideMenuDataTids.js +1 -4
- package/hooks/useAnimateOnMount.js +6 -9
- package/hooks/useMemoIcon.js +12 -18
- package/index.js +14 -17
- package/internal/themes/SideMenuTheme.js +10 -15
- package/lib/theming/ThemeHelpers.js +14 -20
- package/lib/theming/ThemeTypes.js +1 -2
- package/lib/utils/memo.js +1 -5
- package/lib/utils/scripts.js +5 -11
- package/package.json +3 -3
- package/src/Navigation.js +18 -21
- package/src/SideMenu/SideMenu.js +119 -120
- package/src/SideMenu/SideMenu.styles.js +28 -31
- package/src/SideMenuAvatar/SideMenuAvatar.d.ts +1 -1
- package/src/SideMenuAvatar/SideMenuAvatar.js +11 -14
- package/src/SideMenuBody/SideMenuBody.js +18 -21
- package/src/SideMenuBody/SideMenuBody.styles.js +6 -9
- package/src/SideMenuContext.d.ts +1 -1
- package/src/SideMenuContext.js +2 -5
- package/src/SideMenuDivider/SideMenuDivider.js +11 -14
- package/src/SideMenuDivider/SideMenuDivider.styles.js +5 -8
- package/src/SideMenuDropdown/SideMenuDropdown.d.ts +1 -1
- package/src/SideMenuDropdown/SideMenuDropdown.js +22 -24
- package/src/SideMenuDropdown/SideMenuDropdown.styles.js +9 -12
- package/src/SideMenuFooter/SideMenuFooter.js +21 -24
- package/src/SideMenuFooter/SideMenuFooter.styles.js +7 -10
- package/src/SideMenuHeader/SideMenuHeader.js +26 -29
- package/src/SideMenuHeader/SideMenuHeader.styles.js +9 -12
- package/src/SideMenuItem/SideMenuItem.js +7 -10
- package/src/SideMenuLink/SideMenuLink.js +9 -12
- package/src/SideMenuLink/SideMenuLink.styles.js +4 -7
- package/src/SideMenuNotifications/BellWidget.js +41 -45
- package/src/SideMenuNotifications/BellWidgetError.js +15 -20
- package/src/SideMenuNotifications/BellWidgetView.styles.js +11 -14
- package/src/SideMenuNotifications/SideMenuNotifications.js +23 -26
- package/src/SideMenuNotifications/utils/getMarker.js +1 -4
- package/src/SideMenuNotifications/utils/getNotificationsErrorMessages.js +1 -5
- package/src/SideMenuOrganisations/SideMenuOrganisations.js +7 -10
- package/src/SideMenuSubItem/SideMenuSubItem.js +8 -11
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +15 -18
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +6 -9
- package/src/SideMenuSubLink/SideMenuSubLink.js +7 -10
- package/src/Tree.js +9 -12
- package/src/internal/BackButton.js +10 -14
- package/src/internal/Backdrop.js +11 -15
- package/src/internal/Backdrop.styles.js +5 -8
- package/src/internal/Burger.js +12 -17
- package/src/internal/Burger.styles.js +6 -9
- package/src/internal/ClickableElement.js +44 -47
- package/src/internal/ClickableElement.styles.js +12 -15
- package/src/internal/InnerSubMenu.js +10 -14
- package/src/internal/ItemContent/Caption.js +31 -34
- package/src/internal/ItemContent/Caption.styles.js +20 -23
- package/src/internal/ItemContent/Icon.js +20 -25
- package/src/internal/ItemContent/Icon.styles.js +11 -14
- package/src/internal/ItemContent/ItemContent.js +33 -36
- package/src/internal/ItemContent/ItemContent.styles.js +15 -18
- package/src/internal/ItemContent/Marker.js +16 -21
- package/src/internal/ItemContent/Marker.styles.js +12 -15
- package/src/internal/NestedMenu.js +15 -19
- package/src/internal/NestedMenu.styles.js +5 -8
- package/src/internal/RightBorder.js +19 -22
- package/src/internal/RightBorder.styles.js +6 -9
- package/src/internal/SeparatedSubMenu.js +36 -40
- package/src/internal/SeparatedSubMenu.styles.js +13 -16
- package/src/internal/SideMenuLogotype.js +31 -34
- package/src/internal/SideMenuLogotype.styles.js +14 -17
- package/src/internal/SubMenu.js +11 -15
|
@@ -1,63 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var BellWidgetView_styles_1 = require("./BellWidgetView.styles");
|
|
18
|
-
var SideMenuNotifications_1 = require("./SideMenuNotifications");
|
|
19
|
-
var BellWidgetError_1 = require("./BellWidgetError");
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { XIcon20Regular } from '@skbkontur/icons/icons/XIcon/XIcon20Regular';
|
|
4
|
+
import { Center } from '@skbkontur/react-ui/components/Center/Center';
|
|
5
|
+
import { Spinner } from '@skbkontur/react-ui/components/Spinner/Spinner';
|
|
6
|
+
import { Button } from '@skbkontur/react-ui/components/Button/Button';
|
|
7
|
+
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
8
|
+
import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
9
|
+
import { createFailure, createSuccess, isFailure } from '@skbkontur/operation-result';
|
|
10
|
+
import { usePersistentCallback, WidgetRenderer } from '@skbkontur/widget-consumer-react-utils';
|
|
11
|
+
import { SideMenuDataTids } from '../../SideMenuDataTids';
|
|
12
|
+
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
|
|
13
|
+
import { SideMenuTheme } from '../../internal/themes/SideMenuTheme';
|
|
14
|
+
import { customStyles, jsStyles } from './BellWidgetView.styles';
|
|
15
|
+
import { BELL_SIDE_MENU_DATA_ITEM } from './SideMenuNotifications';
|
|
16
|
+
import { BellWidgetError } from './BellWidgetError';
|
|
20
17
|
var getBtnTopPosition = function () {
|
|
21
18
|
var _a;
|
|
22
|
-
var bellDropDownItem = document.querySelector("[data-item=\"".concat(
|
|
19
|
+
var bellDropDownItem = document.querySelector("[data-item=\"".concat(BELL_SIDE_MENU_DATA_ITEM, "\"]"));
|
|
23
20
|
return (_a = bellDropDownItem === null || bellDropDownItem === void 0 ? void 0 : bellDropDownItem.offsetTop) !== null && _a !== void 0 ? _a : 0;
|
|
24
21
|
};
|
|
25
|
-
var BellWidget = function (props) {
|
|
22
|
+
export var BellWidget = function (props) {
|
|
26
23
|
var widgetApi = props.widgetApi, onClose = props.onClose, renderErrorButton = props.renderErrorButton, renderErrorMessage = props.renderErrorMessage, onError = props.onError;
|
|
27
24
|
var btnTopPosition = getBtnTopPosition();
|
|
28
|
-
var theme =
|
|
29
|
-
var hasCustomWrapperHeight = theme.sideMenuNotificationsWrapperHeight !==
|
|
30
|
-
var renderWidget =
|
|
25
|
+
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
26
|
+
var hasCustomWrapperHeight = theme.sideMenuNotificationsWrapperHeight !== SideMenuTheme.sideMenuNotificationsWrapperHeight;
|
|
27
|
+
var renderWidget = usePersistentCallback(function (container) { return __awaiter(void 0, void 0, void 0, function () {
|
|
31
28
|
var api, wrapper, renderResult;
|
|
32
|
-
return
|
|
29
|
+
return __generator(this, function (_a) {
|
|
33
30
|
switch (_a.label) {
|
|
34
31
|
case 0: return [4 /*yield*/, widgetApi];
|
|
35
32
|
case 1:
|
|
36
33
|
api = _a.sent();
|
|
37
|
-
if (
|
|
38
|
-
return [2 /*return*/,
|
|
34
|
+
if (isFailure(api)) {
|
|
35
|
+
return [2 /*return*/, createFailure(api.fault)];
|
|
39
36
|
}
|
|
40
37
|
wrapper = container.parentElement;
|
|
41
38
|
if (wrapper) {
|
|
42
|
-
wrapper.classList.add(
|
|
39
|
+
wrapper.classList.add(jsStyles.widgetWrapper());
|
|
43
40
|
}
|
|
44
41
|
container.style.height = '100%';
|
|
45
42
|
return [4 /*yield*/, api.value.render({ container: container })];
|
|
46
43
|
case 2:
|
|
47
44
|
renderResult = _a.sent();
|
|
48
|
-
if (
|
|
45
|
+
if (isFailure(renderResult)) {
|
|
49
46
|
onError === null || onError === void 0 ? void 0 : onError(renderResult.fault);
|
|
50
|
-
return [2 /*return*/,
|
|
47
|
+
return [2 /*return*/, createFailure(renderResult.fault)];
|
|
51
48
|
}
|
|
52
|
-
return [2 /*return*/,
|
|
53
|
-
dispose: function () { return
|
|
49
|
+
return [2 /*return*/, createSuccess({
|
|
50
|
+
dispose: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
54
51
|
var disposeResult;
|
|
55
|
-
return
|
|
52
|
+
return __generator(this, function (_a) {
|
|
56
53
|
switch (_a.label) {
|
|
57
54
|
case 0: return [4 /*yield*/, renderResult.value.dispose()];
|
|
58
55
|
case 1:
|
|
59
56
|
disposeResult = _a.sent();
|
|
60
|
-
if (
|
|
57
|
+
if (isFailure(disposeResult)) {
|
|
61
58
|
onError === null || onError === void 0 ? void 0 : onError(disposeResult.fault);
|
|
62
59
|
}
|
|
63
60
|
return [2 /*return*/];
|
|
@@ -72,16 +69,15 @@ var BellWidget = function (props) {
|
|
|
72
69
|
btnBorderRadiusMedium: '20px',
|
|
73
70
|
};
|
|
74
71
|
var wrapperHeightClass = hasCustomWrapperHeight
|
|
75
|
-
?
|
|
76
|
-
:
|
|
77
|
-
return (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
? customStyles.customHeight(theme.sideMenuNotificationsWrapperHeight)
|
|
73
|
+
: customStyles.defaultHeight(btnTopPosition);
|
|
74
|
+
return (React.createElement("div", { className: cx(jsStyles.root(), wrapperHeightClass) },
|
|
75
|
+
React.createElement("div", { className: jsStyles.header(), "data-tid": SideMenuDataTids.bellHeader },
|
|
76
|
+
React.createElement("span", { className: jsStyles.headerText() }, "\u0423\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F"),
|
|
77
|
+
React.createElement(Button, { use: "text", size: "medium", width: 40, icon: React.createElement(XIcon20Regular, null), onClick: onClose, theme: buttonCloseTheme, "data-tid": SideMenuDataTids.bellCloseButton, "aria-label": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F" })),
|
|
78
|
+
React.createElement(WidgetRenderer, { renderWidget: renderWidget, renderFault: function (_a) {
|
|
82
79
|
var fault = _a.fault, retryRender = _a.retryRender;
|
|
83
|
-
return (
|
|
84
|
-
}, loader:
|
|
85
|
-
|
|
80
|
+
return (React.createElement(BellWidgetError, { renderErrorButton: renderErrorButton, error: fault, renderErrorMessage: renderErrorMessage, retryRender: retryRender }));
|
|
81
|
+
}, loader: React.createElement(Center, null,
|
|
82
|
+
React.createElement(Spinner, { caption: "\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043C \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F..." })) })));
|
|
86
83
|
};
|
|
87
|
-
exports.BellWidget = BellWidget;
|
|
@@ -1,26 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var WarningTriangleIcon64Solid_1 = require("@skbkontur/icons/icons/WarningTriangleIcon/WarningTriangleIcon64Solid");
|
|
9
|
-
var ArrowUiAuthLoginIcon64Regular_1 = require("@skbkontur/icons/icons/ArrowUiAuthLoginIcon/ArrowUiAuthLoginIcon64Regular");
|
|
10
|
-
var getNotificationsErrorMessages_1 = require("./utils/getNotificationsErrorMessages");
|
|
11
|
-
var BellWidgetError = function (_a) {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Center } from '@skbkontur/react-ui/components/Center/Center';
|
|
3
|
+
import { EmptyState } from '@skbkontur/empty-state';
|
|
4
|
+
import { WarningTriangleIcon64Solid } from '@skbkontur/icons/icons/WarningTriangleIcon/WarningTriangleIcon64Solid';
|
|
5
|
+
import { ArrowUiAuthLoginIcon64Regular } from '@skbkontur/icons/icons/ArrowUiAuthLoginIcon/ArrowUiAuthLoginIcon64Regular';
|
|
6
|
+
import { getErrorMessages } from './utils/getNotificationsErrorMessages';
|
|
7
|
+
export var BellWidgetError = function (_a) {
|
|
12
8
|
var renderErrorButton = _a.renderErrorButton, error = _a.error, renderErrorMessage = _a.renderErrorMessage, retryRender = _a.retryRender;
|
|
13
9
|
if (renderErrorMessage) {
|
|
14
|
-
return
|
|
10
|
+
return React.createElement(React.Fragment, null, renderErrorMessage(error, retryRender));
|
|
15
11
|
}
|
|
16
12
|
var isNotAuthorizedError = error.type === 'userNotAuthorized';
|
|
17
13
|
var errorButton = renderErrorButton === null || renderErrorButton === void 0 ? void 0 : renderErrorButton(error, retryRender);
|
|
18
|
-
var _b =
|
|
19
|
-
var icon = isNotAuthorizedError ? (
|
|
20
|
-
return (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
errorButton &&
|
|
14
|
+
var _b = getErrorMessages(isNotAuthorizedError), titleMessage = _b.titleMessage, errorMessage = _b.errorMessage;
|
|
15
|
+
var icon = isNotAuthorizedError ? (React.createElement(ArrowUiAuthLoginIcon64Regular, { color: "#FCB73E" })) : (React.createElement(WarningTriangleIcon64Solid, { color: "#FCB73E" }));
|
|
16
|
+
return (React.createElement(Center, null,
|
|
17
|
+
React.createElement(EmptyState, { use: "status" },
|
|
18
|
+
React.createElement(EmptyState.Header, { icon: icon }, titleMessage),
|
|
19
|
+
React.createElement(EmptyState.Body, null, errorMessage),
|
|
20
|
+
errorButton && React.createElement(EmptyState.Footer, null, errorButton))));
|
|
25
21
|
};
|
|
26
|
-
exports.BellWidgetError = BellWidgetError;
|
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
|
|
6
|
-
var ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
2
|
+
import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
+
import { memoizeStyle } from '../../lib/theming/ThemeHelpers';
|
|
7
4
|
var styles = {
|
|
8
5
|
root: function () {
|
|
9
|
-
return
|
|
6
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: 400px;\n max-height: 784px;\n width: 100%;\n max-width: 100vw;\n\n @media (min-width: 768px) {\n width: 448px;\n }\n "], ["\n display: flex;\n flex-direction: column;\n min-height: 400px;\n max-height: 784px;\n width: 100%;\n max-width: 100vw;\n\n @media (min-width: 768px) {\n width: 448px;\n }\n "])));
|
|
10
7
|
},
|
|
11
8
|
widgetWrapper: function () {
|
|
12
|
-
return
|
|
9
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n min-height: 0;\n flex-grow: 1;\n "], ["\n min-height: 0;\n flex-grow: 1;\n "])));
|
|
13
10
|
},
|
|
14
11
|
header: function () {
|
|
15
|
-
return
|
|
12
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n padding: 6px 6px 0 20px;\n align-items: center;\n justify-content: space-between;\n "], ["\n display: flex;\n padding: 6px 6px 0 20px;\n align-items: center;\n justify-content: space-between;\n "])));
|
|
16
13
|
},
|
|
17
14
|
headerText: function () {
|
|
18
|
-
return
|
|
15
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: 18px;\n line-height: 24px;\n font-weight: 700;\n "], ["\n font-size: 18px;\n line-height: 24px;\n font-weight: 700;\n "])));
|
|
19
16
|
},
|
|
20
17
|
};
|
|
21
|
-
|
|
18
|
+
export var customStyles = {
|
|
22
19
|
defaultHeight: function (offsetTop) {
|
|
23
20
|
var offsetBottom = '20px';
|
|
24
|
-
return
|
|
21
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n height: calc(100vh - ", "px - ", ");\n "], ["\n height: calc(100vh - ", "px - ", ");\n "])), offsetTop, offsetBottom);
|
|
25
22
|
},
|
|
26
23
|
customHeight: function (value) {
|
|
27
|
-
return
|
|
24
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n height: ", ";\n "], ["\n height: ", ";\n "])), value);
|
|
28
25
|
},
|
|
29
26
|
};
|
|
30
|
-
|
|
27
|
+
export var jsStyles = memoizeStyle(styles);
|
|
31
28
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var currentIcon = marker ? react_1.default.createElement(NotificationBellAlarmIcon24Regular_1.NotificationBellAlarmIcon24Regular, null) : react_1.default.createElement(NotificationBellIcon24Regular_1.NotificationBellIcon24Regular, null);
|
|
21
|
-
var theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
|
|
22
|
-
var bellDropDownItem = document.querySelector("[data-item=\"".concat(exports.BELL_SIDE_MENU_DATA_ITEM, "\"]"));
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import React, { forwardRef, useContext } from 'react';
|
|
3
|
+
import { NotificationBellIcon24Regular } from '@skbkontur/icons/icons/NotificationBellIcon/NotificationBellIcon24Regular';
|
|
4
|
+
import { NotificationBellAlarmIcon24Regular } from '@skbkontur/icons/icons/NotificationBellAlarmIcon/NotificationBellAlarmIcon24Regular';
|
|
5
|
+
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
6
|
+
import { ThemeFactory } from '@skbkontur/react-ui/lib/theming/ThemeFactory';
|
|
7
|
+
import { SideMenuDropdown } from '../SideMenuDropdown/SideMenuDropdown';
|
|
8
|
+
import { SideMenu } from '../SideMenu/SideMenu';
|
|
9
|
+
import { SideMenuDataTids } from '../../SideMenuDataTids';
|
|
10
|
+
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
|
|
11
|
+
import { BellWidget } from './BellWidget';
|
|
12
|
+
import { getMarker } from './utils/getMarker';
|
|
13
|
+
export var BELL_SIDE_MENU_DATA_ITEM = 'bell_side-menu-button';
|
|
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"]);
|
|
16
|
+
var marker = getMarker(count);
|
|
17
|
+
var currentIcon = marker ? React.createElement(NotificationBellAlarmIcon24Regular, null) : React.createElement(NotificationBellIcon24Regular, null);
|
|
18
|
+
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
19
|
+
var bellDropDownItem = document.querySelector("[data-item=\"".concat(BELL_SIDE_MENU_DATA_ITEM, "\"]"));
|
|
23
20
|
var bellDropDownButton = bellDropDownItem === null || bellDropDownItem === void 0 ? void 0 : bellDropDownItem.querySelector('button');
|
|
24
21
|
var handleClose = function () {
|
|
25
22
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
@@ -28,7 +25,7 @@ var SideMenuNotificationsInner = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
28
25
|
}
|
|
29
26
|
bellDropDownButton === null || bellDropDownButton === void 0 ? void 0 : bellDropDownButton.click();
|
|
30
27
|
};
|
|
31
|
-
return (
|
|
28
|
+
return (React.createElement(ThemeContext.Provider, { value: ThemeFactory.create({
|
|
32
29
|
popupBorderRadius: '16px',
|
|
33
30
|
menuBorderRadius: '16px',
|
|
34
31
|
menuPaddingX: '0px',
|
|
@@ -36,14 +33,14 @@ var SideMenuNotificationsInner = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
36
33
|
menuScrollContainerContentWrapperPaddingY: '0px',
|
|
37
34
|
sideMenuMarkerBg: theme.sideMenuNotificationsMarkerBg,
|
|
38
35
|
}, theme) },
|
|
39
|
-
|
|
40
|
-
showDivider &&
|
|
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 }))),
|
|
37
|
+
showDivider && React.createElement(SideMenu.Divider, null)));
|
|
41
38
|
});
|
|
42
39
|
/**
|
|
43
40
|
* Список уведомлений
|
|
44
41
|
*
|
|
45
42
|
* @visibleName SideMenu.Notifications
|
|
46
43
|
*/
|
|
47
|
-
|
|
44
|
+
export var SideMenuNotifications = Object.assign(SideMenuNotificationsInner, {
|
|
48
45
|
__KONTUR_REACT_UI__: 'SideMenuSideMenuNotifications',
|
|
49
46
|
});
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getErrorMessages = void 0;
|
|
4
1
|
var DEFAULT_MESSAGE = 'Попробуйте обновить страницу';
|
|
5
2
|
var SUPPORT_MESSAGE = 'Если проблема не\u00A0решится, обратитесь в\u00A0поддержку';
|
|
6
3
|
var AUTHORIZE_MESSAGE = 'Войдите в учетную запись, чтобы\u00A0посмотреть уведомления';
|
|
@@ -11,9 +8,8 @@ var getErrorMessage = function (isNotAuthorizedError) {
|
|
|
11
8
|
var getTitleMessage = function (isNotAuthorizedError) {
|
|
12
9
|
return isNotAuthorizedError ? AUTHORIZE_MESSAGE : DEFAULT_ERROR_MESSAGE;
|
|
13
10
|
};
|
|
14
|
-
var getErrorMessages = function (isNotAuthorizedError) {
|
|
11
|
+
export var getErrorMessages = function (isNotAuthorizedError) {
|
|
15
12
|
var titleMessage = getTitleMessage(isNotAuthorizedError);
|
|
16
13
|
var errorMessage = getErrorMessage(isNotAuthorizedError);
|
|
17
14
|
return { titleMessage: titleMessage, errorMessage: errorMessage };
|
|
18
15
|
};
|
|
19
|
-
exports.getErrorMessages = getErrorMessages;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var SideMenuOrganisationsInner = (0, react_1.forwardRef)(function (_a, ref) {
|
|
8
|
-
var children = _a.children, _b = _a.caption, caption = _b === void 0 ? 'СКБ Контур' : _b, rest = tslib_1.__rest(_a, ["children", "caption"]);
|
|
9
|
-
return (react_1.default.createElement(SideMenuDropdown_1.SideMenuDropdown, tslib_1.__assign({ caption: caption, menuWidth: '240px', positions: ['top left'], ref: ref }, rest), children));
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { SideMenuDropdown } from '../SideMenuDropdown/SideMenuDropdown';
|
|
4
|
+
var SideMenuOrganisationsInner = forwardRef(function (_a, ref) {
|
|
5
|
+
var children = _a.children, _b = _a.caption, caption = _b === void 0 ? 'СКБ Контур' : _b, rest = __rest(_a, ["children", "caption"]);
|
|
6
|
+
return (React.createElement(SideMenuDropdown, __assign({ caption: caption, menuWidth: '240px', positions: ['top left'], ref: ref }, rest), children));
|
|
10
7
|
});
|
|
11
8
|
SideMenuOrganisationsInner.displayName = 'SideMenuOrganisations';
|
|
12
9
|
/**
|
|
@@ -14,6 +11,6 @@ SideMenuOrganisationsInner.displayName = 'SideMenuOrganisations';
|
|
|
14
11
|
*
|
|
15
12
|
* @visibleName SideMenu.Organisations
|
|
16
13
|
*/
|
|
17
|
-
|
|
14
|
+
export var SideMenuOrganisations = Object.assign(SideMenuOrganisationsInner, {
|
|
18
15
|
__KONTUR_REACT_UI__: 'SideMenuOrganisations',
|
|
19
16
|
});
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var props = tslib_1.__rest(_a, []);
|
|
9
|
-
return (react_1.default.createElement("li", { ref: ref },
|
|
10
|
-
react_1.default.createElement(SideMenuItem_1.SideMenuItem, tslib_1.__assign({ _isSubMenu: true }, props))));
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { SideMenuItem } from '../SideMenuItem/SideMenuItem';
|
|
4
|
+
var SideMenuSubItemInner = forwardRef(function (_a, ref) {
|
|
5
|
+
var props = __rest(_a, []);
|
|
6
|
+
return (React.createElement("li", { ref: ref },
|
|
7
|
+
React.createElement(SideMenuItem, __assign({ _isSubMenu: true }, props))));
|
|
11
8
|
});
|
|
12
9
|
SideMenuSubItemInner.displayName = 'SideMenuSubItem';
|
|
13
10
|
/**
|
|
@@ -15,4 +12,4 @@ SideMenuSubItemInner.displayName = 'SideMenuSubItem';
|
|
|
15
12
|
*
|
|
16
13
|
* @visibleName SideMenu.SubItem
|
|
17
14
|
*/
|
|
18
|
-
|
|
15
|
+
export var SideMenuSubItem = Object.assign(SideMenuSubItemInner, { __KONTUR_REACT_UI__: 'SideMenuSubItem' });
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
var ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
|
|
10
|
-
var SideMenuSubItemHeader_styles_1 = require("./SideMenuSubItemHeader.styles");
|
|
11
|
-
var SideMenuSubItemHeaderInner = (0, react_1.forwardRef)(function (_a, ref) {
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import React, { forwardRef, useContext } from 'react';
|
|
3
|
+
import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
4
|
+
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
5
|
+
import { SideMenuContext } from '../SideMenuContext';
|
|
6
|
+
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
|
|
7
|
+
import { jsStyles } from './SideMenuSubItemHeader.styles';
|
|
8
|
+
var SideMenuSubItemHeaderInner = forwardRef(function (_a, ref) {
|
|
12
9
|
var _b;
|
|
13
|
-
var className = _a.className, children = _a.children, rest =
|
|
14
|
-
var context =
|
|
15
|
-
var theme =
|
|
16
|
-
return (
|
|
17
|
-
_b[
|
|
18
|
-
_b[
|
|
10
|
+
var className = _a.className, children = _a.children, rest = __rest(_a, ["className", "children"]);
|
|
11
|
+
var context = useContext(SideMenuContext);
|
|
12
|
+
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
13
|
+
return (React.createElement("p", __assign({ className: cx((_b = {},
|
|
14
|
+
_b[jsStyles.root(theme)] = true,
|
|
15
|
+
_b[jsStyles.rootInSeparatedSubMenu()] = context.isSeparatedMenu,
|
|
19
16
|
_b), className), ref: ref }, rest), children));
|
|
20
17
|
});
|
|
21
18
|
SideMenuSubItemHeaderInner.displayName = 'SideMenuSubItemHeader';
|
|
@@ -24,6 +21,6 @@ SideMenuSubItemHeaderInner.displayName = 'SideMenuSubItemHeader';
|
|
|
24
21
|
*
|
|
25
22
|
* @visibleName SideMenu.SubItemHeader
|
|
26
23
|
*/
|
|
27
|
-
|
|
24
|
+
export var SideMenuSubItemHeader = Object.assign(SideMenuSubItemHeaderInner, {
|
|
28
25
|
__KONTUR_REACT_UI__: 'SideMenuSubItemHeader',
|
|
29
26
|
});
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
|
|
6
|
-
var ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
2
|
+
import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
+
import { memoizeStyle } from '../../lib/theming/ThemeHelpers';
|
|
7
4
|
var styles = {
|
|
8
5
|
root: function (t) {
|
|
9
|
-
return
|
|
6
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: ", ";\n color: ", ";\n padding: ", ";\n margin: 0;\n "], ["\n font-size: ", ";\n color: ", ";\n padding: ", ";\n margin: 0;\n "])), t.sideMenuSubItemHeaderFontSize, t.sideMenuSubItemHeaderColor, t.sideMenuSubItemHeaderPadding);
|
|
10
7
|
},
|
|
11
8
|
rootInSeparatedSubMenu: function () {
|
|
12
|
-
return
|
|
9
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-left: 8px;\n "], ["\n padding-left: 8px;\n "])));
|
|
13
10
|
},
|
|
14
11
|
};
|
|
15
|
-
|
|
12
|
+
export var jsStyles = memoizeStyle(styles);
|
|
16
13
|
var templateObject_1, templateObject_2;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var SideMenuSubLinkInner = (0, react_1.forwardRef)(function (props, ref) {
|
|
8
|
-
return (react_1.default.createElement("li", { ref: ref },
|
|
9
|
-
react_1.default.createElement(SideMenuLink_1.SideMenuLink, tslib_1.__assign({ _isSubMenu: true }, props))));
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { SideMenuLink } from '../SideMenuLink/SideMenuLink';
|
|
4
|
+
var SideMenuSubLinkInner = forwardRef(function (props, ref) {
|
|
5
|
+
return (React.createElement("li", { ref: ref },
|
|
6
|
+
React.createElement(SideMenuLink, __assign({ _isSubMenu: true }, props))));
|
|
10
7
|
});
|
|
11
8
|
SideMenuSubLinkInner.displayName = 'SideMenuSubLink';
|
|
12
9
|
/**
|
|
@@ -18,4 +15,4 @@ SideMenuSubLinkInner.displayName = 'SideMenuSubLink';
|
|
|
18
15
|
*
|
|
19
16
|
* @visibleName SideMenu.SubLink
|
|
20
17
|
*/
|
|
21
|
-
|
|
18
|
+
export var SideMenuSubLink = Object.assign(SideMenuSubLinkInner, { __KONTUR_REACT_UI__: 'SideMenuSubLink' });
|
package/src/Tree.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Tree = exports.TreeNode = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
1
|
+
import { __generator, __values } from "tslib";
|
|
5
2
|
var TreeNode = /** @class */ (function () {
|
|
6
3
|
function TreeNode(id, value, parent) {
|
|
7
4
|
if (value === void 0) { value = null; }
|
|
@@ -20,7 +17,7 @@ var TreeNode = /** @class */ (function () {
|
|
|
20
17
|
});
|
|
21
18
|
return TreeNode;
|
|
22
19
|
}());
|
|
23
|
-
|
|
20
|
+
export { TreeNode };
|
|
24
21
|
var Tree = /** @class */ (function () {
|
|
25
22
|
function Tree(id, value) {
|
|
26
23
|
if (value === void 0) { value = null; }
|
|
@@ -30,7 +27,7 @@ var Tree = /** @class */ (function () {
|
|
|
30
27
|
var _a, _b, child, e_1_1;
|
|
31
28
|
var e_1, _c;
|
|
32
29
|
if (node === void 0) { node = this.root; }
|
|
33
|
-
return
|
|
30
|
+
return __generator(this, function (_d) {
|
|
34
31
|
switch (_d.label) {
|
|
35
32
|
case 0: return [4 /*yield*/, node];
|
|
36
33
|
case 1:
|
|
@@ -39,12 +36,12 @@ var Tree = /** @class */ (function () {
|
|
|
39
36
|
_d.label = 2;
|
|
40
37
|
case 2:
|
|
41
38
|
_d.trys.push([2, 7, 8, 9]);
|
|
42
|
-
_a =
|
|
39
|
+
_a = __values(node.children), _b = _a.next();
|
|
43
40
|
_d.label = 3;
|
|
44
41
|
case 3:
|
|
45
42
|
if (!!_b.done) return [3 /*break*/, 6];
|
|
46
43
|
child = _b.value;
|
|
47
|
-
return [5 /*yield**/,
|
|
44
|
+
return [5 /*yield**/, __values(this.preOrderTraversal(child))];
|
|
48
45
|
case 4:
|
|
49
46
|
_d.sent();
|
|
50
47
|
_d.label = 5;
|
|
@@ -73,7 +70,7 @@ var Tree = /** @class */ (function () {
|
|
|
73
70
|
return false;
|
|
74
71
|
}
|
|
75
72
|
try {
|
|
76
|
-
for (var _b =
|
|
73
|
+
for (var _b = __values(this.preOrderTraversal()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
77
74
|
var node = _c.value;
|
|
78
75
|
if (node.id === parentId && node.children.every(function (node) { return node.id !== id; })) {
|
|
79
76
|
node.children.push(new TreeNode(id, value, node));
|
|
@@ -93,7 +90,7 @@ var Tree = /** @class */ (function () {
|
|
|
93
90
|
Tree.prototype.remove = function (id) {
|
|
94
91
|
var e_3, _a;
|
|
95
92
|
try {
|
|
96
|
-
for (var _b =
|
|
93
|
+
for (var _b = __values(this.preOrderTraversal()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
97
94
|
var node = _c.value;
|
|
98
95
|
var filtered = node.children.filter(function (c) { return c.id !== id; });
|
|
99
96
|
if (filtered.length !== node.children.length) {
|
|
@@ -117,7 +114,7 @@ var Tree = /** @class */ (function () {
|
|
|
117
114
|
return undefined;
|
|
118
115
|
}
|
|
119
116
|
try {
|
|
120
|
-
for (var _b =
|
|
117
|
+
for (var _b = __values(this.preOrderTraversal()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
121
118
|
var node = _c.value;
|
|
122
119
|
if (node.id === id) {
|
|
123
120
|
return node;
|
|
@@ -135,4 +132,4 @@ var Tree = /** @class */ (function () {
|
|
|
135
132
|
};
|
|
136
133
|
return Tree;
|
|
137
134
|
}());
|
|
138
|
-
|
|
135
|
+
export { Tree };
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var SideMenuDataTids_1 = require("../../SideMenuDataTids");
|
|
8
|
-
var SideMenuItem_1 = require("../SideMenuItem/SideMenuItem");
|
|
9
|
-
var SideMenuContext_1 = require("../SideMenuContext");
|
|
10
|
-
var Navigation_1 = require("../Navigation");
|
|
1
|
+
import React, { forwardRef, useContext } from 'react';
|
|
2
|
+
import { ArrowALeftIcon20Regular } from '@skbkontur/icons/icons/ArrowALeftIcon/ArrowALeftIcon20Regular';
|
|
3
|
+
import { SideMenuDataTids } from '../../SideMenuDataTids';
|
|
4
|
+
import { SideMenuItem } from '../SideMenuItem/SideMenuItem';
|
|
5
|
+
import { SideMenuContext } from '../SideMenuContext';
|
|
6
|
+
import { navigationAttributeBackButton } from '../Navigation';
|
|
11
7
|
/**
|
|
12
8
|
* Кнопка возврата в меню первого уровня
|
|
13
9
|
*
|
|
14
10
|
* @visibleName BackButton
|
|
15
11
|
*/
|
|
16
|
-
var BackButton =
|
|
12
|
+
var BackButton = forwardRef(function (_a, ref) {
|
|
17
13
|
var _b;
|
|
18
14
|
var caption = _a.caption, id = _a.id;
|
|
19
|
-
var context =
|
|
15
|
+
var context = useContext(SideMenuContext);
|
|
20
16
|
var handleClick = function () {
|
|
21
17
|
var _a;
|
|
22
18
|
(_a = context.navigation) === null || _a === void 0 ? void 0 : _a.switchActiveMenuItem(id);
|
|
23
19
|
};
|
|
24
|
-
return (
|
|
20
|
+
return (React.createElement(SideMenuItem, (_b = { "data-tid": SideMenuDataTids.backButton, icon: React.createElement(ArrowALeftIcon20Regular, null), caption: caption, _isSubMenu: true, onClick: handleClick, _isBackButton: true, ref: ref }, _b[navigationAttributeBackButton] = '', _b)));
|
|
25
21
|
});
|
|
26
22
|
BackButton.displayName = 'BackButton';
|
|
27
23
|
var BackButtonWithStaticFields = Object.assign(BackButton, { __KONTUR_REACT_UI__: 'BackButton' });
|
|
28
|
-
|
|
24
|
+
export { BackButtonWithStaticFields as BackButton };
|