@skbkontur/side-menu 0.9.5 → 0.10.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 +11 -0
- package/README.md +90 -9
- package/hooks/useActiveState.js +1 -1
- package/hooks/useNumberOfTextLinesInItem.d.ts +12 -1
- package/hooks/useNumberOfTextLinesInItem.js +45 -30
- package/hooks/useNumberOfTextLinesInSubItem.d.ts +2 -1
- package/hooks/useNumberOfTextLinesInSubItem.js +2 -2
- package/hooks/useOpenedState.js +1 -1
- package/hooks/useOpenedSubElementState.js +1 -1
- package/internal/themes/SideMenuTheme.d.ts +110 -0
- package/internal/themes/SideMenuTheme.js +234 -0
- package/lib/theming/ThemeHelpers.d.ts +18 -0
- package/lib/theming/ThemeHelpers.js +66 -0
- package/lib/theming/ThemeTypes.d.ts +3 -0
- package/lib/theming/ThemeTypes.js +0 -0
- package/lib/utils/memo.d.ts +1 -0
- package/lib/utils/memo.js +9 -0
- package/{utils → lib/utils}/scripts.d.ts +1 -2
- package/{utils → lib/utils}/scripts.js +0 -8
- package/package.json +2 -2
- package/src/SideMenu/SideMenu.js +40 -36
- package/src/SideMenu/SideMenu.styles.d.ts +12 -14
- package/src/SideMenu/SideMenu.styles.js +29 -31
- package/src/SideMenuAvatar/SideMenuAvatar.md +7 -0
- package/src/SideMenuBody/SideMenuBody.d.ts +1 -2
- package/src/SideMenuBody/SideMenuBody.js +16 -9
- package/src/SideMenuBody/SideMenuBody.md +7 -0
- package/src/SideMenuBody/SideMenuBody.styles.d.ts +2 -1
- package/src/SideMenuBody/SideMenuBody.styles.js +4 -4
- package/src/SideMenuContext.d.ts +3 -2
- package/src/SideMenuDivider/SideMenuDivider.md +7 -0
- package/src/SideMenuDivider/SideMenuDivider.styles.js +2 -1
- package/src/SideMenuDropdown/SideMenuDropdown.js +9 -8
- package/src/SideMenuDropdown/SideMenuDropdown.styles.d.ts +2 -1
- package/src/SideMenuDropdown/SideMenuDropdown.styles.js +4 -3
- package/src/SideMenuFooter/SideMenuFooter.js +6 -3
- package/src/SideMenuFooter/SideMenuFooter.md +8 -0
- package/src/SideMenuFooter/SideMenuFooter.styles.d.ts +3 -2
- package/src/SideMenuFooter/SideMenuFooter.styles.js +6 -6
- package/src/SideMenuHeader/SideMenuHeader.js +15 -6
- package/src/SideMenuHeader/SideMenuHeader.md +16 -0
- package/src/SideMenuHeader/SideMenuHeader.styles.d.ts +5 -5
- package/src/SideMenuHeader/SideMenuHeader.styles.js +12 -15
- package/src/SideMenuItem/SideMenuItem.md +63 -0
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +7 -1
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.md +7 -0
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.d.ts +2 -1
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +4 -3
- package/src/internal/Backdrop.styles.js +1 -1
- package/src/internal/Burger.js +4 -1
- package/src/internal/Burger.styles.d.ts +2 -1
- package/src/internal/Burger.styles.js +4 -3
- package/src/internal/ClickableElement.js +8 -5
- package/src/internal/ClickableElement.styles.d.ts +6 -5
- package/src/internal/ClickableElement.styles.js +13 -11
- package/src/internal/InnerBody.js +5 -2
- package/src/internal/InnerBody.styles.d.ts +2 -1
- package/src/internal/InnerBody.styles.js +4 -3
- package/src/internal/InnerSubMenu.js +1 -1
- package/src/internal/ItemContent/Avatar.js +5 -2
- package/src/internal/ItemContent/Avatar.styles.d.ts +2 -1
- package/src/internal/ItemContent/Avatar.styles.js +4 -3
- package/src/internal/ItemContent/Caption.js +9 -6
- package/src/internal/ItemContent/Caption.styles.d.ts +9 -6
- package/src/internal/ItemContent/Caption.styles.js +17 -14
- package/src/internal/ItemContent/Icon.js +19 -9
- package/src/internal/ItemContent/Icon.styles.d.ts +7 -6
- package/src/internal/ItemContent/Icon.styles.js +14 -13
- package/src/internal/ItemContent/ItemContent.js +36 -12
- package/src/internal/ItemContent/ItemContent.styles.d.ts +9 -9
- package/src/internal/ItemContent/ItemContent.styles.js +18 -22
- package/src/internal/ItemContent/Marker.js +6 -3
- package/src/internal/ItemContent/Marker.styles.d.ts +3 -2
- package/src/internal/ItemContent/Marker.styles.js +6 -5
- package/src/internal/NestedMenu.js +6 -3
- package/src/internal/NestedMenu.styles.d.ts +2 -1
- package/src/internal/NestedMenu.styles.js +4 -3
- package/src/internal/RightBorder.js +10 -9
- package/src/internal/RightBorder.styles.d.ts +3 -4
- package/src/internal/RightBorder.styles.js +7 -7
- package/src/internal/SeparatedSubMenu.js +13 -10
- package/src/internal/SeparatedSubMenu.styles.d.ts +9 -6
- package/src/internal/SeparatedSubMenu.styles.js +18 -17
- package/src/internal/SideMenuLogotype.js +14 -10
- package/src/internal/SideMenuLogotype.styles.d.ts +6 -3
- package/src/internal/SideMenuLogotype.styles.js +11 -10
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import { SideMenuTheme } from '../../../lib/theming/ThemeTypes';
|
|
2
|
+
export declare const sideMenuMultilineCaptionPaddingTop = "4px";
|
|
3
|
+
export declare const sideMenuCaptionMarginRight = "8px";
|
|
1
4
|
export declare const jsStyles: {
|
|
2
5
|
root(): string;
|
|
3
6
|
rootBeingTransitioned(): string;
|
|
4
7
|
rootMultiline(): string;
|
|
5
|
-
caption(): string;
|
|
6
|
-
captionForTouchScreens(): string;
|
|
7
|
-
captionSubItem(): string;
|
|
8
|
-
captionSubItemForTouchScreens(): string;
|
|
8
|
+
caption(t: SideMenuTheme): string;
|
|
9
|
+
captionForTouchScreens(t: SideMenuTheme): string;
|
|
10
|
+
captionSubItem(t: SideMenuTheme): string;
|
|
11
|
+
captionSubItemForTouchScreens(t: SideMenuTheme): string;
|
|
9
12
|
captionSubItemSeparatedMenuTopLevel(): string;
|
|
10
13
|
captionNestedItemSeparatedMenu(): string;
|
|
11
14
|
captionWithoutItemIcon(): string;
|
|
12
15
|
captionSubItemWithoutColumnIcons(): string;
|
|
13
|
-
captionLarge(): string;
|
|
14
|
-
captionInBackButton(): string;
|
|
16
|
+
captionLarge(t: SideMenuTheme): string;
|
|
17
|
+
captionInBackButton(t: SideMenuTheme): string;
|
|
15
18
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css
|
|
2
|
+
import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
+
import { memoizeStyle } from '../../../lib/theming/ThemeHelpers';
|
|
4
|
+
export var sideMenuMultilineCaptionPaddingTop = '4px';
|
|
5
|
+
export var sideMenuCaptionMarginRight = '8px';
|
|
3
6
|
var styles = {
|
|
4
7
|
root: function () {
|
|
5
8
|
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n max-width: 100%;\n "], ["\n display: flex;\n flex-direction: column;\n max-width: 100%;\n "])));
|
|
@@ -8,19 +11,19 @@ var styles = {
|
|
|
8
11
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n "], ["\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n "])));
|
|
9
12
|
},
|
|
10
13
|
rootMultiline: function () {
|
|
11
|
-
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding-top:
|
|
14
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding-top: ", ";\n align-self: flex-start;\n "], ["\n padding-top: ", ";\n align-self: flex-start;\n "])), sideMenuMultilineCaptionPaddingTop);
|
|
12
15
|
},
|
|
13
|
-
caption: function () {
|
|
14
|
-
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size:
|
|
16
|
+
caption: function (t) {
|
|
17
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n margin: 0 ", " 0 0;\n "], ["\n font-size: ", ";\n line-height: ", ";\n margin: 0 ", " 0 0;\n "])), t.sideMenuCaptionFontSize, t.sideMenuCaptionLineHeight, sideMenuCaptionMarginRight);
|
|
15
18
|
},
|
|
16
|
-
captionForTouchScreens: function () {
|
|
17
|
-
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-size:
|
|
19
|
+
captionForTouchScreens: function (t) {
|
|
20
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n "], ["\n font-size: ", ";\n line-height: ", ";\n "])), t.sideMenuCaptionFontSizeForTouchScreens, t.sideMenuCaptionLineHeightForTouchScreens);
|
|
18
21
|
},
|
|
19
|
-
captionSubItem: function () {
|
|
20
|
-
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-left:
|
|
22
|
+
captionSubItem: function (t) {
|
|
23
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuCaptionSubItemMarginLeft);
|
|
21
24
|
},
|
|
22
|
-
captionSubItemForTouchScreens: function () {
|
|
23
|
-
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size:
|
|
25
|
+
captionSubItemForTouchScreens: function (t) {
|
|
26
|
+
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n "], ["\n font-size: ", ";\n line-height: ", ";\n "])), t.sideMenuCaptionSubItemFontSizeForTouchScreens, t.sideMenuCaptionSubItemLineHeightForTouchScreens);
|
|
24
27
|
},
|
|
25
28
|
captionSubItemSeparatedMenuTopLevel: function () {
|
|
26
29
|
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n margin: 0 8px;\n "], ["\n margin: 0 8px;\n "])));
|
|
@@ -34,11 +37,11 @@ var styles = {
|
|
|
34
37
|
captionSubItemWithoutColumnIcons: function () {
|
|
35
38
|
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n margin-left: 8px;\n "], ["\n margin-left: 8px;\n "])));
|
|
36
39
|
},
|
|
37
|
-
captionLarge: function () {
|
|
38
|
-
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n font-size:
|
|
40
|
+
captionLarge: function (t) {
|
|
41
|
+
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n font-size: ", " !important;\n line-height: ", " !important;\n "], ["\n font-size: ", " !important;\n line-height: ", " !important;\n "])), t.sideMenuCaptionLargeFontSize, t.sideMenuCaptionLargeLineHeight);
|
|
39
42
|
},
|
|
40
|
-
captionInBackButton: function () {
|
|
41
|
-
return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n font-weight:
|
|
43
|
+
captionInBackButton: function (t) {
|
|
44
|
+
return css(templateObject_13 || (templateObject_13 = __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);
|
|
42
45
|
},
|
|
43
46
|
};
|
|
44
47
|
export var jsStyles = memoizeStyle(styles);
|
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
+
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
3
4
|
import { jsStyles } from './Icon.styles';
|
|
4
5
|
import { SideMenuContext } from '../../SideMenuContext';
|
|
5
|
-
import {
|
|
6
|
+
import { getSideMenuTheme } from '../../../lib/theming/ThemeHelpers';
|
|
7
|
+
var getIconSize = function (theme, _isSubMenu, _isBackButton) {
|
|
8
|
+
if (!_isSubMenu) {
|
|
9
|
+
return parseInt(theme.sideMenuIconSize);
|
|
10
|
+
}
|
|
11
|
+
if (!_isBackButton) {
|
|
12
|
+
return parseInt(theme.sideMenuIconSubItemSize);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
6
15
|
export var Icon = function (_a) {
|
|
7
16
|
var _b;
|
|
8
17
|
var icon = _a.icon, _isSubMenu = _a._isSubMenu, isMultiline = _a.isMultiline, _c = _a._isBackButton, _isBackButton = _c === void 0 ? false : _c;
|
|
9
18
|
var context = useContext(SideMenuContext);
|
|
10
19
|
var isSeparatedMenu = context.isSeparatedMenu, size = context.size;
|
|
20
|
+
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
11
21
|
return React.cloneElement(icon, {
|
|
12
|
-
size: getIconSize(_isSubMenu, _isBackButton),
|
|
13
|
-
color: _isSubMenu ?
|
|
22
|
+
size: getIconSize(theme, _isSubMenu, _isBackButton),
|
|
23
|
+
color: _isSubMenu ? theme.sideMenuIconSubItemColor : undefined,
|
|
14
24
|
disableCompensation: !_isBackButton,
|
|
15
25
|
className: cx((_b = {},
|
|
16
|
-
_b[jsStyles.root()] = true,
|
|
26
|
+
_b[jsStyles.root(theme)] = true,
|
|
17
27
|
_b[jsStyles.rootMultiline()] = isMultiline && (!context.isMinimized || _isSubMenu),
|
|
18
|
-
_b[jsStyles.rootLarge()] = size === 'large',
|
|
19
|
-
_b[jsStyles.rootSubItem()] = _isSubMenu,
|
|
20
|
-
_b[jsStyles.rootSubItemSeparatedMenu()] = isSeparatedMenu && _isSubMenu,
|
|
21
|
-
_b[jsStyles.rootSubItemLarge()] = _isSubMenu && size === 'large',
|
|
22
|
-
_b[jsStyles.rootBackButton()] = _isBackButton,
|
|
28
|
+
_b[jsStyles.rootLarge(theme)] = size === 'large',
|
|
29
|
+
_b[jsStyles.rootSubItem(theme)] = _isSubMenu,
|
|
30
|
+
_b[jsStyles.rootSubItemSeparatedMenu(theme)] = isSeparatedMenu && _isSubMenu,
|
|
31
|
+
_b[jsStyles.rootSubItemLarge(theme)] = _isSubMenu && size === 'large',
|
|
32
|
+
_b[jsStyles.rootBackButton(theme)] = _isBackButton,
|
|
23
33
|
_b)),
|
|
24
34
|
});
|
|
25
35
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { SideMenuTheme } from '../../../lib/theming/ThemeTypes';
|
|
1
2
|
export declare const jsStyles: {
|
|
2
|
-
root(): string;
|
|
3
|
+
root(t: SideMenuTheme): string;
|
|
3
4
|
rootMultiline(): string;
|
|
4
|
-
rootLarge(): string;
|
|
5
|
-
rootSubItemLarge(): string;
|
|
6
|
-
rootSubItem(): string;
|
|
7
|
-
rootSubItemSeparatedMenu(): string;
|
|
8
|
-
rootBackButton(): string;
|
|
5
|
+
rootLarge(t: SideMenuTheme): string;
|
|
6
|
+
rootSubItemLarge(t: SideMenuTheme): string;
|
|
7
|
+
rootSubItem(t: SideMenuTheme): string;
|
|
8
|
+
rootSubItemSeparatedMenu(t: SideMenuTheme): string;
|
|
9
|
+
rootBackButton(t: SideMenuTheme): string;
|
|
9
10
|
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css
|
|
2
|
+
import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
+
import { memoizeStyle } from '../../../lib/theming/ThemeHelpers';
|
|
3
4
|
var styles = {
|
|
4
|
-
root: function () {
|
|
5
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding:
|
|
5
|
+
root: function (t) {
|
|
6
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding: ", " ", ";\n min-height: ", ";\n line-height: ", ";\n flex-shrink: 0;\n box-sizing: content-box;\n "], ["\n display: flex;\n align-items: center;\n padding: ", " ", ";\n min-height: ", ";\n line-height: ", ";\n flex-shrink: 0;\n box-sizing: content-box;\n "])), t.sideMenuIconPaddingY, t.sideMenuIconPaddingX, t.sideMenuIconMinHeight, t.sideMenuIconLineHeight);
|
|
6
7
|
},
|
|
7
8
|
rootMultiline: function () {
|
|
8
9
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: flex-start;\n align-items: flex-start;\n "], ["\n align-self: flex-start;\n align-items: flex-start;\n "])));
|
|
9
10
|
},
|
|
10
|
-
rootLarge: function () {
|
|
11
|
-
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n min-height:
|
|
11
|
+
rootLarge: function (t) {
|
|
12
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n min-height: ", ";\n line-height: ", ";\n "], ["\n min-height: ", ";\n line-height: ", ";\n "])), t.sideMenuIconLargeMinHeight, t.sideMenuIconLargeLineHeight);
|
|
12
13
|
},
|
|
13
|
-
rootSubItemLarge: function () {
|
|
14
|
-
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n min-height:
|
|
14
|
+
rootSubItemLarge: function (t) {
|
|
15
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n min-height: ", ";\n "], ["\n min-height: ", ";\n "])), t.sideMenuIconLargeSubItemMinHeight);
|
|
15
16
|
},
|
|
16
|
-
rootSubItem: function () {
|
|
17
|
-
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding-left:
|
|
17
|
+
rootSubItem: function (t) {
|
|
18
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding-left: ", ";\n padding-right: ", ";\n min-height: ", ";\n line-height: ", ";\n "], ["\n padding-left: ", ";\n padding-right: ", ";\n min-height: ", ";\n line-height: ", ";\n "])), t.sideMenuIconSubItemPaddingLeft, t.sideMenuIconSubItemPaddingRight, t.sideMenuIconSubItemMinHeight, t.sideMenuIconSubItemLineHeight);
|
|
18
19
|
},
|
|
19
|
-
rootSubItemSeparatedMenu: function () {
|
|
20
|
-
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-left:
|
|
20
|
+
rootSubItemSeparatedMenu: function (t) {
|
|
21
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-left: ", ";\n "], ["\n padding-left: ", ";\n "])), t.sideMenuIconWithSeparatedSubMenuSubItemPaddingLeft);
|
|
21
22
|
},
|
|
22
|
-
rootBackButton: function () {
|
|
23
|
-
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-left:
|
|
23
|
+
rootBackButton: function (t) {
|
|
24
|
+
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-left: ", ";\n padding-right: ", ";\n "], ["\n padding-left: ", ";\n padding-right: ", ";\n "])), t.sideMenuBackButtonIconPaddingLeft, t.sideMenuBackButtonIconPaddingRight);
|
|
24
25
|
},
|
|
25
26
|
};
|
|
26
27
|
export var jsStyles = memoizeStyle(styles);
|
|
@@ -8,6 +8,13 @@ import { Icon } from './Icon';
|
|
|
8
8
|
import { Caption } from './Caption';
|
|
9
9
|
import { Marker } from './Marker';
|
|
10
10
|
import { Avatar } from './Avatar';
|
|
11
|
+
import { getSideMenuTheme } from '../../../lib/theming/ThemeHelpers';
|
|
12
|
+
import { ThemeContext } from '@skbkontur/react-ui';
|
|
13
|
+
import { sideMenuMultilineCaptionPaddingTop } from './Caption.styles';
|
|
14
|
+
var getItemContentHeight = function (theme, linesNumber, size) {
|
|
15
|
+
var lineHeight = size === 'large' ? parseInt(theme.sideMenuLargeLineHeight) : parseInt(theme.sideMenuLineHeight);
|
|
16
|
+
return linesNumber * lineHeight + parseInt(sideMenuMultilineCaptionPaddingTop);
|
|
17
|
+
};
|
|
11
18
|
/**
|
|
12
19
|
* Контент для SideMenuItem или SideMenuLink
|
|
13
20
|
*/
|
|
@@ -15,40 +22,57 @@ var ItemContent = forwardRef(function (_a, ref) {
|
|
|
15
22
|
var _b, _c;
|
|
16
23
|
var _isSubMenu = _a._isSubMenu, icon = _a.icon, _isNestedSubMenu = _a._isNestedSubMenu, caption = _a.caption, subCaption = _a.subCaption, marker = _a.marker, _avatar = _a._avatar, _isBackButton = _a._isBackButton;
|
|
17
24
|
var context = useContext(SideMenuContext);
|
|
25
|
+
var size = context.size, isTouchScreen = context.isTouchScreen;
|
|
18
26
|
var textRef = useRef(null);
|
|
19
27
|
var _d = useState(1), linesNumber = _d[0], setLinesNumber = _d[1];
|
|
20
28
|
var _e = useState(false), isMultilineSubItem = _e[0], setMultilineSubItem = _e[1];
|
|
21
29
|
var isMultiline = (!_isSubMenu && linesNumber > 1) || (!!_isSubMenu && isMultilineSubItem) || !!subCaption;
|
|
30
|
+
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
22
31
|
useEffect(function () {
|
|
23
32
|
if (!_isBackButton && !_isSubMenu) {
|
|
24
|
-
useNumberOfTextLinesInItem(
|
|
33
|
+
useNumberOfTextLinesInItem({
|
|
34
|
+
textRef: textRef,
|
|
35
|
+
setLinesNumber: setLinesNumber,
|
|
36
|
+
theme: theme,
|
|
37
|
+
caption: caption,
|
|
38
|
+
marker: marker,
|
|
39
|
+
size: size,
|
|
40
|
+
isTouchScreen: isTouchScreen,
|
|
41
|
+
});
|
|
25
42
|
}
|
|
26
43
|
if (!_isBackButton && _isSubMenu) {
|
|
27
|
-
useNumberOfTextLinesInSubItem(textRef, setMultilineSubItem,
|
|
44
|
+
useNumberOfTextLinesInSubItem(textRef, setMultilineSubItem, size, theme);
|
|
28
45
|
}
|
|
29
46
|
}, []);
|
|
30
47
|
useEffect(function () {
|
|
31
48
|
if (!_isBackButton) {
|
|
32
|
-
useNumberOfTextLinesInItem(
|
|
49
|
+
useNumberOfTextLinesInItem({
|
|
50
|
+
textRef: textRef,
|
|
51
|
+
setLinesNumber: setLinesNumber,
|
|
52
|
+
theme: theme,
|
|
53
|
+
caption: caption,
|
|
54
|
+
marker: marker,
|
|
55
|
+
size: size,
|
|
56
|
+
isTouchScreen: isTouchScreen,
|
|
57
|
+
});
|
|
33
58
|
}
|
|
34
59
|
}, [textRef.current, context.isBeingTransitioned]);
|
|
35
60
|
var hasShortcutImage = !!icon || !!_avatar;
|
|
36
61
|
var isSeparatedSubMenuInNarrowDesktopWithoutOverlay = _isSubMenu && context.separatedMenuWithoutOverlay && context.isNarrowDesktop;
|
|
37
62
|
return (React.createElement("div", { className: cx((_b = {},
|
|
38
|
-
_b[jsStyles.root()] = true,
|
|
39
|
-
_b[jsStyles.subItemRoot()] = _isSubMenu,
|
|
40
|
-
_b[jsStyles.largeRoot()] =
|
|
41
|
-
_b[jsStyles.subItemLargeRoot()] =
|
|
42
|
-
_b[jsStyles.largeMultilineRoot()] = isMultiline &&
|
|
43
|
-
_b[jsStyles.rootForTouchScreens()] =
|
|
44
|
-
_b[jsStyles.subItemRootForTouchScreens()] =
|
|
63
|
+
_b[jsStyles.root(theme)] = true,
|
|
64
|
+
_b[jsStyles.subItemRoot(theme)] = _isSubMenu,
|
|
65
|
+
_b[jsStyles.largeRoot(theme)] = size === 'large',
|
|
66
|
+
_b[jsStyles.subItemLargeRoot(theme)] = size === 'large' && _isSubMenu,
|
|
67
|
+
_b[jsStyles.largeMultilineRoot(theme)] = isMultiline && size === 'large',
|
|
68
|
+
_b[jsStyles.rootForTouchScreens(theme)] = isTouchScreen,
|
|
69
|
+
_b[jsStyles.subItemRootForTouchScreens(theme)] = isTouchScreen && _isSubMenu,
|
|
45
70
|
_b)), ref: ref },
|
|
46
71
|
icon && React.createElement(Icon, { icon: icon, _isSubMenu: _isSubMenu, isMultiline: isMultiline, _isBackButton: _isBackButton }),
|
|
47
72
|
_avatar && React.createElement(Avatar, { _avatar: _avatar }),
|
|
48
73
|
(!context.isMinimized || (context.isMinimized && _isSubMenu)) && (React.createElement("div", { className: cx((_c = {},
|
|
49
74
|
_c[jsStyles.textAndMarkerWrapper()] = true,
|
|
50
|
-
_c[customStyles.textAndMarkerWrapperMultiline(linesNumber)] = isMultiline && !_isSubMenu,
|
|
51
|
-
_c[customStyles.largeTextAndMarkerWrapperMultiline(linesNumber)] = isMultiline && context.size === 'large' && !_isSubMenu,
|
|
75
|
+
_c[customStyles.textAndMarkerWrapperMultiline(getItemContentHeight(theme, linesNumber, size))] = isMultiline && !_isSubMenu,
|
|
52
76
|
_c)) },
|
|
53
77
|
React.createElement(Caption, { _isSubMenu: _isSubMenu, _isNestedSubMenu: _isNestedSubMenu, hasShortcutImage: hasShortcutImage, isMultiline: isMultiline, caption: caption, subCaption: subCaption, _isBackButton: _isBackButton, ref: textRef }),
|
|
54
78
|
marker && (!context.isMinimized || isSeparatedSubMenuInNarrowDesktopWithoutOverlay) && (React.createElement(Marker, { isMultiline: isMultiline, marker: marker }))))));
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { SideMenuTheme } from '../../../lib/theming/ThemeTypes';
|
|
1
2
|
export declare const customStyles: {
|
|
2
|
-
textAndMarkerWrapperMultiline(
|
|
3
|
-
largeTextAndMarkerWrapperMultiline(linesNumber: number): string;
|
|
3
|
+
textAndMarkerWrapperMultiline(height: number): string;
|
|
4
4
|
};
|
|
5
5
|
export declare const jsStyles: {
|
|
6
|
-
root(): string;
|
|
7
|
-
largeRoot(): string;
|
|
8
|
-
subItemLargeRoot(): string;
|
|
9
|
-
largeMultilineRoot(): string;
|
|
10
|
-
rootForTouchScreens(): string;
|
|
11
|
-
subItemRootForTouchScreens(): string;
|
|
12
|
-
subItemRoot(): string;
|
|
6
|
+
root(t: SideMenuTheme): string;
|
|
7
|
+
largeRoot(t: SideMenuTheme): string;
|
|
8
|
+
subItemLargeRoot(t: SideMenuTheme): string;
|
|
9
|
+
largeMultilineRoot(t: SideMenuTheme): string;
|
|
10
|
+
rootForTouchScreens(t: SideMenuTheme): string;
|
|
11
|
+
subItemRootForTouchScreens(t: SideMenuTheme): string;
|
|
12
|
+
subItemRoot(t: SideMenuTheme): string;
|
|
13
13
|
textAndMarkerWrapper(): string;
|
|
14
14
|
};
|
|
@@ -1,40 +1,36 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css
|
|
2
|
+
import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
+
import { memoizeStyle } from '../../../lib/theming/ThemeHelpers';
|
|
3
4
|
var styles = {
|
|
4
|
-
root: function () {
|
|
5
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding-top:
|
|
5
|
+
root: function (t) {
|
|
6
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n display: flex;\n align-items: center;\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuItemContentPaddingY, t.sideMenuItemContentPaddingY);
|
|
6
7
|
},
|
|
7
|
-
largeRoot: function () {
|
|
8
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-top:
|
|
8
|
+
largeRoot: function (t) {
|
|
9
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "], ["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "])), t.sideMenuItemContentLargePaddingY, t.sideMenuItemContentLargePaddingY);
|
|
9
10
|
},
|
|
10
|
-
subItemLargeRoot: function () {
|
|
11
|
-
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding-top:
|
|
11
|
+
subItemLargeRoot: function (t) {
|
|
12
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "], ["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "])), t.sideMenuSubItemContentLargePaddingY, t.sideMenuSubItemContentLargePaddingY);
|
|
12
13
|
},
|
|
13
|
-
largeMultilineRoot: function () {
|
|
14
|
-
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding-top:
|
|
14
|
+
largeMultilineRoot: function (t) {
|
|
15
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuItemContentLargeMultilinePaddingY, t.sideMenuItemContentLargeMultilinePaddingY);
|
|
15
16
|
},
|
|
16
|
-
rootForTouchScreens: function () {
|
|
17
|
-
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding-top:
|
|
17
|
+
rootForTouchScreens: function (t) {
|
|
18
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuItemContentPaddingYForTouchScreens, t.sideMenuItemContentPaddingYForTouchScreens);
|
|
18
19
|
},
|
|
19
|
-
subItemRootForTouchScreens: function () {
|
|
20
|
-
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-top:
|
|
20
|
+
subItemRootForTouchScreens: function (t) {
|
|
21
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuSubItemContentPaddingYForTouchScreens, t.sideMenuSubItemContentPaddingYForTouchScreens);
|
|
21
22
|
},
|
|
22
|
-
subItemRoot: function () {
|
|
23
|
-
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-top:
|
|
23
|
+
subItemRoot: function (t) {
|
|
24
|
+
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuSubItemContentPaddingY, t.sideMenuSubItemContentPaddingY);
|
|
24
25
|
},
|
|
25
26
|
textAndMarkerWrapper: function () {
|
|
26
27
|
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n flex-grow: 1;\n align-items: center;\n min-width: 0;\n "], ["\n display: flex;\n flex-grow: 1;\n align-items: center;\n min-width: 0;\n "])));
|
|
27
28
|
},
|
|
28
29
|
};
|
|
29
30
|
export var customStyles = {
|
|
30
|
-
textAndMarkerWrapperMultiline: function (
|
|
31
|
-
var height = linesNumber * 20 + 4; // TODO: после перехода на переменные темы заменить на формулу: linesNumber*line-height + caption-multiline-padding-top
|
|
31
|
+
textAndMarkerWrapperMultiline: function (height) {
|
|
32
32
|
return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n min-height: ", "px;\n "], ["\n min-height: ", "px;\n "])), height);
|
|
33
33
|
},
|
|
34
|
-
largeTextAndMarkerWrapperMultiline: function (linesNumber) {
|
|
35
|
-
var height = linesNumber * 22 + 4; // TODO: после перехода на переменные темы заменить на формулу: linesNumber*line-height-large + caption-multiline-padding-top
|
|
36
|
-
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n min-height: ", "px;\n "], ["\n min-height: ", "px;\n "])), height);
|
|
37
|
-
},
|
|
38
34
|
};
|
|
39
35
|
export var jsStyles = memoizeStyle(styles);
|
|
40
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9
|
|
36
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
2
2
|
import { jsStyles } from './Marker.styles';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useContext } from 'react';
|
|
4
|
+
import { getSideMenuTheme } from '../../../lib/theming/ThemeHelpers';
|
|
5
|
+
import { ThemeContext } from '@skbkontur/react-ui';
|
|
4
6
|
export var Marker = function (_a) {
|
|
5
7
|
var _b;
|
|
6
8
|
var isMultiline = _a.isMultiline, marker = _a.marker;
|
|
9
|
+
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
7
10
|
return (React.createElement("span", { className: cx((_b = {},
|
|
8
|
-
_b[jsStyles.root()] = true,
|
|
9
|
-
_b[jsStyles.rootMultiline()] = isMultiline,
|
|
11
|
+
_b[jsStyles.root(theme)] = true,
|
|
12
|
+
_b[jsStyles.rootMultiline(theme)] = isMultiline,
|
|
10
13
|
_b)) }, marker));
|
|
11
14
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css
|
|
2
|
+
import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
+
import { memoizeStyle } from '../../../lib/theming/ThemeHelpers';
|
|
3
4
|
var styles = {
|
|
4
|
-
root: function () {
|
|
5
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-right:
|
|
5
|
+
root: function (t) {
|
|
6
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-right: ", ";\n padding-left: ", ";\n background: ", ";\n border-radius: 9999px;\n margin-left: auto;\n margin-right: ", ";\n color: ", ";\n line-height: ", ";\n font-weight: ", ";\n "], ["\n padding-right: ", ";\n padding-left: ", ";\n background: ", ";\n border-radius: 9999px;\n margin-left: auto;\n margin-right: ", ";\n color: ", ";\n line-height: ", ";\n font-weight: ", ";\n "])), t.sideMenuMarkerPaddingX, t.sideMenuMarkerPaddingX, t.sideMenuMarkerBg, t.sideMenuMarkerMarginRight, t.sideMenuMarkerColor, t.sideMenuLineHeight, t.sideMenuMarkerFontWeight);
|
|
6
7
|
},
|
|
7
|
-
rootMultiline: function () {
|
|
8
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: flex-start;\n margin-top:
|
|
8
|
+
rootMultiline: function (t) {
|
|
9
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: flex-start;\n margin-top: ", ";\n "], ["\n align-self: flex-start;\n margin-top: ", ";\n "])), t.sideMenuMarkerMultilineMarginTop);
|
|
9
10
|
},
|
|
10
11
|
};
|
|
11
12
|
export var jsStyles = memoizeStyle(styles);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React, { forwardRef, useContext } from 'react';
|
|
2
2
|
import { jsStyles } from './NestedMenu.styles';
|
|
3
|
-
import { isClickableSubElement } from '../../utils/scripts';
|
|
3
|
+
import { isClickableSubElement } from '../../lib/utils/scripts';
|
|
4
|
+
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
|
|
5
|
+
import { ThemeContext } from '@skbkontur/react-ui';
|
|
4
6
|
/**
|
|
5
7
|
* Вложенное подменю
|
|
6
8
|
*
|
|
@@ -8,8 +10,9 @@ import { isClickableSubElement } from '../../utils/scripts';
|
|
|
8
10
|
*/
|
|
9
11
|
var NestedMenu = forwardRef(function (_a, ref) {
|
|
10
12
|
var _generatedId = _a._generatedId, children = _a.children;
|
|
13
|
+
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
11
14
|
var levelIndex = 0;
|
|
12
|
-
return (React.createElement("div", { className: jsStyles.root() }, React.Children.map(children, function (child) {
|
|
15
|
+
return (React.createElement("div", { className: jsStyles.root(theme) }, React.Children.map(children, function (child) {
|
|
13
16
|
if (React.isValidElement(child) &&
|
|
14
17
|
// @ts-expect-error: accessing private property
|
|
15
18
|
isClickableSubElement(child.type.__KONTUR_REACT_UI__)) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css
|
|
2
|
+
import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
+
import { memoizeStyle } from '../../lib/theming/ThemeHelpers';
|
|
3
4
|
var styles = {
|
|
4
|
-
root: function () {
|
|
5
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-left:
|
|
5
|
+
root: function (t) {
|
|
6
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-left: ", ";\n "], ["\n padding-left: ", ";\n "])), t.sideMenuNestedMenuPaddingLeft);
|
|
6
7
|
},
|
|
7
8
|
};
|
|
8
9
|
export var jsStyles = memoizeStyle(styles);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { forwardRef, useContext, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { jsStyles } from './RightBorder.styles';
|
|
4
|
+
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
|
|
5
|
+
import { ThemeContext } from '@skbkontur/react-ui';
|
|
5
6
|
/**
|
|
6
7
|
* Элемент интерактивной правой границы
|
|
7
8
|
*
|
|
@@ -10,18 +11,18 @@ import { SideMenuContext } from '../SideMenuContext';
|
|
|
10
11
|
var RightBorder = forwardRef(function (_a, ref) {
|
|
11
12
|
var _b;
|
|
12
13
|
var setIsMinimized = _a.setIsMinimized;
|
|
13
|
-
var
|
|
14
|
-
var resizeTimer = null;
|
|
14
|
+
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
15
|
+
var resizeTimer = useRef(null);
|
|
15
16
|
var _c = useState(false), isAbleToResize = _c[0], setIsAbleToResize = _c[1];
|
|
16
17
|
var rightBorderRef = useRef(null);
|
|
17
18
|
var handleMouseEnter = function () {
|
|
18
|
-
resizeTimer = setTimeout(function () {
|
|
19
|
+
resizeTimer.current = setTimeout(function () {
|
|
19
20
|
setIsAbleToResize(true);
|
|
20
21
|
}, 500);
|
|
21
22
|
};
|
|
22
23
|
var handleMouseLeave = function () {
|
|
23
|
-
if (resizeTimer) {
|
|
24
|
-
clearTimeout(resizeTimer);
|
|
24
|
+
if (resizeTimer.current) {
|
|
25
|
+
clearTimeout(resizeTimer.current);
|
|
25
26
|
}
|
|
26
27
|
setIsAbleToResize(false);
|
|
27
28
|
};
|
|
@@ -62,9 +63,9 @@ var RightBorder = forwardRef(function (_a, ref) {
|
|
|
62
63
|
};
|
|
63
64
|
});
|
|
64
65
|
return (React.createElement("div", { className: cx((_b = {},
|
|
65
|
-
_b[jsStyles.root()] = true,
|
|
66
|
+
_b[jsStyles.root(theme)] = true,
|
|
66
67
|
_b[jsStyles.resizableRoot()] = isAbleToResize,
|
|
67
|
-
_b)), ref: rightBorderRef || ref, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, isAbleToResize && React.createElement("div", { className:
|
|
68
|
+
_b)), ref: rightBorderRef || ref, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, isAbleToResize && React.createElement("div", { className: jsStyles.rootHovered(theme) })));
|
|
68
69
|
});
|
|
69
70
|
RightBorder.displayName = 'RightBorder';
|
|
70
71
|
var RightBorderWithStaticFields = Object.assign(RightBorder, { __KONTUR_REACT_UI__: 'RightBorder' });
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
rootHovered(color?: string | undefined): string;
|
|
3
|
-
};
|
|
1
|
+
import { SideMenuTheme } from '../../lib/theming/ThemeTypes';
|
|
4
2
|
export declare const jsStyles: {
|
|
5
|
-
root(): string;
|
|
3
|
+
root(t: SideMenuTheme): string;
|
|
6
4
|
resizableRoot(): string;
|
|
5
|
+
rootHovered(t: SideMenuTheme): string;
|
|
7
6
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css
|
|
2
|
+
import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
+
import { memoizeStyle } from '../../lib/theming/ThemeHelpers';
|
|
3
4
|
var styles = {
|
|
4
|
-
root: function () {
|
|
5
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n width:
|
|
5
|
+
root: function (t) {
|
|
6
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n width: ", ";\n height: 100%;\n right: -", "px;\n background: transparent;\n "], ["\n position: absolute;\n width: ", ";\n height: 100%;\n right: -", "px;\n background: transparent;\n "])), t.sideMenuRightBorderWidth, parseInt(t.sideMenuRightBorderWidth) / 2);
|
|
6
7
|
},
|
|
7
8
|
resizableRoot: function () {
|
|
8
9
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n cursor: col-resize;\n "], ["\n cursor: col-resize;\n "])));
|
|
9
10
|
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n width: 2px;\n background: ", ";\n height: 100%;\n left: 9px;\n "], ["\n position: absolute;\n width: 2px;\n background: ", ";\n height: 100%;\n left: 9px;\n "])), color);
|
|
11
|
+
rootHovered: function (t) {
|
|
12
|
+
var left = parseInt(t.sideMenuRightBorderWidth) / 2 - parseInt(t.sideMenuRightBorderHoverWidth) / 2; //левое положение подсвеченной границы: вычисляется как половина активной ширины (`10`) минус половина ширины подсвеченной границы (`1`)
|
|
13
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n width: ", ";\n background: ", ";\n height: 100%;\n left: ", "px;\n "], ["\n position: absolute;\n width: ", ";\n background: ", ";\n height: 100%;\n left: ", "px;\n "])), t.sideMenuRightBorderHoverWidth, t.sideMenuRightBorderColor, left);
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
export var jsStyles = memoizeStyle(styles);
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
import React, { forwardRef, useContext } from 'react';
|
|
3
3
|
import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
4
|
+
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
4
5
|
import { jsStyles } from '../SideMenu/SideMenu.styles';
|
|
5
|
-
import { jsStylesForSeparatedSubMenu } from './SeparatedSubMenu.styles';
|
|
6
|
+
import { customStyles, jsStylesForSeparatedSubMenu } from './SeparatedSubMenu.styles';
|
|
6
7
|
import { SideMenuContext } from '../SideMenuContext';
|
|
7
|
-
import { isClickableSubElement } from '../../utils/scripts';
|
|
8
|
+
import { isClickableSubElement } from '../../lib/utils/scripts';
|
|
8
9
|
import { BackButton } from './BackButton';
|
|
9
10
|
import { SideMenuDataTids } from '../../SideMenuDataTids';
|
|
10
11
|
import { ScrollContainer } from '@skbkontur/react-ui';
|
|
12
|
+
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
|
|
11
13
|
import { isIE11 } from '@skbkontur/react-ui/lib/client';
|
|
12
14
|
import { ZIndex } from '@skbkontur/react-ui/internal/ZIndex';
|
|
13
15
|
/**
|
|
@@ -19,6 +21,7 @@ var SeparatedSubMenu = forwardRef(function (_a, ref) {
|
|
|
19
21
|
var _b, _c;
|
|
20
22
|
var children = _a.children, generatedId = _a.generatedId, id = _a.id, href = _a.href, caption = _a.caption;
|
|
21
23
|
var context = useContext(SideMenuContext);
|
|
24
|
+
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
22
25
|
var isSubItemWithChildren = function (child) {
|
|
23
26
|
// @ts-expect-error: accessing private property
|
|
24
27
|
return isClickableSubElement(child.type.__KONTUR_REACT_UI__) && child.props.children;
|
|
@@ -35,20 +38,20 @@ var SeparatedSubMenu = forwardRef(function (_a, ref) {
|
|
|
35
38
|
var isDesktopOverlayMenu = (context.isDesktop || context.isNarrowDesktop) && !context.separatedMenuWithoutOverlay;
|
|
36
39
|
var isSeparatedSubMenuOverContent = (context.isTablet || isDesktopOverlayMenu) && !isIE11;
|
|
37
40
|
return (React.createElement(ZIndex, { priority: context.separatedMenuWithoutOverlay ? 8 : 0, className: cx((_b = {},
|
|
38
|
-
_b[jsStyles.container()] = true,
|
|
39
|
-
_b[jsStyles.containerForTouchScreens()] = context.isTouchScreen,
|
|
40
|
-
_b[jsStylesForSeparatedSubMenu.root()] = true,
|
|
41
|
-
_b[
|
|
42
|
-
_b[jsStylesForSeparatedSubMenu.rootWithoutOverlay()] = context.separatedMenuWithoutOverlay && context.isDesktop,
|
|
43
|
-
_b[jsStylesForSeparatedSubMenu.rootWithoutOverlayForNarrowDesktop()] = context.separatedMenuWithoutOverlay && context.isNarrowDesktop,
|
|
44
|
-
_b[jsStylesForSeparatedSubMenu.rootWithShadow()] = isSeparatedSubMenuOverContent,
|
|
41
|
+
_b[jsStyles.container(theme)] = true,
|
|
42
|
+
_b[jsStyles.containerForTouchScreens(theme)] = context.isTouchScreen,
|
|
43
|
+
_b[jsStylesForSeparatedSubMenu.root(theme)] = true,
|
|
44
|
+
_b[customStyles.rootForMobiles(context.headerHeight)] = context.isMobile,
|
|
45
|
+
_b[jsStylesForSeparatedSubMenu.rootWithoutOverlay(theme)] = context.separatedMenuWithoutOverlay && context.isDesktop,
|
|
46
|
+
_b[jsStylesForSeparatedSubMenu.rootWithoutOverlayForNarrowDesktop(theme)] = context.separatedMenuWithoutOverlay && context.isNarrowDesktop,
|
|
47
|
+
_b[jsStylesForSeparatedSubMenu.rootWithShadow(theme)] = isSeparatedSubMenuOverContent,
|
|
45
48
|
_b)), ref: ref, "data-tid": SideMenuDataTids.separatedSubMenu },
|
|
46
49
|
React.createElement(ScrollContainer, { onScrollStateChangeY: function (state) {
|
|
47
50
|
var _a;
|
|
48
51
|
(_a = context.setScrollState) === null || _a === void 0 ? void 0 : _a.call(context, state);
|
|
49
52
|
}, hideScrollBar: true },
|
|
50
53
|
React.createElement("div", { className: cx((_c = {},
|
|
51
|
-
_c[jsStylesForSeparatedSubMenu.contentWrapper()] = true,
|
|
54
|
+
_c[jsStylesForSeparatedSubMenu.contentWrapper(theme)] = true,
|
|
52
55
|
_c[jsStylesForSeparatedSubMenu.contentWrapperForMobiles()] = context.isMobile,
|
|
53
56
|
_c)) },
|
|
54
57
|
context.isMobile && React.createElement(BackButton, { caption: caption, id: id, href: href, generatedId: generatedId }),
|