@skbkontur/side-menu 0.10.0 → 0.11.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 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.11.0](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.10.1...@skbkontur/side-menu@0.11.0) (2023-05-30)
7
+
8
+
9
+ ### Features
10
+
11
+ * **SideMenu:** add truncation to dropdown ([20296d4](https://git.skbkontur.ru/ui/ui-parking/commits/20296d494623e343ad4f425f6fbfa1718634fba2))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.10.1](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.10.0...@skbkontur/side-menu@0.10.1) (2023-05-30)
18
+
19
+ **Note:** Version bump only for package @skbkontur/side-menu
20
+
21
+
22
+
23
+
24
+
6
25
  # [0.10.0](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.9.5...@skbkontur/side-menu@0.10.0) (2023-05-26)
7
26
 
8
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skbkontur/side-menu",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@skbkontur/icons": "^0.16.0",
26
- "@skbkontur/react-ui-addons": "^4.6.3",
26
+ "@skbkontur/react-ui-addons": "^4.7.0",
27
27
  "tslib": "^1"
28
28
  }
29
29
  }
@@ -6,7 +6,7 @@ var SideMenuAvatarInner = forwardRef(function (_a, ref) {
6
6
  var userName = _a.userName, avatarUrl = _a.avatarUrl, children = _a.children, icon = _a.icon, rest = __rest(_a, ["userName", "avatarUrl", "children", "icon"]);
7
7
  return (
8
8
  // @ts-expect-error: icon is not provided as _avatar replaces it
9
- React.createElement(SideMenuDropdown, __assign({ _avatar: React.createElement(UserAvatar, { userName: userName, avatarUrl: avatarUrl }), caption: userName, menuWidth: 200, positions: ['top left'], ref: ref }, rest), children));
9
+ React.createElement(SideMenuDropdown, __assign({ _avatar: React.createElement(UserAvatar, { userName: userName, avatarUrl: avatarUrl }), caption: userName, menuWidth: 200, positions: ['top left'], _isAvatar: true, ref: ref }, rest), children));
10
10
  });
11
11
  SideMenuAvatarInner.displayName = 'SideMenuAvatar';
12
12
  /**
@@ -2,9 +2,14 @@ import React from 'react';
2
2
  import { DropdownMenuProps } from '@skbkontur/react-ui';
3
3
  import { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
4
4
  import { SideMenuItemProps } from '../SideMenuItem/SideMenuItem';
5
- export interface SideMenuDropdownProps extends CommonProps, Omit<DropdownMenuProps, 'caption' | 'disableAnimations'>, Pick<SideMenuItemProps, 'icon' | 'caption' | '_avatar' | 'id' | '_generatedId' | 'subCaption'> {
5
+ export interface SideMenuDropdownProps extends CommonProps, Omit<DropdownMenuProps, 'caption' | 'disableAnimations'>, Pick<SideMenuItemProps, 'icon' | 'caption' | '_avatar' | 'id' | '_generatedId' | 'subCaption' | '_isAvatar'> {
6
6
  children?: React.ReactNode;
7
7
  disableAnimations?: boolean;
8
+ /** @ignore */
9
+ _avatar?: React.ReactElement;
10
+ id?: string;
11
+ /** @ignore */
12
+ _generatedId?: string;
8
13
  }
9
14
  /**
10
15
  * Элемент списка с выпадающим меню
@@ -8,15 +8,16 @@ import { SideMenuContext } from '../SideMenuContext';
8
8
  import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
9
9
  var SideMenuDropdownInner = forwardRef(function (_a, ref) {
10
10
  var _b, _c;
11
- var icon = _a.icon, id = _a.id, _generatedId = _a._generatedId, _avatar = _a._avatar, children = _a.children, _d = _a.caption, caption = _d === void 0 ? 'СКБ Контур' : _d, subCaption = _a.subCaption, className = _a.className, _e = _a.disableAnimations, disableAnimations = _e === void 0 ? false : _e, menuWidth = _a.menuWidth, rest = __rest(_a, ["icon", "id", "_generatedId", "_avatar", "children", "caption", "subCaption", "className", "disableAnimations", "menuWidth"]);
11
+ var icon = _a.icon, id = _a.id, _generatedId = _a._generatedId, _avatar = _a._avatar, children = _a.children, _d = _a.caption, caption = _d === void 0 ? 'СКБ Контур' : _d, subCaption = _a.subCaption, className = _a.className, _e = _a.disableAnimations, disableAnimations = _e === void 0 ? false : _e, menuWidth = _a.menuWidth, _isAvatar = _a._isAvatar, rest = __rest(_a, ["icon", "id", "_generatedId", "_avatar", "children", "caption", "subCaption", "className", "disableAnimations", "menuWidth", "_isAvatar"]);
12
12
  var context = useContext(SideMenuContext);
13
13
  var theme = getSideMenuTheme(useContext(ThemeContext));
14
14
  return (React.createElement("div", { className: cx((_b = {}, _b[jsStyles.wrapper()] = true, _b), className), ref: ref },
15
15
  React.createElement(DropdownMenu, __assign({ caption: React.createElement("div", { className: cx((_c = {},
16
16
  _c[jsStyles.label(theme)] = true,
17
+ _c[jsStyles.labelForTouchScreens(theme)] = context.isTouchScreen,
17
18
  _c[jsStyles.minimizedLabel()] = context.isMinimized,
18
19
  _c)) },
19
- React.createElement(SideMenuItem, { icon: icon, caption: caption, subCaption: subCaption, _avatar: _avatar, id: id, _isDropdown: true })), positions: ['top left'], disableAnimations: true, menuWidth: menuWidth }, rest), React.Children.map(children, function (child) {
20
+ React.createElement(SideMenuItem, { icon: icon, caption: caption, subCaption: subCaption, _avatar: _avatar, id: id, _isDropdown: true, _isAvatar: _isAvatar })), positions: ['top left'], disableAnimations: true, menuWidth: menuWidth }, rest), React.Children.map(children, function (child) {
20
21
  // @ts-expect-error: accessing private property
21
22
  if (React.isValidElement(child) && (child === null || child === void 0 ? void 0 : child.type.__KONTUR_REACT_UI__) === 'MenuItem') {
22
23
  return React.cloneElement(child, {
@@ -1,6 +1,7 @@
1
1
  import { SideMenuTheme } from '../../lib/theming/ThemeTypes';
2
2
  export declare const jsStyles: {
3
3
  label(t: SideMenuTheme): string;
4
+ labelForTouchScreens(t: SideMenuTheme): string;
4
5
  minimizedLabel(): string;
5
6
  wrapper(): string;
6
7
  };
@@ -6,12 +6,15 @@ var styles = {
6
6
  label: function (t) {
7
7
  return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: calc(", " - 2 * ", ");\n transition: width ", "ms ease-out;\n "], ["\n width: calc(", " - 2 * ", ");\n transition: width ", "ms ease-out;\n "])), t.sideMenuWidth, t.sideMenuMarginX, transitionDuration);
8
8
  },
9
+ labelForTouchScreens: function (t) {
10
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: calc(", " - 2 * ", ");\n "], ["\n width: calc(", " - 2 * ", ");\n "])), t.sideMenuWidthForTouchScreens, t.sideMenuMarginX);
11
+ },
9
12
  minimizedLabel: function () {
10
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "])));
13
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "])));
11
14
  },
12
15
  wrapper: function () {
13
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n overflow-x: hidden;\n "], ["\n overflow-x: hidden;\n "])));
16
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n overflow-x: hidden;\n "], ["\n overflow-x: hidden;\n "])));
14
17
  },
15
18
  };
16
19
  export var jsStyles = memoizeStyle(styles);
17
- var templateObject_1, templateObject_2, templateObject_3;
20
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -11,7 +11,7 @@ import { SideMenuContext } from '../SideMenuContext';
11
11
  var BackButton = forwardRef(function (_a, ref) {
12
12
  var caption = _a.caption, id = _a.id, href = _a.href, generatedId = _a.generatedId;
13
13
  var context = useContext(SideMenuContext);
14
- return (React.createElement(SideMenuItem, { "data-tid": SideMenuDataTids.backButton, icon: React.createElement(ArrowALeftIcon20Regular, null), caption: caption, _isDropdown: true, _isSubMenu: true, onClick: function () {
14
+ return (React.createElement(SideMenuItem, { "data-tid": SideMenuDataTids.backButton, icon: React.createElement(ArrowALeftIcon20Regular, null), caption: caption, _isSubMenu: true, onClick: function () {
15
15
  var _a, _b, _c, _d;
16
16
  (_a = context.setIsSeparatedMenuShown) === null || _a === void 0 ? void 0 : _a.call(context, false);
17
17
  if (id) {
@@ -18,6 +18,8 @@ export interface CommonClickableElementProps extends CommonProps {
18
18
  /** @ignore */
19
19
  _isDropdown?: boolean;
20
20
  /** @ignore */
21
+ _isAvatar?: boolean;
22
+ /** @ignore */
21
23
  _isBackButton?: boolean;
22
24
  }
23
25
  export interface ClickableElementProps extends CommonClickableElementProps {
@@ -17,7 +17,7 @@ import { ThemeContext } from '@skbkontur/react-ui';
17
17
  */
18
18
  var ClickableElement = forwardRef(function (_a, ref) {
19
19
  var _b;
20
- 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"]);
20
+ 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, _isAvatar = _a._isAvatar, rest = __rest(_a, ["onClick", "icon", "_avatar", "marker", "caption", "subCaption", "id", "_isSubMenu", "children", "_isNestedSubMenu", "_generatedId", "element", "onKeyDown", "onFocus", "onBlur", "className", "_isDropdown", "_isBackButton", "_isAvatar"]);
21
21
  var context = useContext(SideMenuContext);
22
22
  var theme = getSideMenuTheme(useContext(ThemeContext));
23
23
  var isActive = useActiveState(id, rest.href, _generatedId, context.activeMenuItem);
@@ -74,7 +74,7 @@ var ClickableElement = forwardRef(function (_a, ref) {
74
74
  };
75
75
  var handleClick = function (e) {
76
76
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
77
- var lastElementInTheHierarchy = !hasChildren(id || rest.href, _generatedId) && !_isDropdown;
77
+ var lastElementInTheHierarchy = !hasChildren(id || rest.href, _generatedId) && !_isDropdown && !_isBackButton;
78
78
  switchActiveItem();
79
79
  toggleIsShown(lastElementInTheHierarchy);
80
80
  setIsMinimized(lastElementInTheHierarchy);
@@ -104,7 +104,7 @@ var ClickableElement = forwardRef(function (_a, ref) {
104
104
  shouldHighlightTopLevelItemWhenSubItemSelectedInSeparatedMenu ||
105
105
  shouldHighlightTopLevelItemWhenMenuIsMinimized,
106
106
  _b[jsStyles.activeRootSubItemInSeparatedSubMenu(theme)] = isActive && context.isSeparatedMenu && _isSubMenu,
107
- _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)),
107
+ _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, _isDropdown: _isDropdown, _isAvatar: _isAvatar })), ref: ref }, rest)),
108
108
  React.createElement(SubMenu, { generatedId: _generatedId, id: id, href: rest.href, caption: caption, isSubMenu: _isSubMenu, isSeparatedMenu: context.isSeparatedMenu, isOpened: isOpened, isMinimized: context.isMinimized }, children)));
109
109
  });
110
110
  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' | 'subCaption'> {
3
+ interface CaptionProps extends Pick<SideMenuItemProps, '_isSubMenu' | '_isNestedSubMenu' | 'caption' | '_isBackButton' | '_isDropdown' | '_isAvatar' | 'subCaption'> {
4
4
  hasShortcutImage: boolean;
5
5
  isMultiline: boolean;
6
6
  }
@@ -1,22 +1,60 @@
1
1
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
2
2
  import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
3
3
  import { jsStyles } from './Caption.styles';
4
- import React, { forwardRef, useContext } from 'react';
4
+ import React, { forwardRef, useContext, useEffect, useRef, useState } from 'react';
5
5
  import { SideMenuContext } from '../../SideMenuContext';
6
+ import { mergeRefs } from '@skbkontur/react-ui/lib/utils';
6
7
  import { getSideMenuTheme } from '../../../lib/theming/ThemeHelpers';
8
+ var getTruncatedUserName = function (caption, visibleWidth, fullWidth) {
9
+ var _a = caption.split(' '), firstName = _a[0], lastName = _a[1];
10
+ if (visibleWidth < fullWidth && lastName) {
11
+ return firstName + " " + lastName[0] + ".";
12
+ }
13
+ return caption;
14
+ };
15
+ var getCaptionTail = function (caption, visibleWidth, fullWidth) {
16
+ if (visibleWidth < fullWidth) {
17
+ var symbolsCount = caption.length;
18
+ var symbolLength = fullWidth / symbolsCount;
19
+ var halfVisibleSymbols = visibleWidth / symbolLength / 2;
20
+ return caption.slice(symbolsCount - halfVisibleSymbols);
21
+ }
22
+ return '';
23
+ };
7
24
  export var Caption = forwardRef(function (_a, ref) {
8
25
  var _b, _c;
9
- var _isSubMenu = _a._isSubMenu, _isNestedSubMenu = _a._isNestedSubMenu, hasShortcutImage = _a.hasShortcutImage, caption = _a.caption, subCaption = _a.subCaption, isMultiline = _a.isMultiline, _isBackButton = _a._isBackButton;
10
- var context = useContext(SideMenuContext);
26
+ var _isSubMenu = _a._isSubMenu, _isNestedSubMenu = _a._isNestedSubMenu, hasShortcutImage = _a.hasShortcutImage, caption = _a.caption, subCaption = _a.subCaption, isMultiline = _a.isMultiline, _isBackButton = _a._isBackButton, _isDropdown = _a._isDropdown, _isAvatar = _a._isAvatar;
11
27
  var theme = getSideMenuTheme(useContext(ThemeContext));
12
- var isBeingTransitioned = context.isBeingTransitioned, isSeparatedMenu = context.isSeparatedMenu, size = context.size, isTouchScreen = context.isTouchScreen, hasSubIcons = context.hasSubIcons;
28
+ var _d = useContext(SideMenuContext), isBeingTransitioned = _d.isBeingTransitioned, isSeparatedMenu = _d.isSeparatedMenu, size = _d.size, isTouchScreen = _d.isTouchScreen, hasSubIcons = _d.hasSubIcons, isTablet = _d.isTablet, isMobile = _d.isMobile;
29
+ var captionRef = useRef(null);
30
+ var _e = useState(''), tail = _e[0], setTail = _e[1];
31
+ var _f = useState(caption), truncatedUserName = _f[0], setTruncatedUserName = _f[1];
32
+ useEffect(function () {
33
+ if (!_isDropdown || !captionRef.current || !caption) {
34
+ return;
35
+ }
36
+ var fullWidth = captionRef.current.scrollWidth;
37
+ var visibleWidth = captionRef.current.offsetWidth;
38
+ if (_isAvatar) {
39
+ setTruncatedUserName(getTruncatedUserName(caption, visibleWidth, fullWidth));
40
+ }
41
+ else {
42
+ setTail(getCaptionTail(caption, visibleWidth, fullWidth));
43
+ }
44
+ }, [isBeingTransitioned]);
45
+ var isAvatarCaptionSingleWord = function (userName, _isAvatar) {
46
+ if (userName === void 0) { userName = ''; }
47
+ return _isAvatar && userName.split(' ').length === 1;
48
+ };
13
49
  return (React.createElement("div", { className: cx((_b = {},
14
50
  _b[jsStyles.root()] = true,
15
- _b[jsStyles.rootBeingTransitioned()] = isBeingTransitioned && !_isSubMenu && !(context.isTablet || context.isMobile),
51
+ _b[jsStyles.rootBeingTransitioned()] = isBeingTransitioned && !_isSubMenu && !(isTablet || isMobile),
16
52
  _b[jsStyles.rootMultiline()] = isMultiline && !_isSubMenu,
17
53
  _b)), ref: ref },
18
54
  React.createElement("p", { className: cx((_c = {},
19
55
  _c[jsStyles.caption(theme)] = true,
56
+ _c[jsStyles.captionDropdown()] = _isDropdown,
57
+ _c[jsStyles.captionTruncated()] = _isDropdown && (!_isAvatar || isAvatarCaptionSingleWord(caption, _isAvatar)),
20
58
  _c[jsStyles.captionSubItem(theme)] = _isSubMenu,
21
59
  _c[jsStyles.captionSubItemSeparatedMenuTopLevel()] = isSeparatedMenu && !_isNestedSubMenu && _isSubMenu,
22
60
  _c[jsStyles.captionNestedItemSeparatedMenu()] = isSeparatedMenu && _isNestedSubMenu && !hasShortcutImage,
@@ -26,7 +64,9 @@ export var Caption = forwardRef(function (_a, ref) {
26
64
  _c[jsStyles.captionForTouchScreens(theme)] = isTouchScreen,
27
65
  _c[jsStyles.captionSubItemForTouchScreens(theme)] = isTouchScreen && _isSubMenu,
28
66
  _c[jsStyles.captionInBackButton(theme)] = _isBackButton,
29
- _c)), ref: ref }, caption),
67
+ _c)), ref: mergeRefs([ref, captionRef]), "data-tail": tail },
68
+ !_isAvatar && caption,
69
+ _isAvatar && truncatedUserName),
30
70
  subCaption));
31
71
  });
32
72
  Caption.displayName = 'Caption';
@@ -15,4 +15,6 @@ export declare const jsStyles: {
15
15
  captionSubItemWithoutColumnIcons(): string;
16
16
  captionLarge(t: SideMenuTheme): string;
17
17
  captionInBackButton(t: SideMenuTheme): string;
18
+ captionDropdown(): string;
19
+ captionTruncated(): string;
18
20
  };
@@ -43,6 +43,12 @@ var styles = {
43
43
  captionInBackButton: function (t) {
44
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);
45
45
  },
46
+ captionDropdown: function () {
47
+ return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n white-space: nowrap;\n overflow: hidden;\n "], ["\n white-space: nowrap;\n overflow: hidden;\n "])));
48
+ },
49
+ captionTruncated: function () {
50
+ return css(templateObject_15 || (templateObject_15 = __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 "])));
51
+ },
46
52
  };
47
53
  export var jsStyles = memoizeStyle(styles);
48
- 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;
54
+ 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;
@@ -20,7 +20,7 @@ var getItemContentHeight = function (theme, linesNumber, size) {
20
20
  */
21
21
  var ItemContent = forwardRef(function (_a, ref) {
22
22
  var _b, _c;
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;
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, _isDropdown = _a._isDropdown, _isAvatar = _a._isAvatar;
24
24
  var context = useContext(SideMenuContext);
25
25
  var size = context.size, isTouchScreen = context.isTouchScreen;
26
26
  var textRef = useRef(null);
@@ -29,7 +29,7 @@ var ItemContent = forwardRef(function (_a, ref) {
29
29
  var isMultiline = (!_isSubMenu && linesNumber > 1) || (!!_isSubMenu && isMultilineSubItem) || !!subCaption;
30
30
  var theme = getSideMenuTheme(useContext(ThemeContext));
31
31
  useEffect(function () {
32
- if (!_isBackButton && !_isSubMenu) {
32
+ if (!_isBackButton && !_isSubMenu && !_isDropdown) {
33
33
  useNumberOfTextLinesInItem({
34
34
  textRef: textRef,
35
35
  setLinesNumber: setLinesNumber,
@@ -45,7 +45,7 @@ var ItemContent = forwardRef(function (_a, ref) {
45
45
  }
46
46
  }, []);
47
47
  useEffect(function () {
48
- if (!_isBackButton) {
48
+ if (!_isBackButton && !_isDropdown) {
49
49
  useNumberOfTextLinesInItem({
50
50
  textRef: textRef,
51
51
  setLinesNumber: setLinesNumber,
@@ -72,9 +72,10 @@ var ItemContent = forwardRef(function (_a, ref) {
72
72
  _avatar && React.createElement(Avatar, { _avatar: _avatar }),
73
73
  (!context.isMinimized || (context.isMinimized && _isSubMenu)) && (React.createElement("div", { className: cx((_c = {},
74
74
  _c[jsStyles.textAndMarkerWrapper()] = true,
75
+ _c[jsStyles.textAndMarkerWrapperDropdown()] = _isDropdown,
75
76
  _c[customStyles.textAndMarkerWrapperMultiline(getItemContentHeight(theme, linesNumber, size))] = isMultiline && !_isSubMenu,
76
77
  _c)) },
77
- React.createElement(Caption, { _isSubMenu: _isSubMenu, _isNestedSubMenu: _isNestedSubMenu, hasShortcutImage: hasShortcutImage, isMultiline: isMultiline, caption: caption, subCaption: subCaption, _isBackButton: _isBackButton, ref: textRef }),
78
+ React.createElement(Caption, { _isSubMenu: _isSubMenu, _isNestedSubMenu: _isNestedSubMenu, hasShortcutImage: hasShortcutImage, isMultiline: isMultiline, caption: caption, subCaption: subCaption, _isBackButton: _isBackButton, _isDropdown: _isDropdown, _isAvatar: _isAvatar, ref: textRef }),
78
79
  marker && (!context.isMinimized || isSeparatedSubMenuInNarrowDesktopWithoutOverlay) && (React.createElement(Marker, { isMultiline: isMultiline, marker: marker }))))));
79
80
  });
80
81
  ItemContent.displayName = 'ItemContent';
@@ -11,4 +11,5 @@ export declare const jsStyles: {
11
11
  subItemRootForTouchScreens(t: SideMenuTheme): string;
12
12
  subItemRoot(t: SideMenuTheme): string;
13
13
  textAndMarkerWrapper(): string;
14
+ textAndMarkerWrapperDropdown(): string;
14
15
  };
@@ -26,11 +26,14 @@ var styles = {
26
26
  textAndMarkerWrapper: function () {
27
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 "])));
28
28
  },
29
+ textAndMarkerWrapperDropdown: function () {
30
+ return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n overflow: hidden;\n "], ["\n overflow: hidden;\n "])));
31
+ },
29
32
  };
30
33
  export var customStyles = {
31
34
  textAndMarkerWrapperMultiline: function (height) {
32
- return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n min-height: ", "px;\n "], ["\n min-height: ", "px;\n "])), height);
35
+ return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n min-height: ", "px;\n "], ["\n min-height: ", "px;\n "])), height);
33
36
  },
34
37
  };
35
38
  export var jsStyles = memoizeStyle(styles);
36
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
39
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;