@skbkontur/side-menu 4.0.10-ddcb0.0 → 5.0.0-alpha.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.
Files changed (48) hide show
  1. package/internal/themes/SideMenuDarkTheme.js +6 -0
  2. package/internal/themes/SideMenuTheme.d.ts +28 -3
  3. package/internal/themes/SideMenuTheme.js +43 -12
  4. package/package.json +2 -3
  5. package/src/SideMenu/SideMenu.d.ts +2 -0
  6. package/src/SideMenu/SideMenu.js +74 -27
  7. package/src/SideMenu/SideMenu.styles.d.ts +5 -0
  8. package/src/SideMenu/SideMenu.styles.js +33 -10
  9. package/src/SideMenuAvatar/SideMenuAvatar.js +1 -5
  10. package/src/SideMenuBody/SideMenuBody.js +2 -0
  11. package/src/SideMenuBody/SideMenuBody.styles.js +1 -1
  12. package/src/SideMenuContext.d.ts +5 -0
  13. package/src/SideMenuDivider/SideMenuDivider.js +4 -1
  14. package/src/SideMenuDivider/SideMenuDivider.styles.d.ts +1 -0
  15. package/src/SideMenuDivider/SideMenuDivider.styles.js +5 -2
  16. package/src/SideMenuDropdown/SideMenuDropdown.js +16 -9
  17. package/src/SideMenuDropdown/SideMenuDropdown.styles.d.ts +1 -0
  18. package/src/SideMenuDropdown/SideMenuDropdown.styles.js +13 -8
  19. package/src/SideMenuFooter/SideMenuFooter.js +52 -10
  20. package/src/SideMenuFooter/SideMenuFooter.styles.d.ts +8 -1
  21. package/src/SideMenuFooter/SideMenuFooter.styles.js +32 -10
  22. package/src/SideMenuHeader/SideMenuHeader.js +2 -2
  23. package/src/SideMenuSubItem/SideMenuSubItem.d.ts +1 -1
  24. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +1 -1
  25. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.d.ts +1 -1
  26. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +2 -2
  27. package/src/internal/ClickableElement.d.ts +10 -1
  28. package/src/internal/ClickableElement.js +72 -8
  29. package/src/internal/ClickableElement.styles.d.ts +4 -0
  30. package/src/internal/ClickableElement.styles.js +23 -9
  31. package/src/internal/CollapseToggle.d.ts +2 -1
  32. package/src/internal/CollapseToggle.js +23 -6
  33. package/src/internal/CollapseToggle.styles.d.ts +2 -0
  34. package/src/internal/CollapseToggle.styles.js +9 -2
  35. package/src/internal/ItemContent/Caption.js +1 -0
  36. package/src/internal/ItemContent/Caption.styles.d.ts +1 -0
  37. package/src/internal/ItemContent/Caption.styles.js +16 -13
  38. package/src/internal/ItemContent/Icon.js +2 -0
  39. package/src/internal/ItemContent/Icon.styles.d.ts +2 -0
  40. package/src/internal/ItemContent/Icon.styles.js +14 -8
  41. package/src/internal/ItemContent/Marker.js +8 -2
  42. package/src/internal/ItemContent/Marker.styles.d.ts +3 -0
  43. package/src/internal/ItemContent/Marker.styles.js +16 -5
  44. package/src/internal/NarrowAccordionDropdown.d.ts +3 -1
  45. package/src/internal/NarrowAccordionDropdown.js +11 -10
  46. package/src/internal/SideMenuLogotype.js +3 -3
  47. package/unstable.d.ts +0 -1
  48. package/unstable.js +0 -1
@@ -5,29 +5,43 @@ 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 user-select: text;\n ", ";\n color: ", ";\n width: 100%;\n border-radius: ", ";\n cursor: pointer;\n box-sizing: border-box;\n\n &:hover {\n background: ", ";\n }\n "], ["\n user-select: text;\n ", ";\n color: ", ";\n width: 100%;\n border-radius: ", ";\n cursor: pointer;\n box-sizing: border-box;\n\n &:hover {\n background: ", ";\n }\n "])), resetButton(), t.sideMenuItemColor, t.sideMenuItemBorderRadius, t.sideMenuItemBgHover);
8
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n user-select: text;\n ", ";\n color: ", ";\n width: 100%;\n border-radius: ", ";\n cursor: pointer;\n box-sizing: border-box;\n scroll-margin-top: var(--side-menu-scroll-margin-top, 0);\n scroll-margin-bottom: var(--side-menu-scroll-margin-bottom, 0);\n transition: background ", " ease-out;\n\n &:hover {\n background: ", ";\n }\n "], ["\n user-select: text;\n ", ";\n color: ", ";\n width: 100%;\n border-radius: ", ";\n cursor: pointer;\n box-sizing: border-box;\n scroll-margin-top: var(--side-menu-scroll-margin-top, 0);\n scroll-margin-bottom: var(--side-menu-scroll-margin-bottom, 0);\n transition: background ", " ease-out;\n\n &:hover {\n background: ", ";\n }\n "])), resetButton(), t.sideMenuItemColor, t.sideMenuItemBorderRadius, t.transitionDuration, t.sideMenuItemBgHover);
9
+ },
10
+ rootLarge: function (t) {
11
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: ", ";\n "], ["\n border-radius: ", ";\n "])), t.sideMenuItemBorderRadiusLarge);
9
12
  },
10
13
  rootButton: function (t) {
11
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &:active {\n background: ", ";\n }\n "], ["\n &:active {\n background: ", ";\n }\n "])), t.sideMenuItemBgPressed);
14
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &:active {\n background: ", ";\n }\n "], ["\n &:active {\n background: ", ";\n }\n "])), t.sideMenuItemBgPressed);
12
15
  },
13
16
  rootSubItemInSeparatedSubMenu: function (t) {
14
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &:hover {\n background: ", ";\n }\n "], ["\n &:hover {\n background: ", ";\n }\n "])), t.sideMenuSubItemWithSeparatedSubMenuBgHover);
17
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n &:hover {\n background: ", ";\n }\n "], ["\n &:hover {\n background: ", ";\n }\n "])), t.sideMenuSubItemWithSeparatedSubMenuBgHover);
18
+ },
19
+ rootSubItemInSeparatedSubMenuButton: function (t) {
20
+ // :hover:active — чтобы нажатие не перебивалось :hover из rootSubItemInSeparatedSubMenu,
21
+ // который в итоговом классе идёт позже (одинаковое правило :active из rootButton emotion не дублирует)
22
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n &:hover:active,\n &:active {\n background: ", ";\n }\n "], ["\n &:hover:active,\n &:active {\n background: ", ";\n }\n "])), t.sideMenuSubItemWithSeparatedSubMenuBgPressed);
15
23
  },
16
24
  rootFocus: function (t) {
17
- return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n box-shadow: ", ";\n "], ["\n box-shadow: ", ";\n "])), t.sideMenuItemBoxShadowFocus);
25
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n box-shadow: ", ";\n "], ["\n box-shadow: ", ";\n "])), t.sideMenuItemBoxShadowFocus);
18
26
  },
19
27
  rootDisabled: function (t) {
20
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n color: ", ";\n pointer-events: none;\n "], ["\n color: ", ";\n pointer-events: none;\n "])), t.sideMenuItemColorDisabled);
28
+ return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n color: ", ";\n pointer-events: none;\n "], ["\n color: ", ";\n pointer-events: none;\n "])), t.sideMenuItemColorDisabled);
21
29
  },
22
30
  rootActive: function (t) {
23
- return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background: ", " !important;\n "], ["\n background: ", " !important;\n "])), t.sideMenuItemBgActive);
31
+ return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n background: ", " !important;\n "], ["\n background: ", " !important;\n "])), t.sideMenuItemBgActive);
32
+ },
33
+ rootDropdownOpen: function (t) {
34
+ return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n background: ", " !important;\n "], ["\n background: ", " !important;\n "])), t.sideMenuItemBgHover);
24
35
  },
25
36
  rootSubItemInDropdownActive: function (t) {
26
- return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n background: ", " !important;\n "], ["\n background: ", " !important;\n "])), t.sideMenuItemBgHover);
37
+ return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n background: ", " !important;\n "], ["\n background: ", " !important;\n "])), t.sideMenuItemBgHover);
38
+ },
39
+ rootSubItemInDropdownButton: function (t) {
40
+ return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n &:active {\n background: ", ";\n }\n "], ["\n &:active {\n background: ", ";\n }\n "])), t.sideMenuItemBgPressed);
27
41
  },
28
42
  rootSubItemInSeparatedSubMenuActive: function (t) {
29
- return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n background: ", " !important;\n "], ["\n background: ", " !important;\n "])), t.sideMenuSubItemWithSeparatedSubMenuBgActive);
43
+ return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n background: ", " !important;\n\n &:hover {\n background: ", " !important;\n }\n\n &:active {\n background: ", " !important;\n }\n "], ["\n background: ", " !important;\n\n &:hover {\n background: ", " !important;\n }\n\n &:active {\n background: ", " !important;\n }\n "])), t.sideMenuSubItemWithSeparatedSubMenuBgActive, t.sideMenuSubItemWithSeparatedSubMenuBgActiveHover, t.sideMenuSubItemWithSeparatedSubMenuBgActivePressed);
30
44
  },
31
45
  });
32
46
  });
33
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
47
+ 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;
@@ -1 +1,2 @@
1
- export declare const CollapseToggle: () => JSX.Element;
1
+ import React from 'react';
2
+ export declare const CollapseToggle: () => React.ReactElement | null;
@@ -1,27 +1,44 @@
1
- import { Hint } from '@skbkontur/react-ui/components/Hint/Hint';
1
+ import { __read } from "tslib";
2
2
  import { useEmotion, useStyles } from '@skbkontur/react-ui/lib/renderEnvironment';
3
3
  import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
4
- import React, { useContext } from 'react';
4
+ import React, { useContext, useLayoutEffect, useState } from 'react';
5
+ import ReactDOM from 'react-dom';
5
6
  import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers.js';
6
7
  import { SideMenuDataTids } from '../../SideMenuDataTids.js';
7
8
  import { SideMenuContext } from '../SideMenuContext.js';
9
+ import { ClickableElementWithHint } from './ClickableElement.js';
8
10
  import { getStyles } from './CollapseToggle.styles.js';
9
11
  var SideMenuCollapseIcon = function () {
10
- return (React.createElement("svg", { width: "24", height: "24", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
11
- React.createElement("path", { d: "M7.29951 3.00195L7.29951 17.002M3.69951 17.002H16.2995C17.7907 17.002 18.9995 15.6588 18.9995 14.002V6.00195C18.9995 4.3451 17.7907 3.00195 16.2995 3.00195H3.69951C2.20834 3.00195 0.999512 4.3451 0.999512 6.00195V14.002C0.999512 15.6588 2.20834 17.002 3.69951 17.002Z", stroke: "currentColor", strokeWidth: "1.5" })));
12
+ return (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, fill: "none" },
13
+ React.createElement("path", { stroke: "currentColor", strokeWidth: 1.5, d: "M8.5 19V5M6 19h12a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3H6a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3Z" })));
12
14
  };
13
15
  export var CollapseToggle = function () {
16
+ var _a;
14
17
  var context = useContext(SideMenuContext);
15
18
  var theme = getSideMenuTheme(useContext(ThemeContext));
16
19
  var styles = useStyles(getStyles);
17
20
  var cx = useEmotion().cx;
21
+ var slotRef = context.collapseToggleRef;
22
+ var _b = __read(useState(false), 2), mounted = _b[0], setMounted = _b[1];
23
+ // The slot lives in the Footer, which mounts in the same commit. Refs are assigned
24
+ // before layout effects run, so after this effect the portal target is ready.
25
+ useLayoutEffect(function () {
26
+ setMounted(true);
27
+ }, []);
18
28
  var isOpened = !!context.isOpened;
19
29
  var hintText = isOpened ? 'Свернуть меню' : 'Развернуть меню';
20
30
  var handleClick = function () {
21
31
  var _a;
22
32
  (_a = context.setMenuOpened) === null || _a === void 0 ? void 0 : _a.call(context, !isOpened);
23
33
  };
24
- return (React.createElement(Hint, { text: hintText, pos: 'right' },
25
- React.createElement("button", { type: 'button', className: cx(styles.root(theme)), "aria-label": hintText, "aria-expanded": isOpened, "data-tid": SideMenuDataTids.collapseToggle, onClick: handleClick },
34
+ var button = (React.createElement(ClickableElementWithHint, { hint: hintText, isOpened: false },
35
+ React.createElement("button", { type: 'button', className: cx(styles.root(theme), (_a = {},
36
+ _a[styles.rootOpened(theme)] = isOpened,
37
+ _a[styles.rootLarge(theme)] = context.size === 'large',
38
+ _a)), "aria-label": hintText, "aria-expanded": isOpened, "data-tid": SideMenuDataTids.collapseToggle, onClick: handleClick },
26
39
  React.createElement(SideMenuCollapseIcon, null))));
40
+ if (!mounted || !(slotRef === null || slotRef === void 0 ? void 0 : slotRef.current)) {
41
+ return null;
42
+ }
43
+ return ReactDOM.createPortal(button, slotRef.current);
27
44
  };
@@ -1,4 +1,6 @@
1
1
  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
+ rootOpened(t: SideMenuTheme): string;
5
+ rootLarge(t: SideMenuTheme): string;
4
6
  }>;
@@ -1,12 +1,19 @@
1
1
  import { __makeTemplateObject } from "tslib";
2
2
  import { resetButton } from '@skbkontur/react-ui/lib/styles/Mixins';
3
3
  import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
4
+ import { transitionDuration } from '../SideMenu/SideMenu.js';
4
5
  export var getStyles = memoizeGetStyles(function (_a) {
5
6
  var css = _a.css;
6
7
  return ({
7
8
  root: function (t) {
8
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: ", ";\n flex-shrink: 0;\n border-radius: ", ";\n color: ", ";\n cursor: pointer;\n\n &:hover {\n color: ", ";\n }\n\n &:focus-visible {\n box-shadow: ", ";\n }\n "], ["\n ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: ", ";\n flex-shrink: 0;\n border-radius: ", ";\n color: ", ";\n cursor: pointer;\n\n &:hover {\n color: ", ";\n }\n\n &:focus-visible {\n box-shadow: ", ";\n }\n "])), resetButton(), t.sideMenuCollapseToggleSize, t.sideMenuCollapseToggleSize, t.sideMenuItemBorderRadius, t.sideMenuRightBorderIconColor, t.sideMenuRightBorderIconColorHover, t.sideMenuItemBoxShadowFocus);
9
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: ", ";\n flex-shrink: 0;\n border-radius: ", ";\n color: ", ";\n cursor: pointer;\n transition: background ", " ease-out;\n\n &:hover {\n color: ", ";\n }\n\n &:focus-visible {\n box-shadow: ", ";\n }\n\n svg {\n transition: opacity ", ";\n }\n "], ["\n ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: ", ";\n flex-shrink: 0;\n border-radius: ", ";\n color: ", ";\n cursor: pointer;\n transition: background ", " ease-out;\n\n &:hover {\n color: ", ";\n }\n\n &:focus-visible {\n box-shadow: ", ";\n }\n\n svg {\n transition: opacity ", ";\n }\n "])), resetButton(), t.sideMenuCollapseToggleSize, t.sideMenuCollapseToggleSize, t.sideMenuItemBorderRadius, t.sideMenuRightBorderIconColor, t.transitionDuration, t.sideMenuRightBorderIconColorHover, t.sideMenuItemBoxShadowFocus, transitionDuration);
10
+ },
11
+ rootOpened: function (t) {
12
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n box-sizing: content-box;\n padding-right: ", ";\n "], ["\n box-sizing: content-box;\n padding-right: ", ";\n "])), t.sideMenuCollapseToggleOffsetRight);
13
+ },
14
+ rootLarge: function (t) {
15
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n border-radius: ", ";\n "], ["\n width: ", ";\n height: ", ";\n border-radius: ", ";\n "])), t.sideMenuCollapseToggleSizeLarge, t.sideMenuCollapseToggleSizeLarge, t.sideMenuItemBorderRadiusLarge);
9
16
  },
10
17
  });
11
18
  });
12
- var templateObject_1;
19
+ var templateObject_1, templateObject_2, templateObject_3;
@@ -58,6 +58,7 @@ export var Caption = forwardRef(function (_a, ref) {
58
58
  React.createElement(Component, { className: cx(styles.caption(theme), (_c = {},
59
59
  _c[styles.captionDropdown()] = _isDropdown,
60
60
  _c[styles.captionTruncated()] = isCaptionPlainText && _isDropdown,
61
+ _c[styles.captionWithoutMarker(theme)] = !hasMarker && !_isSubMenu,
61
62
  _c[styles.captionSubItem(theme)] = _isSubMenu,
62
63
  _c[styles.captionSubItemSeparatedMenuTopLevel()] = isSeparatedMenu && !isNestedSubMenu && _isSubMenu && !hasIcon,
63
64
  _c[styles.captionNestedItemSeparatedMenu()] = isSeparatedMenu && isNestedSubMenu && !hasIcon,
@@ -8,6 +8,7 @@ export declare const getStyles: import("../../../lib/theming/ThemeHelpers.js").S
8
8
  rootMultiline(t: SideMenuTheme): string;
9
9
  caption(t: SideMenuTheme): string;
10
10
  captionTouchScreen(t: SideMenuTheme): string;
11
+ captionWithoutMarker(t: SideMenuTheme): string;
11
12
  captionSubItem(t: SideMenuTheme): string;
12
13
  captionSubItemTouchScreen(t: SideMenuTheme): string;
13
14
  captionSubItemSeparatedMenuTopLevel(): string;
@@ -19,42 +19,45 @@ export var getStyles = memoizeGetStyles(function (_a) {
19
19
  captionTouchScreen: function (t) {
20
20
  return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n "], ["\n font-size: ", ";\n line-height: ", ";\n "])), t.sideMenuCaptionFontSizeTouchScreen, t.sideMenuCaptionLineHeightTouchScreen);
21
21
  },
22
+ captionWithoutMarker: function (t) {
23
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-right: ", ";\n "], ["\n margin-right: ", ";\n "])), t.sideMenuItemPaddingRight);
24
+ },
22
25
  captionSubItem: function (t) {
23
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuCaptionSubItemMarginLeft);
26
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuCaptionSubItemMarginLeft);
24
27
  },
25
28
  captionSubItemTouchScreen: function (t) {
26
- return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n "], ["\n font-size: ", ";\n line-height: ", ";\n "])), t.sideMenuCaptionSubItemFontSizeTouchScreen, t.sideMenuCaptionSubItemLineHeightTouchScreen);
29
+ return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n "], ["\n font-size: ", ";\n line-height: ", ";\n "])), t.sideMenuCaptionSubItemFontSizeTouchScreen, t.sideMenuCaptionSubItemLineHeightTouchScreen);
27
30
  },
28
31
  captionSubItemSeparatedMenuTopLevel: function () {
29
- return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin: 0 8px;\n "], ["\n margin: 0 8px;\n "])));
32
+ return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n margin: 0 8px 0 12px;\n "], ["\n margin: 0 8px 0 12px;\n "])));
30
33
  },
31
34
  captionNestedItemSeparatedMenu: function () {
32
- return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n margin-left: 25px;\n "], ["\n margin-left: 25px;\n "])));
35
+ return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n margin-left: 28px;\n "], ["\n margin-left: 28px;\n "])));
33
36
  },
34
37
  captionWithoutItemIcon: function () {
35
- return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n margin-left: 40px;\n "], ["\n margin-left: 40px;\n "])));
38
+ return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n margin-left: 48px;\n "], ["\n margin-left: 48px;\n "])));
36
39
  },
37
40
  captionSubItemWithoutColumnIcons: function () {
38
- return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n margin-left: 8px;\n "], ["\n margin-left: 8px;\n "])));
41
+ return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n margin-left: 12px;\n "], ["\n margin-left: 12px;\n "])));
39
42
  },
40
43
  captionLarge: function (t) {
41
- return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n font-size: ", " !important;\n line-height: ", " !important;\n "], ["\n font-size: ", " !important;\n line-height: ", " !important;\n "])), t.sideMenuCaptionFontSizeLarge, t.sideMenuCaptionLineHeightLarge);
44
+ return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n font-size: ", " !important;\n line-height: ", " !important;\n "], ["\n font-size: ", " !important;\n line-height: ", " !important;\n "])), t.sideMenuCaptionFontSizeLarge, t.sideMenuCaptionLineHeightLarge);
42
45
  },
43
46
  captionInBackButton: function (t) {
44
- return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuBackButtonCaptionFontWeight, t.sideMenuBackButtonCaptionFontSize, t.sideMenuBackButtonCaptionLineHeight, t.sideMenuBackButtonCaptionPaddingY, t.sideMenuBackButtonCaptionPaddingY);
47
+ return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuBackButtonCaptionFontWeight, t.sideMenuBackButtonCaptionFontSize, t.sideMenuBackButtonCaptionLineHeight, t.sideMenuBackButtonCaptionPaddingY, t.sideMenuBackButtonCaptionPaddingY);
45
48
  },
46
49
  captionDropdown: function () {
47
- return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n white-space: nowrap;\n overflow: hidden;\n "], ["\n white-space: nowrap;\n overflow: hidden;\n "])));
50
+ return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n white-space: nowrap;\n overflow: hidden;\n "], ["\n white-space: nowrap;\n overflow: hidden;\n "])));
48
51
  },
49
52
  captionTruncated: function () {
50
- return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n text-overflow: ellipsis;\n &::before {\n float: right;\n content: attr(data-tail);\n }\n "], ["\n text-overflow: ellipsis;\n &::before {\n float: right;\n content: attr(data-tail);\n }\n "])));
53
+ return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n text-overflow: ellipsis;\n &::before {\n float: right;\n content: attr(data-tail);\n }\n "], ["\n text-overflow: ellipsis;\n &::before {\n float: right;\n content: attr(data-tail);\n }\n "])));
51
54
  },
52
55
  captionNoWrap: function () {
53
- return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n "], ["\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n "])));
56
+ return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n "], ["\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n "])));
54
57
  },
55
58
  captionNoWrapWithMarker: function (t) {
56
- return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n margin: 0 ", " 0 0;\n "], ["\n margin: 0 ", " 0 0;\n "])), t.sideMenuCaptionNoWrapWithMarkerMarginRight);
59
+ return css(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n margin: 0 ", " 0 0;\n "], ["\n margin: 0 ", " 0 0;\n "])), t.sideMenuCaptionNoWrapWithMarkerMarginRight);
57
60
  },
58
61
  });
59
62
  });
60
- 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;
63
+ 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;
@@ -36,6 +36,8 @@ export var Icon = function (_a) {
36
36
  return (React.createElement("span", { className: cx(styles.root(theme), (_b = {},
37
37
  _b[styles.rootMultiline()] = isMultiline && (isOpened || _isSubMenu),
38
38
  _b[styles.rootLarge(theme)] = isLarge,
39
+ _b[styles.rootCollapsed(theme)] = !isOpened && !_isSubMenu,
40
+ _b[styles.rootCollapsedLarge(theme)] = !isOpened && !_isSubMenu && isLarge,
39
41
  _b[styles.rootSubItem(theme)] = _isSubMenu,
40
42
  _b[styles.rootSubItemDropdown()] = _isSubMenu && !isOpened && !isSeparatedMenu,
41
43
  _b[styles.rootSubItemSeparatedMenu(theme)] = isSeparatedMenu && _isSubMenu,
@@ -1,6 +1,8 @@
1
1
  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
+ rootCollapsed(t: SideMenuTheme): string;
5
+ rootCollapsedLarge(t: SideMenuTheme): string;
4
6
  rootMultiline(): string;
5
7
  rootLarge(t: SideMenuTheme): string;
6
8
  rootSubItemLarge(t: SideMenuTheme): string;
@@ -6,27 +6,33 @@ export var getStyles = memoizeGetStyles(function (_a) {
6
6
  root: function (t) {
7
7
  return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin: ", " ", " ", " ", ";\n min-height: ", ";\n line-height: ", ";\n flex-shrink: 0;\n box-sizing: content-box;\n "], ["\n display: flex;\n align-items: center;\n margin: ", " ", " ", " ", ";\n min-height: ", ";\n line-height: ", ";\n flex-shrink: 0;\n box-sizing: content-box;\n "])), t.sideMenuIconMarginY, t.sideMenuIconMarginRight, t.sideMenuIconMarginY, t.sideMenuIconMarginLeft, t.sideMenuIconMinHeight, t.sideMenuIconLineHeight);
8
8
  },
9
+ rootCollapsed: function (t) {
10
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuIconMarginLeftCollapsed);
11
+ },
12
+ rootCollapsedLarge: function (t) {
13
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin-left: ", ";\n margin-right: ", ";\n "], ["\n margin-left: ", ";\n margin-right: ", ";\n "])), t.sideMenuIconMarginXCollapsedLarge, t.sideMenuIconMarginXCollapsedLarge);
14
+ },
9
15
  rootMultiline: function () {
10
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: flex-start;\n margin-top: -2px;\n "], ["\n align-self: flex-start;\n margin-top: -2px;\n "])));
16
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n align-self: flex-start;\n margin-top: -2px;\n "], ["\n align-self: flex-start;\n margin-top: -2px;\n "])));
11
17
  },
12
18
  rootLarge: function (t) {
13
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n min-height: ", ";\n line-height: ", ";\n margin-top: 0;\n "], ["\n min-height: ", ";\n line-height: ", ";\n margin-top: 0;\n "])), t.sideMenuIconMinHeightLarge, t.sideMenuIconLineHeightLarge);
19
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n min-height: ", ";\n line-height: ", ";\n margin-top: 0;\n "], ["\n min-height: ", ";\n line-height: ", ";\n margin-top: 0;\n "])), t.sideMenuIconMinHeightLarge, t.sideMenuIconLineHeightLarge);
14
20
  },
15
21
  rootSubItemLarge: function (t) {
16
- return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n min-height: ", ";\n "], ["\n min-height: ", ";\n "])), t.sideMenuIconSubItemMinHeightLarge);
22
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n min-height: ", ";\n "], ["\n min-height: ", ";\n "])), t.sideMenuIconSubItemMinHeightLarge);
17
23
  },
18
24
  rootSubItem: function (t) {
19
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin: 0;\n padding-left: ", ";\n padding-right: ", ";\n min-height: ", ";\n line-height: ", ";\n "], ["\n margin: 0;\n padding-left: ", ";\n padding-right: ", ";\n min-height: ", ";\n line-height: ", ";\n "])), t.sideMenuIconSubItemPaddingLeft, t.sideMenuIconSubItemPaddingRight, t.sideMenuIconSubItemMinHeight, t.sideMenuIconSubItemLineHeight);
25
+ return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin: 0;\n padding-left: ", ";\n padding-right: ", ";\n min-height: ", ";\n line-height: ", ";\n "], ["\n margin: 0;\n padding-left: ", ";\n padding-right: ", ";\n min-height: ", ";\n line-height: ", ";\n "])), t.sideMenuIconSubItemPaddingLeft, t.sideMenuIconSubItemPaddingRight, t.sideMenuIconSubItemMinHeight, t.sideMenuIconSubItemLineHeight);
20
26
  },
21
27
  rootSubItemDropdown: function () {
22
- return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-left: 0;\n "], ["\n padding-left: 0;\n "])));
28
+ return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n padding-left: 0;\n "], ["\n padding-left: 0;\n "])));
23
29
  },
24
30
  rootSubItemSeparatedMenu: function (t) {
25
- return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-left: ", ";\n "], ["\n padding-left: ", ";\n "])), t.sideMenuIconWithSeparatedSubMenuSubItemPaddingLeft);
31
+ return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n padding-left: ", ";\n "], ["\n padding-left: ", ";\n "])), t.sideMenuIconWithSeparatedSubMenuSubItemPaddingLeft);
26
32
  },
27
33
  rootBackButton: function (t) {
28
- return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n padding-left: ", ";\n padding-right: ", ";\n "], ["\n padding-left: ", ";\n padding-right: ", ";\n "])), t.sideMenuBackButtonIconPaddingLeft, t.sideMenuBackButtonIconPaddingRight);
34
+ return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n padding-left: ", ";\n padding-right: ", ";\n "], ["\n padding-left: ", ";\n padding-right: ", ";\n "])), t.sideMenuBackButtonIconPaddingLeft, t.sideMenuBackButtonIconPaddingRight);
29
35
  },
30
36
  });
31
37
  });
32
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
38
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
@@ -2,6 +2,7 @@ import { useEmotion, useStyles } from '@skbkontur/react-ui/lib/renderEnvironment
2
2
  import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
3
3
  import React, { useContext } from 'react';
4
4
  import { getSideMenuTheme } from '../../../lib/theming/ThemeHelpers.js';
5
+ import { SideMenuContext } from '../../SideMenuContext.js';
5
6
  import { getStyles } from './Marker.styles.js';
6
7
  export var Marker = function (_a) {
7
8
  var _b;
@@ -10,12 +11,17 @@ export var Marker = function (_a) {
10
11
  var styles = useStyles(getStyles);
11
12
  var cx = useEmotion().cx;
12
13
  var isEmpty = marker === true || marker === '';
14
+ var isLarge = useContext(SideMenuContext).size === 'large';
15
+ var isCollapsedItem = !_isSubMenu && isCollapsed;
13
16
  return (React.createElement("span", { className: cx(styles.root(theme), (_b = {},
14
17
  _b[styles.rootEmpty(theme)] = isEmpty,
15
18
  _b[styles.rootMultiline(theme)] = isMultiline,
16
19
  _b[styles.rootSubMenu(theme)] = _isSubMenu,
17
20
  _b[styles.rootSubMenuEmpty(theme)] = _isSubMenu && isEmpty,
18
- _b[styles.rootCollapsed()] = !_isSubMenu && isCollapsed,
19
- _b[styles.rootEmptyCollapsed()] = !_isSubMenu && isEmpty && isCollapsed,
21
+ _b[styles.rootSubMenuLarge(theme)] = _isSubMenu && !isEmpty && isLarge,
22
+ _b[styles.rootCollapsed()] = isCollapsedItem,
23
+ _b[styles.rootCollapsedLarge()] = isCollapsedItem && isLarge,
24
+ _b[styles.rootEmptyCollapsed()] = isCollapsedItem && isEmpty,
25
+ _b[styles.rootEmptyCollapsedLarge()] = isCollapsedItem && isEmpty && isLarge,
20
26
  _b)) }, marker));
21
27
  };
@@ -5,6 +5,9 @@ export declare const getStyles: import("../../../lib/theming/ThemeHelpers.js").S
5
5
  rootMultiline(t: SideMenuTheme): string;
6
6
  rootSubMenu(t: SideMenuTheme): string;
7
7
  rootSubMenuEmpty(t: SideMenuTheme): string;
8
+ rootSubMenuLarge(t: SideMenuTheme): string;
8
9
  rootCollapsed(): string;
10
+ rootCollapsedLarge(): string;
9
11
  rootEmptyCollapsed(): string;
12
+ rootEmptyCollapsedLarge(): string;
10
13
  }>;
@@ -13,17 +13,28 @@ export var getStyles = memoizeGetStyles(function (_a) {
13
13
  return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n align-self: flex-start;\n margin-top: ", ";\n "], ["\n align-self: flex-start;\n margin-top: ", ";\n "])), t.sideMenuMarkerMultilineMarginTop);
14
14
  },
15
15
  rootSubMenu: function (t) {
16
- return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background: transparent;\n color: ", ";\n font-weight: ", ";\n "], ["\n background: transparent;\n color: ", ";\n font-weight: ", ";\n "])), t.sideMenuMarkerSubItemColor, t.sideMenuMarkerSubItemFontWeight);
16
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin-right: ", ";\n background: transparent;\n color: ", ";\n font-weight: ", ";\n "], ["\n margin-right: ", ";\n background: transparent;\n color: ", ";\n font-weight: ", ";\n "])), t.sideMenuMarkerSubItemMarginRight, t.sideMenuMarkerSubItemColor, t.sideMenuMarkerSubItemFontWeight);
17
17
  },
18
18
  rootSubMenuEmpty: function (t) {
19
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), t.sideMenuMarkerBg);
19
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-right: ", ";\n background: ", ";\n "], ["\n margin-right: ", ";\n background: ", ";\n "])), t.sideMenuMarkerSubItemEmptyMarginRight, t.sideMenuMarkerBg);
20
20
  },
21
+ rootSubMenuLarge: function (t) {
22
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n "], ["\n font-size: ", ";\n line-height: ", ";\n "])), t.sideMenuMarkerSubItemFontSizeLarge, t.sideMenuMarkerSubItemLineHeightLarge);
23
+ },
24
+ // В свёрнутом меню бейдж позиционируется относительно центра пункта (т.е. иконки),
25
+ // чтобы не отрываться от неё при любом размере пункта.
21
26
  rootCollapsed: function () {
22
- return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: absolute;\n right: 0;\n top: 0;\n margin: 0;\n "], ["\n position: absolute;\n right: 0;\n top: 0;\n margin: 0;\n "])));
27
+ return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: absolute;\n left: calc(50% + 13px);\n top: 0;\n transform: translateX(-50%);\n margin: 0;\n "], ["\n position: absolute;\n left: calc(50% + 13px);\n top: 0;\n transform: translateX(-50%);\n margin: 0;\n "])));
28
+ },
29
+ rootCollapsedLarge: function () {
30
+ return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n top: 3px;\n "], ["\n top: 3px;\n "])));
23
31
  },
24
32
  rootEmptyCollapsed: function () {
25
- return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n right: 4px;\n top: 4px;\n "], ["\n right: 4px;\n top: 4px;\n "])));
33
+ return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n left: calc(50% + 12px);\n top: 4px;\n "], ["\n left: calc(50% + 12px);\n top: 4px;\n "])));
34
+ },
35
+ rootEmptyCollapsedLarge: function () {
36
+ return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n top: 8px;\n "], ["\n top: 8px;\n "])));
26
37
  },
27
38
  });
28
39
  });
29
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
40
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
@@ -5,9 +5,11 @@ interface NarrowAccordionDropdownProps {
5
5
  htmlId: string;
6
6
  'aria-label'?: string;
7
7
  childIdCounterRef?: React.MutableRefObject<number>;
8
+ disabled?: boolean;
9
+ onOpenChange?: (isOpen: boolean) => void;
8
10
  }
9
11
  export declare const NarrowAccordionDropdown: {
10
- ({ caption, children, htmlId, "aria-label": ariaLabel, childIdCounterRef, }: NarrowAccordionDropdownProps): JSX.Element;
12
+ ({ caption, children, htmlId, "aria-label": ariaLabel, childIdCounterRef, disabled, onOpenChange, }: NarrowAccordionDropdownProps): JSX.Element;
11
13
  displayName: string;
12
14
  };
13
15
  export {};
@@ -9,9 +9,9 @@ import { getStyles as getSideMenuStyles } from '../SideMenu/SideMenu.styles.js';
9
9
  import { SideMenuContext } from '../SideMenuContext.js';
10
10
  import { getStyles as getDropdownStyles } from '../SideMenuDropdown/SideMenuDropdown.styles.js';
11
11
  export var NarrowAccordionDropdown = function (_a) {
12
- var _b;
13
- var _c;
14
- var caption = _a.caption, children = _a.children, htmlId = _a.htmlId, ariaLabel = _a["aria-label"], childIdCounterRef = _a.childIdCounterRef;
12
+ var _b, _c;
13
+ var _d;
14
+ var caption = _a.caption, children = _a.children, htmlId = _a.htmlId, ariaLabel = _a["aria-label"], childIdCounterRef = _a.childIdCounterRef, disabled = _a.disabled, onOpenChange = _a.onOpenChange;
15
15
  var context = useContext(SideMenuContext);
16
16
  var theme = getSideMenuTheme(useContext(ThemeContext));
17
17
  var sideMenuStyles = useStyles(getSideMenuStyles);
@@ -19,16 +19,17 @@ export var NarrowAccordionDropdown = function (_a) {
19
19
  var dropdownStyles = useStyles(getDropdownStyles);
20
20
  var dropdownMenuRef = useRef(null);
21
21
  var isMenuCollapsed = !context.isOpened && (context.isDesktop || context.isNarrowDesktop);
22
- return (React.createElement("div", { className: cx(dropdownStyles.wrapper()) },
23
- React.createElement(DropdownMenu, { ref: dropdownMenuRef, caption: React.createElement("div", { className: cx(dropdownStyles.label(theme), (_b = {},
24
- _b[dropdownStyles.labelTouchScreen(theme)] = context.isTouchScreen,
25
- _b[dropdownStyles.labelCollapsed()] = isMenuCollapsed,
26
- _b)) }, caption), positions: ['right top', 'right middle', 'right bottom'], disableAnimations: true, popupMenuId: htmlId, "aria-label": ariaLabel, onOpen: function () {
22
+ return (React.createElement("div", { className: cx(dropdownStyles.wrapper(), (_b = {}, _b[dropdownStyles.wrapperCollapsed()] = isMenuCollapsed, _b)) },
23
+ React.createElement(DropdownMenu, { ref: dropdownMenuRef, caption: React.createElement("div", { className: cx(dropdownStyles.label(theme), (_c = {},
24
+ _c[dropdownStyles.labelTouchScreen(theme)] = context.isTouchScreen,
25
+ _c[dropdownStyles.labelCollapsed()] = isMenuCollapsed,
26
+ _c)), onClick: disabled ? function (e) { return e.stopPropagation(); } : undefined }, caption), positions: ['right top', 'right middle', 'right bottom'], disableAnimations: true, popupMenuId: htmlId, "aria-label": ariaLabel, onOpen: function () {
27
27
  if (childIdCounterRef) {
28
28
  childIdCounterRef.current = 0;
29
29
  }
30
- } },
30
+ onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(true);
31
+ }, onClose: function () { return onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false); } },
31
32
  React.createElement("ul", { className: cx(sideMenuStyles.list()), "data-tid": SideMenuDataTids.narrowAccordionDropdown },
32
- React.createElement(SideMenuContext.Provider, { value: __assign(__assign({}, context), { hasSeparatedSubMenu: false, parentItemId: htmlId, currentItemNestingLevel: ((_c = context.currentItemNestingLevel) !== null && _c !== void 0 ? _c : 0) + 1, closeParentDropdown: function () { var _a; return (_a = dropdownMenuRef.current) === null || _a === void 0 ? void 0 : _a.close(); }, childIdCounterRef: childIdCounterRef !== null && childIdCounterRef !== void 0 ? childIdCounterRef : context.childIdCounterRef }) }, children)))));
33
+ React.createElement(SideMenuContext.Provider, { value: __assign(__assign({}, context), { hasSeparatedSubMenu: false, parentItemId: htmlId, currentItemNestingLevel: ((_d = context.currentItemNestingLevel) !== null && _d !== void 0 ? _d : 0) + 1, closeParentDropdown: function () { var _a; return (_a = dropdownMenuRef.current) === null || _a === void 0 ? void 0 : _a.close(); }, childIdCounterRef: childIdCounterRef !== null && childIdCounterRef !== void 0 ? childIdCounterRef : context.childIdCounterRef }) }, children)))));
33
34
  };
34
35
  NarrowAccordionDropdown.displayName = 'NarrowAccordionDropdown';
@@ -2,7 +2,7 @@ import { __assign, __read, __rest } from "tslib";
2
2
  import { Logotype } from '@skbkontur/react-ui-addons/components/Logotype/Logotype';
3
3
  import { useEmotion, useStyles } from '@skbkontur/react-ui/lib/renderEnvironment';
4
4
  import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
5
- import React, { forwardRef, useContext, useEffect, useRef, useState } from 'react';
5
+ import React, { forwardRef, useContext, useLayoutEffect, useRef, useState } from 'react';
6
6
  import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers.js';
7
7
  import { SideMenuContext } from '../SideMenuContext.js';
8
8
  import { Burger } from './Burger.js';
@@ -44,12 +44,12 @@ var SideMenuLogotype = forwardRef(function (_a, ref) {
44
44
  var productName = getProductName(productLogo);
45
45
  var refLogotype = useRef(null);
46
46
  var _e = __read(useState(28), 2), size = _e[0], setSize = _e[1];
47
- var _f = __read(useState(false), 2), isSizeCalculated = _f[0], setIsSizeCalculated = _f[1];
47
+ var _f = __read(useState(true), 2), isSizeCalculated = _f[0], setIsSizeCalculated = _f[1];
48
48
  var _g = __read(useState(getStaticIconPath(productName)), 2), productIconUrl = _g[0], setProductIconUrl = _g[1];
49
49
  var isTabletOrMobile = context.isTablet || context.isMobile;
50
50
  var isDesktopCollapsedMode = !context.isOpened && (context.isDesktop || context.isNarrowDesktop);
51
51
  var sideMenuWidth = theme.sideMenuWidth, sideMenuMarginX = theme.sideMenuMarginX, sideMenuLogotypePaddingLeft = theme.sideMenuLogotypePaddingLeft;
52
- useEffect(function () {
52
+ useLayoutEffect(function () {
53
53
  var _a, _b;
54
54
  var logotypeWidth = (_b = (_a = refLogotype.current) === null || _a === void 0 ? void 0 : _a.logotypeRef) === null || _b === void 0 ? void 0 : _b.clientWidth;
55
55
  var maxWidth = parseInt(sideMenuWidth, 10) -
package/unstable.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './src/SideMenuContext.js';
package/unstable.js DELETED
@@ -1 +0,0 @@
1
- export * from './src/SideMenuContext.js';