@skbkontur/side-menu 5.0.0-alpha.3 → 5.0.0-beta.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 +26 -0
- package/README.md +2 -2
- package/internal/themes/SideMenuDarkTheme.js +7 -6
- package/internal/themes/SideMenuTheme.d.ts +21 -0
- package/internal/themes/SideMenuTheme.js +49 -8
- package/lib/theming/ThemeHelpers.js +4 -0
- package/package.json +7 -7
- package/src/SideMenu/SideMenu.d.ts +1 -0
- package/src/SideMenu/SideMenu.js +17 -20
- package/src/SideMenu/SideMenu.styles.d.ts +1 -2
- package/src/SideMenu/SideMenu.styles.js +12 -18
- package/src/SideMenuBody/SideMenuBody.js +27 -2
- package/src/SideMenuBody/SideMenuBody.styles.js +2 -1
- package/src/SideMenuDivider/SideMenuDivider.js +12 -2
- package/src/SideMenuDivider/SideMenuDivider.styles.d.ts +5 -0
- package/src/SideMenuDivider/SideMenuDivider.styles.js +18 -3
- package/src/SideMenuDropdown/SideMenuDropdown.styles.js +2 -2
- package/src/SideMenuFooter/SideMenuFooter.js +6 -4
- package/src/SideMenuFooter/SideMenuFooter.styles.js +3 -2
- package/src/SideMenuHeader/SideMenuHeader.styles.js +1 -1
- package/src/SideMenuNotifications/BellWidget.js +13 -6
- package/src/SideMenuNotifications/BellWidgetError.js +6 -3
- package/src/SideMenuNotifications/BellWidgetView.styles.d.ts +7 -4
- package/src/SideMenuNotifications/BellWidgetView.styles.js +20 -9
- package/src/SideMenuNotifications/utils/getWrapperHeightClass.d.ts +11 -0
- package/src/SideMenuNotifications/utils/getWrapperHeightClass.js +10 -0
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +2 -0
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.d.ts +2 -0
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +9 -3
- package/src/internal/ClickableElement.d.ts +2 -1
- package/src/internal/ClickableElement.js +14 -10
- package/src/internal/CollapseToggle.js +1 -2
- package/src/internal/CollapseToggle.styles.d.ts +0 -1
- package/src/internal/CollapseToggle.styles.js +2 -5
- package/src/internal/ItemContent/Caption.js +7 -6
- package/src/internal/ItemContent/Caption.styles.d.ts +3 -0
- package/src/internal/ItemContent/Caption.styles.js +18 -9
- package/src/internal/ItemContent/Icon.js +2 -1
- package/src/internal/ItemContent/Icon.styles.d.ts +1 -0
- package/src/internal/ItemContent/Icon.styles.js +9 -5
- package/src/internal/ItemContent/ItemContent.js +3 -1
- package/src/internal/SideMenuLogotype.js +24 -3
- package/src/internal/SideMenuLogotype.styles.js +3 -3
|
@@ -4,11 +4,26 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
4
4
|
var css = _a.css;
|
|
5
5
|
return ({
|
|
6
6
|
root: function (t) {
|
|
7
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height:
|
|
7
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 0;\n border: none;\n border-top: 1px solid ", ";\n margin: ", " ", " ", ";\n "], ["\n height: 0;\n border: none;\n border-top: 1px solid ", ";\n margin: ", " ", " ", ";\n "])), t.sideMenuDividerBg, t.sideMenuDividerMarginTop, t.sideMenuDividerMarginX, t.sideMenuDividerMarginBottom);
|
|
8
|
+
},
|
|
9
|
+
rootOpened: function (t) {
|
|
10
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuDividerMarginLeft);
|
|
11
|
+
},
|
|
12
|
+
rootSubItem: function (t) {
|
|
13
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuDividerSubItemMarginLeft);
|
|
14
|
+
},
|
|
15
|
+
rootWithoutItemIcons: function (t) {
|
|
16
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuCaptionMarginLeftWithoutIcons);
|
|
17
|
+
},
|
|
18
|
+
rootSubItemWithoutItemIcons: function (t) {
|
|
19
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuSubItemCaptionMarginLeftWithoutIcons);
|
|
20
|
+
},
|
|
21
|
+
rootInSeparatedSubMenu: function (t) {
|
|
22
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuDividerMarginLeftInSeparatedSubMenu);
|
|
8
23
|
},
|
|
9
24
|
rootLarge: function (t) {
|
|
10
|
-
return css(
|
|
25
|
+
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-top: ", ";\n margin-bottom: ", ";\n "], ["\n margin-top: ", ";\n margin-bottom: ", ";\n "])), t.sideMenuDividerMarginTopLarge, t.sideMenuDividerMarginBottomLarge);
|
|
11
26
|
},
|
|
12
27
|
});
|
|
13
28
|
});
|
|
14
|
-
var templateObject_1, templateObject_2;
|
|
29
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
|
-
import { transitionDuration } from '../SideMenu/SideMenu.js';
|
|
3
|
+
import { transitionDuration, transitionEasing } from '../SideMenu/SideMenu.js';
|
|
4
4
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
5
5
|
var css = _a.css, injectGlobal = _a.injectGlobal;
|
|
6
6
|
var _unused = injectGlobal(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n [data-tid='MenuItem']:active {\n background: rgba(0, 0, 0, 0.1) !important;\n transition: background 80ms ease-out;\n }\n "], ["\n [data-tid='MenuItem']:active {\n background: rgba(0, 0, 0, 0.1) !important;\n transition: background 80ms ease-out;\n }\n "])));
|
|
7
7
|
return {
|
|
8
8
|
label: function (t) {
|
|
9
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: calc(\n ", " - 2 * ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n min-width: 0;\n transition: width ", "ms
|
|
9
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: calc(\n ", " - 2 * ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n min-width: 0;\n transition: width ", "ms ", ";\n "], ["\n width: calc(\n ", " - 2 * ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n min-width: 0;\n transition: width ", "ms ", ";\n "])), t.sideMenuWidth, t.sideMenuItemsMarginX, transitionDuration, transitionEasing);
|
|
10
10
|
},
|
|
11
11
|
labelTouchScreen: function (t) {
|
|
12
12
|
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: calc(\n ", " - 2 *\n ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n "], ["\n width: calc(\n ", " - 2 *\n ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n "])), t.sideMenuWidthTouchScreen, t.sideMenuItemsMarginX);
|
|
@@ -7,7 +7,7 @@ import React, { forwardRef, useContext, useEffect, useLayoutEffect, useRef, useS
|
|
|
7
7
|
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers.js';
|
|
8
8
|
import { flattenChildren } from '../../lib/utils/scripts.js';
|
|
9
9
|
import { SideMenuDataTids } from '../../SideMenuDataTids.js';
|
|
10
|
-
import { transitionDuration } from '../SideMenu/SideMenu.js';
|
|
10
|
+
import { transitionDuration, transitionEasing } from '../SideMenu/SideMenu.js';
|
|
11
11
|
import { getStyles as getSideMenuStyles } from '../SideMenu/SideMenu.styles.js';
|
|
12
12
|
import { SideMenuContext } from '../SideMenuContext.js';
|
|
13
13
|
import { getStyles } from './SideMenuFooter.styles.js';
|
|
@@ -43,7 +43,7 @@ var SideMenuFooterInner = forwardRef(function (_a, ref) {
|
|
|
43
43
|
if (offset && !prefersReducedMotion) {
|
|
44
44
|
node.animate([{ transform: "translateY(".concat(offset, "px)") }, { transform: 'translateY(0)' }], {
|
|
45
45
|
duration: transitionDuration,
|
|
46
|
-
easing:
|
|
46
|
+
easing: transitionEasing,
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
}, [context.isOpened]);
|
|
@@ -55,6 +55,7 @@ var SideMenuFooterInner = forwardRef(function (_a, ref) {
|
|
|
55
55
|
var showCollapseToggle = (context.isDesktop || context.isNarrowDesktop) && !context.disableCollapsing;
|
|
56
56
|
var showTrailingItem = showCollapseToggle && context.isOpened;
|
|
57
57
|
var footerItems = flattenChildren(children);
|
|
58
|
+
var isEmpty = footerItems.length === 0;
|
|
58
59
|
var trailingItem = showTrailingItem ? footerItems[footerItems.length - 1] : null;
|
|
59
60
|
var leadingItems = trailingItem ? footerItems.slice(0, -1) : footerItems;
|
|
60
61
|
useEffect(function () {
|
|
@@ -63,8 +64,9 @@ var SideMenuFooterInner = forwardRef(function (_a, ref) {
|
|
|
63
64
|
if (!isTabletOrMobile || context.isOpened) {
|
|
64
65
|
return (React.createElement("footer", __assign({ "data-tid": SideMenuDataTids.footer, "data-visual-state-fixed": isFixed, className: cx(styles.root(theme), (_b = {},
|
|
65
66
|
_b[styles.rootLarge(theme)] = isLarge,
|
|
66
|
-
_b[sideMenuStyles.
|
|
67
|
-
_b[sideMenuStyles.
|
|
67
|
+
_b[sideMenuStyles.itemsContainerOpened(theme)] = context.isOpened && !isEmpty,
|
|
68
|
+
_b[sideMenuStyles.itemsContainerCollapsed(theme)] = !context.isOpened || isEmpty,
|
|
69
|
+
_b[sideMenuStyles.itemsContainerCollapsedLarge(theme)] = (!context.isOpened || isEmpty) && isLarge,
|
|
68
70
|
_b[styles.rootFixed(theme)] = isFixed,
|
|
69
71
|
_b[styles.rootFixedCollapsed(theme)] = isFixed && !context.isOpened,
|
|
70
72
|
_b[styles.rootFixedCollapsedLarge(theme)] = isFixed && !context.isOpened && isLarge,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
|
+
import { transitionDuration, transitionEasing } from '../SideMenu/SideMenu.js';
|
|
3
4
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
4
5
|
var css = _a.css;
|
|
5
6
|
return ({
|
|
6
7
|
root: function (t) {
|
|
7
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: ", ";\n padding-top: ", ";\n margin: 0 ", ";\n background-color: inherit;\n "], ["\n display: flex;\n flex-direction: column;\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: ", ";\n padding-top: ", ";\n margin: 0 ", ";\n background-color: inherit;\n "])), t.sideMenuFooterPaddingBottom, t.sideMenuFooterPaddingTop, t.sideMenuItemsMarginX);
|
|
8
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: ", ";\n padding-top: ", ";\n margin: 0 ", ";\n background-color: inherit;\n transition: margin ", "ms ", ";\n "], ["\n display: flex;\n flex-direction: column;\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: ", ";\n padding-top: ", ";\n margin: 0 ", ";\n background-color: inherit;\n transition: margin ", "ms ", ";\n "])), t.sideMenuFooterPaddingBottom, t.sideMenuFooterPaddingTop, t.sideMenuItemsMarginX, transitionDuration, transitionEasing);
|
|
8
9
|
},
|
|
9
10
|
rootLarge: function (t) {
|
|
10
11
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-bottom: ", ";\n "], ["\n padding-bottom: ", ";\n "])), t.sideMenuFooterPaddingBottomLarge);
|
|
@@ -35,7 +36,7 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
35
36
|
},
|
|
36
37
|
// Разделитель выравнивается по разделителю шапки, а не по краям пунктов
|
|
37
38
|
rootFixed: function (t) {
|
|
38
|
-
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n
|
|
39
|
+
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n border-top: 1px solid ", ";\n }\n "], ["\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n border-top: 1px solid ", ";\n }\n "])), t.sideMenuMarginX, t.sideMenuItemsMarginX, t.sideMenuMarginX, t.sideMenuItemsMarginX, t.sideMenuFooterDividerColor);
|
|
39
40
|
},
|
|
40
41
|
rootFixedCollapsed: function (t) {
|
|
41
42
|
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n &::before {\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n }\n "], ["\n &::before {\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n }\n "])), t.sideMenuMarginX, t.sideMenuItemsMarginXCollapsed, t.sideMenuMarginX, t.sideMenuItemsMarginXCollapsed);
|
|
@@ -19,7 +19,7 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
19
19
|
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background: ", ";\n z-index: 9000;\n "], ["\n background: ", ";\n z-index: 9000;\n "])), t.sideMenuSeparatedSubMenuBg);
|
|
20
20
|
},
|
|
21
21
|
fixedRoot: function (t) {
|
|
22
|
-
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n
|
|
22
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n &::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-top: 1px solid ", ";\n }\n "], ["\n &::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-top: 1px solid ", ";\n }\n "])), t.sideMenuHeaderDividerColor);
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
25
|
});
|
|
@@ -2,7 +2,6 @@ import { __awaiter, __generator } from "tslib";
|
|
|
2
2
|
import { IconXRegular20 } from '@skbkontur/icons/IconXRegular20';
|
|
3
3
|
import { createFailure, createSuccess, isFailure } from '@skbkontur/operation-result';
|
|
4
4
|
import { Button } from '@skbkontur/react-ui/components/Button/Button';
|
|
5
|
-
import { Center } from '@skbkontur/react-ui/components/Center/Center';
|
|
6
5
|
import { Spinner } from '@skbkontur/react-ui/components/Spinner/Spinner';
|
|
7
6
|
import { useStyles, useEmotion } from '@skbkontur/react-ui/lib/renderEnvironment';
|
|
8
7
|
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
@@ -11,9 +10,11 @@ import React, { useContext } from 'react';
|
|
|
11
10
|
import { SideMenuTheme } from '../../internal/themes/SideMenuTheme.js';
|
|
12
11
|
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers.js';
|
|
13
12
|
import { SideMenuDataTids } from '../../SideMenuDataTids.js';
|
|
13
|
+
import { SideMenuContext } from '../SideMenuContext.js';
|
|
14
14
|
import { BellWidgetError } from './BellWidgetError.js';
|
|
15
15
|
import { getCustomStyles, getStyles } from './BellWidgetView.styles.js';
|
|
16
16
|
import { BELL_SIDE_MENU_DATA_ITEM } from './SideMenuNotifications.js';
|
|
17
|
+
import { getWrapperHeightClass } from './utils/getWrapperHeightClass.js';
|
|
17
18
|
var getBtnTopPosition = function () {
|
|
18
19
|
var _a;
|
|
19
20
|
var bellDropDownItem = document.querySelector("[data-item=\"".concat(BELL_SIDE_MENU_DATA_ITEM, "\"]"));
|
|
@@ -22,6 +23,8 @@ var getBtnTopPosition = function () {
|
|
|
22
23
|
export var BellWidget = function (props) {
|
|
23
24
|
var widgetApi = props.widgetApi, onClose = props.onClose, renderErrorButton = props.renderErrorButton, renderErrorMessage = props.renderErrorMessage, onError = props.onError, redirect = props.redirect;
|
|
24
25
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
26
|
+
var context = useContext(SideMenuContext);
|
|
27
|
+
var isMobile = Boolean(context.isMobile);
|
|
25
28
|
var styles = useStyles(getStyles);
|
|
26
29
|
var customStyles = useStyles(getCustomStyles);
|
|
27
30
|
var cx = useEmotion().cx;
|
|
@@ -72,16 +75,20 @@ export var BellWidget = function (props) {
|
|
|
72
75
|
var buttonCloseTheme = {
|
|
73
76
|
btnBorderRadiusMedium: '20px',
|
|
74
77
|
};
|
|
75
|
-
var wrapperHeightClass =
|
|
76
|
-
|
|
77
|
-
:
|
|
78
|
-
|
|
78
|
+
var wrapperHeightClass = getWrapperHeightClass({
|
|
79
|
+
hasCustomWrapperHeight: hasCustomWrapperHeight,
|
|
80
|
+
theme: theme,
|
|
81
|
+
isMobile: isMobile,
|
|
82
|
+
btnTopPosition: btnTopPosition,
|
|
83
|
+
customStyles: customStyles,
|
|
84
|
+
});
|
|
85
|
+
return (React.createElement("div", { className: cx(styles.root(), isMobile ? styles.rootMobile() : styles.rootDesktop(), wrapperHeightClass) },
|
|
79
86
|
React.createElement("div", { className: styles.header(), "data-tid": SideMenuDataTids.bellHeader },
|
|
80
87
|
React.createElement("span", { className: styles.headerText() }, "\u0423\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F"),
|
|
81
88
|
React.createElement(Button, { use: "text", size: "medium", width: 40, icon: React.createElement(IconXRegular20, 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" })),
|
|
82
89
|
React.createElement(WidgetRenderer, { renderWidget: renderWidget, renderFault: function (_a) {
|
|
83
90
|
var fault = _a.fault, retryRender = _a.retryRender;
|
|
84
91
|
return (React.createElement(BellWidgetError, { renderErrorButton: renderErrorButton, error: fault, renderErrorMessage: renderErrorMessage, retryRender: retryRender }));
|
|
85
|
-
}, loader: React.createElement(
|
|
92
|
+
}, loader: React.createElement("div", { className: styles.centeredContent() },
|
|
86
93
|
React.createElement(Spinner, { caption: "\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043C \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F..." })) })));
|
|
87
94
|
};
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
+
import * as colors from '@skbkontur/colors/tokens-default/light';
|
|
1
2
|
import { EmptyState } from '@skbkontur/empty-state';
|
|
2
3
|
import { IconArrowUiAuthLoginRegular64 } from '@skbkontur/icons/IconArrowUiAuthLoginRegular64';
|
|
3
4
|
import { IconWarningTriangleSolid64 } from '@skbkontur/icons/IconWarningTriangleSolid64';
|
|
4
|
-
import {
|
|
5
|
+
import { useStyles } from '@skbkontur/react-ui/lib/renderEnvironment';
|
|
5
6
|
import React from 'react';
|
|
7
|
+
import { getStyles } from './BellWidgetView.styles.js';
|
|
6
8
|
import { getErrorMessages } from './utils/getNotificationsErrorMessages.js';
|
|
7
9
|
export var BellWidgetError = function (_a) {
|
|
8
10
|
var renderErrorButton = _a.renderErrorButton, error = _a.error, renderErrorMessage = _a.renderErrorMessage, retryRender = _a.retryRender;
|
|
11
|
+
var styles = useStyles(getStyles);
|
|
9
12
|
if (renderErrorMessage) {
|
|
10
13
|
return React.createElement(React.Fragment, null, renderErrorMessage(error, retryRender));
|
|
11
14
|
}
|
|
12
15
|
var isNotAuthorizedError = error.type === 'userNotAuthorized';
|
|
13
16
|
var errorButton = renderErrorButton === null || renderErrorButton === void 0 ? void 0 : renderErrorButton(error, retryRender);
|
|
14
17
|
var _b = getErrorMessages(isNotAuthorizedError), titleMessage = _b.titleMessage, errorMessage = _b.errorMessage;
|
|
15
|
-
var icon = isNotAuthorizedError ? (React.createElement(IconArrowUiAuthLoginRegular64, { color:
|
|
16
|
-
return (React.createElement(
|
|
18
|
+
var icon = isNotAuthorizedError ? (React.createElement(IconArrowUiAuthLoginRegular64, { color: colors.shapeBoldWarning })) : (React.createElement(IconWarningTriangleSolid64, { color: colors.shapeBoldWarning }));
|
|
19
|
+
return (React.createElement("div", { className: styles.centeredContent() },
|
|
17
20
|
React.createElement(EmptyState, { use: "status" },
|
|
18
21
|
React.createElement(EmptyState.Header, { icon: icon }, titleMessage),
|
|
19
22
|
React.createElement(EmptyState.Body, null, errorMessage),
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { type Emotion } from '../../lib/theming/ThemeHelpers.js';
|
|
2
2
|
export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").StylesGetter<{
|
|
3
3
|
root(): string;
|
|
4
|
+
rootMobile(): string;
|
|
5
|
+
rootDesktop(): string;
|
|
4
6
|
widgetWrapper(): string;
|
|
7
|
+
centeredContent(): string;
|
|
5
8
|
header(): string;
|
|
6
9
|
headerText(): string;
|
|
7
10
|
}>;
|
|
8
|
-
interface CustomStyles {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
export interface CustomStyles {
|
|
12
|
+
defaultHeightDesktop: (offsetTop: number) => string;
|
|
13
|
+
defaultHeightMobile: (mobilePopupHeightOffset: string) => string;
|
|
14
|
+
customHeight: (value?: string) => string;
|
|
11
15
|
}
|
|
12
16
|
export declare const getCustomStyles: ({ css }: Emotion) => CustomStyles;
|
|
13
|
-
export {};
|
|
@@ -4,31 +4,42 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
4
4
|
var css = _a.css;
|
|
5
5
|
return ({
|
|
6
6
|
root: function () {
|
|
7
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: 400px;\n max-height: 784px;\n
|
|
7
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: 400px;\n max-height: 784px;\n max-width: 100vw;\n "], ["\n display: flex;\n flex-direction: column;\n min-height: 400px;\n max-height: 784px;\n max-width: 100vw;\n "])));
|
|
8
|
+
},
|
|
9
|
+
rootMobile: function () {
|
|
10
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "])));
|
|
11
|
+
},
|
|
12
|
+
rootDesktop: function () {
|
|
13
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 448px;\n "], ["\n width: 448px;\n "])));
|
|
8
14
|
},
|
|
9
15
|
widgetWrapper: function () {
|
|
10
|
-
return css(
|
|
16
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n min-height: 0;\n flex-grow: 1;\n "], ["\n min-height: 0;\n flex-grow: 1;\n "])));
|
|
17
|
+
},
|
|
18
|
+
centeredContent: function () {
|
|
19
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex: 1;\n min-height: 0;\n overflow: auto;\n align-items: center;\n justify-content: center;\n "], ["\n display: flex;\n flex: 1;\n min-height: 0;\n overflow: auto;\n align-items: center;\n justify-content: center;\n "])));
|
|
11
20
|
},
|
|
12
21
|
header: function () {
|
|
13
|
-
return css(
|
|
22
|
+
return css(templateObject_6 || (templateObject_6 = __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 "])));
|
|
14
23
|
},
|
|
15
24
|
headerText: function () {
|
|
16
|
-
return css(
|
|
25
|
+
return css(templateObject_7 || (templateObject_7 = __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 "])));
|
|
17
26
|
},
|
|
18
27
|
});
|
|
19
28
|
});
|
|
20
29
|
export var getCustomStyles = function (_a) {
|
|
21
30
|
var css = _a.css;
|
|
22
31
|
return ({
|
|
23
|
-
|
|
24
|
-
if (offsetTop === void 0) { offsetTop = 0; }
|
|
32
|
+
defaultHeightDesktop: function (offsetTop) {
|
|
25
33
|
var offsetBottom = '20px';
|
|
26
|
-
return css(
|
|
34
|
+
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n height: calc(100vh - ", "px - ", ");\n "], ["\n height: calc(100vh - ", "px - ", ");\n "])), offsetTop, offsetBottom);
|
|
35
|
+
},
|
|
36
|
+
defaultHeightMobile: function (mobilePopupHeightOffset) {
|
|
37
|
+
return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n height: calc(100vh - (", "));\n max-height: calc(100vh - (", "));\n\n @supports (height: 100dvh) {\n height: calc(100dvh - (", "));\n max-height: calc(100dvh - (", "));\n }\n "], ["\n height: calc(100vh - (", "));\n max-height: calc(100vh - (", "));\n\n @supports (height: 100dvh) {\n height: calc(100dvh - (", "));\n max-height: calc(100dvh - (", "));\n }\n "])), mobilePopupHeightOffset, mobilePopupHeightOffset, mobilePopupHeightOffset, mobilePopupHeightOffset);
|
|
27
38
|
},
|
|
28
39
|
customHeight: function (value) {
|
|
29
40
|
if (value === void 0) { value = ''; }
|
|
30
|
-
return css(
|
|
41
|
+
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n height: ", ";\n "], ["\n height: ", ";\n "])), value);
|
|
31
42
|
},
|
|
32
43
|
});
|
|
33
44
|
};
|
|
34
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
45
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SideMenuTheme } from '../../../lib/theming/ThemeTypes.js';
|
|
2
|
+
import type { CustomStyles } from '../BellWidgetView.styles.js';
|
|
3
|
+
interface GetWrapperHeightClassParameters {
|
|
4
|
+
hasCustomWrapperHeight: boolean;
|
|
5
|
+
theme: SideMenuTheme;
|
|
6
|
+
isMobile: boolean;
|
|
7
|
+
btnTopPosition: number;
|
|
8
|
+
customStyles: CustomStyles;
|
|
9
|
+
}
|
|
10
|
+
export declare const getWrapperHeightClass: ({ hasCustomWrapperHeight, theme, isMobile, btnTopPosition, customStyles, }: GetWrapperHeightClassParameters) => string;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var getWrapperHeightClass = function (_a) {
|
|
2
|
+
var hasCustomWrapperHeight = _a.hasCustomWrapperHeight, theme = _a.theme, isMobile = _a.isMobile, btnTopPosition = _a.btnTopPosition, customStyles = _a.customStyles;
|
|
3
|
+
if (hasCustomWrapperHeight) {
|
|
4
|
+
return customStyles.customHeight(theme.sideMenuNotificationsWrapperHeight);
|
|
5
|
+
}
|
|
6
|
+
if (isMobile) {
|
|
7
|
+
return customStyles.defaultHeightMobile(theme.sideMenuNotificationsMobilePopupHeightOffset);
|
|
8
|
+
}
|
|
9
|
+
return customStyles.defaultHeightDesktop(btnTopPosition);
|
|
10
|
+
};
|
|
@@ -13,8 +13,10 @@ var SideMenuSubItemHeaderInner = forwardRef(function (_a, ref) {
|
|
|
13
13
|
var cx = useEmotion().cx;
|
|
14
14
|
var styles = useStyles(getStyles);
|
|
15
15
|
return (React.createElement("p", __assign({ className: cx(styles.root(theme), (_b = {},
|
|
16
|
+
_b[styles.rootWithoutItemIcons(theme)] = context.isOpened && !context.isSeparatedMenu && !context.hasItemIcons,
|
|
16
17
|
_b[styles.rootInDropdown()] = !context.isOpened && !context.isSeparatedMenu,
|
|
17
18
|
_b[styles.rootInSeparatedSubMenu(theme)] = context.isSeparatedMenu,
|
|
19
|
+
_b[styles.rootInSeparatedSubMenuLarge(theme)] = context.isSeparatedMenu && context.size === 'large',
|
|
18
20
|
_b), className), ref: ref }, rest), children));
|
|
19
21
|
});
|
|
20
22
|
SideMenuSubItemHeaderInner.displayName = 'SideMenuSubItemHeader';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { SideMenuTheme } from '../../lib/theming/ThemeTypes.js';
|
|
2
2
|
export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").StylesGetter<{
|
|
3
3
|
root(t: SideMenuTheme): string;
|
|
4
|
+
rootWithoutItemIcons(t: SideMenuTheme): string;
|
|
4
5
|
rootInDropdown(): string;
|
|
6
|
+
rootInSeparatedSubMenuLarge(t: SideMenuTheme): string;
|
|
5
7
|
rootInSeparatedSubMenu(t: SideMenuTheme): string;
|
|
6
8
|
}>;
|
|
@@ -6,12 +6,18 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
6
6
|
root: function (t) {
|
|
7
7
|
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);
|
|
8
8
|
},
|
|
9
|
+
rootWithoutItemIcons: function (t) {
|
|
10
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-left: ", ";\n "], ["\n padding-left: ", ";\n "])), t.sideMenuSubItemCaptionMarginLeftWithoutIcons);
|
|
11
|
+
},
|
|
9
12
|
rootInDropdown: function () {
|
|
10
|
-
return css(
|
|
13
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: 12px 8px 4px 8px;\n "], ["\n padding: 12px 8px 4px 8px;\n "])));
|
|
14
|
+
},
|
|
15
|
+
rootInSeparatedSubMenuLarge: function (t) {
|
|
16
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n "], ["\n font-size: ", ";\n line-height: ", ";\n "])), t.sideMenuSubItemHeaderFontSizeLargeInSeparatedSubMenu, t.sideMenuSubItemHeaderLineHeightLargeInSeparatedSubMenu);
|
|
11
17
|
},
|
|
12
18
|
rootInSeparatedSubMenu: function (t) {
|
|
13
|
-
return css(
|
|
19
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding: ", ";\n line-height: 16px;\n color: ", ";\n "], ["\n padding: ", ";\n line-height: 16px;\n color: ", ";\n "])), t.sideMenuSubItemHeaderPaddingInSeparatedSubMenu, t.sideMenuSubItemHeaderColorInSeparatedSubMenu);
|
|
14
20
|
},
|
|
15
21
|
});
|
|
16
22
|
});
|
|
17
|
-
var templateObject_1, templateObject_2, templateObject_3;
|
|
23
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -50,9 +50,10 @@ export interface ClickableElementProps extends CommonClickableElementProps {
|
|
|
50
50
|
interface ClickableElementWithHintProps {
|
|
51
51
|
hint?: ReactNode;
|
|
52
52
|
isOpened?: boolean;
|
|
53
|
+
isHidden?: boolean;
|
|
53
54
|
children: React.ReactElement;
|
|
54
55
|
}
|
|
55
|
-
declare const ClickableElementWithHint: ({ hint, isOpened, children }: ClickableElementWithHintProps) => JSX.Element;
|
|
56
|
+
declare const ClickableElementWithHint: ({ hint, isOpened, isHidden, children }: ClickableElementWithHintProps) => JSX.Element;
|
|
56
57
|
declare const ClickableElementWithStaticFields: React.ForwardRefExoticComponent<ClickableElementProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>> & {
|
|
57
58
|
__KONTUR_REACT_UI__: string;
|
|
58
59
|
};
|
|
@@ -17,10 +17,11 @@ import { ItemContent } from './ItemContent/ItemContent.js';
|
|
|
17
17
|
import { NarrowAccordionDropdown } from './NarrowAccordionDropdown.js';
|
|
18
18
|
import { SubMenu } from './SubMenu.js';
|
|
19
19
|
var ClickableElementWithHint = function (_a) {
|
|
20
|
-
var hint = _a.hint, isOpened = _a.isOpened, children = _a.children;
|
|
20
|
+
var hint = _a.hint, isOpened = _a.isOpened, isHidden = _a.isHidden, children = _a.children;
|
|
21
21
|
var _b = __read(useState(false), 2), hovered = _b[0], setHovered = _b[1];
|
|
22
22
|
var _c = __read(useState(false), 2), focused = _c[0], setFocused = _c[1];
|
|
23
23
|
var _d = __read(useState(false), 2), tabFocused = _d[0], setTabFocused = _d[1];
|
|
24
|
+
var _e = __read(useState(false), 2), isTruncated = _e[0], setIsTruncated = _e[1];
|
|
24
25
|
useEffect(function () {
|
|
25
26
|
var handleKeyDown = function (e) {
|
|
26
27
|
if (e.key === 'Tab') {
|
|
@@ -37,6 +38,10 @@ var ClickableElementWithHint = function (_a) {
|
|
|
37
38
|
window.removeEventListener('blur', handleBlur);
|
|
38
39
|
};
|
|
39
40
|
}, []);
|
|
41
|
+
var checkTruncated = useCallback(function (element) {
|
|
42
|
+
var caption = element.querySelector('[data-tail]');
|
|
43
|
+
setIsTruncated(!!caption && caption.scrollWidth > caption.clientWidth);
|
|
44
|
+
}, []);
|
|
40
45
|
var handleMouseEnter = useCallback(function () { return setHovered(true); }, []);
|
|
41
46
|
var handleMouseLeave = useCallback(function () { return setHovered(false); }, []);
|
|
42
47
|
var handleFocus = useCallback(function () {
|
|
@@ -49,14 +54,13 @@ var ClickableElementWithHint = function (_a) {
|
|
|
49
54
|
if (hint === null || hint === undefined) {
|
|
50
55
|
return children;
|
|
51
56
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
var shouldShow = hovered || (tabFocused && focused);
|
|
57
|
+
var isRequested = hovered || (tabFocused && focused);
|
|
58
|
+
var shouldShow = !isHidden && isRequested && (!isOpened || isTruncated);
|
|
56
59
|
var childrenWithHandlers = React.cloneElement(children, {
|
|
57
60
|
onMouseEnter: function (e) {
|
|
58
61
|
var _a, _b;
|
|
59
62
|
(_b = (_a = children.props).onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
63
|
+
checkTruncated(e.currentTarget);
|
|
60
64
|
handleMouseEnter();
|
|
61
65
|
},
|
|
62
66
|
onMouseLeave: function (e) {
|
|
@@ -67,6 +71,7 @@ var ClickableElementWithHint = function (_a) {
|
|
|
67
71
|
onFocus: function (e) {
|
|
68
72
|
var _a, _b;
|
|
69
73
|
(_b = (_a = children.props).onFocus) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
74
|
+
checkTruncated(e.currentTarget);
|
|
70
75
|
handleFocus();
|
|
71
76
|
},
|
|
72
77
|
onBlur: function (e) {
|
|
@@ -95,6 +100,8 @@ var ClickableElement = forwardRef(function (_a, ref) {
|
|
|
95
100
|
var cx = useEmotion().cx;
|
|
96
101
|
var keyListener = useKeyListener();
|
|
97
102
|
var _f = __read(useState(false), 2), isFocusedByTab = _f[0], setIsFocusedByTab = _f[1];
|
|
103
|
+
var counter = context.childIdCounterRef;
|
|
104
|
+
var autoIndex = !id && !href && counter ? counter.current++ : undefined;
|
|
98
105
|
var _g = __read(useState(function () {
|
|
99
106
|
if (id) {
|
|
100
107
|
return id;
|
|
@@ -102,11 +109,8 @@ var ClickableElement = forwardRef(function (_a, ref) {
|
|
|
102
109
|
if (href) {
|
|
103
110
|
return href;
|
|
104
111
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var index = counter.current;
|
|
108
|
-
counter.current += 1;
|
|
109
|
-
return "".concat(context.parentItemId, "__").concat(index);
|
|
112
|
+
if (autoIndex !== undefined) {
|
|
113
|
+
return "".concat(context.parentItemId, "__").concat(autoIndex);
|
|
110
114
|
}
|
|
111
115
|
return generateId();
|
|
112
116
|
}), 1), currentId = _g[0];
|
|
@@ -31,9 +31,8 @@ export var CollapseToggle = function () {
|
|
|
31
31
|
var _a;
|
|
32
32
|
(_a = context.setMenuOpened) === null || _a === void 0 ? void 0 : _a.call(context, !isOpened);
|
|
33
33
|
};
|
|
34
|
-
var button = (React.createElement(ClickableElementWithHint, { hint: hintText, isOpened: false },
|
|
34
|
+
var button = (React.createElement(ClickableElementWithHint, { hint: hintText, isOpened: false, isHidden: !!context.isBeingTransitioned },
|
|
35
35
|
React.createElement("button", { type: 'button', className: cx(styles.root(theme), (_a = {},
|
|
36
|
-
_a[styles.rootOpened(theme)] = isOpened,
|
|
37
36
|
_a[styles.rootLarge(theme)] = context.size === 'large',
|
|
38
37
|
_a)), "aria-label": hintText, "aria-expanded": isOpened, "data-tid": SideMenuDataTids.collapseToggle, onClick: handleClick },
|
|
39
38
|
React.createElement(SideMenuCollapseIcon, null))));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { SideMenuTheme } from '../../lib/theming/ThemeTypes.js';
|
|
2
2
|
export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").StylesGetter<{
|
|
3
3
|
root(t: SideMenuTheme): string;
|
|
4
|
-
rootOpened(t: SideMenuTheme): string;
|
|
5
4
|
rootLarge(t: SideMenuTheme): string;
|
|
6
5
|
}>;
|
|
@@ -7,12 +7,9 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
7
7
|
root: function (t) {
|
|
8
8
|
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: ", ";\n flex-shrink: 0;\n border-radius: ", ";\n color: ", ";\n cursor: pointer;\n transition: color ", " ease-out;\n\n &:hover {\n color: ", ";\n }\n\n &:focus-visible {\n box-shadow: ", ";\n }\n "], ["\n ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: ", ";\n flex-shrink: 0;\n border-radius: ", ";\n color: ", ";\n cursor: pointer;\n transition: color ", " ease-out;\n\n &:hover {\n color: ", ";\n }\n\n &:focus-visible {\n box-shadow: ", ";\n }\n "])), resetButton(), t.sideMenuCollapseToggleSize, t.sideMenuCollapseToggleSize, t.sideMenuItemBorderRadius, t.sideMenuRightBorderIconColor, t.transitionDuration, t.sideMenuRightBorderIconColorHover, t.sideMenuItemBoxShadowFocus);
|
|
9
9
|
},
|
|
10
|
-
rootOpened: function (t) {
|
|
11
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n box-sizing: content-box;\n padding-right: ", ";\n "], ["\n box-sizing: content-box;\n padding-right: ", ";\n "])), t.sideMenuCollapseToggleOffsetRight);
|
|
12
|
-
},
|
|
13
10
|
rootLarge: function (t) {
|
|
14
|
-
return css(
|
|
11
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n border-radius: ", ";\n "], ["\n width: ", ";\n height: ", ";\n border-radius: ", ";\n "])), t.sideMenuCollapseToggleSizeLarge, t.sideMenuCollapseToggleSizeLarge, t.sideMenuItemBorderRadiusLarge);
|
|
15
12
|
},
|
|
16
13
|
});
|
|
17
14
|
});
|
|
18
|
-
var templateObject_1, templateObject_2
|
|
15
|
+
var templateObject_1, templateObject_2;
|
|
@@ -16,14 +16,14 @@ var getCaptionTail = function (caption, captionWidth, maxCaptionWidth) {
|
|
|
16
16
|
return '';
|
|
17
17
|
};
|
|
18
18
|
export var Caption = forwardRef(function (_a, ref) {
|
|
19
|
-
var _b, _c;
|
|
19
|
+
var _b, _c, _d;
|
|
20
20
|
var _isSubMenu = _a._isSubMenu, isNestedSubMenu = _a.isNestedSubMenu, caption = _a.caption, subCaption = _a.subCaption, hasIcon = _a.hasIcon, hasMarker = _a.hasMarker, isMultiline = _a.isMultiline, noWrap = _a.noWrap, _isBackButton = _a._isBackButton, _isDropdown = _a._isDropdown, _isAvatar = _a._isAvatar;
|
|
21
21
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
22
|
-
var
|
|
22
|
+
var _e = useContext(SideMenuContext), isSeparatedMenu = _e.isSeparatedMenu, size = _e.size, isTouchScreen = _e.isTouchScreen, hasSeparatedSubMenu = _e.hasSeparatedSubMenu, isBeingTransitioned = _e.isBeingTransitioned, sideMenuRef = _e.sideMenuRef, isOpened = _e.isOpened, hasItemIcons = _e.hasItemIcons;
|
|
23
23
|
var isLarge = size === 'large';
|
|
24
24
|
var isCaptionPlainText = typeof caption === 'string';
|
|
25
25
|
var captionRef = useRef(null);
|
|
26
|
-
var
|
|
26
|
+
var _f = __read(useState(''), 2), tail = _f[0], setTail = _f[1];
|
|
27
27
|
var styles = useStyles(getStyles);
|
|
28
28
|
var cx = useEmotion().cx;
|
|
29
29
|
var truncateSpecialCaption = function () {
|
|
@@ -62,8 +62,9 @@ export var Caption = forwardRef(function (_a, ref) {
|
|
|
62
62
|
_c[styles.captionSubItem(theme)] = _isSubMenu,
|
|
63
63
|
_c[styles.captionSubItemSeparatedMenuTopLevel()] = isSeparatedMenu && !isNestedSubMenu && _isSubMenu && !hasIcon,
|
|
64
64
|
_c[styles.captionNestedItemSeparatedMenu()] = isSeparatedMenu && isNestedSubMenu && !hasIcon,
|
|
65
|
-
_c[styles.captionWithoutItemIcon()] = !hasIcon &&
|
|
66
|
-
_c[styles.captionWithoutAnyIcons(theme)] = !hasIcon &&
|
|
65
|
+
_c[styles.captionWithoutItemIcon()] = !hasIcon && isOpened && hasItemIcons && (!_isSubMenu || !isSeparatedMenu),
|
|
66
|
+
_c[styles.captionWithoutAnyIcons(theme)] = !hasIcon && isOpened && !hasItemIcons && !_isSubMenu,
|
|
67
|
+
_c[styles.captionSubItemWithoutAnyIcons(theme)] = !hasIcon && isOpened && !hasItemIcons && _isSubMenu && !isSeparatedMenu,
|
|
67
68
|
_c[styles.captionSubItemWithoutColumnIcons()] = _isSubMenu && isSeparatedMenu && !hasSeparatedSubMenu,
|
|
68
69
|
_c[styles.captionLarge(theme)] = isLarge,
|
|
69
70
|
_c[styles.captionTouchScreen(theme)] = isTouchScreen,
|
|
@@ -72,6 +73,6 @@ export var Caption = forwardRef(function (_a, ref) {
|
|
|
72
73
|
_c[styles.captionNoWrap()] = noWrap,
|
|
73
74
|
_c[styles.captionNoWrapWithMarker(theme)] = noWrap && hasMarker,
|
|
74
75
|
_c)), ref: captionRef, "data-tail": tail }, caption),
|
|
75
|
-
subCaption));
|
|
76
|
+
subCaption && (React.createElement("div", { className: cx(styles.subCaption(theme), (_d = {}, _d[styles.subCaptionLarge(theme)] = isLarge, _d)) }, subCaption))));
|
|
76
77
|
});
|
|
77
78
|
Caption.displayName = 'Caption';
|
|
@@ -15,7 +15,10 @@ export declare const getStyles: import("../../../lib/theming/ThemeHelpers.js").S
|
|
|
15
15
|
captionNestedItemSeparatedMenu(): string;
|
|
16
16
|
captionWithoutItemIcon(): string;
|
|
17
17
|
captionWithoutAnyIcons(t: SideMenuTheme): string;
|
|
18
|
+
captionSubItemWithoutAnyIcons(t: SideMenuTheme): string;
|
|
18
19
|
captionSubItemWithoutColumnIcons(): string;
|
|
20
|
+
subCaption(t: SideMenuTheme): string;
|
|
21
|
+
subCaptionLarge(t: SideMenuTheme): string;
|
|
19
22
|
captionLarge(t: SideMenuTheme): string;
|
|
20
23
|
captionInBackButton(t: SideMenuTheme): string;
|
|
21
24
|
captionDropdown(): string;
|
|
@@ -38,29 +38,38 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
38
38
|
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n margin-left: 48px;\n "], ["\n margin-left: 48px;\n "])));
|
|
39
39
|
},
|
|
40
40
|
captionWithoutAnyIcons: function (t) {
|
|
41
|
-
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.
|
|
41
|
+
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuCaptionMarginLeftWithoutIcons);
|
|
42
|
+
},
|
|
43
|
+
captionSubItemWithoutAnyIcons: function (t) {
|
|
44
|
+
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuSubItemCaptionMarginLeftWithoutIcons);
|
|
42
45
|
},
|
|
43
46
|
captionSubItemWithoutColumnIcons: function () {
|
|
44
|
-
return css(
|
|
47
|
+
return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n margin-left: 12px;\n "], ["\n margin-left: 12px;\n "])));
|
|
48
|
+
},
|
|
49
|
+
subCaption: function (t) {
|
|
50
|
+
return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n margin-top: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "], ["\n margin-top: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n "])), t.sideMenuSubCaptionMarginTop, t.sideMenuSubCaptionFontSize, t.sideMenuSubCaptionLineHeight, t.sideMenuSubCaptionColor);
|
|
51
|
+
},
|
|
52
|
+
subCaptionLarge: function (t) {
|
|
53
|
+
return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n "], ["\n font-size: ", ";\n line-height: ", ";\n "])), t.sideMenuSubCaptionFontSizeLarge, t.sideMenuSubCaptionLineHeightLarge);
|
|
45
54
|
},
|
|
46
55
|
captionLarge: function (t) {
|
|
47
|
-
return css(
|
|
56
|
+
return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n font-size: ", " !important;\n line-height: ", " !important;\n "], ["\n font-size: ", " !important;\n line-height: ", " !important;\n "])), t.sideMenuCaptionFontSizeLarge, t.sideMenuCaptionLineHeightLarge);
|
|
48
57
|
},
|
|
49
58
|
captionInBackButton: function (t) {
|
|
50
|
-
return css(
|
|
59
|
+
return css(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuBackButtonCaptionFontWeight, t.sideMenuBackButtonCaptionFontSize, t.sideMenuBackButtonCaptionLineHeight, t.sideMenuBackButtonCaptionPaddingY, t.sideMenuBackButtonCaptionPaddingY);
|
|
51
60
|
},
|
|
52
61
|
captionDropdown: function () {
|
|
53
|
-
return css(
|
|
62
|
+
return css(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n white-space: nowrap;\n overflow: hidden;\n "], ["\n white-space: nowrap;\n overflow: hidden;\n "])));
|
|
54
63
|
},
|
|
55
64
|
captionTruncated: function () {
|
|
56
|
-
return css(
|
|
65
|
+
return css(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n text-overflow: ellipsis;\n &::before {\n float: right;\n content: attr(data-tail);\n }\n "], ["\n text-overflow: ellipsis;\n &::before {\n float: right;\n content: attr(data-tail);\n }\n "])));
|
|
57
66
|
},
|
|
58
67
|
captionNoWrap: function () {
|
|
59
|
-
return css(
|
|
68
|
+
return css(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n "], ["\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n "])));
|
|
60
69
|
},
|
|
61
70
|
captionNoWrapWithMarker: function (t) {
|
|
62
|
-
return css(
|
|
71
|
+
return css(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n margin: 0 ", " 0 0;\n "], ["\n margin: 0 ", " 0 0;\n "])), t.sideMenuCaptionNoWrapWithMarkerMarginRight);
|
|
63
72
|
},
|
|
64
73
|
});
|
|
65
74
|
});
|
|
66
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18;
|
|
75
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21;
|