@skbkontur/side-menu 5.0.0-beta.0 → 5.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +1 -1
  3. package/src/SideMenu/SideMenu.js +43 -22
  4. package/src/SideMenu/SideMenu.styles.d.ts +1 -4
  5. package/src/SideMenu/SideMenu.styles.js +18 -30
  6. package/src/SideMenuBody/SideMenuBody.js +4 -28
  7. package/src/SideMenuBody/SideMenuBody.styles.js +1 -2
  8. package/src/SideMenuContext.d.ts +2 -8
  9. package/src/SideMenuDropdown/SideMenuDropdown.js +7 -7
  10. package/src/SideMenuDropdown/SideMenuDropdown.styles.d.ts +0 -1
  11. package/src/SideMenuDropdown/SideMenuDropdown.styles.js +3 -8
  12. package/src/SideMenuFooter/SideMenuFooter.js +6 -30
  13. package/src/SideMenuFooter/SideMenuFooter.styles.js +2 -3
  14. package/src/SideMenuHeader/SideMenuHeader.js +5 -3
  15. package/src/SideMenuHeader/SideMenuHeader.styles.d.ts +1 -0
  16. package/src/SideMenuHeader/SideMenuHeader.styles.js +4 -1
  17. package/src/internal/ClickableElement.d.ts +3 -1
  18. package/src/internal/ClickableElement.js +26 -31
  19. package/src/internal/InnerSubMenu.js +4 -1
  20. package/src/internal/ItemContent/Caption.js +5 -3
  21. package/src/internal/ItemContent/Caption.styles.js +1 -1
  22. package/src/internal/ItemContent/Icon.js +1 -0
  23. package/src/internal/ItemContent/Icon.styles.d.ts +1 -0
  24. package/src/internal/ItemContent/Icon.styles.js +14 -12
  25. package/src/internal/ItemContent/ItemContent.js +27 -8
  26. package/src/internal/ItemContent/ItemContent.styles.d.ts +0 -2
  27. package/src/internal/ItemContent/ItemContent.styles.js +1 -8
  28. package/src/internal/ItemContent/Marker.js +1 -1
  29. package/src/internal/NarrowAccordionDropdown.d.ts +1 -2
  30. package/src/internal/NarrowAccordionDropdown.js +9 -14
  31. package/src/internal/SideMenuLogotype.js +4 -2
  32. package/src/internal/SideMenuLogotype.styles.d.ts +1 -0
  33. package/src/internal/SideMenuLogotype.styles.js +8 -5
  34. package/src/internal/subMenuItems.d.ts +3 -0
  35. package/src/internal/subMenuItems.js +43 -0
  36. 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skbkontur/side-menu",
3
- "version": "5.0.0-beta.0",
3
+ "version": "5.0.0-beta.2",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "author": "Kontur",
@@ -7,7 +7,7 @@ import { mergeRefs } from '@skbkontur/react-ui/lib/mergeRefs';
7
7
  import { useEmotion, useStyles } from '@skbkontur/react-ui/lib/renderEnvironment';
8
8
  import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
9
9
  import { LIGHT_THEME } from '@skbkontur/react-ui/lib/theming/themes/LightTheme';
10
- import React, { forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
10
+ import React, { forwardRef, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
11
11
  import { useAnimateOnMount } from '../../hooks/useAnimateOnMount.js';
12
12
  import { useSideMenuReducer } from '../../hooks/useSideMenuReducer.js';
13
13
  import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers.js';
@@ -41,10 +41,10 @@ var SideMenuInner = forwardRef(function (_a, ref) {
41
41
  var transitionTimer = useRef(null);
42
42
  var timerScrollbar = useRef(null);
43
43
  var sideMenuRef = useRef(null);
44
+ var containerRef = useRef(null);
44
45
  var collapseToggleRef = useRef(null);
45
46
  var contentWrapperRef = useRef(null);
46
47
  var scrollContainerRef = useRef(null);
47
- var childIdCounterRef = useRef(0);
48
48
  var _k = __read(useState(0), 2), itemIconsCount = _k[0], setItemIconsCount = _k[1];
49
49
  var registerItemIcon = useCallback(function () {
50
50
  setItemIconsCount(function (count) { return count + 1; });
@@ -96,6 +96,28 @@ var SideMenuInner = forwardRef(function (_a, ref) {
96
96
  var _r = __read(useState('top'), 2), scrollState = _r[0], setScrollState = _r[1];
97
97
  var _s = __read(useState(false), 2), hasScrollBar = _s[0], setHasScrollBar = _s[1];
98
98
  var isDesktopNarrow = isDesktopViewport && !isOpened;
99
+ var wasDesktopNarrow = useRef(isDesktopNarrow);
100
+ var _t = __read(useState(false), 2), isDesktopOpening = _t[0], setIsDesktopOpening = _t[1];
101
+ useLayoutEffect(function () {
102
+ var _a;
103
+ var justOpened = wasDesktopNarrow.current && isDesktopViewport && isOpened;
104
+ wasDesktopNarrow.current = isDesktopNarrow;
105
+ if (!justOpened ||
106
+ !((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) ||
107
+ window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
108
+ setIsDesktopOpening(false);
109
+ return;
110
+ }
111
+ setIsDesktopOpening(true);
112
+ // A width change can be interrupted by a resize or skipped by the browser.
113
+ var fallback = setTimeout(function () { return setIsDesktopOpening(false); }, transitionDuration + 50);
114
+ return function () { return clearTimeout(fallback); };
115
+ }, [isDesktopNarrow, isDesktopViewport, isOpened]);
116
+ var handleContainerTransitionEnd = function (event) {
117
+ if (event.target === event.currentTarget && event.propertyName === 'width') {
118
+ setIsDesktopOpening(false);
119
+ }
120
+ };
99
121
  // Кнопка сворачивания не должна требовать наличия футера: если Footer не передан,
100
122
  // SideMenu сам рисует внизу область с поведением футера и слотом для кнопки.
101
123
  var hasFooter = flattenChildren(children).some(function (child) { return React.isValidElement(child) && child.type === SideMenuFooter; });
@@ -103,12 +125,12 @@ var SideMenuInner = forwardRef(function (_a, ref) {
103
125
  // Всплывание над контентом — только для планшета/мобайла. На десктопе меню остаётся в потоке;
104
126
  // вложенные пункты на узком десктопе показываются через NarrowAccordionDropdown.
105
127
  var isSideMenuOverContent = isOpened && isTabletOrMobile;
106
- var _t = useSideMenuReducer({
128
+ var _u = useSideMenuReducer({
107
129
  activeItem: activeItem,
108
130
  isSeparatedMenu: isSeparatedMenu,
109
131
  viewport: viewport,
110
132
  isOpened: !!isOpened,
111
- }), machineState = _t.state, machineDispatch = _t.dispatch;
133
+ }), machineState = _u.state, machineDispatch = _u.dispatch;
112
134
  var isSeparatedMenuShown = separatedShown(machineState);
113
135
  // Lift state up: notify the parent only when the machine arrives at a new active id.
114
136
  // `activeItem`/`onActiveItemChange` are read via refs so this effect's sole trigger is
@@ -236,7 +258,7 @@ var SideMenuInner = forwardRef(function (_a, ref) {
236
258
  }
237
259
  transitionTimer.current = setTimeout(function () {
238
260
  setIsBeingTransitioned(false);
239
- }, transitionDuration + 200);
261
+ }, transitionDuration);
240
262
  }
241
263
  };
242
264
  var setIsCollapsedTabletAndMobile = function (isCollapsed) {
@@ -262,17 +284,18 @@ var SideMenuInner = forwardRef(function (_a, ref) {
262
284
  return 'never';
263
285
  };
264
286
  // Анимация задника мобильного меню
265
- var _u = __read(useAnimateOnMount(!!isTabletOrMobile && !!isOpened, burgerTransitionDuration, {
287
+ var _v = __read(useAnimateOnMount(!!isTabletOrMobile && !!isOpened, burgerTransitionDuration, {
266
288
  opacity: LIGHT_THEME.sidePageBackingBgOpacity,
267
289
  }, {
268
290
  opacity: 0,
269
- }), 2), shouldShowBackdrop = _u[0], backdropStyle = _u[1];
291
+ }), 2), shouldShowBackdrop = _v[0], backdropStyle = _v[1];
270
292
  var contextValue = useMemo(function () { return ({
271
293
  isOpened: isOpened,
272
294
  disableCollapsing: disableCollapsing,
273
295
  toggleIsOpened: function () { return setIsCollapsedTabletAndMobile(!!isOpened); },
274
296
  setMenuOpened: setMenuOpened,
275
297
  isBeingTransitioned: isBeingTransitioned,
298
+ isDesktopOpening: isDesktopOpening,
276
299
  isSeparatedMenu: isSeparatedMenu,
277
300
  size: size,
278
301
  isDesktop: isDesktop,
@@ -297,13 +320,13 @@ var SideMenuInner = forwardRef(function (_a, ref) {
297
320
  dispatch: machineDispatch,
298
321
  parentItemId: ROOT,
299
322
  currentItemNestingLevel: 0,
300
- childIdCounterRef: childIdCounterRef,
301
323
  }); }, [
302
324
  isOpened,
303
325
  disableCollapsing,
304
326
  setIsCollapsedTabletAndMobile,
305
327
  setMenuOpened,
306
328
  isBeingTransitioned,
329
+ isDesktopOpening,
307
330
  isSeparatedMenu,
308
331
  size,
309
332
  isDesktop,
@@ -341,7 +364,8 @@ var SideMenuInner = forwardRef(function (_a, ref) {
341
364
  shouldShowBackdrop && React.createElement(Backdrop, { style: backdropStyle }),
342
365
  React.createElement(RenderLayer, { onClickOutside: function () { return setIsCollapsedTabletAndMobile(true); } },
343
366
  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
- React.createElement("div", { className: cx(styles.container(theme), (_d = {},
367
+ React.createElement("div", { ref: containerRef, onTransitionEnd: handleContainerTransitionEnd, className: cx(styles.container(theme), (_d = {},
368
+ _d[styles.containerDesktop()] = isDesktopViewport,
345
369
  _d[styles.containerTouchScreen(theme)] = isTouchScreen,
346
370
  _d[styles.containerCollapsed(theme)] = !isOpened && !isTabletOrMobile,
347
371
  _d[styles.containerCollapsedTabletAndMobile()] = !(isOpened || isBeingTransitioned) && isTabletOrMobile,
@@ -350,19 +374,16 @@ var SideMenuInner = forwardRef(function (_a, ref) {
350
374
  React.createElement(ScrollContainer, { onScrollStateChangeY: function (state) {
351
375
  setScrollState === null || setScrollState === void 0 ? void 0 : setScrollState(state);
352
376
  }, showScrollBar: setScrollBar(), ref: scrollContainerRef },
353
- React.createElement("div", { className: cx(styles.contentClip()) },
354
- React.createElement("div", { className: cx(styles.contentWrapper(theme), (_e = {},
355
- _e[styles.contentWrapperTouchScreen(theme)] = isTouchScreen,
356
- _e[styles.contentWrapperCollapsed()] = !isOpened && !isTabletOrMobile,
357
- _e[styles.contentWrapperCollapsedTabletAndMobile()] = !isOpened && isTabletOrMobile,
358
- _e[styles.contentWrapperOverContent(theme)] = isSideMenuOverContent,
359
- _e[styles.contentWrapperWithSeparatedSubMenuMobile(theme)] = isSeparatedMenuShown && isMobile && (isOpened || isBeingTransitioned),
360
- _e)), ref: contentWrapperRef, style: {
361
- '--side-menu-scroll-margin-top': "".concat(headerHeight, "px"),
362
- '--side-menu-scroll-margin-bottom': "".concat(footerHeight, "px"),
363
- } },
364
- children,
365
- !hasFooter && showCollapseToggle && React.createElement(SideMenuFooter, null)))))))))));
377
+ React.createElement("div", { className: cx(styles.contentWrapper(theme), (_e = {},
378
+ _e[styles.contentWrapperCollapsedTabletAndMobile()] = !isOpened && isTabletOrMobile,
379
+ _e[styles.contentWrapperOverContent(theme)] = isSideMenuOverContent,
380
+ _e[styles.contentWrapperWithSeparatedSubMenuMobile(theme)] = isSeparatedMenuShown && isMobile && (isOpened || isBeingTransitioned),
381
+ _e)), ref: contentWrapperRef, style: {
382
+ '--side-menu-scroll-margin-top': "".concat(headerHeight, "px"),
383
+ '--side-menu-scroll-margin-bottom': "".concat(footerHeight, "px"),
384
+ } },
385
+ children,
386
+ !hasFooter && showCollapseToggle && React.createElement(SideMenuFooter, null))))))))));
366
387
  });
367
388
  SideMenuInner.displayName = 'SideMenu';
368
389
  var STATIC_PROPS = {
@@ -13,17 +13,14 @@ export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").Styl
13
13
  wrapperWithShadow(t: SideMenuTheme): string;
14
14
  container(t: SideMenuTheme): string;
15
15
  containerTouchScreen(t: SideMenuTheme): string;
16
+ containerDesktop(): string;
16
17
  containerCollapsed(t: SideMenuTheme): string;
17
18
  containerCollapsedTabletAndMobile(): string;
18
19
  containerWithSeparatedSubMenuMobile(t: SideMenuTheme): string;
19
- contentClip(): string;
20
20
  contentWrapper(t: SideMenuTheme): string;
21
- contentWrapperTouchScreen(t: SideMenuTheme): string;
22
21
  contentWrapperOverContent(t: SideMenuTheme): string;
23
22
  contentWrapperWithSeparatedSubMenuMobile(t: SideMenuTheme): string;
24
- contentWrapperCollapsed(): string;
25
23
  contentWrapperCollapsedTabletAndMobile(): string;
26
- itemsContainerOpened(t: SideMenuTheme): string;
27
24
  itemsContainerCollapsed(t: SideMenuTheme): string;
28
25
  itemsContainerCollapsedLarge(t: SideMenuTheme): string;
29
26
  list(): string;
@@ -5,7 +5,7 @@ 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 ", ";\n "], ["\n position: relative;\n height: 100%;\n flex-shrink: 0;\n transition: width ", "ms ", ";\n "])), transitionDuration, transitionEasing);
8
+ 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
9
  },
10
10
  rootCollapsed: function (t) {
11
11
  return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), t.sideMenuWidthCollapsed);
@@ -35,61 +35,49 @@ 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 ", ",\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);
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: 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
39
  },
40
40
  containerTouchScreen: function (t) {
41
41
  return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), t.sideMenuWidthTouchScreen);
42
42
  },
43
+ containerDesktop: function () {
44
+ return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n transition:\n width ", "ms ", ",\n left ", "ms ", ";\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n "], ["\n transition:\n width ", "ms ", ",\n left ", "ms ", ";\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n "])), transitionDuration, transitionEasing, transitionDuration, transitionEasing);
45
+ },
43
46
  containerCollapsed: function (t) {
44
- return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n width: ", " !important;\n "], ["\n width: ", " !important;\n "])), t.sideMenuWidthCollapsed);
47
+ return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n width: ", " !important;\n "], ["\n width: ", " !important;\n "])), t.sideMenuWidthCollapsed);
45
48
  },
46
49
  containerCollapsedTabletAndMobile: function () {
47
- return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n background: transparent;\n "], ["\n background: transparent;\n "])));
50
+ return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n background: transparent;\n "], ["\n background: transparent;\n "])));
48
51
  },
49
52
  containerWithSeparatedSubMenuMobile: function (t) {
50
- return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), t.sideMenuSeparatedSubMenuBg);
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 "])));
53
+ return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), t.sideMenuSeparatedSubMenuBg);
57
54
  },
58
55
  contentWrapper: function (t) {
59
- return css(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n\n width: ", ";\n min-height: 100%;\n /* \u041D\u0435 \u0434\u0430\u0451\u043C \u0430\u043D\u0438\u043C\u0438\u0440\u0443\u0435\u043C\u043E\u043C\u0443 \u0444\u0443\u0442\u0435\u0440\u0443 \u0441\u043E\u0437\u0434\u0430\u0432\u0430\u0442\u044C \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0443; \u0432 \u043E\u0442\u043B\u0438\u0447\u0438\u0435 \u043E\u0442 hidden, clip \u043D\u0435 \u043B\u043E\u043C\u0430\u0435\u0442 sticky */\n overflow: clip;\n\n background: ", ";\n transition: background 0.08s;\n "], ["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n\n width: ", ";\n min-height: 100%;\n /* \u041D\u0435 \u0434\u0430\u0451\u043C \u0430\u043D\u0438\u043C\u0438\u0440\u0443\u0435\u043C\u043E\u043C\u0443 \u0444\u0443\u0442\u0435\u0440\u0443 \u0441\u043E\u0437\u0434\u0430\u0432\u0430\u0442\u044C \u043F\u0440\u043E\u043A\u0440\u0443\u0442\u043A\u0443; \u0432 \u043E\u0442\u043B\u0438\u0447\u0438\u0435 \u043E\u0442 hidden, clip \u043D\u0435 \u043B\u043E\u043C\u0430\u0435\u0442 sticky */\n overflow: clip;\n\n background: ", ";\n transition: background 0.08s;\n "])), t.sideMenuWidth, t.sideMenuBg);
60
- },
61
- contentWrapperTouchScreen: function (t) {
62
- return css(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), t.sideMenuWidthTouchScreen);
56
+ return css(templateObject_17 || (templateObject_17 = __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
57
  },
64
58
  contentWrapperOverContent: function (t) {
65
- return css(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), t.sideMenuBgHover);
59
+ return css(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), t.sideMenuBgHover);
66
60
  },
67
61
  contentWrapperWithSeparatedSubMenuMobile: function (t) {
68
- return css(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n background: ", ";\n transition: background 0s;\n "], ["\n background: ", ";\n transition: background 0s;\n "])), t.sideMenuSeparatedSubMenuBg);
69
- },
70
- contentWrapperCollapsed: function () {
71
- return css(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "])));
62
+ return css(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n background: ", ";\n transition: background 0s;\n "], ["\n background: ", ";\n transition: background 0s;\n "])), t.sideMenuSeparatedSubMenuBg);
72
63
  },
73
64
  contentWrapperCollapsedTabletAndMobile: function () {
74
- return css(templateObject_22 || (templateObject_22 = __makeTemplateObject(["\n background: transparent;\n "], ["\n background: transparent;\n "])));
65
+ return css(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n background: transparent;\n "], ["\n background: transparent;\n "])));
75
66
  },
76
67
  // Горизонтальные отступы контейнеров пунктов (Body, Footer) в свёрнутом меню:
77
68
  // пункт становится квадратным, а иконка остаётся на месте при сворачивании.
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
69
  itemsContainerCollapsed: function (t) {
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);
70
+ return css(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n margin-left: ", ";\n margin-right: ", ";\n "], ["\n margin-left: ", ";\n margin-right: ", ";\n "])), t.sideMenuItemsMarginXCollapsed, t.sideMenuItemsMarginXCollapsed);
83
71
  },
84
72
  itemsContainerCollapsedLarge: function (t) {
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);
73
+ return css(templateObject_22 || (templateObject_22 = __makeTemplateObject(["\n margin-left: ", ";\n margin-right: ", ";\n "], ["\n margin-left: ", ";\n margin-right: ", ";\n "])), t.sideMenuItemsMarginXCollapsedLarge, t.sideMenuItemsMarginXCollapsedLarge);
86
74
  },
87
75
  // Общие стили для подкомпонентов SideMenu
88
76
  list: function () {
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 "])));
77
+ return css(templateObject_23 || (templateObject_23 = __makeTemplateObject(["\n list-style: none;\n padding: 0;\n margin: 0;\n "], ["\n list-style: none;\n padding: 0;\n margin: 0;\n "])));
90
78
  },
91
79
  hidden: function () {
92
- return css(templateObject_27 || (templateObject_27 = __makeTemplateObject(["\n display: none;\n "], ["\n display: none;\n "])));
80
+ return css(templateObject_24 || (templateObject_24 = __makeTemplateObject(["\n display: none;\n "], ["\n display: none;\n "])));
93
81
  },
94
82
  });
95
83
  });
@@ -97,8 +85,8 @@ export var getCustomStyles = function (_a) {
97
85
  var css = _a.css;
98
86
  return ({
99
87
  rootTabletAndMobile: function (headerHeight) {
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);
88
+ return css(templateObject_25 || (templateObject_25 = __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
89
  },
102
90
  });
103
91
  };
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;
92
+ 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;
@@ -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, useLayoutEffect, useRef } from 'react';
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 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 = {},
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 transition: margin ", "ms ", ";\n "], ["\n flex-grow: 1;\n margin: 0 ", ";\n min-height: 100%;\n transition: margin ", "ms ", ";\n "])), t.sideMenuItemsMarginX, transitionDuration, transitionEasing);
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);
@@ -1,9 +1,10 @@
1
1
  import type { ScrollContainerScrollStateY } from '@skbkontur/react-ui/components/ScrollContainer';
2
- import type { MutableRefObject, RefObject } from 'react';
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 {
6
6
  isBeingTransitioned?: boolean;
7
+ isDesktopOpening?: boolean;
7
8
  isSeparatedMenu?: boolean;
8
9
  size?: 'small' | 'large';
9
10
  hasSeparatedSubMenu?: boolean;
@@ -37,12 +38,5 @@ export interface SideMenuContextType {
37
38
  openDropdownCount?: number;
38
39
  currentItemNestingLevel?: number;
39
40
  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
41
  }
48
42
  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, _c;
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 _d = __read(useState(false), 2), isMenuOpen = _d[0], setIsMenuOpen = _d[1];
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(), (_b = {}, _b[styles.wrapperCollapsed()] = !context.isOpened, _b), className) },
36
- React.createElement(DropdownMenu, __assign({ ref: ref, caption: React.createElement("div", { className: cx(styles.label(theme), (_c = {},
37
- _c[styles.labelTouchScreen(theme)] = context.isTouchScreen,
38
- _c[styles.labelCollapsed()] = !context.isOpened,
39
- _c)) },
35
+ return (React.createElement("li", { className: cx(styles.wrapper(), className) },
36
+ React.createElement(DropdownMenu, __assign({ ref: ref, width: "100%", 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();
@@ -5,5 +5,4 @@ export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").Styl
5
5
  labelCollapsed(): string;
6
6
  wrapper(): string;
7
7
  collapsedDropdownList(t: SideMenuTheme): string;
8
- wrapperCollapsed(): string;
9
8
  }>;
@@ -1,12 +1,11 @@
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, injectGlobal = _a.injectGlobal;
6
5
  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
6
  return {
8
7
  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 transition: width ", "ms ", ";\n "], ["\n width: calc(\n ", " - 2 * ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n min-width: 0;\n transition: width ", "ms ", ";\n "])), t.sideMenuWidth, t.sideMenuItemsMarginX, transitionDuration, transitionEasing);
8
+ 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 max-width: 100%;\n "], ["\n width: calc(\n ", " - 2 * ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n min-width: 0;\n max-width: 100%;\n "])), t.sideMenuWidth, t.sideMenuItemsMarginX);
10
9
  },
11
10
  labelTouchScreen: function (t) {
12
11
  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 +14,11 @@ export var getStyles = memoizeGetStyles(function (_a) {
15
14
  return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "])));
16
15
  },
17
16
  wrapper: function () {
18
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n overflow-x: hidden;\n min-width: 0;\n /* \u041E\u0431\u043B\u0430\u0441\u0442\u044C \u043E\u0431\u0440\u0435\u0437\u043A\u0438 \u043D\u0430 1px \u0448\u0438\u0440\u0435 \u043F\u0443\u043D\u043A\u0442\u0430, \u0447\u0442\u043E\u0431\u044B \u043D\u0435 \u0441\u0440\u0435\u0437\u0430\u0442\u044C \u0432\u044B\u0441\u0442\u0443\u043F\u0430\u044E\u0449\u0435\u0435 \u043A\u043E\u043B\u044C\u0446\u043E \u0444\u043E\u043A\u0443\u0441\u0430 */\n padding: 1px;\n margin: -1px;\n "], ["\n overflow-x: hidden;\n min-width: 0;\n /* \u041E\u0431\u043B\u0430\u0441\u0442\u044C \u043E\u0431\u0440\u0435\u0437\u043A\u0438 \u043D\u0430 1px \u0448\u0438\u0440\u0435 \u043F\u0443\u043D\u043A\u0442\u0430, \u0447\u0442\u043E\u0431\u044B \u043D\u0435 \u0441\u0440\u0435\u0437\u0430\u0442\u044C \u0432\u044B\u0441\u0442\u0443\u043F\u0430\u044E\u0449\u0435\u0435 \u043A\u043E\u043B\u044C\u0446\u043E \u0444\u043E\u043A\u0443\u0441\u0430 */\n padding: 1px;\n margin: -1px;\n "])));
17
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n min-width: 0;\n "], ["\n min-width: 0;\n "])));
19
18
  },
20
19
  collapsedDropdownList: function (t) {
21
20
  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
21
  },
23
- // В свёрнутом меню подпись скрыта, а бейдж выступает за границы пункта — не обрезаем его
24
- wrapperCollapsed: function () {
25
- return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n overflow: visible;\n "], ["\n overflow: visible;\n "])));
26
- },
27
22
  };
28
23
  });
29
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
24
+ 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, useLayoutEffect, useRef, useState } from 'react';
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.itemsContainerOpened(theme)] = context.isOpened && !isEmpty,
68
- _b[sideMenuStyles.itemsContainerCollapsed(theme)] = !context.isOpened || isEmpty,
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 && !context.isOpened,
72
- _b[styles.rootFixedCollapsedLarge(theme)] = isFixed && !context.isOpened && isLarge,
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 transition: margin ", "ms ", ";\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 transition: margin ", "ms ", ";\n "])), t.sideMenuFooterPaddingBottom, t.sideMenuFooterPaddingTop, t.sideMenuItemsMarginX, transitionDuration, transitionEasing);
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,18 +16,20 @@ 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;
22
23
  if (headerWrapperRef.current) {
23
24
  (_a = context.setHeaderHeight) === null || _a === void 0 ? void 0 : _a.call(context, getDOMRect(headerWrapperRef.current).height);
24
25
  }
25
- }, [context.isOpened]);
26
+ }, [context.isOpened, context.isDesktopOpening]);
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)] = !!context.hasScrollBar && !(context.scrollState === 'top'),
30
- _b[styles.rootCollapsedDesktop(theme)] = !context.isOpened && !isTabletOrMobile,
30
+ _b[styles.fixedRoot(theme)] = showDivider,
31
+ _b[styles.fixedRootTabletAndMobile(theme)] = showDivider && isTabletOrMobile,
32
+ _b[styles.rootCollapsedDesktop(theme)] = (!context.isOpened || context.isDesktopOpening) && !isTabletOrMobile,
31
33
  _b[styles.rootTabletAndMobile(theme)] = isTabletOrMobile,
32
34
  _b[styles.rootCollapsedTabletAndMobile()] = isTabletOrMobile && !context.isOpened,
33
35
  _b[styles.rootWithSeparatedMenuShownMobile(theme)] = context.isOpened && context.isMobile && isSeparatedMenuShown,
@@ -6,4 +6,5 @@ export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").Styl
6
6
  rootCollapsedTabletAndMobile(): string;
7
7
  rootWithSeparatedMenuShownMobile(t: SideMenuTheme): string;
8
8
  fixedRoot(t: SideMenuTheme): string;
9
+ fixedRootTabletAndMobile(t: SideMenuTheme): string;
9
10
  }>;
@@ -21,6 +21,9 @@ export var getStyles = memoizeGetStyles(function (_a) {
21
21
  fixedRoot: function (t) {
22
22
  return css(templateObject_6 || (templateObject_6 = __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);
23
23
  },
24
+ fixedRootTabletAndMobile: function (t) {
25
+ return css(templateObject_7 || (templateObject_7 = __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);
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;