@skbkontur/side-menu 0.8.0 → 0.9.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 +19 -0
- package/hooks/useNumberOfTextLinesInSubItem.d.ts +1 -1
- package/hooks/useNumberOfTextLinesInSubItem.js +3 -2
- package/package.json +2 -2
- package/src/SideMenuDropdown/SideMenuDropdown.d.ts +2 -8
- package/src/SideMenuDropdown/SideMenuDropdown.js +2 -2
- package/src/internal/ClickableElement.d.ts +2 -1
- package/src/internal/ClickableElement.js +2 -2
- package/src/internal/ItemContent/Caption.d.ts +1 -1
- package/src/internal/ItemContent/Caption.js +17 -13
- package/src/internal/ItemContent/Caption.styles.d.ts +10 -9
- package/src/internal/ItemContent/Caption.styles.js +23 -20
- package/src/internal/ItemContent/ItemContent.js +4 -4
- package/src/internal/ItemContent/ItemContent.styles.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.9.0](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.8.1...@skbkontur/side-menu@0.9.0) (2023-05-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **SideMenu:** add subCaption prop ([9776fb4](https://git.skbkontur.ru/ui/ui-parking/commits/9776fb4e013a1c5353c660e89010c7a0841b0fd0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.8.1](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.8.0...@skbkontur/side-menu@0.8.1) (2023-04-19)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @skbkontur/side-menu
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [0.8.0](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.7.4...@skbkontur/side-menu@0.8.0) (2023-03-31)
|
|
7
26
|
|
|
8
27
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const useNumberOfTextLinesInSubItem: (textRef: React.RefObject<HTMLDivElement>, setIsMultilineText: React.Dispatch<React.SetStateAction<boolean
|
|
2
|
+
export declare const useNumberOfTextLinesInSubItem: (textRef: React.RefObject<HTMLDivElement>, setIsMultilineText: React.Dispatch<React.SetStateAction<boolean>>, size?: string) => void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export var useNumberOfTextLinesInSubItem = function (textRef, setIsMultilineText) {
|
|
1
|
+
export var useNumberOfTextLinesInSubItem = function (textRef, setIsMultilineText, size) {
|
|
2
|
+
if (size === void 0) { size = 'small'; }
|
|
2
3
|
if (textRef.current) {
|
|
3
4
|
var el_1 = textRef.current;
|
|
4
5
|
setTimeout(function () {
|
|
5
6
|
var textHeight = +el_1.offsetHeight;
|
|
6
|
-
var lineHeight =
|
|
7
|
+
var lineHeight = size === 'small' ? 20 : 22; //TODO после возврата кастомизации заменить на переменные темы sideMenuLineHeight : sideMenuLargeLineHeight
|
|
7
8
|
var lines = textHeight / lineHeight;
|
|
8
9
|
if (lines >= 2) {
|
|
9
10
|
setIsMultilineText(true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skbkontur/side-menu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@skbkontur/react-ui": "4.13.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@skbkontur/icons": "^0.
|
|
26
|
+
"@skbkontur/icons": "^0.16.0",
|
|
27
27
|
"tslib": "^1"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownMenuProps } from '@skbkontur/react-ui';
|
|
3
3
|
import { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { SideMenuItemProps } from '../SideMenuItem/SideMenuItem';
|
|
5
|
+
export interface SideMenuDropdownProps extends CommonProps, Omit<DropdownMenuProps, 'caption' | 'disableAnimations'>, Pick<SideMenuItemProps, 'icon' | 'caption' | '_avatar' | 'id' | '_generatedId' | 'subCaption'> {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
-
caption?: string;
|
|
8
7
|
disableAnimations?: boolean;
|
|
9
|
-
/** @ignore */
|
|
10
|
-
_avatar?: React.ReactElement;
|
|
11
|
-
id?: string;
|
|
12
|
-
/** @ignore */
|
|
13
|
-
_generatedId?: string;
|
|
14
8
|
}
|
|
15
9
|
/**
|
|
16
10
|
* Элемент списка с выпадающим меню
|
|
@@ -8,13 +8,13 @@ import { SideMenuItem } from '../SideMenuItem/SideMenuItem';
|
|
|
8
8
|
import { SideMenuContext } from '../SideMenuContext';
|
|
9
9
|
var SideMenuDropdownInner = forwardRef(function (_a, ref) {
|
|
10
10
|
var _b;
|
|
11
|
-
var icon = _a.icon, id = _a.id, _generatedId = _a._generatedId, _avatar = _a._avatar, children = _a.children, _c = _a.caption, caption = _c === void 0 ? 'СКБ Контур' : _c, className = _a.className, _d = _a.disableAnimations, disableAnimations = _d === void 0 ? false : _d, menuWidth = _a.menuWidth, rest = __rest(_a, ["icon", "id", "_generatedId", "_avatar", "children", "caption", "className", "disableAnimations", "menuWidth"]);
|
|
11
|
+
var icon = _a.icon, id = _a.id, _generatedId = _a._generatedId, _avatar = _a._avatar, children = _a.children, _c = _a.caption, caption = _c === void 0 ? 'СКБ Контур' : _c, subCaption = _a.subCaption, className = _a.className, _d = _a.disableAnimations, disableAnimations = _d === void 0 ? false : _d, menuWidth = _a.menuWidth, rest = __rest(_a, ["icon", "id", "_generatedId", "_avatar", "children", "caption", "subCaption", "className", "disableAnimations", "menuWidth"]);
|
|
12
12
|
var context = useContext(SideMenuContext);
|
|
13
13
|
var label = (React.createElement("div", { className: cx((_b = {},
|
|
14
14
|
_b[jsStyles.label()] = true,
|
|
15
15
|
_b[jsStyles.minimizedLabel()] = context.isMinimized,
|
|
16
16
|
_b)) },
|
|
17
|
-
React.createElement(SideMenuItem, { icon: icon, caption: caption, _avatar: _avatar, id: id, _isDropdown: true })));
|
|
17
|
+
React.createElement(SideMenuItem, { icon: icon, caption: caption, subCaption: subCaption, _avatar: _avatar, id: id, _isDropdown: true })));
|
|
18
18
|
return (React.createElement(ThemeContext.Consumer, null, function (theme) {
|
|
19
19
|
var _a;
|
|
20
20
|
return (React.createElement(ThemeContext.Provider, { value: ThemeFactory.create({
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
|
|
3
3
|
export interface CommonClickableElementProps extends CommonProps {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
icon: React.ReactElement;
|
|
6
6
|
marker?: string;
|
|
7
7
|
caption?: string;
|
|
8
|
+
subCaption?: ReactNode;
|
|
8
9
|
id?: string;
|
|
9
10
|
/** @ignore */
|
|
10
11
|
_generatedId?: string;
|
|
@@ -15,7 +15,7 @@ import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
|
15
15
|
*/
|
|
16
16
|
var ClickableElement = forwardRef(function (_a, ref) {
|
|
17
17
|
var _b;
|
|
18
|
-
var onClick = _a.onClick, icon = _a.icon, _avatar = _a._avatar, marker = _a.marker, caption = _a.caption, id = _a.id, _isSubMenu = _a._isSubMenu, children = _a.children, _isNestedSubMenu = _a._isNestedSubMenu, _generatedId = _a._generatedId, Tag = _a.element, onKeyDown = _a.onKeyDown, onFocus = _a.onFocus, onBlur = _a.onBlur, className = _a.className, _isDropdown = _a._isDropdown, _isBackButton = _a._isBackButton, rest = __rest(_a, ["onClick", "icon", "_avatar", "marker", "caption", "id", "_isSubMenu", "children", "_isNestedSubMenu", "_generatedId", "element", "onKeyDown", "onFocus", "onBlur", "className", "_isDropdown", "_isBackButton"]);
|
|
18
|
+
var onClick = _a.onClick, icon = _a.icon, _avatar = _a._avatar, marker = _a.marker, caption = _a.caption, subCaption = _a.subCaption, id = _a.id, _isSubMenu = _a._isSubMenu, children = _a.children, _isNestedSubMenu = _a._isNestedSubMenu, _generatedId = _a._generatedId, Tag = _a.element, onKeyDown = _a.onKeyDown, onFocus = _a.onFocus, onBlur = _a.onBlur, className = _a.className, _isDropdown = _a._isDropdown, _isBackButton = _a._isBackButton, rest = __rest(_a, ["onClick", "icon", "_avatar", "marker", "caption", "subCaption", "id", "_isSubMenu", "children", "_isNestedSubMenu", "_generatedId", "element", "onKeyDown", "onFocus", "onBlur", "className", "_isDropdown", "_isBackButton"]);
|
|
19
19
|
var context = useContext(SideMenuContext);
|
|
20
20
|
var isActive = useActiveState(id, rest.href, _generatedId, context.activeMenuItem);
|
|
21
21
|
var _c = useState(false), isFocusedByTab = _c[0], setIsFocusedByTab = _c[1];
|
|
@@ -101,7 +101,7 @@ var ClickableElement = forwardRef(function (_a, ref) {
|
|
|
101
101
|
shouldHighlightTopLevelItemWhenSubItemSelectedInSeparatedMenu ||
|
|
102
102
|
shouldHighlightTopLevelItemWhenMenuIsMinimized,
|
|
103
103
|
_b[jsStyles.activeRootSubItemInSeparatedSubMenu()] = isActive && context.isSeparatedMenu && _isSubMenu,
|
|
104
|
-
_b), className), onClick: handleClick, onFocus: handleFocus, onBlur: handleBlur, children: (React.createElement(ItemContent, { _isSubMenu: _isSubMenu, icon: icon, _isNestedSubMenu: _isNestedSubMenu, caption: caption, marker: marker, _avatar: _avatar, _isBackButton: _isBackButton })), ref: ref }, rest)),
|
|
104
|
+
_b), className), onClick: handleClick, onFocus: handleFocus, onBlur: handleBlur, children: (React.createElement(ItemContent, { _isSubMenu: _isSubMenu, icon: icon, _isNestedSubMenu: _isNestedSubMenu, caption: caption, subCaption: subCaption, marker: marker, _avatar: _avatar, _isBackButton: _isBackButton })), ref: ref }, rest)),
|
|
105
105
|
React.createElement(SubMenu, { generatedId: _generatedId, id: id, href: rest.href, caption: caption, isSubMenu: _isSubMenu, isSeparatedMenu: context.isSeparatedMenu, isOpened: isOpened, isMinimized: context.isMinimized }, children)));
|
|
106
106
|
});
|
|
107
107
|
ClickableElement.displayName = 'ClickableElement';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SideMenuItemProps } from '../../SideMenuItem/SideMenuItem';
|
|
3
|
-
interface CaptionProps extends Pick<SideMenuItemProps, '_isSubMenu' | '_isNestedSubMenu' | 'caption' | '_isBackButton'> {
|
|
3
|
+
interface CaptionProps extends Pick<SideMenuItemProps, '_isSubMenu' | '_isNestedSubMenu' | 'caption' | '_isBackButton' | 'subCaption'> {
|
|
4
4
|
hasShortcutImage: boolean;
|
|
5
5
|
isMultiline: boolean;
|
|
6
6
|
}
|
|
@@ -3,23 +3,27 @@ import { jsStyles } from './Caption.styles';
|
|
|
3
3
|
import React, { forwardRef, useContext } from 'react';
|
|
4
4
|
import { SideMenuContext } from '../../SideMenuContext';
|
|
5
5
|
export var Caption = forwardRef(function (_a, ref) {
|
|
6
|
-
var _b;
|
|
7
|
-
var _isSubMenu = _a._isSubMenu, _isNestedSubMenu = _a._isNestedSubMenu, hasShortcutImage = _a.hasShortcutImage, caption = _a.caption, isMultiline = _a.isMultiline, _isBackButton = _a._isBackButton;
|
|
6
|
+
var _b, _c;
|
|
7
|
+
var _isSubMenu = _a._isSubMenu, _isNestedSubMenu = _a._isNestedSubMenu, hasShortcutImage = _a.hasShortcutImage, caption = _a.caption, subCaption = _a.subCaption, isMultiline = _a.isMultiline, _isBackButton = _a._isBackButton;
|
|
8
8
|
var context = useContext(SideMenuContext);
|
|
9
9
|
var isBeingTransitioned = context.isBeingTransitioned, isSeparatedMenu = context.isSeparatedMenu, size = context.size, isTouchScreen = context.isTouchScreen, hasSubIcons = context.hasSubIcons;
|
|
10
|
-
return (React.createElement("
|
|
10
|
+
return (React.createElement("div", { className: cx((_b = {},
|
|
11
11
|
_b[jsStyles.root()] = true,
|
|
12
12
|
_b[jsStyles.rootBeingTransitioned()] = isBeingTransitioned && !_isSubMenu && !(context.isTablet || context.isMobile),
|
|
13
|
-
_b[jsStyles.rootSubItem()] = _isSubMenu,
|
|
14
|
-
_b[jsStyles.rootSubItemSeparatedMenuTopLevel()] = isSeparatedMenu && !_isNestedSubMenu && _isSubMenu,
|
|
15
|
-
_b[jsStyles.rootNestedItemSeparatedMenu()] = isSeparatedMenu && _isNestedSubMenu && !hasShortcutImage,
|
|
16
|
-
_b[jsStyles.rootWithoutItemIcon()] = !hasShortcutImage && !isSeparatedMenu,
|
|
17
|
-
_b[jsStyles.rootSubItemWithoutColumnIcons()] = _isSubMenu && isSeparatedMenu && !hasSubIcons,
|
|
18
|
-
_b[jsStyles.rootLarge()] = size === 'large',
|
|
19
13
|
_b[jsStyles.rootMultiline()] = isMultiline && !_isSubMenu,
|
|
20
|
-
_b
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
_b)), ref: ref },
|
|
15
|
+
React.createElement("p", { className: cx((_c = {},
|
|
16
|
+
_c[jsStyles.caption()] = true,
|
|
17
|
+
_c[jsStyles.captionSubItem()] = _isSubMenu,
|
|
18
|
+
_c[jsStyles.captionSubItemSeparatedMenuTopLevel()] = isSeparatedMenu && !_isNestedSubMenu && _isSubMenu,
|
|
19
|
+
_c[jsStyles.captionNestedItemSeparatedMenu()] = isSeparatedMenu && _isNestedSubMenu && !hasShortcutImage,
|
|
20
|
+
_c[jsStyles.captionWithoutItemIcon()] = !hasShortcutImage && !isSeparatedMenu,
|
|
21
|
+
_c[jsStyles.captionSubItemWithoutColumnIcons()] = _isSubMenu && isSeparatedMenu && !hasSubIcons,
|
|
22
|
+
_c[jsStyles.captionLarge()] = size === 'large',
|
|
23
|
+
_c[jsStyles.captionForTouchScreens()] = isTouchScreen,
|
|
24
|
+
_c[jsStyles.captionSubItemForTouchScreens()] = isTouchScreen && _isSubMenu,
|
|
25
|
+
_c[jsStyles.captionInBackButton()] = _isBackButton,
|
|
26
|
+
_c)), ref: ref }, caption),
|
|
27
|
+
subCaption));
|
|
24
28
|
});
|
|
25
29
|
Caption.displayName = 'Caption';
|
|
@@ -2,13 +2,14 @@ export declare const jsStyles: {
|
|
|
2
2
|
root(): string;
|
|
3
3
|
rootBeingTransitioned(): string;
|
|
4
4
|
rootMultiline(): string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
caption(): string;
|
|
6
|
+
captionForTouchScreens(): string;
|
|
7
|
+
captionSubItem(): string;
|
|
8
|
+
captionSubItemForTouchScreens(): string;
|
|
9
|
+
captionSubItemSeparatedMenuTopLevel(): string;
|
|
10
|
+
captionNestedItemSeparatedMenu(): string;
|
|
11
|
+
captionWithoutItemIcon(): string;
|
|
12
|
+
captionSubItemWithoutColumnIcons(): string;
|
|
13
|
+
captionLarge(): string;
|
|
14
|
+
captionInBackButton(): string;
|
|
14
15
|
};
|
|
@@ -2,7 +2,7 @@ import { __makeTemplateObject } from "tslib";
|
|
|
2
2
|
import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
3
|
var styles = {
|
|
4
4
|
root: function () {
|
|
5
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n
|
|
5
|
+
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 "])));
|
|
6
6
|
},
|
|
7
7
|
rootBeingTransitioned: function () {
|
|
8
8
|
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 "])));
|
|
@@ -10,33 +10,36 @@ var styles = {
|
|
|
10
10
|
rootMultiline: function () {
|
|
11
11
|
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding-top: 4px;\n align-self: flex-start;\n "], ["\n padding-top: 4px;\n align-self: flex-start;\n "])));
|
|
12
12
|
},
|
|
13
|
-
|
|
14
|
-
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size:
|
|
13
|
+
caption: function () {
|
|
14
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: 14px;\n line-height: 20px;\n margin: 0 8px 0 0;\n "], ["\n font-size: 14px;\n line-height: 20px;\n margin: 0 8px 0 0;\n "])));
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n
|
|
16
|
+
captionForTouchScreens: function () {
|
|
17
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-size: 18px;\n line-height: 24px;\n "], ["\n font-size: 18px;\n line-height: 24px;\n "])));
|
|
18
18
|
},
|
|
19
|
-
|
|
20
|
-
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n
|
|
19
|
+
captionSubItem: function () {
|
|
20
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-left: 4px;\n "], ["\n margin-left: 4px;\n "])));
|
|
21
21
|
},
|
|
22
|
-
|
|
23
|
-
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n
|
|
22
|
+
captionSubItemForTouchScreens: function () {
|
|
23
|
+
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size: 16px;\n line-height: 22px;\n "], ["\n font-size: 16px;\n line-height: 22px;\n "])));
|
|
24
24
|
},
|
|
25
|
-
|
|
26
|
-
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n margin
|
|
25
|
+
captionSubItemSeparatedMenuTopLevel: function () {
|
|
26
|
+
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n margin: 0 8px;\n "], ["\n margin: 0 8px;\n "])));
|
|
27
27
|
},
|
|
28
|
-
|
|
29
|
-
return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n margin-left:
|
|
28
|
+
captionNestedItemSeparatedMenu: function () {
|
|
29
|
+
return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n margin-left: 25px;\n "], ["\n margin-left: 25px;\n "])));
|
|
30
30
|
},
|
|
31
|
-
|
|
32
|
-
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n margin-left:
|
|
31
|
+
captionWithoutItemIcon: function () {
|
|
32
|
+
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n margin-left: 40px;\n "], ["\n margin-left: 40px;\n "])));
|
|
33
33
|
},
|
|
34
|
-
|
|
35
|
-
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n
|
|
34
|
+
captionSubItemWithoutColumnIcons: function () {
|
|
35
|
+
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n margin-left: 8px;\n "], ["\n margin-left: 8px;\n "])));
|
|
36
36
|
},
|
|
37
|
-
|
|
38
|
-
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n font-
|
|
37
|
+
captionLarge: function () {
|
|
38
|
+
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n font-size: 16px !important;\n line-height: 22px !important;\n "], ["\n font-size: 16px !important;\n line-height: 22px !important;\n "])));
|
|
39
|
+
},
|
|
40
|
+
captionInBackButton: function () {
|
|
41
|
+
return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n font-weight: 700;\n font-size: 20px;\n line-height: 28px;\n padding-top: 5px;\n padding-bottom: 5px;\n "], ["\n font-weight: 700;\n font-size: 20px;\n line-height: 28px;\n padding-top: 5px;\n padding-bottom: 5px;\n "])));
|
|
39
42
|
},
|
|
40
43
|
};
|
|
41
44
|
export var jsStyles = memoizeStyle(styles);
|
|
42
|
-
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;
|
|
45
|
+
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;
|
|
@@ -13,18 +13,18 @@ import { Avatar } from './Avatar';
|
|
|
13
13
|
*/
|
|
14
14
|
var ItemContent = forwardRef(function (_a, ref) {
|
|
15
15
|
var _b, _c;
|
|
16
|
-
var _isSubMenu = _a._isSubMenu, icon = _a.icon, _isNestedSubMenu = _a._isNestedSubMenu, caption = _a.caption, marker = _a.marker, _avatar = _a._avatar, _isBackButton = _a._isBackButton;
|
|
16
|
+
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
17
|
var context = useContext(SideMenuContext);
|
|
18
18
|
var textRef = useRef(null);
|
|
19
19
|
var _d = useState(1), linesNumber = _d[0], setLinesNumber = _d[1];
|
|
20
20
|
var _e = useState(false), isMultilineSubItem = _e[0], setMultilineSubItem = _e[1];
|
|
21
|
-
var isMultiline = (!_isSubMenu && linesNumber > 1) || (!!_isSubMenu && isMultilineSubItem);
|
|
21
|
+
var isMultiline = (!_isSubMenu && linesNumber > 1) || (!!_isSubMenu && isMultilineSubItem) || !!subCaption;
|
|
22
22
|
useEffect(function () {
|
|
23
23
|
if (!_isBackButton && !_isSubMenu) {
|
|
24
24
|
useNumberOfTextLinesInItem(textRef, setLinesNumber, caption, marker, context.size);
|
|
25
25
|
}
|
|
26
26
|
if (!_isBackButton && _isSubMenu) {
|
|
27
|
-
useNumberOfTextLinesInSubItem(textRef, setMultilineSubItem);
|
|
27
|
+
useNumberOfTextLinesInSubItem(textRef, setMultilineSubItem, context.size);
|
|
28
28
|
}
|
|
29
29
|
}, []);
|
|
30
30
|
useEffect(function () {
|
|
@@ -50,7 +50,7 @@ var ItemContent = forwardRef(function (_a, ref) {
|
|
|
50
50
|
_c[customStyles.textAndMarkerWrapperMultiline(linesNumber)] = isMultiline && !_isSubMenu,
|
|
51
51
|
_c[customStyles.largeTextAndMarkerWrapperMultiline(linesNumber)] = isMultiline && context.size === 'large' && !_isSubMenu,
|
|
52
52
|
_c)) },
|
|
53
|
-
React.createElement(Caption, { _isSubMenu: _isSubMenu, _isNestedSubMenu: _isNestedSubMenu, hasShortcutImage: hasShortcutImage, isMultiline: isMultiline, caption: caption, _isBackButton: _isBackButton, ref: textRef }),
|
|
53
|
+
React.createElement(Caption, { _isSubMenu: _isSubMenu, _isNestedSubMenu: _isNestedSubMenu, hasShortcutImage: hasShortcutImage, isMultiline: isMultiline, caption: caption, subCaption: subCaption, _isBackButton: _isBackButton, ref: textRef }),
|
|
54
54
|
marker && (!context.isMinimized || isSeparatedSubMenuInNarrowDesktopWithoutOverlay) && (React.createElement(Marker, { isMultiline: isMultiline, marker: marker }))))));
|
|
55
55
|
});
|
|
56
56
|
ItemContent.displayName = 'ItemContent';
|
|
@@ -23,7 +23,7 @@ var styles = {
|
|
|
23
23
|
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-top: 4px;\n padding-bottom: 4px;\n "], ["\n padding-top: 4px;\n padding-bottom: 4px;\n "])));
|
|
24
24
|
},
|
|
25
25
|
textAndMarkerWrapper: function () {
|
|
26
|
-
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n flex-grow: 1;\n align-items: center;\n "], ["\n display: flex;\n flex-grow: 1;\n align-items: center;\n "])));
|
|
26
|
+
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
27
|
},
|
|
28
28
|
};
|
|
29
29
|
export var customStyles = {
|