@skbkontur/side-menu 3.3.4 → 3.3.5-19a67.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/SideMenuDataTids.js +4 -1
- package/hooks/useAnimateOnMount.js +12 -10
- package/hooks/useMemoIcon.js +18 -13
- package/index.js +17 -14
- package/internal/themes/SideMenuTheme.js +209 -282
- package/lib/theming/ThemeHelpers.js +33 -42
- package/lib/theming/ThemeTypes.js +2 -1
- package/lib/utils/memo.js +7 -3
- package/lib/utils/scripts.js +12 -6
- package/package.json +1 -1
- package/src/Navigation.js +81 -123
- package/src/SideMenu/SideMenu.js +202 -207
- package/src/SideMenu/SideMenu.styles.js +145 -73
- package/src/SideMenuAvatar/SideMenuAvatar.js +13 -11
- package/src/SideMenuBody/SideMenuBody.js +21 -20
- package/src/SideMenuBody/SideMenuBody.styles.js +17 -10
- package/src/SideMenuContext.js +5 -2
- package/src/SideMenuDivider/SideMenuDivider.js +13 -12
- package/src/SideMenuDivider/SideMenuDivider.styles.js +14 -8
- package/src/SideMenuDropdown/SideMenuDropdown.js +34 -36
- package/src/SideMenuDropdown/SideMenuDropdown.styles.js +25 -15
- package/src/SideMenuFooter/SideMenuFooter.js +24 -23
- package/src/SideMenuFooter/SideMenuFooter.styles.js +25 -12
- package/src/SideMenuHeader/SideMenuHeader.js +28 -29
- package/src/SideMenuHeader/SideMenuHeader.styles.js +34 -16
- package/src/SideMenuItem/SideMenuItem.js +9 -7
- package/src/SideMenuLink/SideMenuLink.js +11 -10
- package/src/SideMenuLink/SideMenuLink.styles.js +11 -7
- package/src/SideMenuNotifications/BellWidget.js +61 -78
- package/src/SideMenuNotifications/BellWidgetError.js +22 -18
- package/src/SideMenuNotifications/BellWidgetView.styles.js +48 -20
- package/src/SideMenuNotifications/SideMenuNotifications.js +29 -27
- package/src/SideMenuNotifications/utils/getMarker.js +4 -1
- package/src/SideMenuNotifications/utils/getNotificationsErrorMessages.js +15 -11
- package/src/SideMenuOrganisations/SideMenuOrganisations.js +9 -7
- package/src/SideMenuSubItem/SideMenuSubItem.js +10 -8
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +18 -17
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +18 -10
- package/src/SideMenuSubLink/SideMenuSubLink.js +10 -7
- package/src/Tree.js +39 -112
- package/src/internal/BackButton.js +17 -16
- package/src/internal/Backdrop.js +18 -12
- package/src/internal/Backdrop.styles.js +16 -8
- package/src/internal/Burger.js +17 -12
- package/src/internal/Burger.styles.js +14 -9
- package/src/internal/ClickableElement.js +97 -86
- package/src/internal/ClickableElement.styles.js +48 -21
- package/src/internal/InnerSubMenu.js +16 -14
- package/src/internal/ItemContent/Caption.js +47 -48
- package/src/internal/ItemContent/Caption.styles.js +84 -36
- package/src/internal/ItemContent/Icon.js +30 -27
- package/src/internal/ItemContent/Icon.styles.js +49 -20
- package/src/internal/ItemContent/ItemContent.js +44 -44
- package/src/internal/ItemContent/ItemContent.styles.js +65 -28
- package/src/internal/ItemContent/Marker.js +23 -20
- package/src/internal/ItemContent/Marker.styles.js +59 -22
- package/src/internal/NestedMenu.js +21 -19
- package/src/internal/NestedMenu.styles.js +11 -8
- package/src/internal/RightBorder.js +26 -24
- package/src/internal/RightBorder.styles.js +26 -10
- package/src/internal/SeparatedSubMenu.js +48 -49
- package/src/internal/SeparatedSubMenu.styles.js +58 -29
- package/src/internal/SideMenuLogotype.js +48 -49
- package/src/internal/SideMenuLogotype.styles.js +50 -23
- package/src/internal/SubMenu.js +16 -14
|
@@ -1,51 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsStyles = exports.sideMenuCaptionMarginRight = exports.sideMenuMultilineCaptionPaddingTop = void 0;
|
|
4
|
+
const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
|
|
5
|
+
const ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
|
|
6
|
+
exports.sideMenuMultilineCaptionPaddingTop = '4px';
|
|
7
|
+
exports.sideMenuCaptionMarginRight = '8px';
|
|
8
|
+
const styles = {
|
|
9
|
+
root() {
|
|
10
|
+
return (0, Emotion_1.css) `
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
flex: 1;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
`;
|
|
9
16
|
},
|
|
10
|
-
rootMultiline
|
|
11
|
-
return
|
|
17
|
+
rootMultiline() {
|
|
18
|
+
return (0, Emotion_1.css) `
|
|
19
|
+
padding-top: ${exports.sideMenuMultilineCaptionPaddingTop};
|
|
20
|
+
align-self: flex-start;
|
|
21
|
+
`;
|
|
12
22
|
},
|
|
13
|
-
caption
|
|
14
|
-
return
|
|
23
|
+
caption(t) {
|
|
24
|
+
return (0, Emotion_1.css) `
|
|
25
|
+
font-size: ${t.sideMenuCaptionFontSize};
|
|
26
|
+
line-height: ${t.sideMenuCaptionLineHeight};
|
|
27
|
+
margin: 0 ${exports.sideMenuCaptionMarginRight} 0 0;
|
|
28
|
+
overflow-wrap: anywhere;
|
|
29
|
+
`;
|
|
15
30
|
},
|
|
16
|
-
captionForTouchScreens
|
|
17
|
-
return
|
|
31
|
+
captionForTouchScreens(t) {
|
|
32
|
+
return (0, Emotion_1.css) `
|
|
33
|
+
font-size: ${t.sideMenuCaptionFontSizeForTouchScreens};
|
|
34
|
+
line-height: ${t.sideMenuCaptionLineHeightForTouchScreens};
|
|
35
|
+
`;
|
|
18
36
|
},
|
|
19
|
-
captionSubItem
|
|
20
|
-
return
|
|
37
|
+
captionSubItem(t) {
|
|
38
|
+
return (0, Emotion_1.css) `
|
|
39
|
+
margin-left: ${t.sideMenuCaptionSubItemMarginLeft};
|
|
40
|
+
`;
|
|
21
41
|
},
|
|
22
|
-
captionSubItemForTouchScreens
|
|
23
|
-
return
|
|
42
|
+
captionSubItemForTouchScreens(t) {
|
|
43
|
+
return (0, Emotion_1.css) `
|
|
44
|
+
font-size: ${t.sideMenuCaptionSubItemFontSizeForTouchScreens};
|
|
45
|
+
line-height: ${t.sideMenuCaptionSubItemLineHeightForTouchScreens};
|
|
46
|
+
`;
|
|
24
47
|
},
|
|
25
|
-
captionSubItemSeparatedMenuTopLevel
|
|
26
|
-
return
|
|
48
|
+
captionSubItemSeparatedMenuTopLevel() {
|
|
49
|
+
return (0, Emotion_1.css) `
|
|
50
|
+
margin: 0 8px;
|
|
51
|
+
`;
|
|
27
52
|
},
|
|
28
|
-
captionNestedItemSeparatedMenu
|
|
29
|
-
return
|
|
53
|
+
captionNestedItemSeparatedMenu() {
|
|
54
|
+
return (0, Emotion_1.css) `
|
|
55
|
+
margin-left: 25px;
|
|
56
|
+
`;
|
|
30
57
|
},
|
|
31
|
-
captionWithoutItemIcon
|
|
32
|
-
return
|
|
58
|
+
captionWithoutItemIcon() {
|
|
59
|
+
return (0, Emotion_1.css) `
|
|
60
|
+
margin-left: 40px;
|
|
61
|
+
`;
|
|
33
62
|
},
|
|
34
|
-
captionSubItemWithoutColumnIcons
|
|
35
|
-
return
|
|
63
|
+
captionSubItemWithoutColumnIcons() {
|
|
64
|
+
return (0, Emotion_1.css) `
|
|
65
|
+
margin-left: 8px;
|
|
66
|
+
`;
|
|
36
67
|
},
|
|
37
|
-
captionLarge
|
|
38
|
-
return
|
|
68
|
+
captionLarge(t) {
|
|
69
|
+
return (0, Emotion_1.css) `
|
|
70
|
+
font-size: ${t.sideMenuCaptionLargeFontSize} !important;
|
|
71
|
+
line-height: ${t.sideMenuCaptionLargeLineHeight} !important;
|
|
72
|
+
`;
|
|
39
73
|
},
|
|
40
|
-
captionInBackButton
|
|
41
|
-
return
|
|
74
|
+
captionInBackButton(t) {
|
|
75
|
+
return (0, Emotion_1.css) `
|
|
76
|
+
font-weight: ${t.sideMenuBackButtonCaptionFontWeight};
|
|
77
|
+
font-size: ${t.sideMenuBackButtonCaptionFontSize};
|
|
78
|
+
line-height: ${t.sideMenuBackButtonCaptionLineHeight};
|
|
79
|
+
padding-top: ${t.sideMenuBackButtonCaptionPaddingY};
|
|
80
|
+
padding-bottom: ${t.sideMenuBackButtonCaptionPaddingY};
|
|
81
|
+
`;
|
|
42
82
|
},
|
|
43
|
-
captionDropdown
|
|
44
|
-
return
|
|
83
|
+
captionDropdown() {
|
|
84
|
+
return (0, Emotion_1.css) `
|
|
85
|
+
white-space: nowrap;
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
`;
|
|
45
88
|
},
|
|
46
|
-
captionTruncated
|
|
47
|
-
return
|
|
89
|
+
captionTruncated() {
|
|
90
|
+
return (0, Emotion_1.css) `
|
|
91
|
+
text-overflow: ellipsis;
|
|
92
|
+
&::before {
|
|
93
|
+
float: right;
|
|
94
|
+
content: attr(data-tail);
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
48
97
|
},
|
|
49
98
|
};
|
|
50
|
-
|
|
51
|
-
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;
|
|
99
|
+
exports.jsStyles = (0, ThemeHelpers_1.memoizeStyle)(styles);
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Icon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
|
|
7
|
+
const ThemeContext_1 = require("@skbkontur/react-ui/lib/theming/ThemeContext");
|
|
8
|
+
const SideMenuContext_1 = require("../../SideMenuContext");
|
|
9
|
+
const ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
|
|
10
|
+
const scripts_1 = require("../../../lib/utils/scripts");
|
|
11
|
+
const Icon_styles_1 = require("./Icon.styles");
|
|
12
|
+
const getIconSize = (theme, _isSubMenu, _isBackButton) => {
|
|
9
13
|
if (!_isSubMenu) {
|
|
10
14
|
return parseInt(theme.sideMenuIconSize);
|
|
11
15
|
}
|
|
@@ -13,16 +17,14 @@ var getIconSize = function (theme, _isSubMenu, _isBackButton) {
|
|
|
13
17
|
return parseInt(theme.sideMenuIconSubItemSize);
|
|
14
18
|
}
|
|
15
19
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (isKonturIcon(icon)) {
|
|
25
|
-
return React.cloneElement(icon, {
|
|
20
|
+
const Icon = ({ icon, _isSubMenu, isMultiline, _isBackButton = false, disabled }) => {
|
|
21
|
+
const context = (0, react_1.useContext)(SideMenuContext_1.SideMenuContext);
|
|
22
|
+
const { isSeparatedMenu, size } = context;
|
|
23
|
+
const theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
|
|
24
|
+
const renderIcon = () => {
|
|
25
|
+
const iconColor = _isSubMenu && !disabled ? theme.sideMenuIconSubItemColor : undefined;
|
|
26
|
+
if ((0, scripts_1.isKonturIcon)(icon)) {
|
|
27
|
+
return react_1.default.cloneElement(icon, {
|
|
26
28
|
size: getIconSize(theme, _isSubMenu, _isBackButton),
|
|
27
29
|
color: iconColor,
|
|
28
30
|
align: _isBackButton ? 'baseline' : 'none',
|
|
@@ -30,13 +32,14 @@ export var Icon = function (_a) {
|
|
|
30
32
|
}
|
|
31
33
|
return icon;
|
|
32
34
|
};
|
|
33
|
-
return (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
return (react_1.default.createElement("span", { className: (0, Emotion_1.cx)({
|
|
36
|
+
[Icon_styles_1.jsStyles.root(theme)]: true,
|
|
37
|
+
[Icon_styles_1.jsStyles.rootMultiline()]: isMultiline && (context.isOpened || _isSubMenu),
|
|
38
|
+
[Icon_styles_1.jsStyles.rootLarge(theme)]: size === 'large',
|
|
39
|
+
[Icon_styles_1.jsStyles.rootSubItem(theme)]: _isSubMenu,
|
|
40
|
+
[Icon_styles_1.jsStyles.rootSubItemSeparatedMenu(theme)]: isSeparatedMenu && _isSubMenu,
|
|
41
|
+
[Icon_styles_1.jsStyles.rootSubItemLarge(theme)]: _isSubMenu && size === 'large',
|
|
42
|
+
[Icon_styles_1.jsStyles.rootBackButton(theme)]: _isBackButton,
|
|
43
|
+
}) }, renderIcon()));
|
|
42
44
|
};
|
|
45
|
+
exports.Icon = Icon;
|
|
@@ -1,28 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsStyles = void 0;
|
|
4
|
+
const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
|
|
5
|
+
const ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
|
|
6
|
+
const styles = {
|
|
7
|
+
root(t) {
|
|
8
|
+
return (0, Emotion_1.css) `
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
margin: ${t.sideMenuIconMarginY} ${t.sideMenuIconMarginRight} ${t.sideMenuIconMarginY} ${t.sideMenuIconMarginLeft};
|
|
12
|
+
min-height: ${t.sideMenuIconMinHeight};
|
|
13
|
+
line-height: ${t.sideMenuIconLineHeight};
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
box-sizing: content-box;
|
|
16
|
+
`;
|
|
7
17
|
},
|
|
8
|
-
rootMultiline
|
|
9
|
-
return
|
|
18
|
+
rootMultiline() {
|
|
19
|
+
return (0, Emotion_1.css) `
|
|
20
|
+
align-self: flex-start;
|
|
21
|
+
margin-top: -2px;
|
|
22
|
+
`;
|
|
10
23
|
},
|
|
11
|
-
rootLarge
|
|
12
|
-
return
|
|
24
|
+
rootLarge(t) {
|
|
25
|
+
return (0, Emotion_1.css) `
|
|
26
|
+
min-height: ${t.sideMenuIconLargeMinHeight};
|
|
27
|
+
line-height: ${t.sideMenuIconLargeLineHeight};
|
|
28
|
+
margin-top: 0;
|
|
29
|
+
`;
|
|
13
30
|
},
|
|
14
|
-
rootSubItemLarge
|
|
15
|
-
return
|
|
31
|
+
rootSubItemLarge(t) {
|
|
32
|
+
return (0, Emotion_1.css) `
|
|
33
|
+
min-height: ${t.sideMenuIconLargeSubItemMinHeight};
|
|
34
|
+
`;
|
|
16
35
|
},
|
|
17
|
-
rootSubItem
|
|
18
|
-
return
|
|
36
|
+
rootSubItem(t) {
|
|
37
|
+
return (0, Emotion_1.css) `
|
|
38
|
+
margin: 0;
|
|
39
|
+
padding-left: ${t.sideMenuIconSubItemPaddingLeft};
|
|
40
|
+
padding-right: ${t.sideMenuIconSubItemPaddingRight};
|
|
41
|
+
min-height: ${t.sideMenuIconSubItemMinHeight};
|
|
42
|
+
line-height: ${t.sideMenuIconSubItemLineHeight};
|
|
43
|
+
`;
|
|
19
44
|
},
|
|
20
|
-
rootSubItemSeparatedMenu
|
|
21
|
-
return
|
|
45
|
+
rootSubItemSeparatedMenu(t) {
|
|
46
|
+
return (0, Emotion_1.css) `
|
|
47
|
+
padding-left: ${t.sideMenuIconWithSeparatedSubMenuSubItemPaddingLeft};
|
|
48
|
+
`;
|
|
22
49
|
},
|
|
23
|
-
rootBackButton
|
|
24
|
-
return
|
|
50
|
+
rootBackButton(t) {
|
|
51
|
+
return (0, Emotion_1.css) `
|
|
52
|
+
padding-left: ${t.sideMenuBackButtonIconPaddingLeft};
|
|
53
|
+
padding-right: ${t.sideMenuBackButtonIconPaddingRight};
|
|
54
|
+
`;
|
|
25
55
|
},
|
|
26
56
|
};
|
|
27
|
-
|
|
28
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
57
|
+
exports.jsStyles = (0, ThemeHelpers_1.memoizeStyle)(styles);
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ItemContent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
|
|
7
|
+
const ThemeContext_1 = require("@skbkontur/react-ui/lib/theming/ThemeContext");
|
|
8
|
+
const SideMenuContext_1 = require("../../SideMenuContext");
|
|
9
|
+
const ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
|
|
10
|
+
const ItemContent_styles_1 = require("./ItemContent.styles");
|
|
11
|
+
const Icon_1 = require("./Icon");
|
|
12
|
+
const Caption_1 = require("./Caption");
|
|
13
|
+
const Marker_1 = require("./Marker");
|
|
14
|
+
const getCaptionLineHeight = (theme, isTouchScreen, _isSubMenu, size) => {
|
|
12
15
|
if (isTouchScreen) {
|
|
13
16
|
if (_isSubMenu) {
|
|
14
17
|
return theme.sideMenuCaptionSubItemLineHeightForTouchScreens;
|
|
@@ -23,16 +26,13 @@ var getCaptionLineHeight = function (theme, isTouchScreen, _isSubMenu, size) {
|
|
|
23
26
|
/**
|
|
24
27
|
* Контент для SideMenuItem или SideMenuLink
|
|
25
28
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var _e = __read(useState(false), 2), isMultiline = _e[0], setIsMultiline = _e[1];
|
|
34
|
-
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
35
|
-
useEffect(function () {
|
|
29
|
+
const ItemContent = (0, react_1.forwardRef)(({ _isSubMenu, icon, isNestedSubMenu, caption, subCaption, marker, _isBackButton, _isDropdown, _isAvatar, disabled }, ref) => {
|
|
30
|
+
const context = (0, react_1.useContext)(SideMenuContext_1.SideMenuContext);
|
|
31
|
+
const { size, isTouchScreen } = context;
|
|
32
|
+
const textRef = (0, react_1.useRef)(null);
|
|
33
|
+
const [isMultiline, setIsMultiline] = (0, react_1.useState)(false);
|
|
34
|
+
const theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
|
|
35
|
+
(0, react_1.useEffect)(() => {
|
|
36
36
|
if (subCaption) {
|
|
37
37
|
setIsMultiline(true);
|
|
38
38
|
return;
|
|
@@ -40,31 +40,31 @@ var ItemContent = forwardRef(function (_a, ref) {
|
|
|
40
40
|
if (!textRef.current || _isBackButton || _isDropdown) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const captionLineHeight = getCaptionLineHeight(theme, context.isTouchScreen, _isSubMenu, size);
|
|
44
|
+
const isMultiline = parseInt(captionLineHeight) < textRef.current.offsetHeight;
|
|
45
45
|
if (isMultiline) {
|
|
46
46
|
setIsMultiline(true);
|
|
47
47
|
}
|
|
48
|
-
}, [caption, context.isBeingTransitioned,
|
|
49
|
-
return (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
icon && (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
marker !== undefined && (
|
|
48
|
+
}, [caption, context.isBeingTransitioned, context.navigation?.activeMenuItem]);
|
|
49
|
+
return (react_1.default.createElement("div", { className: (0, Emotion_1.cx)({
|
|
50
|
+
[ItemContent_styles_1.jsStyles.root(theme)]: true,
|
|
51
|
+
[ItemContent_styles_1.jsStyles.subItemRoot(theme)]: _isSubMenu,
|
|
52
|
+
[ItemContent_styles_1.jsStyles.largeRoot(theme)]: size === 'large' && !_isSubMenu,
|
|
53
|
+
[ItemContent_styles_1.jsStyles.subItemLargeRoot(theme)]: size === 'large' && _isSubMenu,
|
|
54
|
+
[ItemContent_styles_1.jsStyles.multilineRoot(theme)]: isMultiline && !_isSubMenu && context.isOpened,
|
|
55
|
+
[ItemContent_styles_1.jsStyles.largeMultilineRoot(theme)]: isMultiline && size === 'large',
|
|
56
|
+
[ItemContent_styles_1.jsStyles.rootForTouchScreens(theme)]: isTouchScreen,
|
|
57
|
+
[ItemContent_styles_1.jsStyles.subItemRootForTouchScreens(theme)]: isTouchScreen && _isSubMenu,
|
|
58
|
+
}), ref: ref },
|
|
59
|
+
icon && (react_1.default.createElement(Icon_1.Icon, { icon: icon, _isSubMenu: _isSubMenu, isMultiline: isMultiline, _isBackButton: _isBackButton, _isAvatar: _isAvatar, disabled: disabled })),
|
|
60
|
+
react_1.default.createElement("div", { className: (0, Emotion_1.cx)({
|
|
61
|
+
[ItemContent_styles_1.jsStyles.textAndMarkerWrapper()]: true,
|
|
62
|
+
[ItemContent_styles_1.jsStyles.textAndMarkerWrapperDropdown()]: _isDropdown,
|
|
63
|
+
[ItemContent_styles_1.jsStyles.textAndMarkerWrapperMinimized()]: !context.isOpened && !_isSubMenu,
|
|
64
|
+
}) },
|
|
65
|
+
react_1.default.createElement(Caption_1.Caption, { _isSubMenu: _isSubMenu, isNestedSubMenu: isNestedSubMenu, hasIcon: !!icon, isMultiline: isMultiline, caption: caption, subCaption: subCaption, _isBackButton: _isBackButton, _isDropdown: _isDropdown, _isAvatar: _isAvatar, ref: textRef })),
|
|
66
|
+
marker !== undefined && (react_1.default.createElement(Marker_1.Marker, { isMultiline: isMultiline, marker: marker, _isSubMenu: _isSubMenu, isMinimized: !context.isOpened, disabled: disabled }))));
|
|
67
67
|
});
|
|
68
68
|
ItemContent.displayName = 'ItemContent';
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
const ItemContentWithStaticFields = Object.assign(ItemContent, { __KONTUR_REACT_UI__: 'ItemContent' });
|
|
70
|
+
exports.ItemContent = ItemContentWithStaticFields;
|
|
@@ -1,40 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsStyles = void 0;
|
|
4
|
+
const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
|
|
5
|
+
const ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
|
|
6
|
+
const styles = {
|
|
7
|
+
root(t) {
|
|
8
|
+
return (0, Emotion_1.css) `
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
padding-top: ${t.sideMenuItemContentPaddingY};
|
|
12
|
+
padding-bottom: ${t.sideMenuItemContentPaddingY};
|
|
13
|
+
position: relative;
|
|
14
|
+
`;
|
|
7
15
|
},
|
|
8
|
-
largeRoot
|
|
9
|
-
return
|
|
16
|
+
largeRoot(t) {
|
|
17
|
+
return (0, Emotion_1.css) `
|
|
18
|
+
padding-top: ${t.sideMenuItemContentLargePaddingY} !important;
|
|
19
|
+
padding-bottom: ${t.sideMenuItemContentLargePaddingY} !important;
|
|
20
|
+
`;
|
|
10
21
|
},
|
|
11
|
-
subItemLargeRoot
|
|
12
|
-
return
|
|
22
|
+
subItemLargeRoot(t) {
|
|
23
|
+
return (0, Emotion_1.css) `
|
|
24
|
+
padding-top: ${t.sideMenuSubItemContentLargePaddingY} !important;
|
|
25
|
+
padding-bottom: ${t.sideMenuSubItemContentLargePaddingY} !important;
|
|
26
|
+
`;
|
|
13
27
|
},
|
|
14
|
-
multilineRoot
|
|
15
|
-
return
|
|
28
|
+
multilineRoot(t) {
|
|
29
|
+
return (0, Emotion_1.css) `
|
|
30
|
+
padding-top: ${t.sideMenuItemContentMultilinePaddingTop} !important;
|
|
31
|
+
padding-bottom: ${t.sideMenuItemContentMultilinePaddingBottom} !important;
|
|
32
|
+
`;
|
|
16
33
|
},
|
|
17
|
-
largeMultilineRoot
|
|
18
|
-
return
|
|
34
|
+
largeMultilineRoot(t) {
|
|
35
|
+
return (0, Emotion_1.css) `
|
|
36
|
+
padding-top: ${t.sideMenuItemContentLargeMultilinePaddingTop} !important;
|
|
37
|
+
padding-bottom: ${t.sideMenuItemContentLargeMultilinePaddingBottom} !important;
|
|
38
|
+
`;
|
|
19
39
|
},
|
|
20
|
-
rootForTouchScreens
|
|
21
|
-
return
|
|
40
|
+
rootForTouchScreens(t) {
|
|
41
|
+
return (0, Emotion_1.css) `
|
|
42
|
+
padding-top: ${t.sideMenuItemContentPaddingYForTouchScreens};
|
|
43
|
+
padding-bottom: ${t.sideMenuItemContentPaddingYForTouchScreens};
|
|
44
|
+
`;
|
|
22
45
|
},
|
|
23
|
-
subItemRootForTouchScreens
|
|
24
|
-
return
|
|
46
|
+
subItemRootForTouchScreens(t) {
|
|
47
|
+
return (0, Emotion_1.css) `
|
|
48
|
+
padding-top: ${t.sideMenuSubItemContentPaddingYForTouchScreens};
|
|
49
|
+
padding-bottom: ${t.sideMenuSubItemContentPaddingYForTouchScreens};
|
|
50
|
+
`;
|
|
25
51
|
},
|
|
26
|
-
subItemRoot
|
|
27
|
-
return
|
|
52
|
+
subItemRoot(t) {
|
|
53
|
+
return (0, Emotion_1.css) `
|
|
54
|
+
padding-top: ${t.sideMenuSubItemContentPaddingY};
|
|
55
|
+
padding-bottom: ${t.sideMenuSubItemContentPaddingY};
|
|
56
|
+
`;
|
|
28
57
|
},
|
|
29
|
-
textAndMarkerWrapper
|
|
30
|
-
return
|
|
58
|
+
textAndMarkerWrapper() {
|
|
59
|
+
return (0, Emotion_1.css) `
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-grow: 1;
|
|
62
|
+
align-items: center;
|
|
63
|
+
min-width: 0;
|
|
64
|
+
`;
|
|
31
65
|
},
|
|
32
|
-
textAndMarkerWrapperDropdown
|
|
33
|
-
return
|
|
66
|
+
textAndMarkerWrapperDropdown() {
|
|
67
|
+
return (0, Emotion_1.css) `
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
`;
|
|
34
70
|
},
|
|
35
|
-
textAndMarkerWrapperMinimized
|
|
36
|
-
return
|
|
71
|
+
textAndMarkerWrapperMinimized() {
|
|
72
|
+
return (0, Emotion_1.css) `
|
|
73
|
+
display: none;
|
|
74
|
+
`;
|
|
37
75
|
},
|
|
38
76
|
};
|
|
39
|
-
|
|
40
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
|
|
77
|
+
exports.jsStyles = (0, ThemeHelpers_1.memoizeStyle)(styles);
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Marker = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
const ThemeContext_1 = require("@skbkontur/react-ui/lib/theming/ThemeContext");
|
|
8
|
+
const ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
|
|
9
|
+
const Marker_styles_1 = require("./Marker.styles");
|
|
10
|
+
const Marker = ({ isMultiline, marker, _isSubMenu, disabled, isMinimized }) => {
|
|
11
|
+
const theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
|
|
12
|
+
const emptyMarker = marker === true || marker === '';
|
|
13
|
+
return (react_1.default.createElement("span", { className: (0, Emotion_1.cx)({
|
|
14
|
+
[Marker_styles_1.jsStyles.root(theme)]: true,
|
|
15
|
+
[Marker_styles_1.jsStyles.rootDisabled(theme)]: disabled,
|
|
16
|
+
[Marker_styles_1.jsStyles.rootEmpty(theme)]: emptyMarker,
|
|
17
|
+
[Marker_styles_1.jsStyles.rootMultiline(theme)]: isMultiline,
|
|
18
|
+
[Marker_styles_1.jsStyles.rootSubMenu(theme)]: _isSubMenu,
|
|
19
|
+
[Marker_styles_1.jsStyles.rootSubMenuEmpty(theme)]: _isSubMenu && emptyMarker,
|
|
20
|
+
[Marker_styles_1.jsStyles.rootMinimized()]: isMinimized && !_isSubMenu,
|
|
21
|
+
[Marker_styles_1.jsStyles.rootEmptyMinimized()]: emptyMarker && isMinimized && !_isSubMenu,
|
|
22
|
+
}) }, marker));
|
|
21
23
|
};
|
|
24
|
+
exports.Marker = Marker;
|