@skbkontur/side-menu 0.12.2 → 0.14.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 +22 -0
- package/internal/themes/SideMenuTheme.d.ts +1 -1
- package/internal/themes/SideMenuTheme.js +1 -1
- package/package.json +1 -1
- package/src/SideMenu/SideMenu.js +16 -16
- package/src/SideMenu/SideMenu.styles.d.ts +2 -1
- package/src/SideMenu/SideMenu.styles.js +6 -3
- package/src/SideMenuAvatar/SideMenuAvatar.d.ts +3 -3
- package/src/SideMenuAvatar/SideMenuAvatar.js +6 -5
- package/src/SideMenuBody/SideMenuBody.js +6 -4
- package/src/SideMenuBody/SideMenuBody.styles.d.ts +1 -0
- package/src/SideMenuBody/SideMenuBody.styles.js +5 -2
- package/src/SideMenuDropdown/SideMenuDropdown.d.ts +2 -4
- package/src/SideMenuDropdown/SideMenuDropdown.js +3 -3
- package/src/SideMenuFooter/SideMenuFooter.js +10 -8
- package/src/SideMenuOrganisations/SideMenuOrganisations.d.ts +1 -1
- package/src/SideMenuSubItem/SideMenuSubItem.d.ts +1 -1
- package/src/SideMenuSubItem/SideMenuSubItem.js +3 -3
- package/src/SideMenuSubLink/SideMenuSubLink.d.ts +1 -1
- package/src/SideMenuSubLink/SideMenuSubLink.js +3 -3
- package/src/internal/ClickableElement.d.ts +0 -2
- package/src/internal/ClickableElement.js +15 -12
- package/src/internal/InnerSubMenu.d.ts +2 -1
- package/src/internal/InnerSubMenu.js +3 -2
- package/src/internal/ItemContent/Caption.d.ts +1 -1
- package/src/internal/ItemContent/Caption.js +3 -3
- package/src/internal/ItemContent/Icon.d.ts +2 -2
- package/src/internal/ItemContent/Icon.js +2 -1
- package/src/internal/ItemContent/Icon.styles.d.ts +1 -0
- package/src/internal/ItemContent/Icon.styles.js +4 -1
- package/src/internal/ItemContent/ItemContent.js +3 -6
- package/src/internal/NestedMenu.d.ts +1 -0
- package/src/internal/NestedMenu.js +8 -2
- package/src/internal/SeparatedSubMenu.d.ts +1 -0
- package/src/internal/SeparatedSubMenu.js +13 -12
- package/src/internal/SeparatedSubMenu.styles.d.ts +1 -1
- package/src/internal/SeparatedSubMenu.styles.js +1 -1
- package/src/internal/SubMenu.d.ts +2 -1
- package/src/internal/SubMenu.js +3 -3
- package/src/internal/ItemContent/Avatar.d.ts +0 -5
- package/src/internal/ItemContent/Avatar.js +0 -15
- package/src/internal/ItemContent/Avatar.styles.d.ts +0 -4
- package/src/internal/ItemContent/Avatar.styles.js +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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.0](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.13.0...@skbkontur/side-menu@0.14.0) (2023-06-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **SideMenu:** change avatar size ([6597054](https://git.skbkontur.ru/ui/ui-parking/commits/659705403bda74aa60e6a21b8778d7a71e3fb669))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [0.13.0](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.12.2...@skbkontur/side-menu@0.13.0) (2023-06-09)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **SideMenu:** add basic semantic ([e986397](https://git.skbkontur.ru/ui/ui-parking/commits/e986397737b395eed7086a99b7a12b6bc45ea8ae))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [0.12.2](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.12.1...@skbkontur/side-menu@0.12.2) (2023-06-08)
|
|
7
29
|
|
|
8
30
|
|
|
@@ -27,7 +27,7 @@ export declare class SideMenuTheme extends SideMenuTheme_base {
|
|
|
27
27
|
static sideMenuSubItemHeaderFontSize: string;
|
|
28
28
|
static sideMenuSubItemHeaderColor: string;
|
|
29
29
|
static sideMenuSubItemHeaderPadding: string;
|
|
30
|
-
static
|
|
30
|
+
static sideMenuAvatarSize: string;
|
|
31
31
|
static get sideMenuCaptionLineHeight(): string;
|
|
32
32
|
static sideMenuCaptionFontSize: string;
|
|
33
33
|
static sideMenuCaptionFontSizeForTouchScreens: string;
|
|
@@ -118,7 +118,7 @@ var SideMenuTheme = /** @class */ (function (_super) {
|
|
|
118
118
|
SideMenuTheme.sideMenuSubItemHeaderPadding = '10px 8px 2px 40px';
|
|
119
119
|
//#endregion
|
|
120
120
|
//#region Avatar
|
|
121
|
-
SideMenuTheme.
|
|
121
|
+
SideMenuTheme.sideMenuAvatarSize = '24px';
|
|
122
122
|
SideMenuTheme.sideMenuCaptionFontSize = '14px';
|
|
123
123
|
SideMenuTheme.sideMenuCaptionFontSizeForTouchScreens = '18px';
|
|
124
124
|
SideMenuTheme.sideMenuCaptionLineHeightForTouchScreens = '24px';
|
package/package.json
CHANGED
package/src/SideMenu/SideMenu.js
CHANGED
|
@@ -3,7 +3,7 @@ import React, { forwardRef, useContext, useEffect, useRef, useState } from 'reac
|
|
|
3
3
|
import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
4
4
|
import { isIE11 } from '@skbkontur/react-ui/lib/client';
|
|
5
5
|
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
6
|
-
import {
|
|
6
|
+
import { jsStylesForSideMenu, customStyles } from './SideMenu.styles';
|
|
7
7
|
import { SideMenuOrganisations } from '../SideMenuOrganisations/SideMenuOrganisations';
|
|
8
8
|
import { SideMenuContext } from '../SideMenuContext';
|
|
9
9
|
import { SideMenuBody } from '../SideMenuBody/SideMenuBody';
|
|
@@ -190,31 +190,31 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
190
190
|
setHeaderHeight: setHeaderHeight,
|
|
191
191
|
} },
|
|
192
192
|
React.createElement(ZIndex, { priority: isSideMenuOverflowing ? 8 : 0, className: cx((_b = {},
|
|
193
|
-
_b[
|
|
193
|
+
_b[jsStylesForSideMenu.root()] = true,
|
|
194
194
|
_b[customStyles.rootForTabletsOrMobiles(headerHeight)] = isTabletOrMobile,
|
|
195
|
-
_b[
|
|
196
|
-
_b[
|
|
197
|
-
_b[
|
|
198
|
-
_b[
|
|
195
|
+
_b[jsStylesForSideMenu.shownRootForTabletsOrMobiles()] = isShown && isTabletOrMobile,
|
|
196
|
+
_b[jsStylesForSideMenu.rootForNarrowDesktops(theme)] = isNarrowDesktop,
|
|
197
|
+
_b[jsStylesForSideMenu.separatedRootForNarrowDesktops(theme)] = separatedMenuWithoutOverlay && isSeparatedMenuShown && isNarrowDesktop,
|
|
198
|
+
_b[jsStylesForSideMenu.separatedRootForDesktops(theme)] = separatedMenuWithoutOverlay && isSeparatedMenuShown && isDesktopQuery,
|
|
199
199
|
_b)) },
|
|
200
200
|
React.createElement(React.Fragment, null,
|
|
201
201
|
shouldShowBackdrop && React.createElement(Backdrop, { style: backdropStyle }),
|
|
202
202
|
React.createElement(RenderLayer, { onClickOutside: function () { return handleIsShown(false); } },
|
|
203
203
|
React.createElement("aside", __assign({ className: cx((_c = {},
|
|
204
|
-
_c[
|
|
205
|
-
_c[
|
|
206
|
-
_c[
|
|
204
|
+
_c[jsStylesForSideMenu.wrapper()] = true,
|
|
205
|
+
_c[jsStylesForSideMenu.wrapperIE()] = isIE11,
|
|
206
|
+
_c[jsStylesForSideMenu.wrapperWithShadow(theme)] = isSideMenuOverContent,
|
|
207
207
|
_c), className), "data-tid": SideMenuDataTids.root, ref: ref }, rest, { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseMove: showMinimizedRootForNarrowDesktopWithOverlay }),
|
|
208
208
|
React.createElement("div", { className: cx((_d = {},
|
|
209
|
-
_d[
|
|
210
|
-
_d[
|
|
211
|
-
_d[
|
|
212
|
-
_d[
|
|
213
|
-
_d[
|
|
214
|
-
_d[
|
|
209
|
+
_d[jsStylesForSideMenu.container(theme)] = true,
|
|
210
|
+
_d[jsStylesForSideMenu.collapsedContainerForTabletsOrMobiles()] = !isShown && !isBeingTransitioned,
|
|
211
|
+
_d[jsStylesForSideMenu.minimizedContainer(theme)] = isMinimized,
|
|
212
|
+
_d[jsStylesForSideMenu.innerContainer()] = !isSeparatedMenu,
|
|
213
|
+
_d[jsStylesForSideMenu.containerForTouchScreens(theme)] = isTouchScreen,
|
|
214
|
+
_d[jsStylesForSideMenu.separatedContainerForMobiles(theme)] = isMobile && isSeparatedMenuShown && (isShown || isBeingTransitioned),
|
|
215
215
|
_d)) },
|
|
216
216
|
React.createElement("div", { className: cx((_e = {},
|
|
217
|
-
_e[
|
|
217
|
+
_e[jsStylesForSideMenu.contentWrapper()] = true,
|
|
218
218
|
_e)) }, children)),
|
|
219
219
|
!disableSwipe && isDesktopQuery && !isSeparatedMenuShown && (React.createElement(RightBorder, { setIsMinimized: setIsMinimized }))))))));
|
|
220
220
|
});
|
|
@@ -2,7 +2,7 @@ import { SideMenuTheme } from '../../lib/theming/ThemeTypes';
|
|
|
2
2
|
export declare const customStyles: {
|
|
3
3
|
rootForTabletsOrMobiles(headerHeight?: number | undefined): string;
|
|
4
4
|
};
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const jsStylesForSideMenu: {
|
|
6
6
|
root(): string;
|
|
7
7
|
shownRootForTabletsOrMobiles(): string;
|
|
8
8
|
rootForNarrowDesktops(t: SideMenuTheme): string;
|
|
@@ -18,4 +18,5 @@ export declare const jsStyles: {
|
|
|
18
18
|
wrapperIE(): string;
|
|
19
19
|
wrapperWithShadow(t: SideMenuTheme): string;
|
|
20
20
|
collapsedContainerForTabletsOrMobiles(): string;
|
|
21
|
+
list(): string;
|
|
21
22
|
};
|
|
@@ -49,11 +49,14 @@ var styles = {
|
|
|
49
49
|
collapsedContainerForTabletsOrMobiles: function () {
|
|
50
50
|
return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n background-color: transparent;\n "], ["\n background-color: transparent;\n "])));
|
|
51
51
|
},
|
|
52
|
+
list: function () {
|
|
53
|
+
return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n list-style: none;\n padding: 0;\n margin: 0;\n "], ["\n list-style: none;\n padding: 0;\n margin: 0;\n "])));
|
|
54
|
+
},
|
|
52
55
|
};
|
|
53
56
|
export var customStyles = {
|
|
54
57
|
rootForTabletsOrMobiles: function (headerHeight) {
|
|
55
|
-
return css(
|
|
58
|
+
return css(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n height: ", "px;\n position: absolute;\n top: 0;\n transition: height ", "ms ease-out;\n "], ["\n height: ", "px;\n position: absolute;\n top: 0;\n transition: height ", "ms ease-out;\n "])), headerHeight, burgerTransitionDuration);
|
|
56
59
|
},
|
|
57
60
|
};
|
|
58
|
-
export var
|
|
59
|
-
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, templateObject_16;
|
|
61
|
+
export var jsStylesForSideMenu = memoizeStyle(styles);
|
|
62
|
+
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, templateObject_16, templateObject_17;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { UserAvatarProps } from '
|
|
2
|
+
import { UserAvatarProps } from '../../../react-ui-addons/';
|
|
3
3
|
import { SideMenuDropdownProps } from '../SideMenuDropdown/SideMenuDropdown';
|
|
4
|
-
export interface SideMenuAvatarProps extends UserAvatarProps, Omit<SideMenuDropdownProps, 'icon' | '
|
|
4
|
+
export interface SideMenuAvatarProps extends Omit<UserAvatarProps, 'style'>, Omit<SideMenuDropdownProps, 'icon' | 'caption'>, Partial<Pick<SideMenuDropdownProps, 'icon' | 'onOpen' | 'onClose'>> {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Аватар пользователя
|
|
8
8
|
*
|
|
9
9
|
* @visibleName SideMenu.Avatar
|
|
10
10
|
*/
|
|
11
|
-
export declare const SideMenuAvatar: React.ForwardRefExoticComponent<SideMenuAvatarProps & React.RefAttributes<
|
|
11
|
+
export declare const SideMenuAvatar: React.ForwardRefExoticComponent<SideMenuAvatarProps & React.RefAttributes<HTMLLIElement>> & {
|
|
12
12
|
__KONTUR_REACT_UI__: string;
|
|
13
13
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
3
|
-
import { UserAvatar } from '
|
|
2
|
+
import React, { forwardRef, useContext } from 'react';
|
|
3
|
+
import { UserAvatar } from '../../../react-ui-addons/';
|
|
4
4
|
import { SideMenuDropdown } from '../SideMenuDropdown/SideMenuDropdown';
|
|
5
|
+
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
|
|
6
|
+
import { ThemeContext } from '@skbkontur/react-ui';
|
|
5
7
|
var SideMenuAvatarInner = forwardRef(function (_a, ref) {
|
|
6
8
|
var userName = _a.userName, avatarUrl = _a.avatarUrl, children = _a.children, icon = _a.icon, rest = __rest(_a, ["userName", "avatarUrl", "children", "icon"]);
|
|
7
|
-
|
|
8
|
-
|
|
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));
|
|
9
|
+
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
10
|
+
return (React.createElement(SideMenuDropdown, __assign({ icon: React.createElement(UserAvatar, { userName: userName, avatarUrl: avatarUrl, style: { width: theme.sideMenuAvatarSize, height: theme.sideMenuAvatarSize } }), caption: userName, menuWidth: 200, positions: ['top left'], _isAvatar: true, ref: ref }, rest), children));
|
|
10
11
|
});
|
|
11
12
|
SideMenuAvatarInner.displayName = 'SideMenuAvatar';
|
|
12
13
|
/**
|
|
@@ -8,8 +8,9 @@ import { SideMenuContext } from '../SideMenuContext';
|
|
|
8
8
|
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
|
|
9
9
|
import { ScrollContainer, ScrollContainerDataTids } from '@skbkontur/react-ui';
|
|
10
10
|
import { mergeRefs } from '@skbkontur/react-ui/lib/utils';
|
|
11
|
+
import { jsStylesForSideMenu } from '../SideMenu/SideMenu.styles';
|
|
11
12
|
var SideMenuBodyInner = forwardRef(function (_a, ref) {
|
|
12
|
-
var _b;
|
|
13
|
+
var _b, _c;
|
|
13
14
|
var className = _a.className, children = _a.children, rest = __rest(_a, ["className", "children"]);
|
|
14
15
|
var context = useContext(SideMenuContext);
|
|
15
16
|
var scrollContainerRef = useRef(null);
|
|
@@ -32,13 +33,14 @@ var SideMenuBodyInner = forwardRef(function (_a, ref) {
|
|
|
32
33
|
}, [context.activeMenuItem, context.isShown]);
|
|
33
34
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
34
35
|
if (context.isShown) {
|
|
35
|
-
return (React.createElement("div", { ref: mergeRefs([ref, sideMenuBodyRef]),
|
|
36
|
+
return (React.createElement("div", { ref: mergeRefs([ref, sideMenuBodyRef]), className: cx((_b = {}, _b[jsStyles.root(theme)] = true, _b), className) },
|
|
36
37
|
React.createElement(ScrollContainer, { style: { position: 'static' }, onScrollStateChangeY: function (state) {
|
|
37
38
|
var _a;
|
|
38
39
|
(_a = context.setScrollState) === null || _a === void 0 ? void 0 : _a.call(context, state);
|
|
39
40
|
}, hideScrollBar: true, ref: scrollContainerRef },
|
|
40
|
-
React.createElement("
|
|
41
|
-
React.createElement(
|
|
41
|
+
React.createElement("nav", null,
|
|
42
|
+
React.createElement("ul", __assign({ className: cx((_c = {}, _c[jsStylesForSideMenu.list()] = true, _c[jsStyles.wrapper(theme)] = true, _c)) }, rest),
|
|
43
|
+
React.createElement(InnerBody, null, children))))));
|
|
42
44
|
}
|
|
43
45
|
return null;
|
|
44
46
|
});
|
|
@@ -3,8 +3,11 @@ import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
|
3
3
|
import { memoizeStyle } from '../../lib/theming/ThemeHelpers';
|
|
4
4
|
var styles = {
|
|
5
5
|
root: function (t) {
|
|
6
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n
|
|
6
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n margin: 0 ", ";\n height: 100%;\n overflow: hidden;\n "], ["\n flex-grow: 1;\n margin: 0 ", ";\n height: 100%;\n overflow: hidden;\n "])), t.sideMenuMarginX);
|
|
7
|
+
},
|
|
8
|
+
wrapper: function (t) {
|
|
9
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-bottom: ", ";\n "], ["\n padding-bottom: ", ";\n "])), t.sideMenuBodyPaddingBottom);
|
|
7
10
|
},
|
|
8
11
|
};
|
|
9
12
|
export var jsStyles = memoizeStyle(styles);
|
|
10
|
-
var templateObject_1;
|
|
13
|
+
var templateObject_1, templateObject_2;
|
|
@@ -2,11 +2,9 @@ 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' | '
|
|
5
|
+
export interface SideMenuDropdownProps extends CommonProps, Omit<DropdownMenuProps, 'caption' | 'disableAnimations'>, Pick<SideMenuItemProps, 'icon' | 'caption' | 'id' | '_generatedId' | 'subCaption' | '_isAvatar'> {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
disableAnimations?: boolean;
|
|
8
|
-
/** @ignore */
|
|
9
|
-
_avatar?: React.ReactElement;
|
|
10
8
|
id?: string;
|
|
11
9
|
/** @ignore */
|
|
12
10
|
_generatedId?: string;
|
|
@@ -16,6 +14,6 @@ export interface SideMenuDropdownProps extends CommonProps, Omit<DropdownMenuPro
|
|
|
16
14
|
*
|
|
17
15
|
* @visibleName SideMenu.Dropdown
|
|
18
16
|
*/
|
|
19
|
-
export declare const SideMenuDropdown: React.ForwardRefExoticComponent<SideMenuDropdownProps & React.RefAttributes<
|
|
17
|
+
export declare const SideMenuDropdown: React.ForwardRefExoticComponent<SideMenuDropdownProps & React.RefAttributes<HTMLLIElement>> & {
|
|
20
18
|
__KONTUR_REACT_UI__: string;
|
|
21
19
|
};
|
|
@@ -8,16 +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,
|
|
11
|
+
var icon = _a.icon, id = _a.id, _generatedId = _a._generatedId, 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", "children", "caption", "subCaption", "className", "disableAnimations", "menuWidth", "_isAvatar"]);
|
|
12
12
|
var context = useContext(SideMenuContext);
|
|
13
13
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
14
|
-
return (React.createElement("
|
|
14
|
+
return (React.createElement("li", { 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
17
|
_c[jsStyles.labelForTouchScreens(theme)] = context.isTouchScreen,
|
|
18
18
|
_c[jsStyles.minimizedLabel()] = context.isMinimized,
|
|
19
19
|
_c)) },
|
|
20
|
-
React.createElement(SideMenuItem, { icon: icon, caption: caption, subCaption: subCaption,
|
|
20
|
+
React.createElement(SideMenuItem, { icon: icon, caption: caption, subCaption: subCaption, id: id, _isDropdown: true, _isAvatar: _isAvatar })), positions: ['top left'], disableAnimations: true, menuWidth: menuWidth }, rest), React.Children.map(children, function (child) {
|
|
21
21
|
// @ts-expect-error: accessing private property
|
|
22
22
|
if (React.isValidElement(child) && (child === null || child === void 0 ? void 0 : child.type.__KONTUR_REACT_UI__) === 'MenuItem') {
|
|
23
23
|
return React.cloneElement(child, {
|
|
@@ -5,6 +5,7 @@ import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
|
5
5
|
import { jsStyles } from './SideMenuFooter.styles';
|
|
6
6
|
import { getItemId } from '../../lib/utils/scripts';
|
|
7
7
|
import { SideMenuContext } from '../SideMenuContext';
|
|
8
|
+
import { jsStylesForSideMenu } from '../SideMenu/SideMenu.styles';
|
|
8
9
|
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
|
|
9
10
|
var SideMenuFooterInner = forwardRef(function (_a, ref) {
|
|
10
11
|
var _b;
|
|
@@ -20,14 +21,15 @@ var SideMenuFooterInner = forwardRef(function (_a, ref) {
|
|
|
20
21
|
_b[jsStyles.root(theme)] = true,
|
|
21
22
|
_b[jsStyles.rootFixed(theme)] = isFixed,
|
|
22
23
|
_b[jsStyles.rootTransitioned()] = context.isBeingTransitioned,
|
|
23
|
-
_b), className), ref: ref }, rest),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
_b), className), ref: ref }, rest),
|
|
25
|
+
React.createElement("ul", { className: jsStylesForSideMenu.list() }, React.Children.map(children, function (child, index) {
|
|
26
|
+
if (React.isValidElement(child)) {
|
|
27
|
+
return React.cloneElement(child, {
|
|
28
|
+
_generatedId: getItemId('footer', index++),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return child;
|
|
32
|
+
}))));
|
|
31
33
|
}
|
|
32
34
|
return null;
|
|
33
35
|
});
|
|
@@ -5,6 +5,6 @@ import { SideMenuDropdownProps } from '../SideMenuDropdown/SideMenuDropdown';
|
|
|
5
5
|
*
|
|
6
6
|
* @visibleName SideMenu.Organisations
|
|
7
7
|
*/
|
|
8
|
-
export declare const SideMenuOrganisations: React.ForwardRefExoticComponent<SideMenuDropdownProps & React.RefAttributes<
|
|
8
|
+
export declare const SideMenuOrganisations: React.ForwardRefExoticComponent<SideMenuDropdownProps & React.RefAttributes<HTMLLIElement>> & {
|
|
9
9
|
__KONTUR_REACT_UI__: string;
|
|
10
10
|
};
|
|
@@ -7,6 +7,6 @@ export interface SideMenuSubItemProps extends Omit<SideMenuItemProps, 'icon'>, P
|
|
|
7
7
|
*
|
|
8
8
|
* @visibleName SideMenu.SubItem
|
|
9
9
|
*/
|
|
10
|
-
export declare const SideMenuSubItem: React.ForwardRefExoticComponent<SideMenuSubItemProps & React.RefAttributes<
|
|
10
|
+
export declare const SideMenuSubItem: React.ForwardRefExoticComponent<SideMenuSubItemProps & React.RefAttributes<HTMLLIElement>> & {
|
|
11
11
|
__KONTUR_REACT_UI__: string;
|
|
12
12
|
};
|
|
@@ -10,13 +10,13 @@ var SideMenuSubItemInner = forwardRef(function (_a, ref) {
|
|
|
10
10
|
var context = useContext(SideMenuContext);
|
|
11
11
|
var isOpened = useOpenedSubElementState(id, _generatedId, context.openedParents, context.activeMenuItem);
|
|
12
12
|
var icon = useMemoIcon(children, isOpened);
|
|
13
|
-
return (React.createElement("
|
|
13
|
+
return (React.createElement("li", { ref: ref },
|
|
14
14
|
React.createElement(SideMenuItem
|
|
15
15
|
/*@ts-expect-error: SideMenuItem should have icon */
|
|
16
16
|
, __assign({
|
|
17
17
|
/*@ts-expect-error: SideMenuItem should have icon */
|
|
18
|
-
icon: icon, _isSubMenu: true, id: id, _generatedId: _generatedId }, rest)),
|
|
19
|
-
children && isOpened && React.createElement(NestedMenu, { _generatedId: _generatedId }, children)));
|
|
18
|
+
icon: icon, _isSubMenu: true, id: id, _generatedId: _generatedId, "aria-expanded": children ? isOpened : undefined, "aria-controls": children ? "" + (id || _generatedId) : undefined }, rest)),
|
|
19
|
+
children && isOpened && (React.createElement(NestedMenu, { _generatedId: _generatedId, htmlId: "" + (id || _generatedId) }, children))));
|
|
20
20
|
});
|
|
21
21
|
SideMenuSubItemInner.displayName = 'SideMenuSubItem';
|
|
22
22
|
/**
|
|
@@ -11,6 +11,6 @@ export interface SideMenuSubLinkProps extends Omit<SideMenuLinkProps, 'icon'>, P
|
|
|
11
11
|
*
|
|
12
12
|
* @visibleName SideMenu.SubLink
|
|
13
13
|
*/
|
|
14
|
-
export declare const SideMenuSubLink: React.ForwardRefExoticComponent<SideMenuSubLinkProps & React.RefAttributes<
|
|
14
|
+
export declare const SideMenuSubLink: React.ForwardRefExoticComponent<SideMenuSubLinkProps & React.RefAttributes<HTMLLIElement>> & {
|
|
15
15
|
__KONTUR_REACT_UI__: string;
|
|
16
16
|
};
|
|
@@ -10,13 +10,13 @@ var SideMenuSubLinkInner = forwardRef(function (_a, ref) {
|
|
|
10
10
|
var context = useContext(SideMenuContext);
|
|
11
11
|
var isOpened = useOpenedSubElementState(id, _generatedId, context.openedParents, context.activeMenuItem);
|
|
12
12
|
var icon = useMemoIcon(children, isOpened);
|
|
13
|
-
return (React.createElement("
|
|
13
|
+
return (React.createElement("li", { ref: ref },
|
|
14
14
|
React.createElement(SideMenuLink
|
|
15
15
|
/*@ts-expect-error: SideMenuItem should have icon */
|
|
16
16
|
, __assign({
|
|
17
17
|
/*@ts-expect-error: SideMenuItem should have icon */
|
|
18
|
-
icon: icon, _isSubMenu: true, _isNestedSubMenu: _isNestedSubMenu, id: id, _generatedId: _generatedId }, rest)),
|
|
19
|
-
children && isOpened && React.createElement(NestedMenu, { _generatedId: _generatedId }, children)));
|
|
18
|
+
icon: icon, _isSubMenu: true, _isNestedSubMenu: _isNestedSubMenu, id: id, _generatedId: _generatedId, "aria-expanded": children ? isOpened : undefined, "aria-controls": children ? "" + (id || _generatedId) : undefined }, rest)),
|
|
19
|
+
children && isOpened && (React.createElement(NestedMenu, { _generatedId: _generatedId, htmlId: "" + (id || _generatedId) }, children))));
|
|
20
20
|
});
|
|
21
21
|
SideMenuSubLinkInner.displayName = 'SideMenuSubLink';
|
|
22
22
|
/**
|
|
@@ -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,
|
|
20
|
+
var onClick = _a.onClick, icon = _a.icon, 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", "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);
|
|
@@ -95,17 +95,20 @@ var ClickableElement = forwardRef(function (_a, ref) {
|
|
|
95
95
|
};
|
|
96
96
|
var shouldHighlightTopLevelItemWhenSubItemSelectedInSeparatedMenu = isOpened && !_isSubMenu && context.isSeparatedMenu;
|
|
97
97
|
var shouldHighlightTopLevelItemWhenMenuIsMinimized = isOpened && !_isSubMenu && context.isNarrowDesktop && context.isMinimized;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
var Component = _isSubMenu || _isDropdown ? 'div' : 'li';
|
|
99
|
+
var newProps = __assign({ className: cx((_b = {},
|
|
100
|
+
_b[jsStyles.root(theme)] = true,
|
|
101
|
+
_b[jsStyles.rootSubItemInSeparatedSubMenu(theme)] = context.isSeparatedMenu && _isSubMenu,
|
|
102
|
+
_b[jsStyles.focusedRoot(theme)] = isFocusedByTab,
|
|
103
|
+
_b[jsStyles.activeRoot(theme)] = isActive ||
|
|
104
|
+
shouldHighlightTopLevelItemWhenSubItemSelectedInSeparatedMenu ||
|
|
105
|
+
shouldHighlightTopLevelItemWhenMenuIsMinimized,
|
|
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, _isBackButton: _isBackButton, _isDropdown: _isDropdown, _isAvatar: _isAvatar })), ref: ref }, rest);
|
|
108
|
+
return (React.createElement(Component, null,
|
|
109
|
+
React.cloneElement(React.createElement(Tag, null), children
|
|
110
|
+
? __assign(__assign({}, newProps), { 'aria-expanded': isOpened, 'aria-controls': "" + (id || _generatedId) }) : __assign({}, newProps)),
|
|
111
|
+
React.createElement(SubMenu, { generatedId: _generatedId, id: id, href: rest.href, caption: caption, isSubMenu: _isSubMenu, isSeparatedMenu: context.isSeparatedMenu, isOpened: isOpened, isMinimized: context.isMinimized, htmlId: "" + (id || _generatedId) }, children)));
|
|
109
112
|
});
|
|
110
113
|
ClickableElement.displayName = 'ClickableElement';
|
|
111
114
|
var ClickableElementWithStaticFields = Object.assign(ClickableElement, {
|
|
@@ -2,8 +2,9 @@ import React from 'react';
|
|
|
2
2
|
interface InnerSubMenuProps {
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
generatedId?: string;
|
|
5
|
+
htmlId: string;
|
|
5
6
|
}
|
|
6
|
-
declare const InnerSubMenuWithStaticFields: React.ForwardRefExoticComponent<InnerSubMenuProps & React.RefAttributes<
|
|
7
|
+
declare const InnerSubMenuWithStaticFields: React.ForwardRefExoticComponent<InnerSubMenuProps & React.RefAttributes<HTMLUListElement>> & {
|
|
7
8
|
__KONTUR_REACT_UI__: string;
|
|
8
9
|
};
|
|
9
10
|
export { InnerSubMenuWithStaticFields as InnerSubMenu };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { isClickableSubElement } from '../../lib/utils/scripts';
|
|
3
|
+
import { jsStylesForSideMenu } from '../SideMenu/SideMenu.styles';
|
|
3
4
|
/**
|
|
4
5
|
* Подменю, раскрывающееся внутри основного меню
|
|
5
6
|
*
|
|
6
7
|
* @visibleName InnerSubMenu
|
|
7
8
|
*/
|
|
8
9
|
var InnerSubMenu = forwardRef(function (_a, ref) {
|
|
9
|
-
var children = _a.children, generatedId = _a.generatedId;
|
|
10
|
+
var children = _a.children, generatedId = _a.generatedId, htmlId = _a.htmlId;
|
|
10
11
|
var levelIndex = 0;
|
|
11
|
-
return (React.createElement("
|
|
12
|
+
return (React.createElement("ul", { ref: ref, id: htmlId, className: jsStylesForSideMenu.list() }, React.Children.map(children, function (child) {
|
|
12
13
|
if (React.isValidElement(child)) {
|
|
13
14
|
if (
|
|
14
15
|
// @ts-expect-error: accessing private property
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SideMenuItemProps } from '../../SideMenuItem/SideMenuItem';
|
|
3
3
|
interface CaptionProps extends Pick<SideMenuItemProps, '_isSubMenu' | '_isNestedSubMenu' | 'caption' | '_isBackButton' | '_isDropdown' | '_isAvatar' | 'subCaption'> {
|
|
4
|
-
|
|
4
|
+
hasIcon: boolean;
|
|
5
5
|
isMultiline: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const Caption: React.ForwardRefExoticComponent<CaptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
@@ -23,7 +23,7 @@ var getCaptionTail = function (caption, visibleWidth, fullWidth) {
|
|
|
23
23
|
};
|
|
24
24
|
export var Caption = forwardRef(function (_a, ref) {
|
|
25
25
|
var _b, _c;
|
|
26
|
-
var _isSubMenu = _a._isSubMenu, _isNestedSubMenu = _a._isNestedSubMenu,
|
|
26
|
+
var _isSubMenu = _a._isSubMenu, _isNestedSubMenu = _a._isNestedSubMenu, hasIcon = _a.hasIcon, caption = _a.caption, subCaption = _a.subCaption, isMultiline = _a.isMultiline, _isBackButton = _a._isBackButton, _isDropdown = _a._isDropdown, _isAvatar = _a._isAvatar;
|
|
27
27
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
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);
|
|
@@ -57,8 +57,8 @@ export var Caption = forwardRef(function (_a, ref) {
|
|
|
57
57
|
_c[jsStyles.captionTruncated()] = _isDropdown && (!_isAvatar || isAvatarCaptionSingleWord(caption, _isAvatar)),
|
|
58
58
|
_c[jsStyles.captionSubItem(theme)] = _isSubMenu,
|
|
59
59
|
_c[jsStyles.captionSubItemSeparatedMenuTopLevel()] = isSeparatedMenu && !_isNestedSubMenu && _isSubMenu,
|
|
60
|
-
_c[jsStyles.captionNestedItemSeparatedMenu()] = isSeparatedMenu && _isNestedSubMenu && !
|
|
61
|
-
_c[jsStyles.captionWithoutItemIcon()] = !
|
|
60
|
+
_c[jsStyles.captionNestedItemSeparatedMenu()] = isSeparatedMenu && _isNestedSubMenu && !hasIcon,
|
|
61
|
+
_c[jsStyles.captionWithoutItemIcon()] = !hasIcon && !isSeparatedMenu,
|
|
62
62
|
_c[jsStyles.captionSubItemWithoutColumnIcons()] = _isSubMenu && isSeparatedMenu && !hasSubIcons,
|
|
63
63
|
_c[jsStyles.captionLarge(theme)] = size === 'large',
|
|
64
64
|
_c[jsStyles.captionForTouchScreens(theme)] = isTouchScreen,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SideMenuItemProps } from '../../SideMenuItem/SideMenuItem';
|
|
3
|
-
interface IconProps extends Pick<SideMenuItemProps, '_isSubMenu' | 'icon' | '_isBackButton'> {
|
|
3
|
+
interface IconProps extends Pick<SideMenuItemProps, '_isSubMenu' | 'icon' | '_isBackButton' | '_isAvatar'> {
|
|
4
4
|
isMultiline: boolean;
|
|
5
5
|
}
|
|
6
|
-
export declare const Icon: ({ icon, _isSubMenu, isMultiline, _isBackButton }: IconProps) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
|
6
|
+
export declare const Icon: ({ icon, _isSubMenu, isMultiline, _isBackButton, _isAvatar }: IconProps) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
|
7
7
|
export {};
|
|
@@ -14,7 +14,7 @@ var getIconSize = function (theme, _isSubMenu, _isBackButton) {
|
|
|
14
14
|
};
|
|
15
15
|
export var Icon = function (_a) {
|
|
16
16
|
var _b;
|
|
17
|
-
var icon = _a.icon, _isSubMenu = _a._isSubMenu, isMultiline = _a.isMultiline, _c = _a._isBackButton, _isBackButton = _c === void 0 ? false : _c;
|
|
17
|
+
var icon = _a.icon, _isSubMenu = _a._isSubMenu, isMultiline = _a.isMultiline, _c = _a._isBackButton, _isBackButton = _c === void 0 ? false : _c, _isAvatar = _a._isAvatar;
|
|
18
18
|
var context = useContext(SideMenuContext);
|
|
19
19
|
var isSeparatedMenu = context.isSeparatedMenu, size = context.size;
|
|
20
20
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
@@ -30,6 +30,7 @@ export var Icon = function (_a) {
|
|
|
30
30
|
_b[jsStyles.rootSubItemSeparatedMenu(theme)] = isSeparatedMenu && _isSubMenu,
|
|
31
31
|
_b[jsStyles.rootSubItemLarge(theme)] = _isSubMenu && size === 'large',
|
|
32
32
|
_b[jsStyles.rootBackButton(theme)] = _isBackButton,
|
|
33
|
+
_b[jsStyles.rootAvatar()] = _isAvatar,
|
|
33
34
|
_b)),
|
|
34
35
|
});
|
|
35
36
|
};
|
|
@@ -23,6 +23,9 @@ var styles = {
|
|
|
23
23
|
rootBackButton: function (t) {
|
|
24
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);
|
|
25
25
|
},
|
|
26
|
+
rootAvatar: function () {
|
|
27
|
+
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n min-height: unset;\n "], ["\n min-height: unset;\n "])));
|
|
28
|
+
},
|
|
26
29
|
};
|
|
27
30
|
export var jsStyles = memoizeStyle(styles);
|
|
28
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
31
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
@@ -7,7 +7,6 @@ import { useNumberOfTextLinesInSubItem } from '../../../hooks/useNumberOfTextLin
|
|
|
7
7
|
import { Icon } from './Icon';
|
|
8
8
|
import { Caption } from './Caption';
|
|
9
9
|
import { Marker } from './Marker';
|
|
10
|
-
import { Avatar } from './Avatar';
|
|
11
10
|
import { getSideMenuTheme } from '../../../lib/theming/ThemeHelpers';
|
|
12
11
|
import { ThemeContext } from '@skbkontur/react-ui';
|
|
13
12
|
import { sideMenuMultilineCaptionPaddingTop } from './Caption.styles';
|
|
@@ -20,7 +19,7 @@ var getItemContentHeight = function (theme, linesNumber, size) {
|
|
|
20
19
|
*/
|
|
21
20
|
var ItemContent = forwardRef(function (_a, ref) {
|
|
22
21
|
var _b, _c;
|
|
23
|
-
var _isSubMenu = _a._isSubMenu, icon = _a.icon, _isNestedSubMenu = _a._isNestedSubMenu, caption = _a.caption, subCaption = _a.subCaption, marker = _a.marker,
|
|
22
|
+
var _isSubMenu = _a._isSubMenu, icon = _a.icon, _isNestedSubMenu = _a._isNestedSubMenu, caption = _a.caption, subCaption = _a.subCaption, marker = _a.marker, _isBackButton = _a._isBackButton, _isDropdown = _a._isDropdown, _isAvatar = _a._isAvatar;
|
|
24
23
|
var context = useContext(SideMenuContext);
|
|
25
24
|
var size = context.size, isTouchScreen = context.isTouchScreen;
|
|
26
25
|
var textRef = useRef(null);
|
|
@@ -57,7 +56,6 @@ var ItemContent = forwardRef(function (_a, ref) {
|
|
|
57
56
|
});
|
|
58
57
|
}
|
|
59
58
|
}, [textRef.current, context.isBeingTransitioned]);
|
|
60
|
-
var hasShortcutImage = !!icon || !!_avatar;
|
|
61
59
|
var isSeparatedSubMenuInNarrowDesktopWithoutOverlay = _isSubMenu && context.separatedMenuWithoutOverlay && context.isNarrowDesktop;
|
|
62
60
|
return (React.createElement("div", { className: cx((_b = {},
|
|
63
61
|
_b[jsStyles.root(theme)] = true,
|
|
@@ -68,14 +66,13 @@ var ItemContent = forwardRef(function (_a, ref) {
|
|
|
68
66
|
_b[jsStyles.rootForTouchScreens(theme)] = isTouchScreen,
|
|
69
67
|
_b[jsStyles.subItemRootForTouchScreens(theme)] = isTouchScreen && _isSubMenu,
|
|
70
68
|
_b)), ref: ref },
|
|
71
|
-
icon && React.createElement(Icon, { icon: icon, _isSubMenu: _isSubMenu, isMultiline: isMultiline, _isBackButton: _isBackButton }),
|
|
72
|
-
_avatar && React.createElement(Avatar, { _avatar: _avatar }),
|
|
69
|
+
icon && (React.createElement(Icon, { icon: icon, _isSubMenu: _isSubMenu, isMultiline: isMultiline, _isBackButton: _isBackButton, _isAvatar: _isAvatar })),
|
|
73
70
|
(!context.isMinimized || (context.isMinimized && _isSubMenu)) && (React.createElement("div", { className: cx((_c = {},
|
|
74
71
|
_c[jsStyles.textAndMarkerWrapper()] = true,
|
|
75
72
|
_c[jsStyles.textAndMarkerWrapperDropdown()] = _isDropdown,
|
|
76
73
|
_c[customStyles.textAndMarkerWrapperMultiline(getItemContentHeight(theme, linesNumber, size))] = isMultiline && !_isSubMenu,
|
|
77
74
|
_c)) },
|
|
78
|
-
React.createElement(Caption, { _isSubMenu: _isSubMenu, _isNestedSubMenu: _isNestedSubMenu,
|
|
75
|
+
React.createElement(Caption, { _isSubMenu: _isSubMenu, _isNestedSubMenu: _isNestedSubMenu, hasIcon: !!icon, isMultiline: isMultiline, caption: caption, subCaption: subCaption, _isBackButton: _isBackButton, _isDropdown: _isDropdown, _isAvatar: _isAvatar, ref: textRef }),
|
|
79
76
|
marker && (!context.isMinimized || isSeparatedSubMenuInNarrowDesktopWithoutOverlay) && (React.createElement(Marker, { isMultiline: isMultiline, marker: marker }))))));
|
|
80
77
|
});
|
|
81
78
|
ItemContent.displayName = 'ItemContent';
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
export interface NestedMenuProps {
|
|
3
3
|
_generatedId?: string;
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
+
htmlId: string;
|
|
5
6
|
}
|
|
6
7
|
declare const NestedMenuWithStaticFields: React.ForwardRefExoticComponent<NestedMenuProps & React.RefAttributes<HTMLDivElement>> & {
|
|
7
8
|
__KONTUR_REACT_UI__: string;
|
|
@@ -3,16 +3,22 @@ import { jsStyles } from './NestedMenu.styles';
|
|
|
3
3
|
import { isClickableSubElement } from '../../lib/utils/scripts';
|
|
4
4
|
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
|
|
5
5
|
import { ThemeContext } from '@skbkontur/react-ui';
|
|
6
|
+
import { jsStylesForSideMenu } from '../SideMenu/SideMenu.styles';
|
|
7
|
+
import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
6
8
|
/**
|
|
7
9
|
* Вложенное подменю
|
|
8
10
|
*
|
|
9
11
|
* @visibleName NestedMenu
|
|
10
12
|
*/
|
|
11
13
|
var NestedMenu = forwardRef(function (_a, ref) {
|
|
12
|
-
var
|
|
14
|
+
var _b;
|
|
15
|
+
var _generatedId = _a._generatedId, children = _a.children, htmlId = _a.htmlId;
|
|
13
16
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
14
17
|
var levelIndex = 0;
|
|
15
|
-
return (React.createElement("
|
|
18
|
+
return (React.createElement("ul", { className: cx((_b = {},
|
|
19
|
+
_b[jsStylesForSideMenu.list()] = true,
|
|
20
|
+
_b[jsStyles.root(theme)] = true,
|
|
21
|
+
_b)), id: htmlId }, React.Children.map(children, function (child) {
|
|
16
22
|
if (React.isValidElement(child) &&
|
|
17
23
|
// @ts-expect-error: accessing private property
|
|
18
24
|
isClickableSubElement(child.type.__KONTUR_REACT_UI__)) {
|
|
@@ -5,6 +5,7 @@ interface SeparatedSubMenuProps {
|
|
|
5
5
|
id?: string;
|
|
6
6
|
href?: string;
|
|
7
7
|
caption?: string;
|
|
8
|
+
htmlId: string;
|
|
8
9
|
}
|
|
9
10
|
declare const SeparatedSubMenuWithStaticFields: React.ForwardRefExoticComponent<SeparatedSubMenuProps & React.RefAttributes<HTMLDivElement>> & {
|
|
10
11
|
__KONTUR_REACT_UI__: string;
|
|
@@ -2,8 +2,8 @@ import { __assign } from "tslib";
|
|
|
2
2
|
import React, { forwardRef, useContext } from 'react';
|
|
3
3
|
import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
4
4
|
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
5
|
-
import {
|
|
6
|
-
import { customStyles,
|
|
5
|
+
import { jsStylesForSideMenu } from '../SideMenu/SideMenu.styles';
|
|
6
|
+
import { customStyles, jsStyles } from './SeparatedSubMenu.styles';
|
|
7
7
|
import { SideMenuContext } from '../SideMenuContext';
|
|
8
8
|
import { isClickableSubElement } from '../../lib/utils/scripts';
|
|
9
9
|
import { BackButton } from './BackButton';
|
|
@@ -18,7 +18,7 @@ import { isIE11 } from '@skbkontur/react-ui/lib/client';
|
|
|
18
18
|
*/
|
|
19
19
|
var SeparatedSubMenu = forwardRef(function (_a, ref) {
|
|
20
20
|
var _b, _c;
|
|
21
|
-
var children = _a.children, generatedId = _a.generatedId, id = _a.id, href = _a.href, caption = _a.caption;
|
|
21
|
+
var children = _a.children, generatedId = _a.generatedId, id = _a.id, href = _a.href, caption = _a.caption, htmlId = _a.htmlId;
|
|
22
22
|
var context = useContext(SideMenuContext);
|
|
23
23
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
24
24
|
var isSubItemWithChildren = function (child) {
|
|
@@ -37,21 +37,22 @@ var SeparatedSubMenu = forwardRef(function (_a, ref) {
|
|
|
37
37
|
var isDesktopOverlayMenu = (context.isDesktop || context.isNarrowDesktop) && !context.separatedMenuWithoutOverlay;
|
|
38
38
|
var isSeparatedSubMenuOverContent = (context.isTablet || isDesktopOverlayMenu) && !isIE11;
|
|
39
39
|
return (React.createElement("div", { className: cx((_b = {},
|
|
40
|
-
_b[
|
|
41
|
-
_b[
|
|
42
|
-
_b[
|
|
40
|
+
_b[jsStylesForSideMenu.container(theme)] = true,
|
|
41
|
+
_b[jsStylesForSideMenu.containerForTouchScreens(theme)] = context.isTouchScreen,
|
|
42
|
+
_b[jsStyles.root(theme)] = true,
|
|
43
43
|
_b[customStyles.rootForMobiles(context.headerHeight)] = context.isMobile,
|
|
44
|
-
_b[
|
|
45
|
-
_b[
|
|
46
|
-
_b[
|
|
44
|
+
_b[jsStyles.rootWithoutOverlay(theme)] = context.separatedMenuWithoutOverlay && context.isDesktop,
|
|
45
|
+
_b[jsStyles.rootWithoutOverlayForNarrowDesktop(theme)] = context.separatedMenuWithoutOverlay && context.isNarrowDesktop,
|
|
46
|
+
_b[jsStyles.rootWithShadow(theme)] = isSeparatedSubMenuOverContent,
|
|
47
47
|
_b)), ref: ref, "data-tid": SideMenuDataTids.separatedSubMenu },
|
|
48
48
|
React.createElement(ScrollContainer, { onScrollStateChangeY: function (state) {
|
|
49
49
|
var _a;
|
|
50
50
|
(_a = context.setScrollState) === null || _a === void 0 ? void 0 : _a.call(context, state);
|
|
51
51
|
}, hideScrollBar: true },
|
|
52
|
-
React.createElement("
|
|
53
|
-
_c[
|
|
54
|
-
_c[
|
|
52
|
+
React.createElement("ul", { className: cx((_c = {},
|
|
53
|
+
_c[jsStylesForSideMenu.list()] = true,
|
|
54
|
+
_c[jsStyles.contentWrapper(theme)] = true,
|
|
55
|
+
_c[jsStyles.contentWrapperForMobiles()] = context.isMobile,
|
|
55
56
|
_c)) },
|
|
56
57
|
context.isMobile && React.createElement(BackButton, { caption: caption, id: id, href: href, generatedId: generatedId }),
|
|
57
58
|
React.createElement(SideMenuContext.Provider, { value: __assign({ hasSubIcons: hasSubItems(children) }, context) }, React.Children.map(children, function (child) {
|
|
@@ -2,7 +2,7 @@ import { SideMenuTheme } from '../../lib/theming/ThemeTypes';
|
|
|
2
2
|
export declare const customStyles: {
|
|
3
3
|
rootForMobiles(headerHeight?: number | undefined): string;
|
|
4
4
|
};
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const jsStyles: {
|
|
6
6
|
root(t: SideMenuTheme): string;
|
|
7
7
|
rootWithoutOverlayForNarrowDesktop(t: SideMenuTheme): string;
|
|
8
8
|
rootWithoutOverlay(t: SideMenuTheme): string;
|
|
@@ -26,5 +26,5 @@ export var customStyles = {
|
|
|
26
26
|
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n height: calc(100vh - ", "px);\n left: 0;\n top: ", "px;\n "], ["\n height: calc(100vh - ", "px);\n left: 0;\n top: ", "px;\n "])), headerHeight, headerHeight);
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
|
-
export var
|
|
29
|
+
export var jsStyles = memoizeStyle(styles);
|
|
30
30
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
@@ -9,8 +9,9 @@ interface SubMenuProps {
|
|
|
9
9
|
id?: string;
|
|
10
10
|
href?: string;
|
|
11
11
|
caption?: string;
|
|
12
|
+
htmlId: string;
|
|
12
13
|
}
|
|
13
|
-
declare const SubMenuWithStaticFields: React.ForwardRefExoticComponent<SubMenuProps & React.RefAttributes<HTMLDivElement>> & {
|
|
14
|
+
declare const SubMenuWithStaticFields: React.ForwardRefExoticComponent<SubMenuProps & React.RefAttributes<HTMLDivElement | HTMLUListElement>> & {
|
|
14
15
|
__KONTUR_REACT_UI__: string;
|
|
15
16
|
};
|
|
16
17
|
export { SubMenuWithStaticFields as SubMenu };
|
package/src/internal/SubMenu.js
CHANGED
|
@@ -8,16 +8,16 @@ import { SideMenuContext } from '../SideMenuContext';
|
|
|
8
8
|
* @visibleName InnerSubMenu
|
|
9
9
|
*/
|
|
10
10
|
var SubMenu = forwardRef(function (_a, ref) {
|
|
11
|
-
var children = _a.children, isOpened = _a.isOpened, isSubMenu = _a.isSubMenu, isMinimized = _a.isMinimized, isSeparatedMenu = _a.isSeparatedMenu, generatedId = _a.generatedId, id = _a.id, href = _a.href, caption = _a.caption;
|
|
11
|
+
var children = _a.children, isOpened = _a.isOpened, isSubMenu = _a.isSubMenu, isMinimized = _a.isMinimized, isSeparatedMenu = _a.isSeparatedMenu, generatedId = _a.generatedId, id = _a.id, href = _a.href, caption = _a.caption, htmlId = _a.htmlId;
|
|
12
12
|
var context = useContext(SideMenuContext);
|
|
13
13
|
var shouldHideOverlayMenu = isMinimized && !context.separatedMenuWithoutOverlay;
|
|
14
14
|
if (!children || !isOpened || isSubMenu || shouldHideOverlayMenu) {
|
|
15
15
|
return null;
|
|
16
16
|
}
|
|
17
17
|
if (isSeparatedMenu && (context.isShown || context.isBeingTransitioned)) {
|
|
18
|
-
return (React.createElement(SeparatedSubMenu, { generatedId: generatedId, id: id, href: href, ref: ref, caption: caption }, children));
|
|
18
|
+
return (React.createElement(SeparatedSubMenu, { generatedId: generatedId, id: id, href: href, ref: ref, caption: caption, htmlId: htmlId }, children));
|
|
19
19
|
}
|
|
20
|
-
return (React.createElement(InnerSubMenu, { generatedId: generatedId, ref: ref }, children));
|
|
20
|
+
return (React.createElement(InnerSubMenu, { generatedId: generatedId, ref: ref, htmlId: htmlId }, children));
|
|
21
21
|
});
|
|
22
22
|
SubMenu.displayName = 'SubMenu';
|
|
23
23
|
var SubMenuWithStaticFields = Object.assign(SubMenu, { __KONTUR_REACT_UI__: 'SubMenu' });
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SideMenuItemProps } from '../../SideMenuItem/SideMenuItem';
|
|
3
|
-
declare type AvatarProps = Pick<SideMenuItemProps, '_avatar'>;
|
|
4
|
-
export declare const Avatar: ({ _avatar }: AvatarProps) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>;
|
|
5
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
-
import { jsStyles } from './Avatar.styles';
|
|
4
|
-
import { getSideMenuTheme } from '../../../lib/theming/ThemeHelpers';
|
|
5
|
-
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
6
|
-
export var Avatar = function (_a) {
|
|
7
|
-
var _b;
|
|
8
|
-
var _avatar = _a._avatar;
|
|
9
|
-
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
10
|
-
return React.cloneElement(_avatar, {
|
|
11
|
-
className: cx((_b = {},
|
|
12
|
-
_b[jsStyles.avatarIcon(theme)] = true,
|
|
13
|
-
_b)),
|
|
14
|
-
});
|
|
15
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { __makeTemplateObject } from "tslib";
|
|
2
|
-
import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
-
import { memoizeStyle } from '../../../lib/theming/ThemeHelpers';
|
|
4
|
-
var styles = {
|
|
5
|
-
avatarIcon: function (t) {
|
|
6
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin: ", ";\n "], ["\n margin: ", ";\n "])), t.sideMenuAvatarMargin);
|
|
7
|
-
},
|
|
8
|
-
};
|
|
9
|
-
export var jsStyles = memoizeStyle(styles);
|
|
10
|
-
var templateObject_1;
|