@skbkontur/side-menu 0.14.8 → 1.0.1-router-test.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 (33) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +263 -230
  3. package/internal/themes/SideMenuTheme.d.ts +12 -5
  4. package/internal/themes/SideMenuTheme.js +36 -11
  5. package/package.json +1 -1
  6. package/src/SideMenuBody/SideMenuBody.js +4 -2
  7. package/src/SideMenuDivider/SideMenuDivider.js +5 -2
  8. package/src/SideMenuDivider/SideMenuDivider.md +1 -0
  9. package/src/SideMenuDivider/SideMenuDivider.styles.d.ts +2 -1
  10. package/src/SideMenuDivider/SideMenuDivider.styles.js +2 -2
  11. package/src/SideMenuFooter/SideMenuFooter.styles.js +1 -1
  12. package/src/SideMenuHeader/SideMenuHeader.styles.js +2 -2
  13. package/src/SideMenuItem/SideMenuItem.d.ts +1 -0
  14. package/src/SideMenuItem/SideMenuItem.js +4 -3
  15. package/src/SideMenuItem/SideMenuItem.md +8 -1
  16. package/src/SideMenuLink/SideMenuLink.d.ts +1 -0
  17. package/src/SideMenuLink/SideMenuLink.js +2 -2
  18. package/src/internal/ClickableElement.d.ts +1 -1
  19. package/src/internal/ClickableElement.js +6 -4
  20. package/src/internal/InnerBody.js +0 -10
  21. package/src/internal/ItemContent/Caption.js +1 -1
  22. package/src/internal/ItemContent/Icon.js +0 -1
  23. package/src/internal/ItemContent/Icon.styles.d.ts +0 -1
  24. package/src/internal/ItemContent/Icon.styles.js +3 -6
  25. package/src/internal/ItemContent/ItemContent.js +4 -3
  26. package/src/internal/ItemContent/ItemContent.styles.d.ts +1 -0
  27. package/src/internal/ItemContent/ItemContent.styles.js +11 -8
  28. package/src/internal/ItemContent/Marker.d.ts +2 -2
  29. package/src/internal/ItemContent/Marker.js +2 -1
  30. package/src/internal/ItemContent/Marker.styles.d.ts +1 -0
  31. package/src/internal/ItemContent/Marker.styles.js +5 -2
  32. package/src/internal/InnerBody.styles.d.ts +0 -4
  33. package/src/internal/InnerBody.styles.js +0 -10
@@ -14,7 +14,6 @@ export declare class SideMenuTheme extends SideMenuTheme_base {
14
14
  static sideMenuLineHeight: string;
15
15
  static sideMenuLargeLineHeight: string;
16
16
  static sideMenuProductColor: string;
17
- static sideMenuFixedSeparatorColor: string;
18
17
  static sideMenuDesktopMediaQuery: string;
19
18
  static sideMenuNarrowDesktopMediaQuery: string;
20
19
  static sideMenuTabletMediaQuery: string;
@@ -62,21 +61,28 @@ export declare class SideMenuTheme extends SideMenuTheme_base {
62
61
  static sideMenuItemContentLargePaddingY: string;
63
62
  static sideMenuSubItemContentPaddingY: string;
64
63
  static sideMenuSubItemContentLargePaddingY: string;
65
- static sideMenuItemContentLargeMultilinePaddingY: string;
64
+ static sideMenuItemContentLargeMultilinePaddingTop: string;
65
+ static sideMenuItemContentLargeMultilinePaddingBottom: string;
66
+ static sideMenuItemContentMultilinePaddingTop: string;
67
+ static sideMenuItemContentMultilinePaddingBottom: string;
66
68
  static sideMenuItemContentPaddingYForTouchScreens: string;
67
69
  static sideMenuSubItemContentPaddingYForTouchScreens: string;
68
70
  static sideMenuMarkerPaddingX: string;
71
+ static sideMenuMarkerPaddingY: string;
69
72
  static get sideMenuMarkerBg(): string;
70
73
  static sideMenuMarkerColor: string;
74
+ static get sideMenuMarkerSubItemColor(): string;
71
75
  static sideMenuMarkerMarginRight: string;
72
76
  static sideMenuMarkerFontWeight: string;
77
+ static sideMenuSubItemMarkerFontWeight: string;
73
78
  static sideMenuMarkerMultilineMarginTop: string;
79
+ static sideMenuMarkerLineHeight: string;
74
80
  static sideMenuBurgerMarginRight: string;
75
81
  static sideMenuItemBorderRadius: string;
76
82
  static sideMenuItemHoverBg: string;
77
83
  static sideMenuItemActiveBg: string;
78
- static sideMenuSubItemWithSeparatedSubMenuHoverBg: string;
79
- static sideMenuSubItemWithSeparatedSubMenuActiveBg: string;
84
+ static get sideMenuSubItemWithSeparatedSubMenuHoverBg(): string;
85
+ static get sideMenuSubItemWithSeparatedSubMenuActiveBg(): string;
80
86
  static sideMenuFocusedItemBoxShadowInset: string;
81
87
  static sideMenuFocusedItemBoxShadowOffsetX: string;
82
88
  static sideMenuFocusedItemBoxShadowOffsetY: string;
@@ -84,8 +90,9 @@ export declare class SideMenuTheme extends SideMenuTheme_base {
84
90
  static sideMenuFocusedItemBoxShadowSpreadRadius: string;
85
91
  static sideMenuFocusedItemBoxShadowColor: string;
86
92
  static get sideMenuFocusedItemBoxShadow(): string;
87
- static sideMenuDividerBgColor: string;
88
93
  static sideMenuDividerMarginX: string;
94
+ static sideMenuDividerMarginY: string;
95
+ static sideMenuDividerBgColor: string;
89
96
  static sideMenuNestedMenuPaddingLeft: string;
90
97
  static sideMenuRightBorderWidth: string;
91
98
  static get sideMenuRightBorderColor(): string;
@@ -56,6 +56,27 @@ var SideMenuTheme = /** @class */ (function (_super) {
56
56
  enumerable: false,
57
57
  configurable: true
58
58
  });
59
+ Object.defineProperty(SideMenuTheme, "sideMenuMarkerSubItemColor", {
60
+ get: function () {
61
+ return this.sideMenuIconSubItemColor;
62
+ },
63
+ enumerable: false,
64
+ configurable: true
65
+ });
66
+ Object.defineProperty(SideMenuTheme, "sideMenuSubItemWithSeparatedSubMenuHoverBg", {
67
+ get: function () {
68
+ return this.sideMenuBgColor;
69
+ },
70
+ enumerable: false,
71
+ configurable: true
72
+ });
73
+ Object.defineProperty(SideMenuTheme, "sideMenuSubItemWithSeparatedSubMenuActiveBg", {
74
+ get: function () {
75
+ return this.sideMenuBgColor;
76
+ },
77
+ enumerable: false,
78
+ configurable: true
79
+ });
59
80
  Object.defineProperty(SideMenuTheme, "sideMenuFocusedItemBoxShadow", {
60
81
  get: function () {
61
82
  return this.sideMenuFocusedItemBoxShadowInset + " " + this.sideMenuFocusedItemBoxShadowOffsetX + " " + this.sideMenuFocusedItemBoxShadowOffsetY + " " + this.sideMenuFocusedItemBoxShadowBlurRadius + " " + this.sideMenuFocusedItemBoxShadowSpreadRadius + " " + this.sideMenuFocusedItemBoxShadowColor;
@@ -72,14 +93,14 @@ var SideMenuTheme = /** @class */ (function (_super) {
72
93
  });
73
94
  Object.defineProperty(SideMenuTheme, "sideMenuFooterDividerColor", {
74
95
  get: function () {
75
- return this.sideMenuFixedSeparatorColor;
96
+ return this.sideMenuDividerBgColor;
76
97
  },
77
98
  enumerable: false,
78
99
  configurable: true
79
100
  });
80
101
  Object.defineProperty(SideMenuTheme, "sideMenuHeaderDividerColor", {
81
102
  get: function () {
82
- return this.sideMenuFixedSeparatorColor;
103
+ return this.sideMenuDividerBgColor;
83
104
  },
84
105
  enumerable: false,
85
106
  configurable: true
@@ -89,7 +110,7 @@ var SideMenuTheme = /** @class */ (function (_super) {
89
110
  SideMenuTheme.sideMenuWidthForTouchScreens = '328px';
90
111
  SideMenuTheme.sideMenuMinimizedWidth = '72px';
91
112
  SideMenuTheme.sideMenuMarginX = '16px';
92
- SideMenuTheme.sideMenuBgColor = '#f6f6f6';
113
+ SideMenuTheme.sideMenuBgColor = '#f0f0f0';
93
114
  SideMenuTheme.sideMenuBoxShadowOffsetX = '4px';
94
115
  SideMenuTheme.sideMenuBoxShadowOffsetY = '4px';
95
116
  SideMenuTheme.sideMenuBoxShadowBlurRadius = '24px';
@@ -97,7 +118,6 @@ var SideMenuTheme = /** @class */ (function (_super) {
97
118
  SideMenuTheme.sideMenuLineHeight = '20px';
98
119
  SideMenuTheme.sideMenuLargeLineHeight = '22px';
99
120
  SideMenuTheme.sideMenuProductColor = '#2291ff';
100
- SideMenuTheme.sideMenuFixedSeparatorColor = '#e6e6e6';
101
121
  SideMenuTheme.sideMenuDesktopMediaQuery = '(min-width: 1200px)';
102
122
  SideMenuTheme.sideMenuNarrowDesktopMediaQuery = '(min-width: 992px)';
103
123
  SideMenuTheme.sideMenuTabletMediaQuery = '(min-width: 768px)';
@@ -145,7 +165,7 @@ var SideMenuTheme = /** @class */ (function (_super) {
145
165
  SideMenuTheme.sideMenuIconSubItemPaddingRight = '0';
146
166
  SideMenuTheme.sideMenuIconSubItemMinHeight = '20px';
147
167
  SideMenuTheme.sideMenuIconSubItemLineHeight = '16px';
148
- SideMenuTheme.sideMenuIconSubItemColor = '#858585';
168
+ SideMenuTheme.sideMenuIconSubItemColor = '#757575';
149
169
  SideMenuTheme.sideMenuIconLargeSubItemMinHeight = '22px';
150
170
  SideMenuTheme.sideMenuIconWithSeparatedSubMenuSubItemPaddingLeft = '4px';
151
171
  //#endregion
@@ -154,26 +174,30 @@ var SideMenuTheme = /** @class */ (function (_super) {
154
174
  SideMenuTheme.sideMenuItemContentLargePaddingY = '9px';
155
175
  SideMenuTheme.sideMenuSubItemContentPaddingY = '4px';
156
176
  SideMenuTheme.sideMenuSubItemContentLargePaddingY = '5px';
157
- SideMenuTheme.sideMenuItemContentLargeMultilinePaddingY = '5px';
177
+ SideMenuTheme.sideMenuItemContentLargeMultilinePaddingTop = '9px';
178
+ SideMenuTheme.sideMenuItemContentLargeMultilinePaddingBottom = '13px';
179
+ SideMenuTheme.sideMenuItemContentMultilinePaddingTop = '6px';
180
+ SideMenuTheme.sideMenuItemContentMultilinePaddingBottom = '10px';
158
181
  SideMenuTheme.sideMenuItemContentPaddingYForTouchScreens = '8px';
159
182
  SideMenuTheme.sideMenuSubItemContentPaddingYForTouchScreens = '9px';
160
183
  //#endregion
161
184
  // #region Marker
162
185
  SideMenuTheme.sideMenuMarkerPaddingX = '6px';
186
+ SideMenuTheme.sideMenuMarkerPaddingY = '0px';
163
187
  SideMenuTheme.sideMenuMarkerColor = '#fff';
164
188
  SideMenuTheme.sideMenuMarkerMarginRight = '8px';
165
- SideMenuTheme.sideMenuMarkerFontWeight = '700';
189
+ SideMenuTheme.sideMenuMarkerFontWeight = '600';
190
+ SideMenuTheme.sideMenuSubItemMarkerFontWeight = '400';
166
191
  SideMenuTheme.sideMenuMarkerMultilineMarginTop = '4px';
192
+ SideMenuTheme.sideMenuMarkerLineHeight = '20px';
167
193
  //#endregion
168
194
  // #region Burger
169
195
  SideMenuTheme.sideMenuBurgerMarginRight = '8px';
170
196
  //#endregion
171
197
  // #region MenuItem
172
198
  SideMenuTheme.sideMenuItemBorderRadius = '8px';
173
- SideMenuTheme.sideMenuItemHoverBg = 'rgba(255, 255, 255, 0.48)';
199
+ SideMenuTheme.sideMenuItemHoverBg = '#E6E6E6';
174
200
  SideMenuTheme.sideMenuItemActiveBg = '#fff';
175
- SideMenuTheme.sideMenuSubItemWithSeparatedSubMenuHoverBg = '#f6f6f6';
176
- SideMenuTheme.sideMenuSubItemWithSeparatedSubMenuActiveBg = '#f2f2f2';
177
201
  SideMenuTheme.sideMenuFocusedItemBoxShadowInset = 'inset';
178
202
  SideMenuTheme.sideMenuFocusedItemBoxShadowOffsetX = '0';
179
203
  SideMenuTheme.sideMenuFocusedItemBoxShadowOffsetY = '0';
@@ -182,8 +206,9 @@ var SideMenuTheme = /** @class */ (function (_super) {
182
206
  SideMenuTheme.sideMenuFocusedItemBoxShadowColor = '#1c7edf';
183
207
  //#endregion
184
208
  //#region Divider
185
- SideMenuTheme.sideMenuDividerBgColor = '#d6d6d6';
186
209
  SideMenuTheme.sideMenuDividerMarginX = '8px';
210
+ SideMenuTheme.sideMenuDividerMarginY = '4px';
211
+ SideMenuTheme.sideMenuDividerBgColor = 'rgba(0,0,0, 0.1)';
187
212
  //#endregion
188
213
  //#region NestedMenu
189
214
  SideMenuTheme.sideMenuNestedMenuPaddingLeft = '16px';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skbkontur/side-menu",
3
- "version": "0.14.8",
3
+ "version": "1.0.1-router-test.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -9,6 +9,7 @@ import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
9
9
  import { ScrollContainer, ScrollContainerDataTids } from '@skbkontur/react-ui';
10
10
  import { mergeRefs } from '@skbkontur/react-ui/lib/utils';
11
11
  import { jsStylesForSideMenu } from '../SideMenu/SideMenu.styles';
12
+ import { burgerTransitionDuration } from '../SideMenu/SideMenu';
12
13
  var SideMenuBodyInner = forwardRef(function (_a, ref) {
13
14
  var _b, _c;
14
15
  var className = _a.className, children = _a.children, rest = __rest(_a, ["className", "children"]);
@@ -24,13 +25,14 @@ var SideMenuBodyInner = forwardRef(function (_a, ref) {
24
25
  }
25
26
  };
26
27
  useEffect(function () {
28
+ var delay = context.isMobile ? burgerTransitionDuration : 50;
27
29
  setTimeout(function () {
28
30
  var _a, _b;
29
31
  // @ts-expect-error: accessing private method
30
32
  (_a = context.setHasScrollBar) === null || _a === void 0 ? void 0 : _a.call(context, (_b = scrollContainerRef.current) === null || _b === void 0 ? void 0 : _b.hasScrollBar('y'));
31
- }, 50);
33
+ }, delay);
32
34
  setScrollContainerInnerPosition();
33
- }, [context.activeMenuItem, context.isShown]);
35
+ }, [context.activeMenuItem, context.isShown, context.isBeingTransitioned && context.isMobile]);
34
36
  var theme = getSideMenuTheme(useContext(ThemeContext));
35
37
  if (context.isShown) {
36
38
  return (React.createElement("div", { ref: mergeRefs([ref, sideMenuBodyRef]), className: cx((_b = {}, _b[jsStyles.root(theme)] = true, _b), className) },
@@ -1,11 +1,14 @@
1
1
  import { __assign, __rest } from "tslib";
2
- import React, { forwardRef } from 'react';
2
+ import React, { forwardRef, useContext } from 'react';
3
3
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
4
4
  import { jsStyles } from './SideMenuDivider.styles';
5
+ import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
6
+ import { ThemeContext } from '@skbkontur/react-ui';
5
7
  var SideMenuDividerInner = forwardRef(function (_a, ref) {
6
8
  var _b;
7
9
  var className = _a.className, rest = __rest(_a, ["className"]);
8
- return React.createElement("hr", __assign({ className: cx((_b = {}, _b[jsStyles.root()] = true, _b), className), ref: ref }, rest));
10
+ var theme = getSideMenuTheme(useContext(ThemeContext));
11
+ return React.createElement("hr", __assign({ className: cx((_b = {}, _b[jsStyles.root(theme)] = true, _b), className), ref: ref }, rest));
9
12
  });
10
13
  SideMenuDividerInner.displayName = 'SideMenuDivider';
11
14
  /**
@@ -4,4 +4,5 @@
4
4
  {
5
5
  sideMenuDividerBgColor: string;
6
6
  sideMenuDividerMarginX: string;
7
+ sideMenuDividerMarginY: string;
7
8
  }
@@ -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
  };
@@ -2,8 +2,8 @@ import { __makeTemplateObject } from "tslib";
2
2
  import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
3
3
  import { memoizeStyle } from '../../lib/theming/ThemeHelpers';
4
4
  var styles = {
5
- root: function () {
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 "])));
5
+ root: function (t) {
6
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 1px;\n border: none;\n background: ", ";\n margin: ", " ", ";\n "], ["\n height: 1px;\n border: none;\n background: ", ";\n margin: ", " ", ";\n "])), t.sideMenuDividerBgColor, t.sideMenuDividerMarginY, t.sideMenuDividerMarginX);
7
7
  },
8
8
  };
9
9
  export var jsStyles = memoizeStyle(styles);
@@ -6,7 +6,7 @@ var styles = {
6
6
  return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: ", ";\n padding-top: ", ";\n margin: 0 ", ";\n "], ["\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: ", ";\n padding-top: ", ";\n margin: 0 ", ";\n "])), t.sideMenuFooterPaddingBottom, t.sideMenuFooterPaddingTop, t.sideMenuMarginX);
7
7
  },
8
8
  rootFixed: function (t) {
9
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n box-shadow: inset 0 1px 0 ", ";\n "], ["\n box-shadow: inset 0 1px 0 ", ";\n "])), t.sideMenuFooterDividerColor);
9
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n box-shadow: 0 -1px 0 ", ";\n "], ["\n box-shadow: 0 -1px 0 ", ";\n "])), t.sideMenuFooterDividerColor);
10
10
  },
11
11
  rootTransitioned: function () {
12
12
  return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: static;\n "], ["\n position: static;\n "])));
@@ -12,10 +12,10 @@ var styles = {
12
12
  return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background: transparent;\n "], ["\n background: transparent;\n "])));
13
13
  },
14
14
  rootWithSeparatedMenuShown: function (t) {
15
- return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), t.sideMenuSeparatedSubMenuBgColor);
15
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background: ", ";\n z-index: 9000;\n "], ["\n background: ", ";\n z-index: 9000;\n "])), t.sideMenuSeparatedSubMenuBgColor);
16
16
  },
17
17
  fixedRoot: function (t) {
18
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n box-shadow: inset 0 -1px 0 ", ";\n "], ["\n box-shadow: inset 0 -1px 0 ", ";\n "])), t.sideMenuHeaderDividerColor);
18
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n box-shadow: 0 1px 0 ", ";\n "], ["\n box-shadow: 0 1px 0 ", ";\n "])), t.sideMenuHeaderDividerColor);
19
19
  },
20
20
  };
21
21
  export var jsStyles = memoizeStyle(styles);
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { CommonClickableElementProps } from '../internal/ClickableElement';
3
3
  export interface SideMenuItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, CommonClickableElementProps {
4
+ component?: React.ComponentType<any>;
4
5
  }
5
6
  /**
6
7
  * Элемент списка
@@ -1,8 +1,9 @@
1
- import { __assign } from "tslib";
1
+ import { __assign, __rest } from "tslib";
2
2
  import React, { forwardRef } from 'react';
3
3
  import { ClickableElement } from '../internal/ClickableElement';
4
- var SideMenuItemInner = forwardRef(function (props, ref) {
5
- return React.createElement(ClickableElement, __assign({}, props, { ref: ref, element: 'button' }));
4
+ var SideMenuItemInner = forwardRef(function (_a, ref) {
5
+ var component = _a.component, rest = __rest(_a, ["component"]);
6
+ return React.createElement(ClickableElement, __assign({}, rest, { ref: ref, element: component !== null && component !== void 0 ? component : 'button' }));
6
7
  });
7
8
  SideMenuItemInner.displayName = 'SideMenuItem';
8
9
  /**
@@ -19,7 +19,10 @@
19
19
  sideMenuItemContentLargePaddingY: string;
20
20
  sideMenuSubItemContentPaddingY: string;
21
21
  sideMenuSubItemContentLargePaddingY: string;
22
- sideMenuItemContentLargeMultilinePaddingY: string;
22
+ sideMenuItemContentLargeMultilinePaddingTop: string;
23
+ sideMenuItemContentLargeMultilinePaddingBottom: string;
24
+ sideMenuItemContentMultilinePaddingTop: string;
25
+ sideMenuItemContentMultilinePaddingBottom: string;
23
26
  sideMenuItemContentPaddingYForTouchScreens: string;
24
27
  sideMenuSubItemContentPaddingYForTouchScreens: string;
25
28
  //#endregion
@@ -53,11 +56,15 @@
53
56
  //#endregion
54
57
  // #region Marker
55
58
  sideMenuMarkerPaddingX: string;
59
+ sideMenuMarkerPaddingY: string;
56
60
  sideMenuMarkerBg: string;
57
61
  sideMenuMarkerColor: string;
62
+ sideMenuMarkerSubItemColor: string;
58
63
  sideMenuMarkerMarginRight: string;
59
64
  sideMenuMarkerFontWeight: string;
65
+ sideMenuSubItemMarkerFontWeight: string;
60
66
  sideMenuMarkerMultilineMarginTop: string;
67
+ sideMenuMarkerLineHeight: string;
61
68
  //#endregion
62
69
  }
63
70
  ```
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { CommonClickableElementProps } from '../internal/ClickableElement';
3
3
  export interface SideMenuLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement>, CommonClickableElementProps {
4
+ component?: React.ComponentType<any>;
4
5
  }
5
6
  /**
6
7
  * Ссылка для `SideMenu`
@@ -5,8 +5,8 @@ import { jsStyles } from './SideMenuLink.styles';
5
5
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
6
6
  var SideMenuLinkInner = forwardRef(function (_a, ref) {
7
7
  var _b;
8
- var className = _a.className, rest = __rest(_a, ["className"]);
9
- return React.createElement(ClickableElement, __assign({}, rest, { ref: ref, element: 'a', className: cx((_b = {}, _b[jsStyles.link()] = true, _b), className) }));
8
+ var className = _a.className, component = _a.component, rest = __rest(_a, ["className", "component"]);
9
+ return (React.createElement(ClickableElement, __assign({}, rest, { ref: ref, element: component !== null && component !== void 0 ? component : 'a', className: cx((_b = {}, _b[jsStyles.link()] = true, _b), className) })));
10
10
  });
11
11
  SideMenuLinkInner.displayName = 'SideMenuLink';
12
12
  /**
@@ -21,7 +21,7 @@ export interface CommonClickableElementProps extends CommonProps {
21
21
  _isBackButton?: boolean;
22
22
  }
23
23
  export interface ClickableElementProps extends CommonClickableElementProps {
24
- element: 'a' | 'button';
24
+ element: 'a' | 'button' | React.ComponentType<any>;
25
25
  href?: string;
26
26
  onClick?: React.EventHandler<React.MouseEvent<Element>>;
27
27
  onKeyDown?: React.EventHandler<React.KeyboardEvent<Element>>;
@@ -65,11 +65,13 @@ var ClickableElement = forwardRef(function (_a, ref) {
65
65
  };
66
66
  var setSeparatedMenuIsShown = function () {
67
67
  var _a, _b;
68
- if (!_isSubMenu && context.isSeparatedMenu) {
69
- (_a = context.setIsSeparatedMenuShown) === null || _a === void 0 ? void 0 : _a.call(context, false);
68
+ if (_isDropdown || _isSubMenu || !context.isSeparatedMenu)
69
+ return;
70
+ if (children) {
71
+ (_a = context.setIsSeparatedMenuShown) === null || _a === void 0 ? void 0 : _a.call(context, true);
70
72
  }
71
- if (context.isSeparatedMenu && !_isSubMenu && children) {
72
- (_b = context.setIsSeparatedMenuShown) === null || _b === void 0 ? void 0 : _b.call(context, true);
73
+ else {
74
+ (_b = context.setIsSeparatedMenuShown) === null || _b === void 0 ? void 0 : _b.call(context, false);
73
75
  }
74
76
  };
75
77
  var handleClick = function (e) {
@@ -1,10 +1,7 @@
1
1
  import { __assign } from "tslib";
2
2
  import React, { isValidElement, useContext, useEffect, useRef, useState } from 'react';
3
- import { jsStyles } from './InnerBody.styles';
4
3
  import { SideMenuContext } from '../SideMenuContext';
5
4
  import { getAllParents, getChildrenIdArray, getElementsChildren, getItemId, isClickableElement, } from '../../lib/utils/scripts';
6
- import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
7
- import { ThemeContext } from '@skbkontur/react-ui';
8
5
  /**
9
6
  * Внутренняя часть SideMenuBody
10
7
  *
@@ -15,7 +12,6 @@ var InnerBody = function (_a) {
15
12
  var context = useContext(SideMenuContext);
16
13
  var _b = useState([]), parents = _b[0], setParents = _b[1];
17
14
  var flattedArrayOfAllElements = useRef([]);
18
- var theme = getSideMenuTheme(useContext(ThemeContext));
19
15
  var getFlattedArrayOfAllElements = function () {
20
16
  var levelIndex = 0;
21
17
  React.Children.map(children, function (child) {
@@ -52,12 +48,6 @@ var InnerBody = function (_a) {
52
48
  var levelIndex = 0;
53
49
  return (React.createElement(SideMenuContext.Provider, { value: __assign({ openedParents: parents, flattedArrayOfAllElements: flattedArrayOfAllElements.current }, context) }, React.Children.map(children, function (child) {
54
50
  if (React.isValidElement(child)) {
55
- // @ts-expect-error: accessing private property
56
- if ((child === null || child === void 0 ? void 0 : child.type.__KONTUR_REACT_UI__) === 'SideMenuDivider') {
57
- return React.cloneElement(child, {
58
- className: jsStyles.divider(theme),
59
- });
60
- }
61
51
  if (
62
52
  // @ts-expect-error: accessing private property
63
53
  isClickableElement(child.type.__KONTUR_REACT_UI__)) {
@@ -56,7 +56,7 @@ export var Caption = forwardRef(function (_a, ref) {
56
56
  _c[jsStyles.captionDropdown()] = _isDropdown,
57
57
  _c[jsStyles.captionTruncated()] = _isDropdown && (!_isAvatar || isAvatarCaptionSingleWord(caption, _isAvatar)),
58
58
  _c[jsStyles.captionSubItem(theme)] = _isSubMenu,
59
- _c[jsStyles.captionSubItemSeparatedMenuTopLevel()] = isSeparatedMenu && !_isNestedSubMenu && _isSubMenu,
59
+ _c[jsStyles.captionSubItemSeparatedMenuTopLevel()] = isSeparatedMenu && !_isNestedSubMenu && _isSubMenu && !hasIcon,
60
60
  _c[jsStyles.captionNestedItemSeparatedMenu()] = isSeparatedMenu && _isNestedSubMenu && !hasIcon,
61
61
  _c[jsStyles.captionWithoutItemIcon()] = !hasIcon && !isSeparatedMenu,
62
62
  _c[jsStyles.captionSubItemWithoutColumnIcons()] = _isSubMenu && isSeparatedMenu && !hasSubIcons,
@@ -37,6 +37,5 @@ export var Icon = function (_a) {
37
37
  _b[jsStyles.rootSubItemSeparatedMenu(theme)] = isSeparatedMenu && _isSubMenu,
38
38
  _b[jsStyles.rootSubItemLarge(theme)] = _isSubMenu && size === 'large',
39
39
  _b[jsStyles.rootBackButton(theme)] = _isBackButton,
40
- _b[jsStyles.rootAvatar()] = _isAvatar,
41
40
  _b)) }, renderIcon()));
42
41
  };
@@ -7,5 +7,4 @@ export declare const jsStyles: {
7
7
  rootSubItem(t: SideMenuTheme): string;
8
8
  rootSubItemSeparatedMenu(t: SideMenuTheme): string;
9
9
  rootBackButton(t: SideMenuTheme): string;
10
- rootAvatar(): string;
11
10
  };
@@ -6,10 +6,10 @@ var styles = {
6
6
  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.sideMenuIconMarginX, t.sideMenuIconMinHeight, t.sideMenuIconLineHeight);
7
7
  },
8
8
  rootMultiline: function () {
9
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: flex-start;\n "], ["\n align-self: flex-start;\n "])));
9
+ 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 "])));
10
10
  },
11
11
  rootLarge: function (t) {
12
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n min-height: ", ";\n line-height: ", ";\n "], ["\n min-height: ", ";\n line-height: ", ";\n "])), t.sideMenuIconLargeMinHeight, t.sideMenuIconLargeLineHeight);
12
+ 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.sideMenuIconLargeMinHeight, t.sideMenuIconLargeLineHeight);
13
13
  },
14
14
  rootSubItemLarge: function (t) {
15
15
  return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n min-height: ", ";\n "], ["\n min-height: ", ";\n "])), t.sideMenuIconLargeSubItemMinHeight);
@@ -23,9 +23,6 @@ var styles = {
23
23
  rootBackButton: function (t) {
24
24
  return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-left: ", ";\n padding-right: ", ";\n "], ["\n padding-left: ", ";\n padding-right: ", ";\n "])), t.sideMenuBackButtonIconPaddingLeft, t.sideMenuBackButtonIconPaddingRight);
25
25
  },
26
- rootAvatar: function () {
27
- return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n min-height: unset;\n "], ["\n min-height: unset;\n "])));
28
- },
29
26
  };
30
27
  export var jsStyles = memoizeStyle(styles);
31
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
28
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
@@ -42,7 +42,7 @@ var ItemContent = forwardRef(function (_a, ref) {
42
42
  if (!_isBackButton && _isSubMenu) {
43
43
  useNumberOfTextLinesInSubItem(textRef, setMultilineSubItem, size, theme);
44
44
  }
45
- }, []);
45
+ }, [caption]);
46
46
  useEffect(function () {
47
47
  if (!_isBackButton && !_isDropdown) {
48
48
  useNumberOfTextLinesInItem({
@@ -60,8 +60,9 @@ var ItemContent = forwardRef(function (_a, ref) {
60
60
  return (React.createElement("div", { className: cx((_b = {},
61
61
  _b[jsStyles.root(theme)] = true,
62
62
  _b[jsStyles.subItemRoot(theme)] = _isSubMenu,
63
- _b[jsStyles.largeRoot(theme)] = size === 'large',
63
+ _b[jsStyles.largeRoot(theme)] = size === 'large' && !_isSubMenu,
64
64
  _b[jsStyles.subItemLargeRoot(theme)] = size === 'large' && _isSubMenu,
65
+ _b[jsStyles.multilineRoot(theme)] = isMultiline && !_isSubMenu,
65
66
  _b[jsStyles.largeMultilineRoot(theme)] = isMultiline && size === 'large',
66
67
  _b[jsStyles.rootForTouchScreens(theme)] = isTouchScreen,
67
68
  _b[jsStyles.subItemRootForTouchScreens(theme)] = isTouchScreen && _isSubMenu,
@@ -73,7 +74,7 @@ var ItemContent = forwardRef(function (_a, ref) {
73
74
  _c[customStyles.textAndMarkerWrapperMultiline(getItemContentHeight(theme, linesNumber, size))] = isMultiline && !_isSubMenu,
74
75
  _c)) },
75
76
  React.createElement(Caption, { _isSubMenu: _isSubMenu, _isNestedSubMenu: _isNestedSubMenu, hasIcon: !!icon, isMultiline: isMultiline, caption: caption, subCaption: subCaption, _isBackButton: _isBackButton, _isDropdown: _isDropdown, _isAvatar: _isAvatar, ref: textRef }),
76
- marker && (!context.isMinimized || isSeparatedSubMenuInNarrowDesktop) && (React.createElement(Marker, { isMultiline: isMultiline, marker: marker }))))));
77
+ marker && (!context.isMinimized || isSeparatedSubMenuInNarrowDesktop) && (React.createElement(Marker, { isMultiline: isMultiline, marker: marker, _isSubMenu: _isSubMenu }))))));
77
78
  });
78
79
  ItemContent.displayName = 'ItemContent';
79
80
  var ItemContentWithStaticFields = Object.assign(ItemContent, { __KONTUR_REACT_UI__: 'ItemContent' });
@@ -6,6 +6,7 @@ export declare const jsStyles: {
6
6
  root(t: SideMenuTheme): string;
7
7
  largeRoot(t: SideMenuTheme): string;
8
8
  subItemLargeRoot(t: SideMenuTheme): string;
9
+ multilineRoot(t: SideMenuTheme): string;
9
10
  largeMultilineRoot(t: SideMenuTheme): string;
10
11
  rootForTouchScreens(t: SideMenuTheme): string;
11
12
  subItemRootForTouchScreens(t: SideMenuTheme): string;
@@ -11,29 +11,32 @@ var styles = {
11
11
  subItemLargeRoot: function (t) {
12
12
  return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "], ["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "])), t.sideMenuSubItemContentLargePaddingY, t.sideMenuSubItemContentLargePaddingY);
13
13
  },
14
+ multilineRoot: function (t) {
15
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "], ["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "])), t.sideMenuItemContentMultilinePaddingTop, t.sideMenuItemContentMultilinePaddingBottom);
16
+ },
14
17
  largeMultilineRoot: function (t) {
15
- return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuItemContentLargeMultilinePaddingY, t.sideMenuItemContentLargeMultilinePaddingY);
18
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "], ["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "])), t.sideMenuItemContentLargeMultilinePaddingTop, t.sideMenuItemContentLargeMultilinePaddingBottom);
16
19
  },
17
20
  rootForTouchScreens: function (t) {
18
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuItemContentPaddingYForTouchScreens, t.sideMenuItemContentPaddingYForTouchScreens);
21
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuItemContentPaddingYForTouchScreens, t.sideMenuItemContentPaddingYForTouchScreens);
19
22
  },
20
23
  subItemRootForTouchScreens: function (t) {
21
- return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuSubItemContentPaddingYForTouchScreens, t.sideMenuSubItemContentPaddingYForTouchScreens);
24
+ return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuSubItemContentPaddingYForTouchScreens, t.sideMenuSubItemContentPaddingYForTouchScreens);
22
25
  },
23
26
  subItemRoot: function (t) {
24
- return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuSubItemContentPaddingY, t.sideMenuSubItemContentPaddingY);
27
+ return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuSubItemContentPaddingY, t.sideMenuSubItemContentPaddingY);
25
28
  },
26
29
  textAndMarkerWrapper: function () {
27
- return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n flex-grow: 1;\n align-items: center;\n min-width: 0;\n "], ["\n display: flex;\n flex-grow: 1;\n align-items: center;\n min-width: 0;\n "])));
30
+ return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n display: flex;\n flex-grow: 1;\n align-items: center;\n min-width: 0;\n "], ["\n display: flex;\n flex-grow: 1;\n align-items: center;\n min-width: 0;\n "])));
28
31
  },
29
32
  textAndMarkerWrapperDropdown: function () {
30
- return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n overflow: hidden;\n "], ["\n overflow: hidden;\n "])));
33
+ return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n overflow: hidden;\n "], ["\n overflow: hidden;\n "])));
31
34
  },
32
35
  };
33
36
  export var customStyles = {
34
37
  textAndMarkerWrapperMultiline: function (height) {
35
- return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n min-height: ", "px;\n "], ["\n min-height: ", "px;\n "])), height);
38
+ return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n min-height: ", "px;\n "], ["\n min-height: ", "px;\n "])), height);
36
39
  },
37
40
  };
38
41
  export var jsStyles = memoizeStyle(styles);
39
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
42
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
@@ -1,6 +1,6 @@
1
1
  import { SideMenuItemProps } from '../../SideMenuItem/SideMenuItem';
2
- interface MarkerProps extends Pick<SideMenuItemProps, 'marker'> {
2
+ interface MarkerProps extends Pick<SideMenuItemProps, 'marker' | '_isSubMenu'> {
3
3
  isMultiline: boolean;
4
4
  }
5
- export declare const Marker: ({ isMultiline, marker }: MarkerProps) => JSX.Element;
5
+ export declare const Marker: ({ isMultiline, marker, _isSubMenu }: MarkerProps) => JSX.Element;
6
6
  export {};
@@ -5,10 +5,11 @@ import { getSideMenuTheme } from '../../../lib/theming/ThemeHelpers';
5
5
  import { ThemeContext } from '@skbkontur/react-ui';
6
6
  export var Marker = function (_a) {
7
7
  var _b;
8
- var isMultiline = _a.isMultiline, marker = _a.marker;
8
+ var isMultiline = _a.isMultiline, marker = _a.marker, _isSubMenu = _a._isSubMenu;
9
9
  var theme = getSideMenuTheme(useContext(ThemeContext));
10
10
  return (React.createElement("span", { className: cx((_b = {},
11
11
  _b[jsStyles.root(theme)] = true,
12
12
  _b[jsStyles.rootMultiline(theme)] = isMultiline,
13
+ _b[jsStyles.rootSubMenu(theme)] = _isSubMenu,
13
14
  _b)) }, marker));
14
15
  };
@@ -2,4 +2,5 @@ import { SideMenuTheme } from '../../../lib/theming/ThemeTypes';
2
2
  export declare const jsStyles: {
3
3
  root(t: SideMenuTheme): string;
4
4
  rootMultiline(t: SideMenuTheme): string;
5
+ rootSubMenu(t: SideMenuTheme): string;
5
6
  };
@@ -3,11 +3,14 @@ import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
3
3
  import { memoizeStyle } from '../../../lib/theming/ThemeHelpers';
4
4
  var styles = {
5
5
  root: function (t) {
6
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-right: ", ";\n padding-left: ", ";\n background: ", ";\n border-radius: 9999px;\n margin-left: auto;\n margin-right: ", ";\n color: ", ";\n line-height: ", ";\n font-weight: ", ";\n "], ["\n padding-right: ", ";\n padding-left: ", ";\n background: ", ";\n border-radius: 9999px;\n margin-left: auto;\n margin-right: ", ";\n color: ", ";\n line-height: ", ";\n font-weight: ", ";\n "])), t.sideMenuMarkerPaddingX, t.sideMenuMarkerPaddingX, t.sideMenuMarkerBg, t.sideMenuMarkerMarginRight, t.sideMenuMarkerColor, t.sideMenuLineHeight, t.sideMenuMarkerFontWeight);
6
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: ", " ", ";\n background: ", ";\n border-radius: 9999px;\n margin-left: auto;\n margin-right: ", ";\n color: ", ";\n font-size: 14px;\n line-height: ", ";\n font-weight: ", ";\n min-width: 8px;\n text-align: center;\n flex-shrink: 0;\n "], ["\n padding: ", " ", ";\n background: ", ";\n border-radius: 9999px;\n margin-left: auto;\n margin-right: ", ";\n color: ", ";\n font-size: 14px;\n line-height: ", ";\n font-weight: ", ";\n min-width: 8px;\n text-align: center;\n flex-shrink: 0;\n "])), t.sideMenuMarkerPaddingY, t.sideMenuMarkerPaddingX, t.sideMenuMarkerBg, t.sideMenuMarkerMarginRight, t.sideMenuMarkerColor, t.sideMenuMarkerLineHeight, t.sideMenuMarkerFontWeight);
7
7
  },
8
8
  rootMultiline: function (t) {
9
9
  return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: flex-start;\n margin-top: ", ";\n "], ["\n align-self: flex-start;\n margin-top: ", ";\n "])), t.sideMenuMarkerMultilineMarginTop);
10
10
  },
11
+ rootSubMenu: function (t) {
12
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background: transparent;\n color: ", ";\n font-weight: ", ";\n "], ["\n background: transparent;\n color: ", ";\n font-weight: ", ";\n "])), t.sideMenuMarkerSubItemColor, t.sideMenuSubItemMarkerFontWeight);
13
+ },
11
14
  };
12
15
  export var jsStyles = memoizeStyle(styles);
13
- var templateObject_1, templateObject_2;
16
+ var templateObject_1, templateObject_2, templateObject_3;
@@ -1,4 +0,0 @@
1
- import { SideMenuTheme } from '../../lib/theming/ThemeTypes';
2
- export declare const jsStyles: {
3
- divider(t: SideMenuTheme): string;
4
- };
@@ -1,10 +0,0 @@
1
- import { __makeTemplateObject } from "tslib";
2
- import { css } from '@skbkontur/react-ui/lib/theming/Emotion';
3
- import { memoizeStyle } from '../../lib/theming/ThemeHelpers';
4
- var styles = {
5
- divider: function (t) {
6
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: ", ";\n margin-left: ", ";\n margin-right: ", ";\n "], ["\n background: ", ";\n margin-left: ", ";\n margin-right: ", ";\n "])), t.sideMenuDividerBgColor, t.sideMenuDividerMarginX, t.sideMenuDividerMarginX);
7
- },
8
- };
9
- export var jsStyles = memoizeStyle(styles);
10
- var templateObject_1;