@skbkontur/side-menu 5.0.0-beta.0 → 5.0.0-beta.1
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 +6 -0
- package/package.json +1 -1
- package/src/SideMenu/SideMenu.js +13 -16
- package/src/SideMenu/SideMenu.styles.d.ts +4 -4
- package/src/SideMenu/SideMenu.styles.js +25 -29
- package/src/SideMenuBody/SideMenuBody.js +4 -28
- package/src/SideMenuBody/SideMenuBody.styles.js +1 -2
- package/src/SideMenuContext.d.ts +1 -8
- package/src/SideMenuDropdown/SideMenuDropdown.js +7 -7
- package/src/SideMenuDropdown/SideMenuDropdown.styles.d.ts +0 -1
- package/src/SideMenuDropdown/SideMenuDropdown.styles.js +4 -8
- package/src/SideMenuFooter/SideMenuFooter.js +6 -30
- package/src/SideMenuFooter/SideMenuFooter.styles.js +2 -3
- package/src/SideMenuHeader/SideMenuHeader.js +4 -1
- package/src/SideMenuHeader/SideMenuHeader.styles.d.ts +2 -0
- package/src/SideMenuHeader/SideMenuHeader.styles.js +12 -5
- package/src/internal/ClickableElement.d.ts +3 -1
- package/src/internal/ClickableElement.js +26 -31
- package/src/internal/InnerSubMenu.js +4 -0
- package/src/internal/ItemContent/Caption.styles.js +1 -1
- package/src/internal/ItemContent/Icon.js +1 -0
- package/src/internal/ItemContent/Icon.styles.d.ts +1 -0
- package/src/internal/ItemContent/Icon.styles.js +14 -12
- package/src/internal/ItemContent/ItemContent.js +26 -7
- package/src/internal/ItemContent/ItemContent.styles.d.ts +0 -1
- package/src/internal/ItemContent/ItemContent.styles.js +2 -6
- package/src/internal/ItemContent/Marker.js +1 -1
- package/src/internal/NarrowAccordionDropdown.d.ts +1 -2
- package/src/internal/NarrowAccordionDropdown.js +9 -14
- package/src/internal/SideMenuLogotype.js +5 -0
- package/src/internal/SideMenuLogotype.styles.d.ts +2 -0
- package/src/internal/SideMenuLogotype.styles.js +12 -5
- package/src/internal/subMenuItems.d.ts +3 -0
- package/src/internal/subMenuItems.js +43 -0
- package/src/state/reducer.js +46 -26
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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
|
+
## Unreleased
|
|
7
|
+
|
|
8
|
+
### BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* **SideMenu:** numeric `marker` values greater than 99 are displayed as `99+`. Pass a string to display the full count.
|
|
11
|
+
|
|
6
12
|
# [4.1.0](/compare/@skbkontur/side-menu@4.0.10...@skbkontur/side-menu@4.1.0) (2026-11-05)
|
|
7
13
|
|
|
8
14
|
|
package/package.json
CHANGED
package/src/SideMenu/SideMenu.js
CHANGED
|
@@ -44,7 +44,6 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
44
44
|
var collapseToggleRef = useRef(null);
|
|
45
45
|
var contentWrapperRef = useRef(null);
|
|
46
46
|
var scrollContainerRef = useRef(null);
|
|
47
|
-
var childIdCounterRef = useRef(0);
|
|
48
47
|
var _k = __read(useState(0), 2), itemIconsCount = _k[0], setItemIconsCount = _k[1];
|
|
49
48
|
var registerItemIcon = useCallback(function () {
|
|
50
49
|
setItemIconsCount(function (count) { return count + 1; });
|
|
@@ -236,7 +235,7 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
236
235
|
}
|
|
237
236
|
transitionTimer.current = setTimeout(function () {
|
|
238
237
|
setIsBeingTransitioned(false);
|
|
239
|
-
}, transitionDuration
|
|
238
|
+
}, transitionDuration);
|
|
240
239
|
}
|
|
241
240
|
};
|
|
242
241
|
var setIsCollapsedTabletAndMobile = function (isCollapsed) {
|
|
@@ -297,7 +296,6 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
297
296
|
dispatch: machineDispatch,
|
|
298
297
|
parentItemId: ROOT,
|
|
299
298
|
currentItemNestingLevel: 0,
|
|
300
|
-
childIdCounterRef: childIdCounterRef,
|
|
301
299
|
}); }, [
|
|
302
300
|
isOpened,
|
|
303
301
|
disableCollapsing,
|
|
@@ -342,6 +340,8 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
342
340
|
React.createElement(RenderLayer, { onClickOutside: function () { return setIsCollapsedTabletAndMobile(true); } },
|
|
343
341
|
React.createElement("aside", __assign({ className: cx(styles.wrapper(), (_c = {}, _c[styles.wrapperWithShadow(theme)] = isSideMenuOverContent, _c), className), "data-tid": SideMenuDataTids.root, ref: mergeRefs(sideMenuRef, ref !== null && ref !== void 0 ? ref : null) }, rest),
|
|
344
342
|
React.createElement("div", { className: cx(styles.container(theme), (_d = {},
|
|
343
|
+
_d[styles.containerDesktop()] = isDesktopViewport,
|
|
344
|
+
_d[styles.containerDesktopTouchScreen()] = isDesktopViewport && isTouchScreen,
|
|
345
345
|
_d[styles.containerTouchScreen(theme)] = isTouchScreen,
|
|
346
346
|
_d[styles.containerCollapsed(theme)] = !isOpened && !isTabletOrMobile,
|
|
347
347
|
_d[styles.containerCollapsedTabletAndMobile()] = !(isOpened || isBeingTransitioned) && isTabletOrMobile,
|
|
@@ -350,19 +350,16 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
350
350
|
React.createElement(ScrollContainer, { onScrollStateChangeY: function (state) {
|
|
351
351
|
setScrollState === null || setScrollState === void 0 ? void 0 : setScrollState(state);
|
|
352
352
|
}, showScrollBar: setScrollBar(), ref: scrollContainerRef },
|
|
353
|
-
React.createElement("div", { className: cx(styles.
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
} },
|
|
364
|
-
children,
|
|
365
|
-
!hasFooter && showCollapseToggle && React.createElement(SideMenuFooter, null)))))))))));
|
|
353
|
+
React.createElement("div", { className: cx(styles.contentWrapper(theme), (_e = {},
|
|
354
|
+
_e[styles.contentWrapperCollapsedTabletAndMobile()] = !isOpened && isTabletOrMobile,
|
|
355
|
+
_e[styles.contentWrapperOverContent(theme)] = isSideMenuOverContent,
|
|
356
|
+
_e[styles.contentWrapperWithSeparatedSubMenuMobile(theme)] = isSeparatedMenuShown && isMobile && (isOpened || isBeingTransitioned),
|
|
357
|
+
_e)), ref: contentWrapperRef, style: {
|
|
358
|
+
'--side-menu-scroll-margin-top': "".concat(headerHeight, "px"),
|
|
359
|
+
'--side-menu-scroll-margin-bottom': "".concat(footerHeight, "px"),
|
|
360
|
+
} },
|
|
361
|
+
children,
|
|
362
|
+
!hasFooter && showCollapseToggle && React.createElement(SideMenuFooter, null))))))))));
|
|
366
363
|
});
|
|
367
364
|
SideMenuInner.displayName = 'SideMenu';
|
|
368
365
|
var STATIC_PROPS = {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Emotion } from '../../lib/theming/ThemeHelpers.js';
|
|
2
2
|
import type { SideMenuTheme } from '../../lib/theming/ThemeTypes.js';
|
|
3
|
+
export declare const compactDesktopMenu: (t: SideMenuTheme, declarations: string) => string;
|
|
3
4
|
export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").StylesGetter<{
|
|
4
5
|
root(): string;
|
|
5
6
|
rootCollapsed(t: SideMenuTheme): string;
|
|
@@ -13,17 +14,16 @@ export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").Styl
|
|
|
13
14
|
wrapperWithShadow(t: SideMenuTheme): string;
|
|
14
15
|
container(t: SideMenuTheme): string;
|
|
15
16
|
containerTouchScreen(t: SideMenuTheme): string;
|
|
17
|
+
containerDesktop(): string;
|
|
18
|
+
containerDesktopTouchScreen(): string;
|
|
19
|
+
hideUntilExpanded(t: SideMenuTheme): string;
|
|
16
20
|
containerCollapsed(t: SideMenuTheme): string;
|
|
17
21
|
containerCollapsedTabletAndMobile(): string;
|
|
18
22
|
containerWithSeparatedSubMenuMobile(t: SideMenuTheme): string;
|
|
19
|
-
contentClip(): string;
|
|
20
23
|
contentWrapper(t: SideMenuTheme): string;
|
|
21
|
-
contentWrapperTouchScreen(t: SideMenuTheme): string;
|
|
22
24
|
contentWrapperOverContent(t: SideMenuTheme): string;
|
|
23
25
|
contentWrapperWithSeparatedSubMenuMobile(t: SideMenuTheme): string;
|
|
24
|
-
contentWrapperCollapsed(): string;
|
|
25
26
|
contentWrapperCollapsedTabletAndMobile(): string;
|
|
26
|
-
itemsContainerOpened(t: SideMenuTheme): string;
|
|
27
27
|
itemsContainerCollapsed(t: SideMenuTheme): string;
|
|
28
28
|
itemsContainerCollapsedLarge(t: SideMenuTheme): string;
|
|
29
29
|
list(): string;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
3
|
import { burgerTransitionDuration, transitionDuration, transitionEasing } from './SideMenu.js';
|
|
4
|
+
// The measured width also covers transitions triggered by a controlled isOpen prop.
|
|
5
|
+
export var compactDesktopMenu = function (t, declarations) { return "\n @container side-menu (width < ".concat(t.sideMenuWidth, ") {\n ").concat(declarations, "\n }\n @container side-menu-touch (width < ").concat(t.sideMenuWidthTouchScreen, ") {\n ").concat(declarations, "\n }\n"); };
|
|
4
6
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
5
7
|
var css = _a.css;
|
|
6
8
|
return ({
|
|
7
9
|
root: function () {
|
|
8
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n height: 100%;\n flex-shrink: 0;\n
|
|
10
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n height: 100%;\n flex-shrink: 0;\n "], ["\n position: relative;\n height: 100%;\n flex-shrink: 0;\n "])));
|
|
9
11
|
},
|
|
10
12
|
rootCollapsed: function (t) {
|
|
11
13
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), t.sideMenuWidthCollapsed);
|
|
@@ -35,61 +37,55 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
35
37
|
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n box-shadow: ", ";\n "], ["\n box-shadow: ", ";\n "])), t.sideMenuBoxShadow);
|
|
36
38
|
},
|
|
37
39
|
container: function (t) {
|
|
38
|
-
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n position: relative;\n box-sizing: border-box;\n\n width: ", ";\n height: 100%;\n\n background: ", ";\n transition
|
|
40
|
+
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n position: relative;\n box-sizing: border-box;\n\n width: ", ";\n height: 100%;\n\n background: ", ";\n transition: left ", "ms ", ";\n "], ["\n position: relative;\n box-sizing: border-box;\n\n width: ", ";\n height: 100%;\n\n background: ", ";\n transition: left ", "ms ", ";\n "])), t.sideMenuWidth, t.sideMenuBg, transitionDuration, transitionEasing);
|
|
39
41
|
},
|
|
40
42
|
containerTouchScreen: function (t) {
|
|
41
43
|
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), t.sideMenuWidthTouchScreen);
|
|
42
44
|
},
|
|
45
|
+
containerDesktop: function () {
|
|
46
|
+
return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n container: side-menu / inline-size;\n\n @supports (container-type: inline-size) {\n @media (prefers-reduced-motion: no-preference) {\n transition:\n width ", "ms ", ",\n left ", "ms ", ";\n }\n }\n "], ["\n container: side-menu / inline-size;\n\n @supports (container-type: inline-size) {\n @media (prefers-reduced-motion: no-preference) {\n transition:\n width ", "ms ", ",\n left ", "ms ", ";\n }\n }\n "])), transitionDuration, transitionEasing, transitionDuration, transitionEasing);
|
|
47
|
+
},
|
|
48
|
+
containerDesktopTouchScreen: function () {
|
|
49
|
+
return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n container-name: side-menu-touch;\n "], ["\n container-name: side-menu-touch;\n "])));
|
|
50
|
+
},
|
|
51
|
+
hideUntilExpanded: function (t) {
|
|
52
|
+
return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), compactDesktopMenu(t, 'display: none;'));
|
|
53
|
+
},
|
|
43
54
|
containerCollapsed: function (t) {
|
|
44
|
-
return css(
|
|
55
|
+
return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n width: ", " !important;\n "], ["\n width: ", " !important;\n "])), t.sideMenuWidthCollapsed);
|
|
45
56
|
},
|
|
46
57
|
containerCollapsedTabletAndMobile: function () {
|
|
47
|
-
return css(
|
|
58
|
+
return css(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n background: transparent;\n "], ["\n background: transparent;\n "])));
|
|
48
59
|
},
|
|
49
60
|
containerWithSeparatedSubMenuMobile: function (t) {
|
|
50
|
-
return css(
|
|
51
|
-
},
|
|
52
|
-
// Во время анимации ширины содержимое шире контейнера; обрезаем его по горизонтали, чтобы
|
|
53
|
-
// ScrollContainer не включал горизонтальную прокрутку (она добавляет отступ снизу и мигает
|
|
54
|
-
// разделитель футера). clip, в отличие от hidden, не ломает sticky шапку и футер.
|
|
55
|
-
contentClip: function () {
|
|
56
|
-
return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n height: 100%;\n overflow-x: clip;\n "], ["\n height: 100%;\n overflow-x: clip;\n "])));
|
|
61
|
+
return css(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), t.sideMenuSeparatedSubMenuBg);
|
|
57
62
|
},
|
|
58
63
|
contentWrapper: function (t) {
|
|
59
|
-
return css(
|
|
60
|
-
},
|
|
61
|
-
contentWrapperTouchScreen: function (t) {
|
|
62
|
-
return css(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), t.sideMenuWidthTouchScreen);
|
|
64
|
+
return css(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n\n width: 100%;\n min-height: 100%;\n\n background: ", ";\n transition: background 0.08s;\n "], ["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n\n width: 100%;\n min-height: 100%;\n\n background: ", ";\n transition: background 0.08s;\n "])), t.sideMenuBg);
|
|
63
65
|
},
|
|
64
66
|
contentWrapperOverContent: function (t) {
|
|
65
|
-
return css(
|
|
67
|
+
return css(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), t.sideMenuBgHover);
|
|
66
68
|
},
|
|
67
69
|
contentWrapperWithSeparatedSubMenuMobile: function (t) {
|
|
68
|
-
return css(
|
|
69
|
-
},
|
|
70
|
-
contentWrapperCollapsed: function () {
|
|
71
|
-
return css(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "])));
|
|
70
|
+
return css(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n background: ", ";\n transition: background 0s;\n "], ["\n background: ", ";\n transition: background 0s;\n "])), t.sideMenuSeparatedSubMenuBg);
|
|
72
71
|
},
|
|
73
72
|
contentWrapperCollapsedTabletAndMobile: function () {
|
|
74
73
|
return css(templateObject_22 || (templateObject_22 = __makeTemplateObject(["\n background: transparent;\n "], ["\n background: transparent;\n "])));
|
|
75
74
|
},
|
|
76
75
|
// Горизонтальные отступы контейнеров пунктов (Body, Footer) в свёрнутом меню:
|
|
77
76
|
// пункт становится квадратным, а иконка остаётся на месте при сворачивании.
|
|
78
|
-
itemsContainerOpened: function (t) {
|
|
79
|
-
return css(templateObject_23 || (templateObject_23 = __makeTemplateObject(["\n width: calc(100% - 2 * ", ");\n "], ["\n width: calc(100% - 2 * ", ");\n "])), t.sideMenuItemsMarginX);
|
|
80
|
-
},
|
|
81
77
|
itemsContainerCollapsed: function (t) {
|
|
82
|
-
return css(
|
|
78
|
+
return css(templateObject_23 || (templateObject_23 = __makeTemplateObject(["\n margin-left: ", ";\n margin-right: ", ";\n "], ["\n margin-left: ", ";\n margin-right: ", ";\n "])), t.sideMenuItemsMarginXCollapsed, t.sideMenuItemsMarginXCollapsed);
|
|
83
79
|
},
|
|
84
80
|
itemsContainerCollapsedLarge: function (t) {
|
|
85
|
-
return css(
|
|
81
|
+
return css(templateObject_24 || (templateObject_24 = __makeTemplateObject(["\n margin-left: ", ";\n margin-right: ", ";\n "], ["\n margin-left: ", ";\n margin-right: ", ";\n "])), t.sideMenuItemsMarginXCollapsedLarge, t.sideMenuItemsMarginXCollapsedLarge);
|
|
86
82
|
},
|
|
87
83
|
// Общие стили для подкомпонентов SideMenu
|
|
88
84
|
list: function () {
|
|
89
|
-
return css(
|
|
85
|
+
return css(templateObject_25 || (templateObject_25 = __makeTemplateObject(["\n list-style: none;\n padding: 0;\n margin: 0;\n "], ["\n list-style: none;\n padding: 0;\n margin: 0;\n "])));
|
|
90
86
|
},
|
|
91
87
|
hidden: function () {
|
|
92
|
-
return css(
|
|
88
|
+
return css(templateObject_26 || (templateObject_26 = __makeTemplateObject(["\n display: none;\n "], ["\n display: none;\n "])));
|
|
93
89
|
},
|
|
94
90
|
});
|
|
95
91
|
});
|
|
@@ -97,8 +93,8 @@ export var getCustomStyles = function (_a) {
|
|
|
97
93
|
var css = _a.css;
|
|
98
94
|
return ({
|
|
99
95
|
rootTabletAndMobile: function (headerHeight) {
|
|
100
|
-
return css(
|
|
96
|
+
return css(templateObject_27 || (templateObject_27 = __makeTemplateObject(["\n height: ", "px;\n top: 0;\n transition: height ", "ms ease-out;\n "], ["\n height: ", "px;\n top: 0;\n transition: height ", "ms ease-out;\n "])), headerHeight, burgerTransitionDuration);
|
|
101
97
|
},
|
|
102
98
|
});
|
|
103
99
|
};
|
|
104
|
-
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, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27
|
|
100
|
+
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, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
|
-
import { getDOMRect } from '@skbkontur/react-ui/lib/dom/getDOMRect';
|
|
3
|
-
import { mergeRefs } from '@skbkontur/react-ui/lib/mergeRefs';
|
|
4
2
|
import { useEmotion, useStyles } from '@skbkontur/react-ui/lib/renderEnvironment';
|
|
5
3
|
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
6
|
-
import React, { forwardRef, useContext
|
|
4
|
+
import React, { forwardRef, useContext } from 'react';
|
|
7
5
|
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers.js';
|
|
8
|
-
import { transitionDuration, transitionEasing } from '../SideMenu/SideMenu.js';
|
|
9
6
|
import { getStyles as getSideMenuStyles } from '../SideMenu/SideMenu.styles.js';
|
|
10
7
|
import { SideMenuContext } from '../SideMenuContext.js';
|
|
11
8
|
import { getStyles } from './SideMenuBody.styles.js';
|
|
@@ -17,30 +14,9 @@ var SideMenuBodyInner = forwardRef(function (_a, ref) {
|
|
|
17
14
|
var sideMenuStyles = useStyles(getSideMenuStyles);
|
|
18
15
|
var styles = useStyles(getStyles);
|
|
19
16
|
var cx = useEmotion().cx;
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _a;
|
|
24
|
-
var node = bodyRef.current;
|
|
25
|
-
var prevTop = prevTopRef.current;
|
|
26
|
-
if (!node || prevTop === null || typeof node.animate !== 'function') {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
var offset = prevTop - getDOMRect(node).top;
|
|
30
|
-
var prefersReducedMotion = (_a = globalThis.matchMedia) === null || _a === void 0 ? void 0 : _a.call(globalThis, '(prefers-reduced-motion: reduce)').matches;
|
|
31
|
-
if (offset && !prefersReducedMotion) {
|
|
32
|
-
node.animate([{ transform: "translateY(".concat(offset, "px)") }, { transform: 'translateY(0)' }], {
|
|
33
|
-
duration: transitionDuration,
|
|
34
|
-
easing: transitionEasing,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}, [context.isOpened]);
|
|
38
|
-
useLayoutEffect(function () {
|
|
39
|
-
prevTopRef.current = bodyRef.current ? getDOMRect(bodyRef.current).top : null;
|
|
40
|
-
});
|
|
41
|
-
return (React.createElement("div", { ref: mergeRefs(bodyRef, ref), className: cx(styles.root(theme), (_b = {},
|
|
42
|
-
_b[sideMenuStyles.hidden()] = !context.isOpened && (context.isMobile || context.isTablet),
|
|
43
|
-
_b[sideMenuStyles.itemsContainerOpened(theme)] = context.isOpened,
|
|
17
|
+
var isTabletOrMobile = context.isTablet || context.isMobile;
|
|
18
|
+
return (React.createElement("div", { ref: ref, className: cx(styles.root(theme), (_b = {},
|
|
19
|
+
_b[sideMenuStyles.hidden()] = !context.isOpened && isTabletOrMobile,
|
|
44
20
|
_b[sideMenuStyles.itemsContainerCollapsed(theme)] = !context.isOpened,
|
|
45
21
|
_b[sideMenuStyles.itemsContainerCollapsedLarge(theme)] = !context.isOpened && context.size === 'large',
|
|
46
22
|
_b)) },
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
|
-
import { transitionDuration, transitionEasing } from '../SideMenu/SideMenu.js';
|
|
4
3
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
5
4
|
var css = _a.css;
|
|
6
5
|
return ({
|
|
7
6
|
root: function (t) {
|
|
8
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n margin: 0 ", ";\n min-height: 100%;\n
|
|
7
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n margin: 0 ", ";\n min-height: 100%;\n "], ["\n flex-grow: 1;\n margin: 0 ", ";\n min-height: 100%;\n "])), t.sideMenuItemsMarginX);
|
|
9
8
|
},
|
|
10
9
|
wrapper: function (t) {
|
|
11
10
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-bottom: ", ";\n "], ["\n padding-bottom: ", ";\n "])), t.sideMenuBodyPaddingBottom);
|
package/src/SideMenuContext.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ScrollContainerScrollStateY } from '@skbkontur/react-ui/components/ScrollContainer';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RefObject } from 'react';
|
|
3
3
|
import type { showScrollBarType } from './SideMenu/SideMenu.js';
|
|
4
4
|
import { type Action, type SideMenuState } from './state/types.js';
|
|
5
5
|
export interface SideMenuContextType {
|
|
@@ -37,12 +37,5 @@ export interface SideMenuContextType {
|
|
|
37
37
|
openDropdownCount?: number;
|
|
38
38
|
currentItemNestingLevel?: number;
|
|
39
39
|
closeParentDropdown?: () => void;
|
|
40
|
-
/**
|
|
41
|
-
* A mutable counter reset to 0 on each parent render and incremented by each child during
|
|
42
|
-
* its `useState` initializer. Produces a stable, position-based index so generated ids
|
|
43
|
-
* survive unmount → re-mount (e.g. narrow accordion dropdown closing → inline submenu
|
|
44
|
-
* opening) without explicit `id` props.
|
|
45
|
-
*/
|
|
46
|
-
childIdCounterRef?: MutableRefObject<number>;
|
|
47
40
|
}
|
|
48
41
|
export declare const SideMenuContext: import("react").Context<SideMenuContextType>;
|
|
@@ -8,11 +8,11 @@ import { SideMenuContext } from '../SideMenuContext.js';
|
|
|
8
8
|
import { SideMenuItem } from '../SideMenuItem/SideMenuItem.js';
|
|
9
9
|
import { getStyles } from './SideMenuDropdown.styles.js';
|
|
10
10
|
var SideMenuDropdownInner = forwardRef(function (_a, ref) {
|
|
11
|
-
var _b
|
|
11
|
+
var _b;
|
|
12
12
|
var icon = _a.icon, id = _a.id, children = _a.children, caption = _a.caption, marker = _a.marker, subCaption = _a.subCaption, className = _a.className, menuWidth = _a.menuWidth, _isAvatar = _a._isAvatar, onClose = _a.onClose, onOpen = _a.onOpen, ariaLabel = _a["aria-label"], rest = __rest(_a, ["icon", "id", "children", "caption", "marker", "subCaption", "className", "menuWidth", "_isAvatar", "onClose", "onOpen", 'aria-label']);
|
|
13
13
|
var context = useContext(SideMenuContext);
|
|
14
14
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
15
|
-
var
|
|
15
|
+
var _c = __read(useState(false), 2), isMenuOpen = _c[0], setIsMenuOpen = _c[1];
|
|
16
16
|
var cx = useEmotion().cx;
|
|
17
17
|
var styles = useStyles(getStyles);
|
|
18
18
|
var dropdownChildren = useMemo(function () {
|
|
@@ -32,11 +32,11 @@ var SideMenuDropdownInner = forwardRef(function (_a, ref) {
|
|
|
32
32
|
return child;
|
|
33
33
|
});
|
|
34
34
|
}, [children, context.toggleIsOpened]);
|
|
35
|
-
return (React.createElement("li", { className: cx(styles.wrapper(),
|
|
36
|
-
React.createElement(DropdownMenu, __assign({ ref: ref, caption: React.createElement("div", { className: cx(styles.label(theme), (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
return (React.createElement("li", { className: cx(styles.wrapper(), className) },
|
|
36
|
+
React.createElement(DropdownMenu, __assign({ ref: ref, caption: React.createElement("div", { className: cx(styles.label(theme), (_b = {},
|
|
37
|
+
_b[styles.labelTouchScreen(theme)] = context.isTouchScreen,
|
|
38
|
+
_b[styles.labelCollapsed()] = !context.isOpened,
|
|
39
|
+
_b)) },
|
|
40
40
|
React.createElement(SideMenuItem, { "aria-label": ariaLabel, icon: icon, caption: caption, subCaption: subCaption, marker: marker, id: id, _isDropdown: true, _isDropdownOpen: isMenuOpen, _isAvatar: _isAvatar })), positions: ['top left'], disableAnimations: true, menuWidth: menuWidth, onOpen: function () {
|
|
41
41
|
setIsMenuOpen(true);
|
|
42
42
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
|
-
import {
|
|
3
|
+
import { compactDesktopMenu } from '../SideMenu/SideMenu.styles.js';
|
|
4
4
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
5
5
|
var css = _a.css, injectGlobal = _a.injectGlobal;
|
|
6
6
|
var _unused = injectGlobal(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n [data-tid='MenuItem']:active {\n background: rgba(0, 0, 0, 0.1) !important;\n transition: background 80ms ease-out;\n }\n "], ["\n [data-tid='MenuItem']:active {\n background: rgba(0, 0, 0, 0.1) !important;\n transition: background 80ms ease-out;\n }\n "])));
|
|
7
7
|
return {
|
|
8
8
|
label: function (t) {
|
|
9
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: calc(\n ", " - 2 * ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n min-width: 0;\n
|
|
9
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: calc(\n ", " - 2 * ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n min-width: 0;\n ", "\n "], ["\n width: calc(\n ", " - 2 * ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n min-width: 0;\n ", "\n "])), t.sideMenuWidth, t.sideMenuItemsMarginX, compactDesktopMenu(t, "max-width: max(0px, calc(100cqw - 2 * ".concat(t.sideMenuItemsMarginX, " - var(--side-menu-footer-trailing-reserved-width, 0px)));")));
|
|
10
10
|
},
|
|
11
11
|
labelTouchScreen: function (t) {
|
|
12
12
|
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: calc(\n ", " - 2 *\n ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n "], ["\n width: calc(\n ", " - 2 *\n ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n "])), t.sideMenuWidthTouchScreen, t.sideMenuItemsMarginX);
|
|
@@ -15,15 +15,11 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
15
15
|
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "])));
|
|
16
16
|
},
|
|
17
17
|
wrapper: function () {
|
|
18
|
-
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n
|
|
18
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n min-width: 0;\n "], ["\n min-width: 0;\n "])));
|
|
19
19
|
},
|
|
20
20
|
collapsedDropdownList: function (t) {
|
|
21
21
|
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n min-width: calc(", " - 8px);\n max-width: calc(", " - 8px);\n "], ["\n min-width: calc(", " - 8px);\n max-width: calc(", " - 8px);\n "])), t.sideMenuCollapsedDropdownMinWidth, t.sideMenuCollapsedDropdownMaxWidth);
|
|
22
22
|
},
|
|
23
|
-
// В свёрнутом меню подпись скрыта, а бейдж выступает за границы пункта — не обрезаем его
|
|
24
|
-
wrapperCollapsed: function () {
|
|
25
|
-
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n overflow: visible;\n "], ["\n overflow: visible;\n "])));
|
|
26
|
-
},
|
|
27
23
|
};
|
|
28
24
|
});
|
|
29
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6
|
|
25
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -3,11 +3,10 @@ import { getDOMRect } from '@skbkontur/react-ui/lib/dom/getDOMRect';
|
|
|
3
3
|
import { mergeRefs } from '@skbkontur/react-ui/lib/mergeRefs';
|
|
4
4
|
import { useEmotion, useStyles } from '@skbkontur/react-ui/lib/renderEnvironment';
|
|
5
5
|
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
6
|
-
import React, { forwardRef, useContext, useEffect,
|
|
6
|
+
import React, { forwardRef, useContext, useEffect, useRef, useState } from 'react';
|
|
7
7
|
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers.js';
|
|
8
8
|
import { flattenChildren } from '../../lib/utils/scripts.js';
|
|
9
9
|
import { SideMenuDataTids } from '../../SideMenuDataTids.js';
|
|
10
|
-
import { transitionDuration, transitionEasing } from '../SideMenu/SideMenu.js';
|
|
11
10
|
import { getStyles as getSideMenuStyles } from '../SideMenu/SideMenu.styles.js';
|
|
12
11
|
import { SideMenuContext } from '../SideMenuContext.js';
|
|
13
12
|
import { getStyles } from './SideMenuFooter.styles.js';
|
|
@@ -27,35 +26,13 @@ var SideMenuFooterInner = forwardRef(function (_a, ref) {
|
|
|
27
26
|
(_a = context.setFooterHeight) === null || _a === void 0 ? void 0 : _a.call(context, getDOMRect(footerRef.current).height);
|
|
28
27
|
}
|
|
29
28
|
}, [children, context.isOpened, context.setFooterHeight]);
|
|
30
|
-
// При сворачивании кнопка сворачивания переезжает из строки аватара в отдельную строку
|
|
31
|
-
// (и обратно), из-за чего высота футера меняется скачком, а пункты футера подпрыгивают.
|
|
32
|
-
// Футер прижат к низу меню, поэтому плавно доводим его от прежнего положения к новому.
|
|
33
|
-
var prevHeightRef = useRef(null);
|
|
34
|
-
useLayoutEffect(function () {
|
|
35
|
-
var _a;
|
|
36
|
-
var node = footerRef.current;
|
|
37
|
-
var prevHeight = prevHeightRef.current;
|
|
38
|
-
if (!node || prevHeight === null || typeof node.animate !== 'function') {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
var offset = getDOMRect(node).height - prevHeight;
|
|
42
|
-
var prefersReducedMotion = (_a = globalThis.matchMedia) === null || _a === void 0 ? void 0 : _a.call(globalThis, '(prefers-reduced-motion: reduce)').matches;
|
|
43
|
-
if (offset && !prefersReducedMotion) {
|
|
44
|
-
node.animate([{ transform: "translateY(".concat(offset, "px)") }, { transform: 'translateY(0)' }], {
|
|
45
|
-
duration: transitionDuration,
|
|
46
|
-
easing: transitionEasing,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}, [context.isOpened]);
|
|
50
|
-
useLayoutEffect(function () {
|
|
51
|
-
prevHeightRef.current = footerRef.current ? getDOMRect(footerRef.current).height : null;
|
|
52
|
-
});
|
|
53
29
|
var isTabletOrMobile = context.isTablet || context.isMobile;
|
|
54
30
|
var isLarge = context.size === 'large';
|
|
55
31
|
var showCollapseToggle = (context.isDesktop || context.isNarrowDesktop) && !context.disableCollapsing;
|
|
56
32
|
var showTrailingItem = showCollapseToggle && context.isOpened;
|
|
57
33
|
var footerItems = flattenChildren(children);
|
|
58
34
|
var isEmpty = footerItems.length === 0;
|
|
35
|
+
var useCollapsedMargins = !context.isOpened || isEmpty;
|
|
59
36
|
var trailingItem = showTrailingItem ? footerItems[footerItems.length - 1] : null;
|
|
60
37
|
var leadingItems = trailingItem ? footerItems.slice(0, -1) : footerItems;
|
|
61
38
|
useEffect(function () {
|
|
@@ -64,12 +41,11 @@ var SideMenuFooterInner = forwardRef(function (_a, ref) {
|
|
|
64
41
|
if (!isTabletOrMobile || context.isOpened) {
|
|
65
42
|
return (React.createElement("footer", __assign({ "data-tid": SideMenuDataTids.footer, "data-visual-state-fixed": isFixed, className: cx(styles.root(theme), (_b = {},
|
|
66
43
|
_b[styles.rootLarge(theme)] = isLarge,
|
|
67
|
-
_b[sideMenuStyles.
|
|
68
|
-
_b[sideMenuStyles.
|
|
69
|
-
_b[sideMenuStyles.itemsContainerCollapsedLarge(theme)] = (!context.isOpened || isEmpty) && isLarge,
|
|
44
|
+
_b[sideMenuStyles.itemsContainerCollapsed(theme)] = useCollapsedMargins,
|
|
45
|
+
_b[sideMenuStyles.itemsContainerCollapsedLarge(theme)] = useCollapsedMargins && isLarge,
|
|
70
46
|
_b[styles.rootFixed(theme)] = isFixed,
|
|
71
|
-
_b[styles.rootFixedCollapsed(theme)] = isFixed &&
|
|
72
|
-
_b[styles.rootFixedCollapsedLarge(theme)] = isFixed &&
|
|
47
|
+
_b[styles.rootFixedCollapsed(theme)] = isFixed && useCollapsedMargins,
|
|
48
|
+
_b[styles.rootFixedCollapsedLarge(theme)] = isFixed && useCollapsedMargins && isLarge,
|
|
73
49
|
_b[styles.rootTransitionedTabletAndMobile()] = context.isBeingTransitioned && isTabletOrMobile,
|
|
74
50
|
_b), className), ref: mergeRefs(footerRef, ref) }, rest),
|
|
75
51
|
leadingItems.length > 0 && React.createElement("ul", { className: cx(sideMenuStyles.list(), styles.list()) }, leadingItems),
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
|
-
import { transitionDuration, transitionEasing } from '../SideMenu/SideMenu.js';
|
|
4
3
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
5
4
|
var css = _a.css;
|
|
6
5
|
return ({
|
|
7
6
|
root: function (t) {
|
|
8
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: ", ";\n padding-top: ", ";\n margin: 0 ", ";\n background-color: inherit;\n
|
|
7
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: ", ";\n padding-top: ", ";\n margin: 0 ", ";\n background-color: inherit;\n "], ["\n display: flex;\n flex-direction: column;\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: ", ";\n padding-top: ", ";\n margin: 0 ", ";\n background-color: inherit;\n "])), t.sideMenuFooterPaddingBottom, t.sideMenuFooterPaddingTop, t.sideMenuItemsMarginX);
|
|
9
8
|
},
|
|
10
9
|
rootLarge: function (t) {
|
|
11
10
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-bottom: ", ";\n "], ["\n padding-bottom: ", ";\n "])), t.sideMenuFooterPaddingBottomLarge);
|
|
@@ -14,7 +13,7 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
14
13
|
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-width: 0;\n "], ["\n display: flex;\n flex-direction: column;\n min-width: 0;\n "])));
|
|
15
14
|
},
|
|
16
15
|
trailingRow: function () {
|
|
17
|
-
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n min-width: 0;\n "], ["\n display: flex;\n align-items: center;\n min-width: 0;\n "])));
|
|
16
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: flex-end;\n min-width: 0;\n "], ["\n display: flex;\n align-items: center;\n justify-content: flex-end;\n min-width: 0;\n "])));
|
|
18
17
|
},
|
|
19
18
|
trailingItem: function (t) {
|
|
20
19
|
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n flex: 1 1 auto;\n min-width: 0;\n --side-menu-footer-trailing-reserved-width: calc(\n ", " + ", "\n );\n "], ["\n flex: 1 1 auto;\n min-width: 0;\n --side-menu-footer-trailing-reserved-width: calc(\n ", " + ", "\n );\n "])), t.sideMenuCollapseToggleSize, t.sideMenuCollapseToggleOffsetRight);
|
|
@@ -16,6 +16,7 @@ var SideMenuHeaderInner = forwardRef(function (_a, ref) {
|
|
|
16
16
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
17
17
|
var headerWrapperRef = useRef(null);
|
|
18
18
|
var isTabletOrMobile = context.isTablet || context.isMobile;
|
|
19
|
+
var showDivider = !!context.hasScrollBar && context.scrollState !== 'top';
|
|
19
20
|
var isSeparatedMenuShown = separatedShown(context.state);
|
|
20
21
|
useEffect(function () {
|
|
21
22
|
var _a;
|
|
@@ -26,8 +27,10 @@ var SideMenuHeaderInner = forwardRef(function (_a, ref) {
|
|
|
26
27
|
var styles = useStyles(getStyles);
|
|
27
28
|
var cx = useEmotion().cx;
|
|
28
29
|
return (React.createElement("header", { className: cx(styles.root(theme), (_b = {},
|
|
29
|
-
_b[styles.fixedRoot(theme)] =
|
|
30
|
+
_b[styles.fixedRoot(theme)] = showDivider,
|
|
31
|
+
_b[styles.fixedRootTabletAndMobile(theme)] = showDivider && isTabletOrMobile,
|
|
30
32
|
_b[styles.rootCollapsedDesktop(theme)] = !context.isOpened && !isTabletOrMobile,
|
|
33
|
+
_b[styles.rootOpeningDesktop(theme)] = context.isOpened && !isTabletOrMobile,
|
|
31
34
|
_b[styles.rootTabletAndMobile(theme)] = isTabletOrMobile,
|
|
32
35
|
_b[styles.rootCollapsedTabletAndMobile()] = isTabletOrMobile && !context.isOpened,
|
|
33
36
|
_b[styles.rootWithSeparatedMenuShownMobile(theme)] = context.isOpened && context.isMobile && isSeparatedMenuShown,
|
|
@@ -2,8 +2,10 @@ import type { SideMenuTheme } from '../../lib/theming/ThemeTypes.js';
|
|
|
2
2
|
export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").StylesGetter<{
|
|
3
3
|
root(t: SideMenuTheme): string;
|
|
4
4
|
rootCollapsedDesktop(t: SideMenuTheme): string;
|
|
5
|
+
rootOpeningDesktop(t: SideMenuTheme): string;
|
|
5
6
|
rootTabletAndMobile(t: SideMenuTheme): string;
|
|
6
7
|
rootCollapsedTabletAndMobile(): string;
|
|
7
8
|
rootWithSeparatedMenuShownMobile(t: SideMenuTheme): string;
|
|
8
9
|
fixedRoot(t: SideMenuTheme): string;
|
|
10
|
+
fixedRootTabletAndMobile(t: SideMenuTheme): string;
|
|
9
11
|
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
|
+
import { compactDesktopMenu } from '../SideMenu/SideMenu.styles.js';
|
|
3
4
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
4
5
|
var css = _a.css;
|
|
5
6
|
return ({
|
|
@@ -9,18 +10,24 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
9
10
|
rootCollapsedDesktop: function (t) {
|
|
10
11
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuHeaderPaddingTopCollapsed, t.sideMenuHeaderPaddingBottomCollapsed);
|
|
11
12
|
},
|
|
13
|
+
rootOpeningDesktop: function (t) {
|
|
14
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), compactDesktopMenu(t, "padding-top: ".concat(t.sideMenuHeaderPaddingTopCollapsed, "; padding-bottom: ").concat(t.sideMenuHeaderPaddingBottomCollapsed, ";")));
|
|
15
|
+
},
|
|
12
16
|
rootTabletAndMobile: function (t) {
|
|
13
|
-
return css(
|
|
17
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding-top: ", ";\n margin-left: ", ";\n "], ["\n padding-top: ", ";\n margin-left: ", ";\n "])), t.sideMenuHeaderPaddingTopTabletAndMobile, t.sideMenuHeaderMarginLeftTabletAndMobile);
|
|
14
18
|
},
|
|
15
19
|
rootCollapsedTabletAndMobile: function () {
|
|
16
|
-
return css(
|
|
20
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background: transparent;\n "], ["\n background: transparent;\n "])));
|
|
17
21
|
},
|
|
18
22
|
rootWithSeparatedMenuShownMobile: function (t) {
|
|
19
|
-
return css(
|
|
23
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background: ", ";\n z-index: 9000;\n "], ["\n background: ", ";\n z-index: 9000;\n "])), t.sideMenuSeparatedSubMenuBg);
|
|
20
24
|
},
|
|
21
25
|
fixedRoot: function (t) {
|
|
22
|
-
return css(
|
|
26
|
+
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n &::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-top: 1px solid ", ";\n }\n "], ["\n &::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-top: 1px solid ", ";\n }\n "])), t.sideMenuHeaderDividerColor);
|
|
27
|
+
},
|
|
28
|
+
fixedRootTabletAndMobile: function (t) {
|
|
29
|
+
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n &::after {\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n }\n "], ["\n &::after {\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n }\n "])), t.sideMenuMarginX, t.sideMenuHeaderMarginLeftTabletAndMobile, t.sideMenuHeaderMarginLeftTabletAndMobile, t.sideMenuMarginX);
|
|
23
30
|
},
|
|
24
31
|
});
|
|
25
32
|
});
|
|
26
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
33
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
@@ -5,7 +5,7 @@ export interface CommonClickableElementProps extends CommonProps {
|
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
/** Иконка. */
|
|
7
7
|
icon?: React.ReactElement;
|
|
8
|
-
/** Визуальный маркер. */
|
|
8
|
+
/** Визуальный маркер. Числа больше 99 отображаются как «99+». Строки отображаются как переданы. */
|
|
9
9
|
marker?: ReactNode;
|
|
10
10
|
/** Заголовок элемента. */
|
|
11
11
|
caption?: ReactNode;
|
|
@@ -37,6 +37,8 @@ export interface CommonClickableElementProps extends CommonProps {
|
|
|
37
37
|
_isAvatar?: boolean;
|
|
38
38
|
/** @ignore */
|
|
39
39
|
_isBackButton?: boolean;
|
|
40
|
+
/** @ignore */
|
|
41
|
+
_generatedId?: string;
|
|
40
42
|
}
|
|
41
43
|
export interface ClickableElementProps extends CommonClickableElementProps {
|
|
42
44
|
element: 'a' | 'button' | React.ComponentType<any>;
|