@skbkontur/side-menu 0.9.5 → 0.10.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 (86) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +90 -9
  3. package/hooks/useActiveState.js +1 -1
  4. package/hooks/useNumberOfTextLinesInItem.d.ts +12 -1
  5. package/hooks/useNumberOfTextLinesInItem.js +45 -30
  6. package/hooks/useNumberOfTextLinesInSubItem.d.ts +2 -1
  7. package/hooks/useNumberOfTextLinesInSubItem.js +2 -2
  8. package/hooks/useOpenedState.js +1 -1
  9. package/hooks/useOpenedSubElementState.js +1 -1
  10. package/internal/themes/SideMenuTheme.d.ts +110 -0
  11. package/internal/themes/SideMenuTheme.js +234 -0
  12. package/lib/theming/ThemeHelpers.d.ts +18 -0
  13. package/lib/theming/ThemeHelpers.js +66 -0
  14. package/lib/theming/ThemeTypes.d.ts +3 -0
  15. package/lib/theming/ThemeTypes.js +0 -0
  16. package/lib/utils/memo.d.ts +1 -0
  17. package/lib/utils/memo.js +9 -0
  18. package/{utils → lib/utils}/scripts.d.ts +1 -2
  19. package/{utils → lib/utils}/scripts.js +0 -8
  20. package/package.json +2 -2
  21. package/src/SideMenu/SideMenu.js +40 -36
  22. package/src/SideMenu/SideMenu.styles.d.ts +12 -14
  23. package/src/SideMenu/SideMenu.styles.js +29 -31
  24. package/src/SideMenuAvatar/SideMenuAvatar.md +7 -0
  25. package/src/SideMenuBody/SideMenuBody.d.ts +1 -2
  26. package/src/SideMenuBody/SideMenuBody.js +16 -9
  27. package/src/SideMenuBody/SideMenuBody.md +7 -0
  28. package/src/SideMenuBody/SideMenuBody.styles.d.ts +2 -1
  29. package/src/SideMenuBody/SideMenuBody.styles.js +4 -4
  30. package/src/SideMenuContext.d.ts +3 -2
  31. package/src/SideMenuDivider/SideMenuDivider.md +7 -0
  32. package/src/SideMenuDivider/SideMenuDivider.styles.js +2 -1
  33. package/src/SideMenuDropdown/SideMenuDropdown.js +9 -8
  34. package/src/SideMenuDropdown/SideMenuDropdown.styles.d.ts +2 -1
  35. package/src/SideMenuDropdown/SideMenuDropdown.styles.js +4 -3
  36. package/src/SideMenuFooter/SideMenuFooter.js +6 -3
  37. package/src/SideMenuFooter/SideMenuFooter.md +8 -0
  38. package/src/SideMenuFooter/SideMenuFooter.styles.d.ts +3 -2
  39. package/src/SideMenuFooter/SideMenuFooter.styles.js +6 -6
  40. package/src/SideMenuHeader/SideMenuHeader.js +15 -6
  41. package/src/SideMenuHeader/SideMenuHeader.md +16 -0
  42. package/src/SideMenuHeader/SideMenuHeader.styles.d.ts +5 -5
  43. package/src/SideMenuHeader/SideMenuHeader.styles.js +12 -15
  44. package/src/SideMenuItem/SideMenuItem.md +63 -0
  45. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +7 -1
  46. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.md +7 -0
  47. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.d.ts +2 -1
  48. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +4 -3
  49. package/src/internal/Backdrop.styles.js +1 -1
  50. package/src/internal/Burger.js +4 -1
  51. package/src/internal/Burger.styles.d.ts +2 -1
  52. package/src/internal/Burger.styles.js +4 -3
  53. package/src/internal/ClickableElement.js +8 -5
  54. package/src/internal/ClickableElement.styles.d.ts +6 -5
  55. package/src/internal/ClickableElement.styles.js +13 -11
  56. package/src/internal/InnerBody.js +5 -2
  57. package/src/internal/InnerBody.styles.d.ts +2 -1
  58. package/src/internal/InnerBody.styles.js +4 -3
  59. package/src/internal/InnerSubMenu.js +1 -1
  60. package/src/internal/ItemContent/Avatar.js +5 -2
  61. package/src/internal/ItemContent/Avatar.styles.d.ts +2 -1
  62. package/src/internal/ItemContent/Avatar.styles.js +4 -3
  63. package/src/internal/ItemContent/Caption.js +9 -6
  64. package/src/internal/ItemContent/Caption.styles.d.ts +9 -6
  65. package/src/internal/ItemContent/Caption.styles.js +17 -14
  66. package/src/internal/ItemContent/Icon.js +19 -9
  67. package/src/internal/ItemContent/Icon.styles.d.ts +7 -6
  68. package/src/internal/ItemContent/Icon.styles.js +14 -13
  69. package/src/internal/ItemContent/ItemContent.js +36 -12
  70. package/src/internal/ItemContent/ItemContent.styles.d.ts +9 -9
  71. package/src/internal/ItemContent/ItemContent.styles.js +18 -22
  72. package/src/internal/ItemContent/Marker.js +6 -3
  73. package/src/internal/ItemContent/Marker.styles.d.ts +3 -2
  74. package/src/internal/ItemContent/Marker.styles.js +6 -5
  75. package/src/internal/NestedMenu.js +6 -3
  76. package/src/internal/NestedMenu.styles.d.ts +2 -1
  77. package/src/internal/NestedMenu.styles.js +4 -3
  78. package/src/internal/RightBorder.js +10 -9
  79. package/src/internal/RightBorder.styles.d.ts +3 -4
  80. package/src/internal/RightBorder.styles.js +7 -7
  81. package/src/internal/SeparatedSubMenu.js +13 -10
  82. package/src/internal/SeparatedSubMenu.styles.d.ts +9 -6
  83. package/src/internal/SeparatedSubMenu.styles.js +18 -17
  84. package/src/internal/SideMenuLogotype.js +14 -10
  85. package/src/internal/SideMenuLogotype.styles.d.ts +6 -3
  86. package/src/internal/SideMenuLogotype.styles.js +11 -10
@@ -0,0 +1,66 @@
1
+ import { isFunction } from '@skbkontur/react-ui/lib/utils';
2
+ import { memo } from '../utils/memo';
3
+ import { SideMenuThemeInternal, isSideMenuTheme, markAsSideMenuTheme } from '../../internal/themes/SideMenuTheme';
4
+ /**
5
+ * Creates SideMenuTheme out of ReactUI's Theme.
6
+ *
7
+ * Inserts SideMenu vars in the theme, puts them over ReactUI's vars,
8
+ * but respects these SideMenu vars values that might have been specified in ReactUI's theme before that.
9
+ *
10
+ * This allows inserting SideMenu vars in the theme on the fly
11
+ * (without need for users to do it manually in their apps),
12
+ * and using ReactUI's ThemeContext.Provider for overriding them.
13
+ */
14
+ export var createSideMenuTheme = function (theme) {
15
+ if (isSideMenuTheme(theme))
16
+ return theme;
17
+ var sideMenuTheme = Object.create(theme, Object.assign(Object.getOwnPropertyDescriptors(SideMenuThemeInternal), {}));
18
+ var _loop_1 = function (key) {
19
+ var descriptor = Object.getOwnPropertyDescriptor(sideMenuTheme, key);
20
+ Object.defineProperty(sideMenuTheme, key, {
21
+ get: function () {
22
+ if (descriptor) {
23
+ var get = descriptor.get, value = descriptor.value;
24
+ // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
25
+ // @ts-ignore
26
+ return theme[key] || (isFunction(get) ? get.call(this) : value);
27
+ }
28
+ },
29
+ });
30
+ };
31
+ for (var _i = 0, _a = Object.keys(sideMenuTheme); _i < _a.length; _i++) {
32
+ var key = _a[_i];
33
+ _loop_1(key);
34
+ }
35
+ return markAsSideMenuTheme(sideMenuTheme);
36
+ };
37
+ export var getSideMenuTheme = memo(function (theme) {
38
+ return createSideMenuTheme(theme);
39
+ });
40
+ function isZeroArgs(fn) {
41
+ return fn.length == 0;
42
+ }
43
+ var memoize = function (fn) {
44
+ if (isZeroArgs(fn)) {
45
+ var isCalled_1 = false;
46
+ var result_1;
47
+ return function () {
48
+ if (!isCalled_1) {
49
+ isCalled_1 = true;
50
+ result_1 = fn();
51
+ }
52
+ return result_1;
53
+ };
54
+ }
55
+ var cache = new WeakMap();
56
+ return function (arg) {
57
+ if (!cache.has(arg))
58
+ cache.set(arg, fn(arg));
59
+ return cache.get(arg);
60
+ };
61
+ };
62
+ export var memoizeStyle = function (styles) {
63
+ Object.keys(styles).forEach(function (className) { return (styles[className] = memoize(styles[className])); });
64
+ return styles;
65
+ };
66
+ export var cssName = function (className) { return "." + className; };
@@ -0,0 +1,3 @@
1
+ import { SideMenuThemeInternal } from '../../internal/themes/SideMenuTheme';
2
+ export declare type SideMenuTheme = Readonly<typeof SideMenuThemeInternal>;
3
+ export declare type SideMenuThemeIn = Partial<SideMenuTheme>;
File without changes
@@ -0,0 +1 @@
1
+ export declare const memo: <A extends Record<string, unknown>, R>(fn: (() => R) | ((arg: A) => R)) => (() => R) | ((arg: A) => R);
@@ -0,0 +1,9 @@
1
+ export var memo = function (fn) {
2
+ var cache = new WeakMap();
3
+ return function (arg) {
4
+ if (!cache.has(arg)) {
5
+ cache.set(arg, fn(arg));
6
+ }
7
+ return cache.get(arg);
8
+ };
9
+ };
@@ -1,5 +1,5 @@
1
1
  import { ReactElement } from 'react';
2
- import { FlattedArrayElementType } from '../src/internal/InnerBody';
2
+ import { FlattedArrayElementType } from '../../src/internal/InnerBody';
3
3
  export declare const getItemId: (prefix: 'body' | 'footer', id: string | number) => string;
4
4
  export declare const isClickableSubElement: (element: string) => boolean;
5
5
  export declare const isClickableElement: (element: string) => boolean;
@@ -10,4 +10,3 @@ export declare const isParentOpened: (id: string | undefined, generatedId: strin
10
10
  export declare const isElementActive: (id: string | undefined, activeMenuItem: string | undefined | null) => boolean;
11
11
  export declare const isBrowser: boolean;
12
12
  export declare const isTouchDevice: () => boolean;
13
- export declare const getIconSize: (_isSubMenu?: boolean | undefined, _isBackButton?: boolean | undefined) => 24 | 16 | undefined;
@@ -77,11 +77,3 @@ export var isBrowser = typeof window !== 'undefined';
77
77
  export var isTouchDevice = function () {
78
78
  return isBrowser && ('ontouchstart' in window || navigator.maxTouchPoints > 0);
79
79
  };
80
- export var getIconSize = function (_isSubMenu, _isBackButton) {
81
- if (!_isSubMenu) {
82
- return 24;
83
- }
84
- if (!_isBackButton) {
85
- return 16;
86
- }
87
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skbkontur/side-menu",
3
- "version": "0.9.5",
3
+ "version": "0.10.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@skbkontur/icons": "^0.16.0",
26
- "@skbkontur/react-ui-addons": "^4.6.2",
26
+ "@skbkontur/react-ui-addons": "^4.6.3",
27
27
  "tslib": "^1"
28
28
  }
29
29
  }
@@ -1,8 +1,9 @@
1
1
  import { __assign, __rest } from "tslib";
2
- import React, { forwardRef, useEffect, useRef, useState } from 'react';
2
+ import React, { forwardRef, useContext, useEffect, useRef, useState } from 'react';
3
3
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
4
4
  import { isIE11 } from '@skbkontur/react-ui/lib/client';
5
- import { jsStyles, sideMenuMinimizedWidth, sideMenuStandardWidth } from './SideMenu.styles';
5
+ import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
6
+ import { customStyles, jsStyles } from './SideMenu.styles';
6
7
  import { SideMenuOrganisations } from '../SideMenuOrganisations/SideMenuOrganisations';
7
8
  import { SideMenuContext } from '../SideMenuContext';
8
9
  import { SideMenuBody } from '../SideMenuBody/SideMenuBody';
@@ -20,43 +21,45 @@ import { SideMenuSubLink } from '../SideMenuSubLink/SideMenuSubLink';
20
21
  import { DEFAULT_THEME, useResponsiveLayout } from '@skbkontur/react-ui';
21
22
  import { Backdrop } from '../internal/Backdrop';
22
23
  import { RenderLayer } from '@skbkontur/react-ui/internal/RenderLayer';
23
- import { isTouchDevice } from '../../utils/scripts';
24
+ import { isTouchDevice } from '../../lib/utils/scripts';
24
25
  import { SideMenuDataTids } from '../../SideMenuDataTids';
25
26
  import { ZIndex } from '@skbkontur/react-ui/internal/ZIndex';
26
27
  import { useAnimateOnMount } from '../../hooks/useAnimateOnMount';
28
+ import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
27
29
  export var transitionDuration = 300; //ms
28
30
  export var burgerTransitionDuration = (transitionDuration * 2) / 3;
29
31
  var SideMenuInner = forwardRef(function (_a, ref) {
30
32
  var _b, _c, _d, _e;
31
- var children = _a.children, value = _a.value, onValueChange = _a.onValueChange, _f = _a.size, size = _f === void 0 ? 'small' : _f, _g = _a.isSeparatedMenu, isSeparatedMenu = _g === void 0 ? false : _g, className = _a.className, _h = _a.disableSwipe, disableSwipe = _h === void 0 ? true : _h, _j = _a.desktopMediaQuery, desktopMediaQuery = _j === void 0 ? '(min-width: 1200px)' : _j, _k = _a.narrowDesktopMediaQuery, narrowDesktopMediaQuery = _k === void 0 ? '(min-width: 992px)' : _k, _l = _a.tabletMediaQuery, tabletMediaQuery = _l === void 0 ? '(min-width: 768px)' : _l, _m = _a.mobileMediaQuery, mobileMediaQuery = _m === void 0 ? '(min-width: 0px)' : _m, _o = _a.separatedMenuWithOverlay, separatedMenuWithOverlay = _o === void 0 ? false : _o, rest = __rest(_a, ["children", "value", "onValueChange", "size", "isSeparatedMenu", "className", "disableSwipe", "desktopMediaQuery", "narrowDesktopMediaQuery", "tabletMediaQuery", "mobileMediaQuery", "separatedMenuWithOverlay"]);
33
+ var children = _a.children, value = _a.value, onValueChange = _a.onValueChange, _f = _a.size, size = _f === void 0 ? 'small' : _f, _g = _a.isSeparatedMenu, isSeparatedMenu = _g === void 0 ? false : _g, className = _a.className, _h = _a.disableSwipe, disableSwipe = _h === void 0 ? true : _h, desktopMediaQuery = _a.desktopMediaQuery, narrowDesktopMediaQuery = _a.narrowDesktopMediaQuery, tabletMediaQuery = _a.tabletMediaQuery, mobileMediaQuery = _a.mobileMediaQuery, _j = _a.separatedMenuWithOverlay, separatedMenuWithOverlay = _j === void 0 ? false : _j, rest = __rest(_a, ["children", "value", "onValueChange", "size", "isSeparatedMenu", "className", "disableSwipe", "desktopMediaQuery", "narrowDesktopMediaQuery", "tabletMediaQuery", "mobileMediaQuery", "separatedMenuWithOverlay"]);
32
34
  var transitionTimer = useRef(null);
33
35
  var widgetTimer = useRef(null);
36
+ var theme = getSideMenuTheme(useContext(ThemeContext));
34
37
  var customMediaQueries = {
35
- isMobileQuery: mobileMediaQuery,
36
- isTabletQuery: tabletMediaQuery,
37
- isNarrowDesktopQuery: narrowDesktopMediaQuery,
38
- isDesktopQuery: desktopMediaQuery,
38
+ isMobileQuery: mobileMediaQuery || theme.sideMenuMobileMediaQuery,
39
+ isTabletQuery: tabletMediaQuery || theme.sideMenuTabletMediaQuery,
40
+ isNarrowDesktopQuery: narrowDesktopMediaQuery || theme.sideMenuNarrowDesktopMediaQuery,
41
+ isDesktopQuery: desktopMediaQuery || theme.sideMenuDesktopMediaQuery,
39
42
  };
40
- var _p = useResponsiveLayout({
43
+ var _k = useResponsiveLayout({
41
44
  customMediaQueries: customMediaQueries,
42
- }), isMobileQuery = _p.isMobileQuery, isTabletQuery = _p.isTabletQuery, isNarrowDesktopQuery = _p.isNarrowDesktopQuery, isDesktopQuery = _p.isDesktopQuery;
45
+ }), isMobileQuery = _k.isMobileQuery, isTabletQuery = _k.isTabletQuery, isNarrowDesktopQuery = _k.isNarrowDesktopQuery, isDesktopQuery = _k.isDesktopQuery;
43
46
  var isNarrowDesktop = isNarrowDesktopQuery && !isDesktopQuery;
44
47
  var isTablet = isTabletQuery && !isNarrowDesktopQuery;
45
48
  var isMobile = isMobileQuery && !isTabletQuery;
46
49
  var isTabletOrMobile = isTablet || isMobile;
47
50
  var isTouchScreen = isTouchDevice() || isMobile || isTablet;
48
51
  var separatedMenuWithoutOverlay = isSeparatedMenu && !separatedMenuWithOverlay;
49
- var _q = useState(isNarrowDesktop), isMinimized = _q[0], setIsMinimized = _q[1];
50
- var _r = useState(false), isBeingTransitioned = _r[0], setIsBeingTransitioned = _r[1];
51
- var _s = useState('#2291ff'), productColor = _s[0], setProductColor = _s[1];
52
- var _t = useState(false), showWidget = _t[0], setShowWidget = _t[1];
53
- var _u = useState(value), activeMenuItem = _u[0], setActiveMenuItem = _u[1];
54
- var _v = useState(isDesktopQuery || isNarrowDesktop), isShown = _v[0], setIsShown = _v[1];
55
- var _w = useState(false), isSeparatedMenuShown = _w[0], setIsSeparatedMenuShown = _w[1];
56
- var _x = useState(true), isMouseOutside = _x[0], setIsMouseOutside = _x[1];
57
- var _y = useState('top'), scrollState = _y[0], setScrollState = _y[1];
58
- var _z = useState(false), hasScrollBar = _z[0], setHasScrollBar = _z[1];
59
- var _0 = useState(0), mousePositionX = _0[0], setMousePositionX = _0[1];
52
+ var _l = useState(isNarrowDesktop), isMinimized = _l[0], setIsMinimized = _l[1];
53
+ var _m = useState(false), isBeingTransitioned = _m[0], setIsBeingTransitioned = _m[1];
54
+ var _o = useState(false), showWidget = _o[0], setShowWidget = _o[1];
55
+ var _p = useState(value), activeMenuItem = _p[0], setActiveMenuItem = _p[1];
56
+ var _q = useState(isDesktopQuery || isNarrowDesktop), isShown = _q[0], setIsShown = _q[1];
57
+ var _r = useState(false), isSeparatedMenuShown = _r[0], setIsSeparatedMenuShown = _r[1];
58
+ var _s = useState(true), isMouseOutside = _s[0], setIsMouseOutside = _s[1];
59
+ var _t = useState('top'), scrollState = _t[0], setScrollState = _t[1];
60
+ var _u = useState(false), hasScrollBar = _u[0], setHasScrollBar = _u[1];
61
+ var _v = useState(0), mousePositionX = _v[0], setMousePositionX = _v[1];
62
+ var _w = useState(0), headerHeight = _w[0], setHeaderHeight = _w[1];
60
63
  useEffect(function () {
61
64
  return function () {
62
65
  if (transitionTimer.current) {
@@ -123,10 +126,11 @@ var SideMenuInner = forwardRef(function (_a, ref) {
123
126
  var showMinimizedRootForNarrowDesktopWithOverlay = function (e) {
124
127
  if (!separatedMenuWithoutOverlay || !isNarrowDesktop)
125
128
  return;
126
- if (e.clientX < parseInt(sideMenuMinimizedWidth) && mousePositionX > parseInt(sideMenuMinimizedWidth)) {
129
+ if (e.clientX < parseInt(theme.sideMenuMinimizedWidth) &&
130
+ mousePositionX > parseInt(theme.sideMenuMinimizedWidth)) {
127
131
  showMinimizedRoot(false);
128
132
  }
129
- if (e.clientX > parseInt(sideMenuStandardWidth)) {
133
+ if (e.clientX > parseInt(theme.sideMenuWidth)) {
130
134
  showMinimizedRoot(true);
131
135
  }
132
136
  setMousePositionX(e.clientX);
@@ -152,19 +156,17 @@ var SideMenuInner = forwardRef(function (_a, ref) {
152
156
  }
153
157
  };
154
158
  var isSideMenuOverContent = (isNarrowDesktop && !isMinimized) || (isMobile && isShown) || (isTablet && isShown && !isSeparatedMenuShown);
155
- var _1 = useAnimateOnMount(!!isTabletOrMobile && !!isShown, burgerTransitionDuration, {
159
+ var _x = useAnimateOnMount(!!isTabletOrMobile && !!isShown, burgerTransitionDuration, {
156
160
  opacity: DEFAULT_THEME.sidePageBackingBgOpacity,
157
161
  }, {
158
162
  opacity: 0,
159
- }), shouldShowBackdrop = _1[0], backdropStyle = _1[1];
163
+ }), shouldShowBackdrop = _x[0], backdropStyle = _x[1];
160
164
  return (React.createElement(SideMenuContext.Provider, { value: {
161
165
  isMinimized: isMinimized,
162
166
  setIsMinimized: showMinimizedRoot,
163
167
  isBeingTransitioned: isBeingTransitioned,
164
168
  isSeparatedMenu: isSeparatedMenu,
165
169
  size: size,
166
- productColor: productColor,
167
- setProductColor: setProductColor,
168
170
  showWidget: showWidget,
169
171
  activeMenuItem: activeMenuItem,
170
172
  switchActiveMenuItem: switchActiveMenuItem,
@@ -183,14 +185,16 @@ var SideMenuInner = forwardRef(function (_a, ref) {
183
185
  setScrollState: setScrollState,
184
186
  hasScrollBar: hasScrollBar,
185
187
  setHasScrollBar: setHasScrollBar,
188
+ headerHeight: headerHeight,
189
+ setHeaderHeight: setHeaderHeight,
186
190
  } },
187
191
  React.createElement(ZIndex, { priority: isTabletOrMobile || isNarrowDesktop ? 8 : 0, className: cx((_b = {},
188
192
  _b[jsStyles.root()] = true,
189
- _b[jsStyles.rootForTabletsOrMobiles()] = isTabletOrMobile,
193
+ _b[customStyles.rootForTabletsOrMobiles(headerHeight)] = isTabletOrMobile,
190
194
  _b[jsStyles.shownRootForTabletsOrMobiles()] = isShown && isTabletOrMobile,
191
- _b[jsStyles.rootForNarrowDesktops()] = isNarrowDesktop,
192
- _b[jsStyles.separatedRootForNarrowDesktops()] = separatedMenuWithoutOverlay && isSeparatedMenuShown && isNarrowDesktop,
193
- _b[jsStyles.separatedRootForDesktops()] = separatedMenuWithoutOverlay && isSeparatedMenuShown && isDesktopQuery,
195
+ _b[jsStyles.rootForNarrowDesktops(theme)] = isNarrowDesktop,
196
+ _b[jsStyles.separatedRootForNarrowDesktops(theme)] = separatedMenuWithoutOverlay && isSeparatedMenuShown && isNarrowDesktop,
197
+ _b[jsStyles.separatedRootForDesktops(theme)] = separatedMenuWithoutOverlay && isSeparatedMenuShown && isDesktopQuery,
194
198
  _b)) },
195
199
  React.createElement(React.Fragment, null,
196
200
  shouldShowBackdrop && React.createElement(Backdrop, { style: backdropStyle }),
@@ -198,15 +202,15 @@ var SideMenuInner = forwardRef(function (_a, ref) {
198
202
  React.createElement("aside", __assign({ className: cx((_c = {},
199
203
  _c[jsStyles.wrapper()] = true,
200
204
  _c[jsStyles.wrapperIE()] = isIE11,
201
- _c[jsStyles.wrapperWithShadow()] = isSideMenuOverContent,
205
+ _c[jsStyles.wrapperWithShadow(theme)] = isSideMenuOverContent,
202
206
  _c), className), "data-tid": SideMenuDataTids.root, ref: ref }, rest, { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseMove: showMinimizedRootForNarrowDesktopWithOverlay }),
203
207
  React.createElement("div", { className: cx((_d = {},
204
- _d[jsStyles.container()] = true,
208
+ _d[jsStyles.container(theme)] = true,
205
209
  _d[jsStyles.collapsedContainerForTabletsOrMobiles()] = !isShown && !isBeingTransitioned,
206
- _d[jsStyles.minimizedContainer()] = isMinimized,
210
+ _d[jsStyles.minimizedContainer(theme)] = isMinimized,
207
211
  _d[jsStyles.innerContainer()] = !isSeparatedMenu,
208
- _d[jsStyles.containerForTouchScreens()] = isTouchScreen,
209
- _d[jsStyles.separatedContainerForMobiles()] = isMobile && isSeparatedMenuShown && (isShown || isBeingTransitioned),
212
+ _d[jsStyles.containerForTouchScreens(theme)] = isTouchScreen,
213
+ _d[jsStyles.separatedContainerForMobiles(theme)] = isMobile && isSeparatedMenuShown && (isShown || isBeingTransitioned),
210
214
  _d)) },
211
215
  React.createElement("div", { className: cx((_e = {},
212
216
  _e[jsStyles.contentWrapper()] = true,
@@ -1,23 +1,21 @@
1
- export declare const sideMenuMinimizedWidth = "72px";
2
- export declare const sideMenuStandardWidth = "232px";
3
- export declare const sideMenuForTouchScreenWidth = "328px";
4
- export declare const sideMenuBoxShadow = "4px 4px 24px rgba(0, 0, 0, 0.24)";
5
- export declare const sideMenuMarginX = "16px";
1
+ import { SideMenuTheme } from '../../lib/theming/ThemeTypes';
2
+ export declare const customStyles: {
3
+ rootForTabletsOrMobiles(headerHeight?: number | undefined): string;
4
+ };
6
5
  export declare const jsStyles: {
7
6
  root(): string;
8
- rootForTabletsOrMobiles(): string;
9
7
  shownRootForTabletsOrMobiles(): string;
10
- rootForNarrowDesktops(): string;
11
- separatedRootForNarrowDesktops(): string;
12
- separatedRootForDesktops(): string;
13
- container(): string;
14
- minimizedContainer(): string;
8
+ rootForNarrowDesktops(t: SideMenuTheme): string;
9
+ separatedRootForNarrowDesktops(t: SideMenuTheme): string;
10
+ separatedRootForDesktops(t: SideMenuTheme): string;
11
+ container(t: SideMenuTheme): string;
12
+ minimizedContainer(t: SideMenuTheme): string;
15
13
  innerContainer(): string;
16
- containerForTouchScreens(): string;
17
- separatedContainerForMobiles(): string;
14
+ containerForTouchScreens(t: SideMenuTheme): string;
15
+ separatedContainerForMobiles(t: SideMenuTheme): string;
18
16
  contentWrapper(): string;
19
17
  wrapper(): string;
20
18
  wrapperIE(): string;
21
- wrapperWithShadow(): string;
19
+ wrapperWithShadow(t: SideMenuTheme): string;
22
20
  collapsedContainerForTabletsOrMobiles(): string;
23
21
  };
@@ -1,60 +1,58 @@
1
1
  import { __makeTemplateObject } from "tslib";
2
- import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
2
+ import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
3
+ import { memoizeStyle } from '../../lib/theming/ThemeHelpers';
3
4
  import { burgerTransitionDuration, transitionDuration } from './SideMenu';
4
- export var sideMenuMinimizedWidth = '72px';
5
- export var sideMenuStandardWidth = '232px';
6
- export var sideMenuForTouchScreenWidth = '328px';
7
- export var sideMenuBoxShadow = '4px 4px 24px rgba(0, 0, 0, 0.24)';
8
- export var sideMenuMarginX = '16px';
9
5
  var styles = {
10
6
  root: function () {
11
7
  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 "])));
12
8
  },
13
- rootForTabletsOrMobiles: function () {
14
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 68px;\n position: absolute;\n top: 0;\n transition: height ", "ms ease-out;\n "], ["\n height: 68px;\n position: absolute;\n top: 0;\n transition: height ", "ms ease-out;\n "])), burgerTransitionDuration);
15
- },
16
9
  shownRootForTabletsOrMobiles: function () {
17
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n height: 100vh;\n transition: height ", "ms ease-out;\n "], ["\n height: 100vh;\n transition: height ", "ms ease-out;\n "])), burgerTransitionDuration);
10
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 100vh;\n transition: height ", "ms ease-out;\n "], ["\n height: 100vh;\n transition: height ", "ms ease-out;\n "])), burgerTransitionDuration);
18
11
  },
19
- rootForNarrowDesktops: function () {
20
- return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), sideMenuMinimizedWidth);
12
+ rootForNarrowDesktops: function (t) {
13
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), t.sideMenuMinimizedWidth);
21
14
  },
22
- separatedRootForNarrowDesktops: function () {
23
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: calc(", " + ", ");\n background: #fff;\n "], ["\n width: calc(", " + ", ");\n background: #fff;\n "])), sideMenuMinimizedWidth, sideMenuStandardWidth);
15
+ separatedRootForNarrowDesktops: function (t) {
16
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: calc(", " + ", ");\n background: ", ";\n "], ["\n width: calc(", " + ", ");\n background: ", ";\n "])), t.sideMenuMinimizedWidth, t.sideMenuWidth, t.sideMenuSeparatedSubMenuBgColor);
24
17
  },
25
- separatedRootForDesktops: function () {
26
- return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n width: calc(", " + ", ");\n background: #fff;\n "], ["\n width: calc(", " + ", ");\n background: #fff;\n "])), sideMenuStandardWidth, sideMenuStandardWidth);
18
+ separatedRootForDesktops: function (t) {
19
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: calc(", " + ", ");\n background: ", ";\n "], ["\n width: calc(", " + ", ");\n background: ", ";\n "])), t.sideMenuWidth, t.sideMenuWidth, t.sideMenuSeparatedSubMenuBgColor);
27
20
  },
28
- container: function () {
29
- return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n width: ", ";\n height: 100%;\n background: #f6f6f6;\n position: relative;\n box-sizing: border-box;\n transition: width ", "ms ease-out;\n "], ["\n width: ", ";\n height: 100%;\n background: #f6f6f6;\n position: relative;\n box-sizing: border-box;\n transition: width ", "ms ease-out;\n "])), sideMenuStandardWidth, transitionDuration);
21
+ container: function (t) {
22
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n width: ", ";\n height: 100%;\n background: ", ";\n position: relative;\n box-sizing: border-box;\n transition: width ", "ms ease-out;\n "], ["\n width: ", ";\n height: 100%;\n background: ", ";\n position: relative;\n box-sizing: border-box;\n transition: width ", "ms ease-out;\n "])), t.sideMenuWidth, t.sideMenuBgColor, transitionDuration);
30
23
  },
31
- minimizedContainer: function () {
32
- return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n width: ", " !important;\n "], ["\n width: ", " !important;\n "])), sideMenuMinimizedWidth);
24
+ minimizedContainer: function (t) {
25
+ return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n width: ", " !important;\n "], ["\n width: ", " !important;\n "])), t.sideMenuMinimizedWidth);
33
26
  },
34
27
  innerContainer: function () {
35
- return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n overflow-x: hidden;\n "], ["\n overflow-x: hidden;\n "])));
28
+ return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n overflow-x: hidden;\n "], ["\n overflow-x: hidden;\n "])));
36
29
  },
37
- containerForTouchScreens: function () {
38
- return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), sideMenuForTouchScreenWidth);
30
+ containerForTouchScreens: function (t) {
31
+ return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), t.sideMenuWidthForTouchScreens);
39
32
  },
40
- separatedContainerForMobiles: function () {
41
- return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n background: #fff;\n "], ["\n background: #fff;\n "])));
33
+ separatedContainerForMobiles: function (t) {
34
+ return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), t.sideMenuSeparatedSubMenuBgColor);
42
35
  },
43
36
  contentWrapper: function () {
44
- return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n overflow: hidden;\n "], ["\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n overflow: hidden;\n "])));
37
+ return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n overflow: hidden;\n "], ["\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n overflow: hidden;\n "])));
45
38
  },
46
39
  wrapper: function () {
47
- return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n height: 100%;\n display: inline-flex;\n position: relative;\n "], ["\n height: 100%;\n display: inline-flex;\n position: relative;\n "])));
40
+ return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n height: 100%;\n display: inline-flex;\n position: relative;\n "], ["\n height: 100%;\n display: inline-flex;\n position: relative;\n "])));
48
41
  },
49
42
  wrapperIE: function () {
50
43
  var ieRootWrapperCorrection = 15;
51
- return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n position: relative;\n top: -", "px;\n height: calc(100% + ", "px);\n "], ["\n position: relative;\n top: -", "px;\n height: calc(100% + ", "px);\n "])), ieRootWrapperCorrection, ieRootWrapperCorrection);
44
+ return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n position: relative;\n top: -", ";\n height: calc(100% + ", ");\n "], ["\n position: relative;\n top: -", ";\n height: calc(100% + ", ");\n "])), ieRootWrapperCorrection, ieRootWrapperCorrection);
52
45
  },
53
- wrapperWithShadow: function () {
54
- return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n box-shadow: ", ";\n "], ["\n box-shadow: ", ";\n "])), sideMenuBoxShadow);
46
+ wrapperWithShadow: function (t) {
47
+ return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n box-shadow: ", ";\n "], ["\n box-shadow: ", ";\n "])), t.sideMenuBoxShadow);
55
48
  },
56
49
  collapsedContainerForTabletsOrMobiles: function () {
57
- return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n background-color: transparent;\n "], ["\n background-color: transparent;\n "])));
50
+ return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n background-color: transparent;\n "], ["\n background-color: transparent;\n "])));
51
+ },
52
+ };
53
+ export var customStyles = {
54
+ rootForTabletsOrMobiles: function (headerHeight) {
55
+ return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n height: ", "px;\n position: absolute;\n top: 0;\n transition: height ", "ms ease-out;\n "], ["\n height: ", "px;\n position: absolute;\n top: 0;\n transition: height ", "ms ease-out;\n "])), headerHeight, burgerTransitionDuration);
58
56
  },
59
57
  };
60
58
  export var jsStyles = memoizeStyle(styles);
@@ -0,0 +1,7 @@
1
+ #### Переменные кастомизации (см. [ThemeContext](https://tech.skbkontur.ru/react-ui/#/Customization/ThemeContext))
2
+
3
+ ```typescript
4
+ {
5
+ sideMenuAvatarMargin: string;
6
+ }
7
+ ```
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
3
- import { ScrollContainer } from '@skbkontur/react-ui';
4
3
  export interface SideMenuBodyProps extends CommonProps {
5
4
  children?: React.ReactNode;
6
5
  }
@@ -9,6 +8,6 @@ export interface SideMenuBodyProps extends CommonProps {
9
8
  *
10
9
  * @visibleName SideMenu.Body
11
10
  */
12
- export declare const SideMenuBody: React.ForwardRefExoticComponent<SideMenuBodyProps & React.RefAttributes<ScrollContainer>> & {
11
+ export declare const SideMenuBody: React.ForwardRefExoticComponent<SideMenuBodyProps & React.RefAttributes<HTMLDivElement>> & {
13
12
  __KONTUR_REACT_UI__: string;
14
13
  };
@@ -1,9 +1,11 @@
1
1
  import { __assign, __rest } from "tslib";
2
2
  import React, { forwardRef, useContext, useEffect, useRef } from 'react';
3
3
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
4
+ import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
4
5
  import { jsStyles } from './SideMenuBody.styles';
5
6
  import { InnerBody } from '../internal/InnerBody';
6
7
  import { SideMenuContext } from '../SideMenuContext';
8
+ import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
7
9
  import { ScrollContainer, ScrollContainerDataTids } from '@skbkontur/react-ui';
8
10
  import { mergeRefs } from '@skbkontur/react-ui/lib/utils';
9
11
  var SideMenuBodyInner = forwardRef(function (_a, ref) {
@@ -11,10 +13,13 @@ var SideMenuBodyInner = forwardRef(function (_a, ref) {
11
13
  var className = _a.className, children = _a.children, rest = __rest(_a, ["className", "children"]);
12
14
  var context = useContext(SideMenuContext);
13
15
  var scrollContainerRef = useRef(null);
16
+ var sideMenuBodyRef = useRef(null);
14
17
  var setScrollContainerInnerPosition = function () {
15
- var scrollContainerInner = document.querySelector("[data-tid=" + ScrollContainerDataTids.inner + "]");
16
- if (scrollContainerInner) {
17
- scrollContainerInner.style.position = 'static';
18
+ if (sideMenuBodyRef.current) {
19
+ var scrollContainerInner = sideMenuBodyRef.current.querySelector("[data-tid=" + ScrollContainerDataTids.inner + "]");
20
+ if (scrollContainerInner) {
21
+ scrollContainerInner.style.position = 'static';
22
+ }
18
23
  }
19
24
  };
20
25
  useEffect(function () {
@@ -25,13 +30,15 @@ var SideMenuBodyInner = forwardRef(function (_a, ref) {
25
30
  }, 50);
26
31
  setScrollContainerInnerPosition();
27
32
  }, [context.activeMenuItem, context.isShown]);
33
+ var theme = getSideMenuTheme(useContext(ThemeContext));
28
34
  if (context.isShown) {
29
- return (React.createElement(ScrollContainer, { style: { position: 'static' }, onScrollStateChangeY: function (state) {
30
- var _a;
31
- (_a = context.setScrollState) === null || _a === void 0 ? void 0 : _a.call(context, state);
32
- }, hideScrollBar: true, ref: mergeRefs([ref, scrollContainerRef]) },
33
- React.createElement("div", __assign({ className: cx((_b = {}, _b[jsStyles.root()] = true, _b), className) }, rest),
34
- React.createElement(InnerBody, null, children))));
35
+ return (React.createElement("div", { ref: mergeRefs([ref, sideMenuBodyRef]), style: { overflow: 'hidden', height: '100%' } },
36
+ React.createElement(ScrollContainer, { style: { position: 'static' }, onScrollStateChangeY: function (state) {
37
+ var _a;
38
+ (_a = context.setScrollState) === null || _a === void 0 ? void 0 : _a.call(context, state);
39
+ }, hideScrollBar: true, ref: scrollContainerRef },
40
+ React.createElement("div", __assign({ className: cx((_b = {}, _b[jsStyles.root(theme)] = true, _b), className) }, rest),
41
+ React.createElement(InnerBody, null, children)))));
35
42
  }
36
43
  return null;
37
44
  });
@@ -0,0 +1,7 @@
1
+ #### Переменные кастомизации (см. [ThemeContext](https://tech.skbkontur.ru/react-ui/#/Customization/ThemeContext))
2
+
3
+ ```typescript
4
+ {
5
+ sideMenuBodyPaddingBottom: string;
6
+ }
7
+ ```
@@ -1,3 +1,4 @@
1
+ import { SideMenuTheme } from '../../lib/theming/ThemeTypes';
1
2
  export declare const jsStyles: {
2
- root(): string;
3
+ root(t: SideMenuTheme): string;
3
4
  };
@@ -1,9 +1,9 @@
1
1
  import { __makeTemplateObject } from "tslib";
2
- import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
3
- import { sideMenuMarginX } from '../SideMenu/SideMenu.styles';
2
+ import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
3
+ import { memoizeStyle } from '../../lib/theming/ThemeHelpers';
4
4
  var styles = {
5
- root: function () {
6
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n padding-bottom: 8px;\n margin: 0 ", ";\n "], ["\n flex-grow: 1;\n padding-bottom: 8px;\n margin: 0 ", ";\n "])), sideMenuMarginX);
5
+ root: function (t) {
6
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n padding-bottom: ", ";\n margin: 0 ", ";\n "], ["\n flex-grow: 1;\n padding-bottom: ", ";\n margin: 0 ", ";\n "])), t.sideMenuBodyPaddingBottom, t.sideMenuMarginX);
7
7
  },
8
8
  };
9
9
  export var jsStyles = memoizeStyle(styles);
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { FlattedArrayElementType } from './internal/InnerBody';
2
3
  import { ScrollContainerScrollStateY } from '@skbkontur/react-ui';
3
4
  export interface SideMenuContextType {
@@ -9,8 +10,6 @@ export interface SideMenuContextType {
9
10
  activeMenuItem?: string | null;
10
11
  switchActiveMenuItem?: (id: string) => void;
11
12
  hasSubIcons?: boolean;
12
- productColor?: string;
13
- setProductColor?: (color: string) => void;
14
13
  showWidget?: boolean;
15
14
  openedParents?: string[];
16
15
  isDesktop?: boolean;
@@ -29,5 +28,7 @@ export interface SideMenuContextType {
29
28
  setScrollState?: (state: ScrollContainerScrollStateY) => void;
30
29
  hasScrollBar?: boolean;
31
30
  setHasScrollBar?: (hasScrollBar: boolean) => void;
31
+ headerHeight?: number;
32
+ setHeaderHeight?: (mobileHeaderHeight: number) => void;
32
33
  }
33
34
  export declare const SideMenuContext: import("react").Context<SideMenuContextType>;
@@ -0,0 +1,7 @@
1
+ #### Переменные кастомизации (см. [ThemeContext](https://tech.skbkontur.ru/react-ui/#/Customization/ThemeContext))
2
+
3
+ ```typescript
4
+ {
5
+ sideMenuDividerBgColor: string;
6
+ sideMenuDividerMarginX: string;
7
+ }
@@ -1,5 +1,6 @@
1
1
  import { __makeTemplateObject } from "tslib";
2
- import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
2
+ import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
3
+ import { memoizeStyle } from '../../lib/theming/ThemeHelpers';
3
4
  var styles = {
4
5
  root: function () {
5
6
  return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: #ebebeb;\n height: 1px;\n border: none;\n margin: 4px 12px 4px 32px;\n "], ["\n background: #ebebeb;\n height: 1px;\n border: none;\n margin: 4px 12px 4px 32px;\n "])));
@@ -1,21 +1,22 @@
1
1
  import { __assign, __rest } from "tslib";
2
2
  import React, { forwardRef, useContext } from 'react';
3
- import { DropdownMenu } from '@skbkontur/react-ui';
3
+ import { ThemeContext, DropdownMenu } from '@skbkontur/react-ui';
4
4
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
5
5
  import { jsStyles } from './SideMenuDropdown.styles';
6
6
  import { SideMenuItem } from '../SideMenuItem/SideMenuItem';
7
7
  import { SideMenuContext } from '../SideMenuContext';
8
+ import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
8
9
  var SideMenuDropdownInner = forwardRef(function (_a, ref) {
9
10
  var _b, _c;
10
11
  var icon = _a.icon, id = _a.id, _generatedId = _a._generatedId, _avatar = _a._avatar, children = _a.children, _d = _a.caption, caption = _d === void 0 ? 'СКБ Контур' : _d, subCaption = _a.subCaption, className = _a.className, _e = _a.disableAnimations, disableAnimations = _e === void 0 ? false : _e, menuWidth = _a.menuWidth, rest = __rest(_a, ["icon", "id", "_generatedId", "_avatar", "children", "caption", "subCaption", "className", "disableAnimations", "menuWidth"]);
11
12
  var context = useContext(SideMenuContext);
12
- var label = (React.createElement("div", { className: cx((_b = {},
13
- _b[jsStyles.label()] = true,
14
- _b[jsStyles.minimizedLabel()] = context.isMinimized,
15
- _b)) },
16
- React.createElement(SideMenuItem, { icon: icon, caption: caption, subCaption: subCaption, _avatar: _avatar, id: id, _isDropdown: true })));
17
- return (React.createElement("div", { className: cx((_c = {}, _c[jsStyles.wrapper()] = true, _c), className), ref: ref },
18
- React.createElement(DropdownMenu, __assign({ caption: label, positions: ['top left'], disableAnimations: true, menuWidth: menuWidth }, rest), React.Children.map(children, function (child) {
13
+ var theme = getSideMenuTheme(useContext(ThemeContext));
14
+ return (React.createElement("div", { className: cx((_b = {}, _b[jsStyles.wrapper()] = true, _b), className), ref: ref },
15
+ React.createElement(DropdownMenu, __assign({ caption: React.createElement("div", { className: cx((_c = {},
16
+ _c[jsStyles.label(theme)] = true,
17
+ _c[jsStyles.minimizedLabel()] = context.isMinimized,
18
+ _c)) },
19
+ React.createElement(SideMenuItem, { icon: icon, caption: caption, subCaption: subCaption, _avatar: _avatar, id: id, _isDropdown: true })), positions: ['top left'], disableAnimations: true, menuWidth: menuWidth }, rest), React.Children.map(children, function (child) {
19
20
  // @ts-expect-error: accessing private property
20
21
  if (React.isValidElement(child) && (child === null || child === void 0 ? void 0 : child.type.__KONTUR_REACT_UI__) === 'MenuItem') {
21
22
  return React.cloneElement(child, {
@@ -1,5 +1,6 @@
1
+ import { SideMenuTheme } from '../../lib/theming/ThemeTypes';
1
2
  export declare const jsStyles: {
2
- label(): string;
3
+ label(t: SideMenuTheme): string;
3
4
  minimizedLabel(): string;
4
5
  wrapper(): string;
5
6
  };