@skbkontur/side-menu 5.0.0-alpha.4 → 5.0.0-beta.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 +26 -0
- package/README.md +2 -2
- package/internal/themes/SideMenuDarkTheme.js +7 -6
- package/internal/themes/SideMenuTheme.d.ts +16 -0
- package/internal/themes/SideMenuTheme.js +38 -8
- package/lib/theming/ThemeHelpers.js +4 -0
- package/package.json +7 -7
- package/src/SideMenu/SideMenu.d.ts +1 -0
- package/src/SideMenu/SideMenu.js +17 -19
- package/src/SideMenu/SideMenu.styles.d.ts +1 -2
- package/src/SideMenu/SideMenu.styles.js +12 -18
- package/src/SideMenuBody/SideMenuBody.js +27 -2
- package/src/SideMenuBody/SideMenuBody.styles.js +2 -2
- package/src/SideMenuDivider/SideMenuDivider.js +4 -2
- package/src/SideMenuDivider/SideMenuDivider.styles.d.ts +1 -0
- package/src/SideMenuDivider/SideMenuDivider.styles.js +6 -3
- package/src/SideMenuDropdown/SideMenuDropdown.styles.js +2 -2
- package/src/SideMenuFooter/SideMenuFooter.js +3 -2
- package/src/SideMenuFooter/SideMenuFooter.styles.js +3 -3
- package/src/SideMenuHeader/SideMenuHeader.styles.js +1 -1
- package/src/SideMenuNotifications/BellWidget.js +13 -6
- package/src/SideMenuNotifications/BellWidgetError.js +6 -3
- package/src/SideMenuNotifications/BellWidgetView.styles.d.ts +7 -4
- package/src/SideMenuNotifications/BellWidgetView.styles.js +20 -9
- package/src/SideMenuNotifications/utils/getWrapperHeightClass.d.ts +11 -0
- package/src/SideMenuNotifications/utils/getWrapperHeightClass.js +10 -0
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +1 -0
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.d.ts +1 -0
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +5 -2
- package/src/internal/ClickableElement.js +13 -9
- package/src/internal/ItemContent/Caption.js +4 -4
- package/src/internal/ItemContent/Caption.styles.d.ts +2 -0
- package/src/internal/ItemContent/Caption.styles.js +13 -7
- package/src/internal/ItemContent/Icon.styles.js +2 -1
- package/src/internal/ItemContent/ItemContent.js +3 -1
- package/src/internal/SideMenuLogotype.js +24 -3
- package/src/internal/SideMenuLogotype.styles.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
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
|
+
# [4.1.0](/compare/@skbkontur/side-menu@4.0.10...@skbkontur/side-menu@4.1.0) (2026-11-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **side-menu:** update @skbkontur/colors to 3.0.0 2c3514a
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [4.0.10](/compare/@skbkontur/side-menu@4.0.9...@skbkontur/side-menu@4.0.10) (2026-09-16)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **SideMenu:** fit BellWidget error layout on small screens fd17bcd
|
|
23
|
+
* **SideMenu:** fit BellWidget height to MobilePopup on mobile dd8c638
|
|
24
|
+
* **SideMenu:** show deprecation warning on sideMenuProductColor var customization a53a9b9
|
|
25
|
+
* **SideMenu:** use isMobile for BellWidget width 19a4233
|
|
26
|
+
* **SideMenu:** use shapeBoldWarning for BellWidgetError icons ee5f199
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
6
32
|
## [4.0.9](/compare/@skbkontur/side-menu@4.0.8...@skbkontur/side-menu@4.0.9) (2026-07-23)
|
|
7
33
|
|
|
8
34
|
|
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ import { IconAttachLinkRegular24 } from '@skbkontur/icons/IconAttachLinkRegular2
|
|
|
48
48
|
<SideMenu.SubItem caption={'Внутренние'} marker/>
|
|
49
49
|
<SideMenu.SubItem caption={'Черновики'}/>
|
|
50
50
|
<SideMenu.SubItem caption={'Удаленные'}/>
|
|
51
|
-
<SideMenu.SubLink caption={'
|
|
51
|
+
<SideMenu.SubLink caption={'Ссылка в подменю'} href={'https://www.google.com/search?q=test'} target={'_blank'}/>
|
|
52
52
|
<SideMenu.SubItemHeader>Согласованные</SideMenu.SubItemHeader>
|
|
53
53
|
<SideMenu.SubItem caption={'Требуют обработки'}/>
|
|
54
54
|
<SideMenu.SubItem caption={'Обработанные'}/>
|
|
@@ -362,7 +362,7 @@ const items = [
|
|
|
362
362
|
`sideMenuTabletMediaQuery = '(min-width: 768px)';`
|
|
363
363
|
`sideMenuMobileMediaQuery = '(min-width: 0px)';`
|
|
364
364
|
|
|
365
|
-
Для того чтобы пропускать
|
|
365
|
+
Для того чтобы пропускать брейкпойнты, достаточно указать значение, равное следующему за ним брейкпойнту.
|
|
366
366
|
Например, в следующем случае у `SideMenu` не будет адаптива для планшетов:
|
|
367
367
|
|
|
368
368
|
`<SideMenu tabletMediaQuery={'(min-width: 768px)'} narrowDesktopMediaQuery={'(min-width: 768px)'}/>`
|
|
@@ -9,25 +9,25 @@ var SideMenuDarkTheme = /** @class */ (function (_super) {
|
|
|
9
9
|
}
|
|
10
10
|
// #region SideMenu
|
|
11
11
|
SideMenuDarkTheme.sideMenuBg = colors.surfaceLow;
|
|
12
|
-
SideMenuDarkTheme.sideMenuBgHover = colors.
|
|
13
|
-
SideMenuDarkTheme.sideMenuBgPressed = colors.
|
|
12
|
+
SideMenuDarkTheme.sideMenuBgHover = colors.shapeFaintNeutralSolid;
|
|
13
|
+
SideMenuDarkTheme.sideMenuBgPressed = colors.shapeFaintNeutralSolidPressed;
|
|
14
14
|
// #endregion
|
|
15
15
|
// #region Divider
|
|
16
16
|
SideMenuDarkTheme.sideMenuDividerBg = colors.lineNeutralFaint;
|
|
17
17
|
// #endregion
|
|
18
18
|
// #region Item
|
|
19
|
-
SideMenuDarkTheme.sideMenuItemBgHover = colors.
|
|
19
|
+
SideMenuDarkTheme.sideMenuItemBgHover = colors.shapeOtherBacklessAlphaHover;
|
|
20
20
|
SideMenuDarkTheme.sideMenuItemBgActive = colors.shapeOtherBase;
|
|
21
21
|
SideMenuDarkTheme.sideMenuItemBgActivePressed = colors.shapeOtherBasePressed;
|
|
22
|
-
SideMenuDarkTheme.sideMenuItemBgPressed = colors.
|
|
22
|
+
SideMenuDarkTheme.sideMenuItemBgPressed = colors.shapeOtherBacklessAlphaPressed;
|
|
23
23
|
SideMenuDarkTheme.sideMenuItemColor = colors.textNeutralHeavy;
|
|
24
24
|
SideMenuDarkTheme.sideMenuItemColorDisabled = colors.textNeutralFaint;
|
|
25
25
|
SideMenuDarkTheme.sideMenuItemBoxShadowColorFocus = colors.lineAccentBold;
|
|
26
|
-
SideMenuDarkTheme.sideMenuSubItemWithSeparatedSubMenuBgHover = colors.
|
|
26
|
+
SideMenuDarkTheme.sideMenuSubItemWithSeparatedSubMenuBgHover = colors.shapeOtherBacklessAlphaHover;
|
|
27
27
|
SideMenuDarkTheme.sideMenuSubItemWithSeparatedSubMenuBgActive = colors.shapeFaintNeutralAlpha;
|
|
28
28
|
SideMenuDarkTheme.sideMenuSubItemWithSeparatedSubMenuBgActiveHover = colors.shapeFaintNeutralAlphaHover;
|
|
29
29
|
SideMenuDarkTheme.sideMenuSubItemWithSeparatedSubMenuBgActivePressed = colors.shapeFaintNeutralAlphaPressed;
|
|
30
|
-
SideMenuDarkTheme.sideMenuSubItemWithSeparatedSubMenuBgPressed = colors.
|
|
30
|
+
SideMenuDarkTheme.sideMenuSubItemWithSeparatedSubMenuBgPressed = colors.shapeOtherBacklessAlphaPressed;
|
|
31
31
|
// #endregion
|
|
32
32
|
// #region Icon
|
|
33
33
|
SideMenuDarkTheme.sideMenuIconSubItemColor = colors.textNeutralSoft;
|
|
@@ -36,6 +36,7 @@ var SideMenuDarkTheme = /** @class */ (function (_super) {
|
|
|
36
36
|
SideMenuDarkTheme.sideMenuMarkerColor = colors.textOnBrandOriginalHeavy;
|
|
37
37
|
SideMenuDarkTheme.sideMenuMarkerBg = colors.shapeBoldBrandOriginal;
|
|
38
38
|
SideMenuDarkTheme.sideMenuMarkerSubItemColor = colors.textNeutralSoft;
|
|
39
|
+
SideMenuDarkTheme.sideMenuSubCaptionColor = colors.textNeutralSoft;
|
|
39
40
|
// #endregion
|
|
40
41
|
// #region SeparatedSubMenu
|
|
41
42
|
SideMenuDarkTheme.sideMenuSeparatedSubMenuBg = colors.surfaceBase;
|
|
@@ -26,6 +26,7 @@ export declare class SideMenuTheme extends BasicThemeClassForExtension {
|
|
|
26
26
|
static sideMenuDividerMarginX: string;
|
|
27
27
|
static get sideMenuDividerMarginLeft(): string;
|
|
28
28
|
static sideMenuDividerSubItemMarginLeft: string;
|
|
29
|
+
static sideMenuDividerMarginLeftInSeparatedSubMenu: string;
|
|
29
30
|
static sideMenuCaptionMarginLeftWithoutIcons: string;
|
|
30
31
|
static sideMenuSubItemCaptionMarginLeftWithoutIcons: string;
|
|
31
32
|
static sideMenuIconSubItemPaddingLeftWithoutIcons: string;
|
|
@@ -107,6 +108,12 @@ export declare class SideMenuTheme extends BasicThemeClassForExtension {
|
|
|
107
108
|
static sideMenuCaptionFontSize: string;
|
|
108
109
|
static sideMenuCaptionFontSizeLarge: string;
|
|
109
110
|
static sideMenuCaptionFontSizeTouchScreen: string;
|
|
111
|
+
static sideMenuSubCaptionFontSize: string;
|
|
112
|
+
static sideMenuSubCaptionLineHeight: string;
|
|
113
|
+
static sideMenuSubCaptionFontSizeLarge: string;
|
|
114
|
+
static sideMenuSubCaptionLineHeightLarge: string;
|
|
115
|
+
static sideMenuSubCaptionMarginTop: string;
|
|
116
|
+
static sideMenuSubCaptionColor: string;
|
|
110
117
|
static get sideMenuCaptionLineHeight(): string;
|
|
111
118
|
static get sideMenuCaptionLineHeightLarge(): string;
|
|
112
119
|
static sideMenuCaptionLineHeightTouchScreen: string;
|
|
@@ -145,6 +152,8 @@ export declare class SideMenuTheme extends BasicThemeClassForExtension {
|
|
|
145
152
|
static sideMenuSubItemHeaderPadding: string;
|
|
146
153
|
static sideMenuSubItemHeaderColorInSeparatedSubMenu: string;
|
|
147
154
|
static sideMenuSubItemHeaderPaddingInSeparatedSubMenu: string;
|
|
155
|
+
static sideMenuSubItemHeaderFontSizeLargeInSeparatedSubMenu: string;
|
|
156
|
+
static sideMenuSubItemHeaderLineHeightLargeInSeparatedSubMenu: string;
|
|
148
157
|
static sideMenuRightBorderWidth: string;
|
|
149
158
|
static sideMenuRightBorderIconColor: string;
|
|
150
159
|
static sideMenuRightBorderIconColorHover: string;
|
|
@@ -160,6 +169,13 @@ export declare class SideMenuTheme extends BasicThemeClassForExtension {
|
|
|
160
169
|
static sideMenuNotificationsMarkerBg: string;
|
|
161
170
|
/** от 400px до 784px */
|
|
162
171
|
static sideMenuNotificationsWrapperHeight: string;
|
|
172
|
+
/**
|
|
173
|
+
* CSS-выражение для вычитания из 100vh на mobile (отступы MobilePopup `@skbkontur/react-ui`).
|
|
174
|
+
*
|
|
175
|
+
* Тема < 6.1: `2 * mobilePopupTopPadding`.
|
|
176
|
+
* Тема ≥ 6.1: `2 * mobilePopupPositionY + 2 * mobilePopupPaddingSmall` (size small).
|
|
177
|
+
*/
|
|
178
|
+
static get sideMenuNotificationsMobilePopupHeightOffset(): string;
|
|
163
179
|
}
|
|
164
180
|
export declare const REACT_UI_SIDE_MENU_THEME_KEY = "__IS_REACT_UI_SIDE_MENU_THEME__";
|
|
165
181
|
export declare const markAsSideMenuTheme: <T extends object>(theme: T) => T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __extends } from "tslib";
|
|
2
2
|
import * as colors from '@skbkontur/colors/tokens-default/light';
|
|
3
3
|
import { BasicThemeClassForExtension } from '@skbkontur/react-ui/internal/themes/BasicTheme';
|
|
4
|
-
import { exposeGetters } from '@skbkontur/react-ui/lib/theming/ThemeHelpers';
|
|
4
|
+
import { exposeGetters, isThemeGTE } from '@skbkontur/react-ui/lib/theming/ThemeHelpers';
|
|
5
5
|
import warning from 'warning';
|
|
6
6
|
var SideMenuTheme = /** @class */ (function (_super) {
|
|
7
7
|
__extends(SideMenuTheme, _super);
|
|
@@ -15,7 +15,7 @@ var SideMenuTheme = /** @class */ (function (_super) {
|
|
|
15
15
|
return this._sideMenuProductColor;
|
|
16
16
|
},
|
|
17
17
|
set: function (value) {
|
|
18
|
-
warning('[SideMenuTheme]: sideMenuProductColor is deprecated. Use @skbkontur/colors or theme variable `sideMenuMarkerBg` instead');
|
|
18
|
+
warning(false, '[SideMenuTheme]: sideMenuProductColor is deprecated. Use @skbkontur/colors or theme variable `sideMenuMarkerBg` instead');
|
|
19
19
|
this._sideMenuProductColor = value;
|
|
20
20
|
},
|
|
21
21
|
enumerable: false,
|
|
@@ -105,6 +105,27 @@ var SideMenuTheme = /** @class */ (function (_super) {
|
|
|
105
105
|
enumerable: false,
|
|
106
106
|
configurable: true
|
|
107
107
|
});
|
|
108
|
+
Object.defineProperty(SideMenuTheme, "sideMenuNotificationsMobilePopupHeightOffset", {
|
|
109
|
+
/**
|
|
110
|
+
* CSS-выражение для вычитания из 100vh на mobile (отступы MobilePopup `@skbkontur/react-ui`).
|
|
111
|
+
*
|
|
112
|
+
* Тема < 6.1: `2 * mobilePopupTopPadding`.
|
|
113
|
+
* Тема ≥ 6.1: `2 * mobilePopupPositionY + 2 * mobilePopupPaddingSmall` (size small).
|
|
114
|
+
*/
|
|
115
|
+
get: function () {
|
|
116
|
+
var _a, _b;
|
|
117
|
+
if (isThemeGTE(this, '6.1')) {
|
|
118
|
+
var theme = this;
|
|
119
|
+
var positionY = (_a = theme.mobilePopupPositionY) !== null && _a !== void 0 ? _a : '16px';
|
|
120
|
+
var paddingSmall = (_b = theme.mobilePopupPaddingSmall) !== null && _b !== void 0 ? _b : '6px';
|
|
121
|
+
// Внешние скобки обязательны: иначе в `calc(100vh - A + B)` B прибавится, а не вычтется.
|
|
122
|
+
return "((2 * ".concat(positionY, ") + (2 * ").concat(paddingSmall, "))");
|
|
123
|
+
}
|
|
124
|
+
return "(2 * ".concat(this.mobilePopupTopPadding, ")");
|
|
125
|
+
},
|
|
126
|
+
enumerable: false,
|
|
127
|
+
configurable: true
|
|
128
|
+
});
|
|
108
129
|
// #region SideMenu
|
|
109
130
|
SideMenuTheme.sideMenuWidth = '232px';
|
|
110
131
|
SideMenuTheme.sideMenuWidthTouchScreen = '328px';
|
|
@@ -114,8 +135,8 @@ var SideMenuTheme = /** @class */ (function (_super) {
|
|
|
114
135
|
SideMenuTheme.sideMenuItemsMarginXCollapsed = '16px';
|
|
115
136
|
SideMenuTheme.sideMenuItemsMarginXCollapsedLarge = '12px';
|
|
116
137
|
SideMenuTheme.sideMenuBg = colors.surfaceLow;
|
|
117
|
-
SideMenuTheme.sideMenuBgHover = colors.
|
|
118
|
-
SideMenuTheme.sideMenuBgPressed = colors.
|
|
138
|
+
SideMenuTheme.sideMenuBgHover = colors.shapeFaintNeutralSolid;
|
|
139
|
+
SideMenuTheme.sideMenuBgPressed = colors.shapeFaintNeutralSolidPressed;
|
|
119
140
|
SideMenuTheme.sideMenuBoxShadow = "\n 4px 0 12px rgba(0, 0, 0, 0.08),\n 12px 0 32px rgba(0, 0, 0, 0.04),\n 16px 0 40px rgba(0, 0, 0, 0.04)\n ";
|
|
120
141
|
SideMenuTheme.sideMenuLineHeight = '20px';
|
|
121
142
|
SideMenuTheme.sideMenuLineHeightLarge = '22px';
|
|
@@ -128,6 +149,7 @@ var SideMenuTheme = /** @class */ (function (_super) {
|
|
|
128
149
|
// #region Divider
|
|
129
150
|
SideMenuTheme.sideMenuDividerMarginX = '8px';
|
|
130
151
|
SideMenuTheme.sideMenuDividerSubItemMarginLeft = '48px';
|
|
152
|
+
SideMenuTheme.sideMenuDividerMarginLeftInSeparatedSubMenu = '12px';
|
|
131
153
|
SideMenuTheme.sideMenuCaptionMarginLeftWithoutIcons = '20px';
|
|
132
154
|
SideMenuTheme.sideMenuSubItemCaptionMarginLeftWithoutIcons = '36px';
|
|
133
155
|
SideMenuTheme.sideMenuIconSubItemPaddingLeftWithoutIcons = '16px';
|
|
@@ -167,19 +189,19 @@ var SideMenuTheme = /** @class */ (function (_super) {
|
|
|
167
189
|
SideMenuTheme.sideMenuItemBorderRadius = '8px';
|
|
168
190
|
SideMenuTheme.sideMenuItemBorderRadiusLarge = '10px';
|
|
169
191
|
SideMenuTheme.sideMenuItemPaddingRight = '12px';
|
|
170
|
-
SideMenuTheme.sideMenuItemBgHover = colors.
|
|
192
|
+
SideMenuTheme.sideMenuItemBgHover = colors.shapeOtherBacklessAlphaHover;
|
|
171
193
|
SideMenuTheme.sideMenuItemBgActive = colors.shapeOtherBase;
|
|
172
194
|
SideMenuTheme.sideMenuItemBgActivePressed = colors.shapeOtherBasePressed;
|
|
173
|
-
SideMenuTheme.sideMenuItemBgPressed = colors.
|
|
195
|
+
SideMenuTheme.sideMenuItemBgPressed = colors.shapeOtherBacklessAlphaPressed;
|
|
174
196
|
SideMenuTheme.sideMenuItemColor = colors.textNeutralHeavy;
|
|
175
197
|
SideMenuTheme.sideMenuItemColorDisabled = colors.textNeutralFaint;
|
|
176
198
|
SideMenuTheme.sideMenuItemBoxShadowColorFocus = colors.lineAccentBold;
|
|
177
199
|
SideMenuTheme.sideMenuItemNestedPaddingLeft = '16px';
|
|
178
|
-
SideMenuTheme.sideMenuSubItemWithSeparatedSubMenuBgHover = colors.
|
|
200
|
+
SideMenuTheme.sideMenuSubItemWithSeparatedSubMenuBgHover = colors.shapeOtherBacklessAlphaHover;
|
|
179
201
|
SideMenuTheme.sideMenuSubItemWithSeparatedSubMenuBgActive = colors.shapeFaintNeutralAlpha;
|
|
180
202
|
SideMenuTheme.sideMenuSubItemWithSeparatedSubMenuBgActiveHover = colors.shapeFaintNeutralAlphaHover;
|
|
181
203
|
SideMenuTheme.sideMenuSubItemWithSeparatedSubMenuBgActivePressed = colors.shapeFaintNeutralAlphaPressed;
|
|
182
|
-
SideMenuTheme.sideMenuSubItemWithSeparatedSubMenuBgPressed = colors.
|
|
204
|
+
SideMenuTheme.sideMenuSubItemWithSeparatedSubMenuBgPressed = colors.shapeOtherBacklessAlphaPressed;
|
|
183
205
|
// #endregion
|
|
184
206
|
// #region ItemContent
|
|
185
207
|
SideMenuTheme.sideMenuItemContentPaddingY = '4px';
|
|
@@ -218,6 +240,12 @@ var SideMenuTheme = /** @class */ (function (_super) {
|
|
|
218
240
|
SideMenuTheme.sideMenuCaptionFontSize = '14px';
|
|
219
241
|
SideMenuTheme.sideMenuCaptionFontSizeLarge = '16px';
|
|
220
242
|
SideMenuTheme.sideMenuCaptionFontSizeTouchScreen = '18px';
|
|
243
|
+
SideMenuTheme.sideMenuSubCaptionFontSize = '12px';
|
|
244
|
+
SideMenuTheme.sideMenuSubCaptionLineHeight = '16px';
|
|
245
|
+
SideMenuTheme.sideMenuSubCaptionFontSizeLarge = '14px';
|
|
246
|
+
SideMenuTheme.sideMenuSubCaptionLineHeightLarge = '20px';
|
|
247
|
+
SideMenuTheme.sideMenuSubCaptionMarginTop = '2px';
|
|
248
|
+
SideMenuTheme.sideMenuSubCaptionColor = colors.textNeutralSoft;
|
|
221
249
|
SideMenuTheme.sideMenuCaptionLineHeightTouchScreen = '24px';
|
|
222
250
|
SideMenuTheme.sideMenuCaptionMultilinePaddingTop = '4px';
|
|
223
251
|
SideMenuTheme.sideMenuCaptionMarginRight = '8px';
|
|
@@ -260,6 +288,8 @@ var SideMenuTheme = /** @class */ (function (_super) {
|
|
|
260
288
|
SideMenuTheme.sideMenuSubItemHeaderPadding = '10px 8px 2px 48px';
|
|
261
289
|
SideMenuTheme.sideMenuSubItemHeaderColorInSeparatedSubMenu = colors.textNeutralPale;
|
|
262
290
|
SideMenuTheme.sideMenuSubItemHeaderPaddingInSeparatedSubMenu = '12px 8px 4px 12px';
|
|
291
|
+
SideMenuTheme.sideMenuSubItemHeaderFontSizeLargeInSeparatedSubMenu = '14px';
|
|
292
|
+
SideMenuTheme.sideMenuSubItemHeaderLineHeightLargeInSeparatedSubMenu = '20px';
|
|
263
293
|
// #endregion
|
|
264
294
|
// #region RightBorder
|
|
265
295
|
SideMenuTheme.sideMenuRightBorderWidth = '16px';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __values } from "tslib";
|
|
2
2
|
import { isDarkTheme } from '@skbkontur/react-ui/lib/theming/ThemeHelpers';
|
|
3
3
|
import { isFunction } from '@skbkontur/react-ui/lib/utils';
|
|
4
|
+
import warning from 'warning';
|
|
4
5
|
import { SideMenuDarkThemeInternal } from '../../internal/themes/SideMenuDarkTheme.js';
|
|
5
6
|
import { SideMenuThemeInternal, isSideMenuTheme, markAsSideMenuTheme } from '../../internal/themes/SideMenuTheme.js';
|
|
6
7
|
import { memo } from '../utils/memo.js';
|
|
@@ -19,6 +20,9 @@ export var createSideMenuTheme = function (theme) {
|
|
|
19
20
|
if (isSideMenuTheme(theme)) {
|
|
20
21
|
return theme;
|
|
21
22
|
}
|
|
23
|
+
if (Object.prototype.hasOwnProperty.call(theme, 'sideMenuProductColor')) {
|
|
24
|
+
warning(false, '[SideMenuTheme]: sideMenuProductColor is deprecated. Use @skbkontur/colors or theme variable `sideMenuMarkerBg` instead');
|
|
25
|
+
}
|
|
22
26
|
var sideMenuTheme = Object.create(theme, Object.assign(Object.getOwnPropertyDescriptors(SideMenuThemeInternal), isDarkTheme(theme) ? Object.getOwnPropertyDescriptors(SideMenuDarkThemeInternal) : {}));
|
|
23
27
|
var _loop_1 = function (key) {
|
|
24
28
|
var descriptor = Object.getOwnPropertyDescriptor(sideMenuTheme, key);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skbkontur/side-menu",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-beta.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Kontur",
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"build:lint:attw": "attw --config-path ../../.attw.json ./dist"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@skbkontur/bell-widget-npm-loader": "^0.3.
|
|
29
|
-
"@skbkontur/colors": "
|
|
30
|
-
"@skbkontur/empty-state": "^2.0
|
|
31
|
-
"@skbkontur/icons": "^2.
|
|
32
|
-
"@skbkontur/react-ui-addons": "^6.0
|
|
28
|
+
"@skbkontur/bell-widget-npm-loader": "^0.3.22",
|
|
29
|
+
"@skbkontur/colors": "^3.0.0",
|
|
30
|
+
"@skbkontur/empty-state": "^2.1.0",
|
|
31
|
+
"@skbkontur/icons": "^2.1.0",
|
|
32
|
+
"@skbkontur/react-ui-addons": "^6.1.0",
|
|
33
33
|
"@skbkontur/widget-consumer-react-utils": "^1.6.12",
|
|
34
34
|
"tslib": "^2.8.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@skbkontur/ui-cdn-components": "^2.1.
|
|
37
|
+
"@skbkontur/ui-cdn-components": "^2.1.10"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@skbkontur/react-ui": ">=6 <7",
|
|
@@ -102,6 +102,7 @@ interface SubComponents {
|
|
|
102
102
|
__KONTUR_REACT_UI__: string;
|
|
103
103
|
}
|
|
104
104
|
export declare const transitionDuration = 200;
|
|
105
|
+
export declare const transitionEasing = "cubic-bezier(0.25, 0.25, 0.4, 1)";
|
|
105
106
|
export declare const burgerTransitionDuration: number;
|
|
106
107
|
export declare const SideMenu: React.ForwardRefExoticComponent<SideMenuProps & React.RefAttributes<HTMLElement>> & SubComponents;
|
|
107
108
|
export {};
|
package/src/SideMenu/SideMenu.js
CHANGED
|
@@ -33,10 +33,11 @@ import { separatedShown } from '../state/selectors.js';
|
|
|
33
33
|
import { ROOT } from '../state/types.js';
|
|
34
34
|
import { getStyles, getCustomStyles } from './SideMenu.styles.js';
|
|
35
35
|
export var transitionDuration = 200; //ms
|
|
36
|
+
export var transitionEasing = 'cubic-bezier(0.25, 0.25, 0.4, 1)';
|
|
36
37
|
export var burgerTransitionDuration = (transitionDuration * 2) / 3;
|
|
37
38
|
var SideMenuInner = forwardRef(function (_a, ref) {
|
|
38
|
-
var _b, _c, _d, _e
|
|
39
|
-
var children = _a.children, activeItem = _a.activeItem,
|
|
39
|
+
var _b, _c, _d, _e;
|
|
40
|
+
var children = _a.children, activeItem = _a.activeItem, _f = _a.size, size = _f === void 0 ? 'small' : _f, _g = _a.isSeparatedMenu, isSeparatedMenu = _g === void 0 ? false : _g, className = _a.className, _h = _a.disableCollapsing, disableCollapsing = _h === void 0 ? false : _h, desktopMediaQuery = _a.desktopMediaQuery, narrowDesktopMediaQuery = _a.narrowDesktopMediaQuery, tabletMediaQuery = _a.tabletMediaQuery, mobileMediaQuery = _a.mobileMediaQuery, _j = _a.showScrollBar, showScrollBar = _j === void 0 ? 'hover' : _j, isOpen = _a.isOpen, isPinned = _a.isPinned, onActiveItemChange = _a.onActiveItemChange, onOpen = _a.onOpen, onClose = _a.onClose, onPinnedValueChange = _a.onPinnedValueChange, rest = __rest(_a, ["children", "activeItem", "size", "isSeparatedMenu", "className", "disableCollapsing", "desktopMediaQuery", "narrowDesktopMediaQuery", "tabletMediaQuery", "mobileMediaQuery", "showScrollBar", "isOpen", "isPinned", "onActiveItemChange", "onOpen", "onClose", "onPinnedValueChange"]);
|
|
40
41
|
var transitionTimer = useRef(null);
|
|
41
42
|
var timerScrollbar = useRef(null);
|
|
42
43
|
var sideMenuRef = useRef(null);
|
|
@@ -44,7 +45,7 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
44
45
|
var contentWrapperRef = useRef(null);
|
|
45
46
|
var scrollContainerRef = useRef(null);
|
|
46
47
|
var childIdCounterRef = useRef(0);
|
|
47
|
-
var
|
|
48
|
+
var _k = __read(useState(0), 2), itemIconsCount = _k[0], setItemIconsCount = _k[1];
|
|
48
49
|
var registerItemIcon = useCallback(function () {
|
|
49
50
|
setItemIconsCount(function (count) { return count + 1; });
|
|
50
51
|
return function () { return setItemIconsCount(function (count) { return count - 1; }); };
|
|
@@ -60,9 +61,9 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
60
61
|
isNarrowDesktopQuery: narrowDesktopMediaQuery || theme.sideMenuNarrowDesktopMediaQuery,
|
|
61
62
|
isDesktopQuery: desktopMediaQuery || theme.sideMenuDesktopMediaQuery,
|
|
62
63
|
};
|
|
63
|
-
var
|
|
64
|
+
var _l = useResponsiveLayout({
|
|
64
65
|
customMediaQueries: customMediaQueries,
|
|
65
|
-
}), isMobileQuery =
|
|
66
|
+
}), isMobileQuery = _l.isMobileQuery, isTabletQuery = _l.isTabletQuery, isNarrowDesktopQuery = _l.isNarrowDesktopQuery, isDesktopQuery = _l.isDesktopQuery;
|
|
66
67
|
var isDesktop = isDesktopQuery;
|
|
67
68
|
var isNarrowDesktop = isNarrowDesktopQuery && !isDesktopQuery;
|
|
68
69
|
var isTablet = isTabletQuery && !isNarrowDesktopQuery;
|
|
@@ -87,13 +88,13 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
87
88
|
var initialIsOpen = isPinned !== undefined ? !isPinned : !isNarrowDesktop;
|
|
88
89
|
// Собственное состояние нужно только без `isOpen`. В управляемом режиме видимое состояние —
|
|
89
90
|
// всегда проп: так оно не расходится с родителем и совпадает на сервере и на первой отрисовке.
|
|
90
|
-
var
|
|
91
|
+
var _m = __read(useState(isDesktop && initialIsOpen), 2), internalIsOpened = _m[0], setInternalIsOpened = _m[1];
|
|
91
92
|
var isOpened = manual ? !!isOpen : internalIsOpened;
|
|
92
|
-
var
|
|
93
|
-
var
|
|
94
|
-
var
|
|
95
|
-
var
|
|
96
|
-
var
|
|
93
|
+
var _o = __read(useState(false), 2), isBeingTransitioned = _o[0], setIsBeingTransitioned = _o[1];
|
|
94
|
+
var _p = __read(useState(0), 2), headerHeight = _p[0], setHeaderHeight = _p[1];
|
|
95
|
+
var _q = __read(useState(0), 2), footerHeight = _q[0], setFooterHeight = _q[1];
|
|
96
|
+
var _r = __read(useState('top'), 2), scrollState = _r[0], setScrollState = _r[1];
|
|
97
|
+
var _s = __read(useState(false), 2), hasScrollBar = _s[0], setHasScrollBar = _s[1];
|
|
97
98
|
var isDesktopNarrow = isDesktopViewport && !isOpened;
|
|
98
99
|
// Кнопка сворачивания не должна требовать наличия футера: если Footer не передан,
|
|
99
100
|
// SideMenu сам рисует внизу область с поведением футера и слотом для кнопки.
|
|
@@ -102,12 +103,12 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
102
103
|
// Всплывание над контентом — только для планшета/мобайла. На десктопе меню остаётся в потоке;
|
|
103
104
|
// вложенные пункты на узком десктопе показываются через NarrowAccordionDropdown.
|
|
104
105
|
var isSideMenuOverContent = isOpened && isTabletOrMobile;
|
|
105
|
-
var
|
|
106
|
+
var _t = useSideMenuReducer({
|
|
106
107
|
activeItem: activeItem,
|
|
107
108
|
isSeparatedMenu: isSeparatedMenu,
|
|
108
109
|
viewport: viewport,
|
|
109
110
|
isOpened: !!isOpened,
|
|
110
|
-
}), machineState =
|
|
111
|
+
}), machineState = _t.state, machineDispatch = _t.dispatch;
|
|
111
112
|
var isSeparatedMenuShown = separatedShown(machineState);
|
|
112
113
|
// Lift state up: notify the parent only when the machine arrives at a new active id.
|
|
113
114
|
// `activeItem`/`onActiveItemChange` are read via refs so this effect's sole trigger is
|
|
@@ -261,11 +262,11 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
261
262
|
return 'never';
|
|
262
263
|
};
|
|
263
264
|
// Анимация задника мобильного меню
|
|
264
|
-
var
|
|
265
|
+
var _u = __read(useAnimateOnMount(!!isTabletOrMobile && !!isOpened, burgerTransitionDuration, {
|
|
265
266
|
opacity: LIGHT_THEME.sidePageBackingBgOpacity,
|
|
266
267
|
}, {
|
|
267
268
|
opacity: 0,
|
|
268
|
-
}), 2), shouldShowBackdrop =
|
|
269
|
+
}), 2), shouldShowBackdrop = _u[0], backdropStyle = _u[1];
|
|
269
270
|
var contextValue = useMemo(function () { return ({
|
|
270
271
|
isOpened: isOpened,
|
|
271
272
|
disableCollapsing: disableCollapsing,
|
|
@@ -361,10 +362,7 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
361
362
|
'--side-menu-scroll-margin-bottom': "".concat(footerHeight, "px"),
|
|
362
363
|
} },
|
|
363
364
|
children,
|
|
364
|
-
!hasFooter && showCollapseToggle &&
|
|
365
|
-
_f[styles.collapseToggleBottomSlotLarge(theme)] = size === 'large',
|
|
366
|
-
_f[styles.itemsContainerCollapsedLarge(theme)] = size === 'large',
|
|
367
|
-
_f)), "data-tid": SideMenuDataTids.footer }))))))))))));
|
|
365
|
+
!hasFooter && showCollapseToggle && React.createElement(SideMenuFooter, null)))))))))));
|
|
368
366
|
});
|
|
369
367
|
SideMenuInner.displayName = 'SideMenu';
|
|
370
368
|
var STATIC_PROPS = {
|
|
@@ -23,8 +23,7 @@ export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").Styl
|
|
|
23
23
|
contentWrapperWithSeparatedSubMenuMobile(t: SideMenuTheme): string;
|
|
24
24
|
contentWrapperCollapsed(): string;
|
|
25
25
|
contentWrapperCollapsedTabletAndMobile(): string;
|
|
26
|
-
|
|
27
|
-
collapseToggleBottomSlotLarge(t: SideMenuTheme): string;
|
|
26
|
+
itemsContainerOpened(t: SideMenuTheme): string;
|
|
28
27
|
itemsContainerCollapsed(t: SideMenuTheme): string;
|
|
29
28
|
itemsContainerCollapsedLarge(t: SideMenuTheme): string;
|
|
30
29
|
list(): string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
|
-
import { burgerTransitionDuration, transitionDuration } from './SideMenu.js';
|
|
3
|
+
import { burgerTransitionDuration, transitionDuration, transitionEasing } from './SideMenu.js';
|
|
4
4
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
5
5
|
var css = _a.css;
|
|
6
6
|
return ({
|
|
7
7
|
root: function () {
|
|
8
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n height: 100%;\n flex-shrink: 0;\n transition: width ", "ms
|
|
8
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n height: 100%;\n flex-shrink: 0;\n transition: width ", "ms ", ";\n "], ["\n position: relative;\n height: 100%;\n flex-shrink: 0;\n transition: width ", "ms ", ";\n "])), transitionDuration, transitionEasing);
|
|
9
9
|
},
|
|
10
10
|
rootCollapsed: function (t) {
|
|
11
11
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), t.sideMenuWidthCollapsed);
|
|
@@ -35,7 +35,7 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
35
35
|
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n box-shadow: ", ";\n "], ["\n box-shadow: ", ";\n "])), t.sideMenuBoxShadow);
|
|
36
36
|
},
|
|
37
37
|
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:\n width ", "ms
|
|
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:\n width ", "ms ", ",\n left ", "ms ", ";\n "], ["\n position: relative;\n box-sizing: border-box;\n\n width: ", ";\n height: 100%;\n\n background: ", ";\n transition:\n width ", "ms ", ",\n left ", "ms ", ";\n "])), t.sideMenuWidth, t.sideMenuBg, transitionDuration, transitionEasing, transitionDuration, transitionEasing);
|
|
39
39
|
},
|
|
40
40
|
containerTouchScreen: function (t) {
|
|
41
41
|
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), t.sideMenuWidthTouchScreen);
|
|
@@ -73,29 +73,23 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
73
73
|
contentWrapperCollapsedTabletAndMobile: function () {
|
|
74
74
|
return css(templateObject_22 || (templateObject_22 = __makeTemplateObject(["\n background: transparent;\n "], ["\n background: transparent;\n "])));
|
|
75
75
|
},
|
|
76
|
-
// Запасной слот кнопки сворачивания, когда Footer не передан: нижняя область меню
|
|
77
|
-
// с поведением футера (растягивается на всю ширину, липнет к низу при прокрутке),
|
|
78
|
-
// где кнопка выравнивается по правому краю — как в trailing-ряду футера.
|
|
79
|
-
collapseToggleBottomSlot: function (t) {
|
|
80
|
-
return css(templateObject_23 || (templateObject_23 = __makeTemplateObject(["\n position: sticky;\n bottom: 0;\n display: flex;\n align-items: flex-end;\n flex-shrink: 0;\n margin: 0 ", ";\n padding-bottom: ", ";\n background-color: inherit;\n "], ["\n position: sticky;\n bottom: 0;\n display: flex;\n align-items: flex-end;\n flex-shrink: 0;\n margin: 0 ", ";\n padding-bottom: ", ";\n background-color: inherit;\n "])), t.sideMenuItemsMarginX, t.sideMenuFooterPaddingBottom);
|
|
81
|
-
},
|
|
82
|
-
collapseToggleBottomSlotLarge: function (t) {
|
|
83
|
-
return css(templateObject_24 || (templateObject_24 = __makeTemplateObject(["\n padding-bottom: ", ";\n "], ["\n padding-bottom: ", ";\n "])), t.sideMenuFooterPaddingBottomLarge);
|
|
84
|
-
},
|
|
85
76
|
// Горизонтальные отступы контейнеров пунктов (Body, Footer) в свёрнутом меню:
|
|
86
77
|
// пункт становится квадратным, а иконка остаётся на месте при сворачивании.
|
|
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
|
+
},
|
|
87
81
|
itemsContainerCollapsed: function (t) {
|
|
88
|
-
return css(
|
|
82
|
+
return css(templateObject_24 || (templateObject_24 = __makeTemplateObject(["\n margin-left: ", ";\n margin-right: ", ";\n "], ["\n margin-left: ", ";\n margin-right: ", ";\n "])), t.sideMenuItemsMarginXCollapsed, t.sideMenuItemsMarginXCollapsed);
|
|
89
83
|
},
|
|
90
84
|
itemsContainerCollapsedLarge: function (t) {
|
|
91
|
-
return css(
|
|
85
|
+
return css(templateObject_25 || (templateObject_25 = __makeTemplateObject(["\n margin-left: ", ";\n margin-right: ", ";\n "], ["\n margin-left: ", ";\n margin-right: ", ";\n "])), t.sideMenuItemsMarginXCollapsedLarge, t.sideMenuItemsMarginXCollapsedLarge);
|
|
92
86
|
},
|
|
93
87
|
// Общие стили для подкомпонентов SideMenu
|
|
94
88
|
list: function () {
|
|
95
|
-
return css(
|
|
89
|
+
return css(templateObject_26 || (templateObject_26 = __makeTemplateObject(["\n list-style: none;\n padding: 0;\n margin: 0;\n "], ["\n list-style: none;\n padding: 0;\n margin: 0;\n "])));
|
|
96
90
|
},
|
|
97
91
|
hidden: function () {
|
|
98
|
-
return css(
|
|
92
|
+
return css(templateObject_27 || (templateObject_27 = __makeTemplateObject(["\n display: none;\n "], ["\n display: none;\n "])));
|
|
99
93
|
},
|
|
100
94
|
});
|
|
101
95
|
});
|
|
@@ -103,8 +97,8 @@ export var getCustomStyles = function (_a) {
|
|
|
103
97
|
var css = _a.css;
|
|
104
98
|
return ({
|
|
105
99
|
rootTabletAndMobile: function (headerHeight) {
|
|
106
|
-
return css(
|
|
100
|
+
return css(templateObject_28 || (templateObject_28 = __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);
|
|
107
101
|
},
|
|
108
102
|
});
|
|
109
103
|
};
|
|
110
|
-
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, templateObject_28
|
|
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, templateObject_28;
|
|
@@ -1,8 +1,11 @@
|
|
|
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';
|
|
2
4
|
import { useEmotion, useStyles } from '@skbkontur/react-ui/lib/renderEnvironment';
|
|
3
5
|
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
4
|
-
import React, { forwardRef, useContext } from 'react';
|
|
6
|
+
import React, { forwardRef, useContext, useLayoutEffect, useRef } from 'react';
|
|
5
7
|
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers.js';
|
|
8
|
+
import { transitionDuration, transitionEasing } from '../SideMenu/SideMenu.js';
|
|
6
9
|
import { getStyles as getSideMenuStyles } from '../SideMenu/SideMenu.styles.js';
|
|
7
10
|
import { SideMenuContext } from '../SideMenuContext.js';
|
|
8
11
|
import { getStyles } from './SideMenuBody.styles.js';
|
|
@@ -14,8 +17,30 @@ var SideMenuBodyInner = forwardRef(function (_a, ref) {
|
|
|
14
17
|
var sideMenuStyles = useStyles(getSideMenuStyles);
|
|
15
18
|
var styles = useStyles(getStyles);
|
|
16
19
|
var cx = useEmotion().cx;
|
|
17
|
-
|
|
20
|
+
var bodyRef = useRef(null);
|
|
21
|
+
var prevTopRef = useRef(null);
|
|
22
|
+
useLayoutEffect(function () {
|
|
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 = {},
|
|
18
42
|
_b[sideMenuStyles.hidden()] = !context.isOpened && (context.isMobile || context.isTablet),
|
|
43
|
+
_b[sideMenuStyles.itemsContainerOpened(theme)] = context.isOpened,
|
|
19
44
|
_b[sideMenuStyles.itemsContainerCollapsed(theme)] = !context.isOpened,
|
|
20
45
|
_b[sideMenuStyles.itemsContainerCollapsedLarge(theme)] = !context.isOpened && context.size === 'large',
|
|
21
46
|
_b)) },
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
|
-
import { transitionDuration } from '../SideMenu/SideMenu.js';
|
|
3
|
+
import { transitionDuration, transitionEasing } from '../SideMenu/SideMenu.js';
|
|
4
4
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
5
5
|
var css = _a.css;
|
|
6
6
|
return ({
|
|
7
7
|
root: function (t) {
|
|
8
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n margin: 0 ", ";\n min-height: 100%;\n transition: margin ", "ms
|
|
8
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n margin: 0 ", ";\n min-height: 100%;\n transition: margin ", "ms ", ";\n "], ["\n flex-grow: 1;\n margin: 0 ", ";\n min-height: 100%;\n transition: margin ", "ms ", ";\n "])), t.sideMenuItemsMarginX, transitionDuration, transitionEasing);
|
|
9
9
|
},
|
|
10
10
|
wrapper: function (t) {
|
|
11
11
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-bottom: ", ";\n "], ["\n padding-bottom: ", ";\n "])), t.sideMenuBodyPaddingBottom);
|
|
@@ -14,11 +14,13 @@ var SideMenuDividerInner = forwardRef(function (_a, ref) {
|
|
|
14
14
|
var context = useContext(SideMenuContext);
|
|
15
15
|
var isLarge = context.size === 'large';
|
|
16
16
|
var isSubItem = !!context.currentItemNestingLevel && !context.isSeparatedMenu;
|
|
17
|
+
var isInSeparatedSubMenu = !!context.currentItemNestingLevel && !!context.isSeparatedMenu;
|
|
17
18
|
return (React.createElement("hr", __assign({ className: cx(styles.root(theme), (_b = {},
|
|
18
|
-
_b[styles.rootOpened(theme)] = context.isOpened,
|
|
19
|
+
_b[styles.rootOpened(theme)] = context.isOpened && !isInSeparatedSubMenu,
|
|
19
20
|
_b[styles.rootSubItem(theme)] = context.isOpened && isSubItem,
|
|
20
|
-
_b[styles.rootWithoutItemIcons(theme)] = context.isOpened && !
|
|
21
|
+
_b[styles.rootWithoutItemIcons(theme)] = context.isOpened && !context.currentItemNestingLevel && !context.hasItemIcons,
|
|
21
22
|
_b[styles.rootSubItemWithoutItemIcons(theme)] = context.isOpened && isSubItem && !context.hasItemIcons,
|
|
23
|
+
_b[styles.rootInSeparatedSubMenu(theme)] = isInSeparatedSubMenu,
|
|
22
24
|
_b[styles.rootLarge(theme)] = isLarge,
|
|
23
25
|
_b), className), ref: ref }, rest)));
|
|
24
26
|
});
|
|
@@ -5,5 +5,6 @@ export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").Styl
|
|
|
5
5
|
rootSubItem(t: SideMenuTheme): string;
|
|
6
6
|
rootWithoutItemIcons(t: SideMenuTheme): string;
|
|
7
7
|
rootSubItemWithoutItemIcons(t: SideMenuTheme): string;
|
|
8
|
+
rootInSeparatedSubMenu(t: SideMenuTheme): string;
|
|
8
9
|
rootLarge(t: SideMenuTheme): string;
|
|
9
10
|
}>;
|
|
@@ -4,7 +4,7 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
4
4
|
var css = _a.css;
|
|
5
5
|
return ({
|
|
6
6
|
root: function (t) {
|
|
7
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height:
|
|
7
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 0;\n border: none;\n border-top: 1px solid ", ";\n margin: ", " ", " ", ";\n "], ["\n height: 0;\n border: none;\n border-top: 1px solid ", ";\n margin: ", " ", " ", ";\n "])), t.sideMenuDividerBg, t.sideMenuDividerMarginTop, t.sideMenuDividerMarginX, t.sideMenuDividerMarginBottom);
|
|
8
8
|
},
|
|
9
9
|
rootOpened: function (t) {
|
|
10
10
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuDividerMarginLeft);
|
|
@@ -18,9 +18,12 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
18
18
|
rootSubItemWithoutItemIcons: function (t) {
|
|
19
19
|
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuSubItemCaptionMarginLeftWithoutIcons);
|
|
20
20
|
},
|
|
21
|
+
rootInSeparatedSubMenu: function (t) {
|
|
22
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuDividerMarginLeftInSeparatedSubMenu);
|
|
23
|
+
},
|
|
21
24
|
rootLarge: function (t) {
|
|
22
|
-
return css(
|
|
25
|
+
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-top: ", ";\n margin-bottom: ", ";\n "], ["\n margin-top: ", ";\n margin-bottom: ", ";\n "])), t.sideMenuDividerMarginTopLarge, t.sideMenuDividerMarginBottomLarge);
|
|
23
26
|
},
|
|
24
27
|
});
|
|
25
28
|
});
|
|
26
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
29
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|