@skbkontur/side-menu 0.14.1 → 0.14.2
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/package.json +1 -1
- package/src/internal/ItemContent/Caption.js +3 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.14.2](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.14.1...@skbkontur/side-menu@0.14.2) (2023-06-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **SideMenu:** fix truncation in dynamic avatar change ([82b1337](https://git.skbkontur.ru/ui/ui-parking/commits/82b13373283a3871b6e959defcaf20afc922113c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [0.14.1](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.14.0...@skbkontur/side-menu@0.14.1) (2023-06-19)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @skbkontur/side-menu
|
package/package.json
CHANGED
|
@@ -28,15 +28,15 @@ export var Caption = forwardRef(function (_a, ref) {
|
|
|
28
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
29
|
var captionRef = useRef(null);
|
|
30
30
|
var _e = useState(''), tail = _e[0], setTail = _e[1];
|
|
31
|
-
var _f = useState(caption), truncatedUserName = _f[0], setTruncatedUserName = _f[1];
|
|
32
31
|
useEffect(function () {
|
|
33
32
|
if (!_isDropdown || !captionRef.current || !caption) {
|
|
34
33
|
return;
|
|
35
34
|
}
|
|
35
|
+
captionRef.current.innerText = caption;
|
|
36
36
|
var fullWidth = captionRef.current.scrollWidth;
|
|
37
37
|
var visibleWidth = captionRef.current.offsetWidth;
|
|
38
38
|
if (_isAvatar) {
|
|
39
|
-
|
|
39
|
+
captionRef.current.innerText = getTruncatedUserName(caption, visibleWidth, fullWidth);
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
42
|
setTail(getCaptionTail(caption, visibleWidth, fullWidth));
|
|
@@ -64,9 +64,7 @@ export var Caption = forwardRef(function (_a, ref) {
|
|
|
64
64
|
_c[jsStyles.captionForTouchScreens(theme)] = isTouchScreen,
|
|
65
65
|
_c[jsStyles.captionSubItemForTouchScreens(theme)] = isTouchScreen && _isSubMenu,
|
|
66
66
|
_c[jsStyles.captionInBackButton(theme)] = _isBackButton,
|
|
67
|
-
_c)), ref: mergeRefs([ref, captionRef]), "data-tail": tail },
|
|
68
|
-
!_isAvatar && caption,
|
|
69
|
-
_isAvatar && truncatedUserName),
|
|
67
|
+
_c)), ref: mergeRefs([ref, captionRef]), "data-tail": tail }, caption),
|
|
70
68
|
subCaption));
|
|
71
69
|
});
|
|
72
70
|
Caption.displayName = 'Caption';
|