@skbkontur/side-menu 4.0.10 → 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 (91) hide show
  1. package/CHANGELOG.md +0 -15
  2. package/README.md +38 -11
  3. package/SideMenuDataTids.d.ts +2 -1
  4. package/SideMenuDataTids.js +2 -1
  5. package/hooks/useMemoIcon.d.ts +1 -2
  6. package/hooks/useMemoIcon.js +0 -9
  7. package/hooks/useNodeState.d.ts +7 -0
  8. package/hooks/useNodeState.js +12 -0
  9. package/hooks/useSideMenuReducer.d.ts +13 -0
  10. package/hooks/useSideMenuReducer.js +23 -0
  11. package/internal/themes/SideMenuDarkTheme.js +6 -0
  12. package/internal/themes/SideMenuTheme.d.ts +32 -10
  13. package/internal/themes/SideMenuTheme.js +44 -30
  14. package/lib/theming/ThemeHelpers.js +0 -4
  15. package/lib/utils/scripts.d.ts +1 -0
  16. package/lib/utils/scripts.js +9 -0
  17. package/package.json +2 -2
  18. package/src/SideMenu/SideMenu.d.ts +9 -4
  19. package/src/SideMenu/SideMenu.js +206 -189
  20. package/src/SideMenu/SideMenu.styles.d.ts +5 -0
  21. package/src/SideMenu/SideMenu.styles.js +35 -12
  22. package/src/SideMenuAvatar/SideMenuAvatar.js +7 -2
  23. package/src/SideMenuBody/SideMenuBody.js +2 -0
  24. package/src/SideMenuBody/SideMenuBody.styles.js +1 -1
  25. package/src/SideMenuContext.d.ts +21 -9
  26. package/src/SideMenuContext.js +6 -1
  27. package/src/SideMenuDivider/SideMenuDivider.js +4 -1
  28. package/src/SideMenuDivider/SideMenuDivider.styles.d.ts +1 -0
  29. package/src/SideMenuDivider/SideMenuDivider.styles.js +5 -2
  30. package/src/SideMenuDropdown/SideMenuDropdown.js +20 -20
  31. package/src/SideMenuDropdown/SideMenuDropdown.styles.d.ts +1 -0
  32. package/src/SideMenuDropdown/SideMenuDropdown.styles.js +13 -8
  33. package/src/SideMenuFooter/SideMenuFooter.js +59 -5
  34. package/src/SideMenuFooter/SideMenuFooter.styles.d.ts +11 -0
  35. package/src/SideMenuFooter/SideMenuFooter.styles.js +38 -4
  36. package/src/SideMenuHeader/SideMenuHeader.js +6 -5
  37. package/src/SideMenuNotifications/BellWidget.js +6 -13
  38. package/src/SideMenuNotifications/BellWidgetError.js +3 -6
  39. package/src/SideMenuNotifications/BellWidgetView.styles.d.ts +4 -7
  40. package/src/SideMenuNotifications/BellWidgetView.styles.js +9 -20
  41. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +2 -1
  42. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.d.ts +2 -1
  43. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +6 -3
  44. package/src/SideMenuSubLink/SideMenuSubLink.d.ts +1 -1
  45. package/src/internal/BackButton.d.ts +1 -3
  46. package/src/internal/BackButton.js +4 -3
  47. package/src/internal/ClickableElement.d.ts +18 -2
  48. package/src/internal/ClickableElement.js +191 -69
  49. package/src/internal/ClickableElement.styles.d.ts +5 -0
  50. package/src/internal/ClickableElement.styles.js +25 -8
  51. package/src/internal/CollapseToggle.d.ts +2 -0
  52. package/src/internal/CollapseToggle.js +44 -0
  53. package/src/internal/{RightBorder.styles.d.ts → CollapseToggle.styles.d.ts} +2 -1
  54. package/src/internal/CollapseToggle.styles.js +19 -0
  55. package/src/internal/ItemContent/Caption.d.ts +1 -1
  56. package/src/internal/ItemContent/Caption.js +10 -26
  57. package/src/internal/ItemContent/Caption.styles.d.ts +1 -0
  58. package/src/internal/ItemContent/Caption.styles.js +16 -13
  59. package/src/internal/ItemContent/Icon.js +5 -2
  60. package/src/internal/ItemContent/Icon.styles.d.ts +3 -0
  61. package/src/internal/ItemContent/Icon.styles.js +16 -7
  62. package/src/internal/ItemContent/ItemContent.js +17 -5
  63. package/src/internal/ItemContent/ItemContent.styles.d.ts +1 -0
  64. package/src/internal/ItemContent/ItemContent.styles.js +7 -4
  65. package/src/internal/ItemContent/Marker.js +8 -2
  66. package/src/internal/ItemContent/Marker.styles.d.ts +3 -0
  67. package/src/internal/ItemContent/Marker.styles.js +16 -5
  68. package/src/internal/NarrowAccordionDropdown.d.ts +15 -0
  69. package/src/internal/NarrowAccordionDropdown.js +35 -0
  70. package/src/internal/SeparatedSubMenu.js +7 -9
  71. package/src/internal/SeparatedSubMenu.styles.d.ts +0 -3
  72. package/src/internal/SeparatedSubMenu.styles.js +6 -15
  73. package/src/internal/SideMenuLogotype.js +13 -11
  74. package/src/internal/SubMenu.js +3 -2
  75. package/src/navigationAttributes.d.ts +3 -0
  76. package/src/navigationAttributes.js +3 -0
  77. package/src/state/reducer.d.ts +2 -0
  78. package/src/state/reducer.js +258 -0
  79. package/src/state/selectors.d.ts +16 -0
  80. package/src/state/selectors.js +71 -0
  81. package/src/state/types.d.ts +59 -0
  82. package/src/state/types.js +17 -0
  83. package/src/Navigation.d.ts +0 -53
  84. package/src/Navigation.js +0 -194
  85. package/src/SideMenuNotifications/utils/getWrapperHeightClass.d.ts +0 -11
  86. package/src/SideMenuNotifications/utils/getWrapperHeightClass.js +0 -10
  87. package/src/Tree.d.ts +0 -17
  88. package/src/Tree.js +0 -135
  89. package/src/internal/RightBorder.d.ts +0 -9
  90. package/src/internal/RightBorder.js +0 -37
  91. package/src/internal/RightBorder.styles.js +0 -14
@@ -4,42 +4,31 @@ export var getStyles = memoizeGetStyles(function (_a) {
4
4
  var css = _a.css;
5
5
  return ({
6
6
  root: function () {
7
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: 400px;\n max-height: 784px;\n max-width: 100vw;\n "], ["\n display: flex;\n flex-direction: column;\n min-height: 400px;\n max-height: 784px;\n max-width: 100vw;\n "])));
8
- },
9
- rootMobile: function () {
10
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "])));
11
- },
12
- rootDesktop: function () {
13
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 448px;\n "], ["\n width: 448px;\n "])));
7
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: 400px;\n max-height: 784px;\n width: 100%;\n max-width: 100vw;\n\n @media (min-width: 768px) {\n width: 448px;\n }\n "], ["\n display: flex;\n flex-direction: column;\n min-height: 400px;\n max-height: 784px;\n width: 100%;\n max-width: 100vw;\n\n @media (min-width: 768px) {\n width: 448px;\n }\n "])));
14
8
  },
15
9
  widgetWrapper: function () {
16
- return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n min-height: 0;\n flex-grow: 1;\n "], ["\n min-height: 0;\n flex-grow: 1;\n "])));
17
- },
18
- centeredContent: function () {
19
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex: 1;\n min-height: 0;\n overflow: auto;\n align-items: center;\n justify-content: center;\n "], ["\n display: flex;\n flex: 1;\n min-height: 0;\n overflow: auto;\n align-items: center;\n justify-content: center;\n "])));
10
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n min-height: 0;\n flex-grow: 1;\n "], ["\n min-height: 0;\n flex-grow: 1;\n "])));
20
11
  },
21
12
  header: function () {
22
- return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n padding: 6px 6px 0 20px;\n align-items: center;\n justify-content: space-between;\n "], ["\n display: flex;\n padding: 6px 6px 0 20px;\n align-items: center;\n justify-content: space-between;\n "])));
13
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n padding: 6px 6px 0 20px;\n align-items: center;\n justify-content: space-between;\n "], ["\n display: flex;\n padding: 6px 6px 0 20px;\n align-items: center;\n justify-content: space-between;\n "])));
23
14
  },
24
15
  headerText: function () {
25
- return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size: 18px;\n line-height: 24px;\n font-weight: 700;\n "], ["\n font-size: 18px;\n line-height: 24px;\n font-weight: 700;\n "])));
16
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: 18px;\n line-height: 24px;\n font-weight: 700;\n "], ["\n font-size: 18px;\n line-height: 24px;\n font-weight: 700;\n "])));
26
17
  },
27
18
  });
28
19
  });
29
20
  export var getCustomStyles = function (_a) {
30
21
  var css = _a.css;
31
22
  return ({
32
- defaultHeightDesktop: function (offsetTop) {
23
+ defaultHeight: function (offsetTop) {
24
+ if (offsetTop === void 0) { offsetTop = 0; }
33
25
  var offsetBottom = '20px';
34
- return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n height: calc(100vh - ", "px - ", ");\n "], ["\n height: calc(100vh - ", "px - ", ");\n "])), offsetTop, offsetBottom);
35
- },
36
- defaultHeightMobile: function (mobilePopupHeightOffset) {
37
- return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n height: calc(100vh - (", "));\n max-height: calc(100vh - (", "));\n\n @supports (height: 100dvh) {\n height: calc(100dvh - (", "));\n max-height: calc(100dvh - (", "));\n }\n "], ["\n height: calc(100vh - (", "));\n max-height: calc(100vh - (", "));\n\n @supports (height: 100dvh) {\n height: calc(100dvh - (", "));\n max-height: calc(100dvh - (", "));\n }\n "])), mobilePopupHeightOffset, mobilePopupHeightOffset, mobilePopupHeightOffset, mobilePopupHeightOffset);
26
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n height: calc(100vh - ", "px - ", ");\n "], ["\n height: calc(100vh - ", "px - ", ");\n "])), offsetTop, offsetBottom);
38
27
  },
39
28
  customHeight: function (value) {
40
29
  if (value === void 0) { value = ''; }
41
- return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n height: ", ";\n "], ["\n height: ", ";\n "])), value);
30
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n height: ", ";\n "], ["\n height: ", ";\n "])), value);
42
31
  },
43
32
  });
44
33
  };
45
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
34
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -13,7 +13,8 @@ var SideMenuSubItemHeaderInner = forwardRef(function (_a, ref) {
13
13
  var cx = useEmotion().cx;
14
14
  var styles = useStyles(getStyles);
15
15
  return (React.createElement("p", __assign({ className: cx(styles.root(theme), (_b = {},
16
- _b[styles.rootInSeparatedSubMenu()] = context.isSeparatedMenu,
16
+ _b[styles.rootInDropdown()] = !context.isOpened && !context.isSeparatedMenu,
17
+ _b[styles.rootInSeparatedSubMenu(theme)] = context.isSeparatedMenu,
17
18
  _b), className), ref: ref }, rest), children));
18
19
  });
19
20
  SideMenuSubItemHeaderInner.displayName = 'SideMenuSubItemHeader';
@@ -1,5 +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
- rootInSeparatedSubMenu(): string;
4
+ rootInDropdown(): string;
5
+ rootInSeparatedSubMenu(t: SideMenuTheme): string;
5
6
  }>;
@@ -6,9 +6,12 @@ export var getStyles = memoizeGetStyles(function (_a) {
6
6
  root: function (t) {
7
7
  return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: ", ";\n color: ", ";\n padding: ", ";\n margin: 0;\n "], ["\n font-size: ", ";\n color: ", ";\n padding: ", ";\n margin: 0;\n "])), t.sideMenuSubItemHeaderFontSize, t.sideMenuSubItemHeaderColor, t.sideMenuSubItemHeaderPadding);
8
8
  },
9
- rootInSeparatedSubMenu: function () {
10
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-left: 8px;\n "], ["\n padding-left: 8px;\n "])));
9
+ rootInDropdown: function () {
10
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 12px 8px 4px 8px;\n "], ["\n padding: 12px 8px 4px 8px;\n "])));
11
+ },
12
+ rootInSeparatedSubMenu: function (t) {
13
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: ", ";\n line-height: 16px;\n color: ", ";\n "], ["\n padding: ", ";\n line-height: 16px;\n color: ", ";\n "])), t.sideMenuSubItemHeaderPaddingInSeparatedSubMenu, t.sideMenuSubItemHeaderColorInSeparatedSubMenu);
11
14
  },
12
15
  });
13
16
  });
14
- var templateObject_1, templateObject_2;
17
+ var templateObject_1, templateObject_2, templateObject_3;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { SideMenuLinkProps } from '../SideMenuLink/SideMenuLink.js';
3
- export interface SideMenuSubLinkProps<T = string> extends Omit<SideMenuLinkProps<T>, 'icon'>, Partial<Pick<SideMenuLinkProps, 'icon'>> {
3
+ export interface SideMenuSubLinkProps<T = string> extends Omit<SideMenuLinkProps<T>, 'icon' | 'hint'>, Partial<Pick<SideMenuLinkProps, 'icon'>> {
4
4
  }
5
5
  /**
6
6
  * Ссылка в подменю для `SideMenu`
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { CommonClickableElementProps } from './ClickableElement.js';
3
- export interface BackButtonProps extends Pick<CommonClickableElementProps, 'caption' | 'id'> {
4
- href?: string;
5
- }
3
+ export type BackButtonProps = Pick<CommonClickableElementProps, 'caption' | 'id'>;
6
4
  declare const BackButtonWithStaticFields: React.ForwardRefExoticComponent<BackButtonProps & React.RefAttributes<HTMLButtonElement>> & {
7
5
  __KONTUR_REACT_UI__: string;
8
6
  };
@@ -1,7 +1,7 @@
1
1
  import { IconArrowALeftRegular20 } from '@skbkontur/icons/IconArrowALeftRegular20';
2
2
  import React, { forwardRef, useContext } from 'react';
3
3
  import { SideMenuDataTids } from '../../SideMenuDataTids.js';
4
- import { navigationAttributeBackButton } from '../Navigation.js';
4
+ import { navigationAttributeBackButton } from '../navigationAttributes.js';
5
5
  import { SideMenuContext } from '../SideMenuContext.js';
6
6
  import { SideMenuItem } from '../SideMenuItem/SideMenuItem.js';
7
7
  /**
@@ -14,8 +14,9 @@ var BackButton = forwardRef(function (_a, ref) {
14
14
  var caption = _a.caption, id = _a.id;
15
15
  var context = useContext(SideMenuContext);
16
16
  var handleClick = function () {
17
- var _a;
18
- (_a = context.navigation) === null || _a === void 0 ? void 0 : _a.switchActiveMenuItem(id);
17
+ if (id !== undefined) {
18
+ context.dispatch({ type: 'SELECT', id: id, isButton: false });
19
+ }
19
20
  };
20
21
  return (React.createElement(SideMenuItem, (_b = { ref: ref, "data-tid": SideMenuDataTids.backButton, icon: React.createElement(IconArrowALeftRegular20, null), caption: caption, onClick: handleClick, _isSubMenu: true, _isBackButton: true }, _b[navigationAttributeBackButton] = '', _b)));
21
22
  });
@@ -19,11 +19,21 @@ export interface CommonClickableElementProps extends CommonProps {
19
19
  disabled?: boolean;
20
20
  /** Отключает перенос строки у заголовка элемента, вместо этого он будет обрезаться многоточием. */
21
21
  noWrap?: boolean;
22
+ /**
23
+ * Текст всплывающей подсказки (`Hint`) над элементом. Показывается только в свёрнутом
24
+ * меню (наведение мыши); в развёрнутом — подавляется, т.к. подпись и так видна.
25
+ * По умолчанию берётся из `caption`. Чтобы скрыть подсказку, передайте `hint={null}`.
26
+ * Для доступности в свёрнутом состоянии передавайте также `aria-label` — `hint` носит
27
+ * визуальный характер и не подставляется в `aria-label` автоматически.
28
+ */
29
+ hint?: ReactNode;
22
30
  /** @ignore */
23
31
  _isSubMenu?: boolean;
24
32
  /** @ignore */
25
33
  _isDropdown?: boolean;
26
34
  /** @ignore */
35
+ _isDropdownOpen?: boolean;
36
+ /** @ignore */
27
37
  _isAvatar?: boolean;
28
38
  /** @ignore */
29
39
  _isBackButton?: boolean;
@@ -37,7 +47,13 @@ export interface ClickableElementProps extends CommonClickableElementProps {
37
47
  onFocus?: React.EventHandler<React.FocusEvent>;
38
48
  onBlur?: React.EventHandler<React.FocusEvent>;
39
49
  }
40
- declare const ClickableElementWithStaticFields: React.ForwardRefExoticComponent<ClickableElementProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>> & {
50
+ interface ClickableElementWithHintProps {
51
+ hint?: ReactNode;
52
+ isOpened?: boolean;
53
+ children: React.ReactElement;
54
+ }
55
+ declare const ClickableElementWithHint: ({ hint, isOpened, children }: ClickableElementWithHintProps) => JSX.Element;
56
+ declare const ClickableElementWithStaticFields: React.ForwardRefExoticComponent<ClickableElementProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>> & {
41
57
  __KONTUR_REACT_UI__: string;
42
58
  };
43
- export { ClickableElementWithStaticFields as ClickableElement };
59
+ export { ClickableElementWithStaticFields as ClickableElement, ClickableElementWithHint };
@@ -1,17 +1,85 @@
1
1
  import { __assign, __read, __rest } from "tslib";
2
+ import { Hint } from '@skbkontur/react-ui/components/Hint/Hint';
2
3
  import { useKeyListener } from '@skbkontur/react-ui/lib/events/keyListener';
3
4
  import { useEmotion, useStyles } from '@skbkontur/react-ui/lib/renderEnvironment';
4
5
  import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
5
- import React, { forwardRef, useContext, useEffect, useState } from 'react';
6
+ import React, { forwardRef, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
6
7
  import { useMemoIcon } from '../../hooks/useMemoIcon.js';
8
+ import { useNodeState } from '../../hooks/useNodeState.js';
7
9
  import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers.js';
8
10
  import { generateId } from '../../lib/utils/scripts.js';
9
11
  import { SideMenuDataTids } from '../../SideMenuDataTids.js';
10
- import { navigationAttribute } from '../Navigation.js';
12
+ import { navigationAttribute } from '../navigationAttributes.js';
11
13
  import { SideMenuContext } from '../SideMenuContext.js';
14
+ import { hasChildren } from '../state/selectors.js';
12
15
  import { getStyles } from './ClickableElement.styles.js';
13
16
  import { ItemContent } from './ItemContent/ItemContent.js';
17
+ import { NarrowAccordionDropdown } from './NarrowAccordionDropdown.js';
14
18
  import { SubMenu } from './SubMenu.js';
19
+ var ClickableElementWithHint = function (_a) {
20
+ var hint = _a.hint, isOpened = _a.isOpened, children = _a.children;
21
+ var _b = __read(useState(false), 2), hovered = _b[0], setHovered = _b[1];
22
+ var _c = __read(useState(false), 2), focused = _c[0], setFocused = _c[1];
23
+ var _d = __read(useState(false), 2), tabFocused = _d[0], setTabFocused = _d[1];
24
+ useEffect(function () {
25
+ var handleKeyDown = function (e) {
26
+ if (e.key === 'Tab') {
27
+ setTabFocused(true);
28
+ }
29
+ };
30
+ var handleBlur = function () {
31
+ setTabFocused(false);
32
+ };
33
+ window.addEventListener('keydown', handleKeyDown);
34
+ window.addEventListener('blur', handleBlur);
35
+ return function () {
36
+ window.removeEventListener('keydown', handleKeyDown);
37
+ window.removeEventListener('blur', handleBlur);
38
+ };
39
+ }, []);
40
+ var handleMouseEnter = useCallback(function () { return setHovered(true); }, []);
41
+ var handleMouseLeave = useCallback(function () { return setHovered(false); }, []);
42
+ var handleFocus = useCallback(function () {
43
+ setFocused(true);
44
+ }, []);
45
+ var handleBlur = useCallback(function () {
46
+ setFocused(false);
47
+ setTabFocused(false);
48
+ }, []);
49
+ if (hint === null || hint === undefined) {
50
+ return children;
51
+ }
52
+ if (isOpened) {
53
+ return children;
54
+ }
55
+ var shouldShow = hovered || (tabFocused && focused);
56
+ var childrenWithHandlers = React.cloneElement(children, {
57
+ onMouseEnter: function (e) {
58
+ var _a, _b;
59
+ (_b = (_a = children.props).onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
60
+ handleMouseEnter();
61
+ },
62
+ onMouseLeave: function (e) {
63
+ var _a, _b;
64
+ (_b = (_a = children.props).onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
65
+ handleMouseLeave();
66
+ },
67
+ onFocus: function (e) {
68
+ var _a, _b;
69
+ (_b = (_a = children.props).onFocus) === null || _b === void 0 ? void 0 : _b.call(_a, e);
70
+ handleFocus();
71
+ },
72
+ onBlur: function (e) {
73
+ var _a, _b;
74
+ (_b = (_a = children.props).onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, e);
75
+ handleBlur();
76
+ },
77
+ });
78
+ if (!shouldShow) {
79
+ return (React.createElement(Hint, { text: null, pos: 'right', manual: true, opened: false }, childrenWithHandlers));
80
+ }
81
+ return (React.createElement(Hint, { text: hint, pos: 'right', manual: true, opened: true }, childrenWithHandlers));
82
+ };
15
83
  /**
16
84
  * Элемент списка (пункт меню либо ссылка)
17
85
  *
@@ -20,90 +88,112 @@ import { SubMenu } from './SubMenu.js';
20
88
  var ClickableElement = forwardRef(function (_a, ref) {
21
89
  var _b, _c, _d;
22
90
  var _e;
23
- var onClick = _a.onClick, icon = _a.icon, marker = _a.marker, caption = _a.caption, subCaption = _a.subCaption, id = _a.id, _isSubMenu = _a._isSubMenu, children = _a.children, Tag = _a.element, onKeyDown = _a.onKeyDown, onFocus = _a.onFocus, onBlur = _a.onBlur, className = _a.className, _isDropdown = _a._isDropdown, _isBackButton = _a._isBackButton, _isAvatar = _a._isAvatar, isButton = _a.isButton, href = _a.href, disabled = _a.disabled, noWrap = _a.noWrap, rest = __rest(_a, ["onClick", "icon", "marker", "caption", "subCaption", "id", "_isSubMenu", "children", "element", "onKeyDown", "onFocus", "onBlur", "className", "_isDropdown", "_isBackButton", "_isAvatar", "isButton", "href", "disabled", "noWrap"]);
91
+ var onClick = _a.onClick, icon = _a.icon, marker = _a.marker, caption = _a.caption, subCaption = _a.subCaption, id = _a.id, _isSubMenu = _a._isSubMenu, children = _a.children, Tag = _a.element, onKeyDown = _a.onKeyDown, onFocus = _a.onFocus, onBlur = _a.onBlur, className = _a.className, _isDropdown = _a._isDropdown, _isDropdownOpen = _a._isDropdownOpen, _isBackButton = _a._isBackButton, _isAvatar = _a._isAvatar, isButton = _a.isButton, href = _a.href, disabled = _a.disabled, noWrap = _a.noWrap, hint = _a.hint, rest = __rest(_a, ["onClick", "icon", "marker", "caption", "subCaption", "id", "_isSubMenu", "children", "element", "onKeyDown", "onFocus", "onBlur", "className", "_isDropdown", "_isDropdownOpen", "_isBackButton", "_isAvatar", "isButton", "href", "disabled", "noWrap", "hint"]);
24
92
  var context = useContext(SideMenuContext);
25
93
  var theme = getSideMenuTheme(useContext(ThemeContext));
26
94
  var styles = useStyles(getStyles);
27
95
  var cx = useEmotion().cx;
28
96
  var keyListener = useKeyListener();
29
- var _f = __read(useState(false), 2), isActive = _f[0], setIsActive = _f[1];
30
- var _g = __read(useState(false), 2), isFirstLevelParentOfActiveMenuItem = _g[0], setIsFirstLevelParentOfActiveMenuItem = _g[1];
31
- var _h = __read(useState(false), 2), isOpened = _h[0], setIsOpened = _h[1];
32
- var _j = __read(useState(false), 2), isNestedSubMenu = _j[0], setIsNestedSubMenu = _j[1];
33
- var _k = __read(useState(false), 2), hasSubIcons = _k[0], setHasSubIcons = _k[1];
34
- var _l = __read(useState(false), 2), isFocusedByTab = _l[0], setIsFocusedByTab = _l[1];
35
- var _m = __read(useState(id || href || ''), 2), currentId = _m[0], setCurrentId = _m[1];
97
+ var _f = __read(useState(false), 2), isFocusedByTab = _f[0], setIsFocusedByTab = _f[1];
98
+ var _g = __read(useState(function () {
99
+ if (id) {
100
+ return id;
101
+ }
102
+ if (href) {
103
+ return href;
104
+ }
105
+ var counter = context.childIdCounterRef;
106
+ if (counter) {
107
+ var index = counter.current;
108
+ counter.current += 1;
109
+ return "".concat(context.parentItemId, "__").concat(index);
110
+ }
111
+ return generateId();
112
+ }), 1), currentId = _g[0];
113
+ var focusRafRef = useRef(null);
114
+ var childIdCounterRef = useRef(0);
36
115
  useEffect(function () {
37
- var _a;
38
- if (!currentId) {
39
- var generatedId = generateId();
40
- setCurrentId(generatedId);
41
- }
42
- (_a = context.navigation) === null || _a === void 0 ? void 0 : _a.addValue(currentId, {
43
- setIsActive: setIsActive,
44
- setIsOpened: setIsOpened,
45
- isSubMenu: _isSubMenu,
46
- setIsNestedSubMenu: setIsNestedSubMenu,
47
- setHasSubIcons: setHasSubIcons,
48
- setIsFirstLevelParentOfActiveMenuItem: setIsFirstLevelParentOfActiveMenuItem,
116
+ return function () {
117
+ if (focusRafRef.current !== null) {
118
+ cancelAnimationFrame(focusRafRef.current);
119
+ focusRafRef.current = null;
120
+ }
121
+ };
122
+ }, []);
123
+ var _h = useNodeState(currentId), isActive = _h.isActive, isExpanded = _h.isExpanded, isNestedSubMenu = _h.isNestedSubMenu, hasSeparatedSubMenu = _h.hasSeparatedSubMenu;
124
+ useEffect(function () {
125
+ context.dispatch({
126
+ type: 'REGISTER',
127
+ id: currentId,
128
+ parentId: context.parentItemId,
129
+ isSubMenu: !!_isSubMenu,
49
130
  });
50
131
  return function () {
51
- var _a;
52
- (_a = context.navigation) === null || _a === void 0 ? void 0 : _a.updateNavigationTree();
132
+ context.dispatch({ type: 'UNREGISTER', id: currentId });
53
133
  };
54
- });
134
+ }, [currentId, context.parentItemId, _isSubMenu, context.dispatch]);
135
+ var Component = _isSubMenu || _isDropdown ? 'div' : 'li';
136
+ var isDesktopCollapsedMode = (context.isDesktop || context.isNarrowDesktop) && !context.isOpened;
137
+ var isActiveSection = context.state.activeFirstLevelParentId === currentId;
138
+ var isHighlighted = isActive || (isActiveSection && (context.isSeparatedMenu || isDesktopCollapsedMode));
139
+ var isCollapsedTopLevelSection = isDesktopCollapsedMode && !_isSubMenu && !_isDropdown && !_isBackButton && !_isAvatar;
140
+ var isCollapsedAccordionSection = isCollapsedTopLevelSection && !!children && !context.isSeparatedMenu;
141
+ var _j = __read(useState(false), 2), isAccordionOpen = _j[0], setIsAccordionOpen = _j[1];
142
+ useEffect(function () {
143
+ if (!isCollapsedAccordionSection) {
144
+ setIsAccordionOpen(false);
145
+ }
146
+ }, [isCollapsedAccordionSection]);
55
147
  var toggleIsShown = function (lastElementInTheHierarchy) {
56
148
  var _a;
57
149
  if ((context.isMobile || context.isTablet) && lastElementInTheHierarchy) {
58
150
  (_a = context.toggleIsOpened) === null || _a === void 0 ? void 0 : _a.call(context);
59
151
  }
60
152
  };
61
- var setIsCollapsed = function (lastElementInTheHierarchy) {
62
- var _a, _b;
63
- if (context.isMobile || context.isTablet || (context.isDesktop && !context.isCollapsable)) {
64
- return;
65
- }
66
- var topLevelItemInSeparatedSideMenu = context.isSeparatedMenu && !_isSubMenu && children;
67
- if (context.isCollapsable && (lastElementInTheHierarchy || topLevelItemInSeparatedSideMenu)) {
68
- (_a = context.setIsCollapsed) === null || _a === void 0 ? void 0 : _a.call(context, true);
69
- }
70
- if (!_isSubMenu) {
71
- (_b = context.setIsCollapsed) === null || _b === void 0 ? void 0 : _b.call(context, false);
72
- }
73
- };
74
- var setMouseIsOutside = function (lastElementInTheHierarchy) {
75
- var _a;
76
- if (lastElementInTheHierarchy) {
77
- (_a = context.setIsMouseOutside) === null || _a === void 0 ? void 0 : _a.call(context, true);
78
- }
79
- };
80
153
  var handleClick = function (e) {
81
- var _a, _b, _c, _d, _e, _f, _g;
82
154
  if (disabled) {
83
155
  return;
84
156
  }
157
+ if (isCollapsedAccordionSection) {
158
+ return;
159
+ }
85
160
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
161
+ if (e.defaultPrevented) {
162
+ return;
163
+ }
86
164
  if (_isBackButton || _isDropdown) {
87
165
  return;
88
166
  }
89
- var item = (_b = (_a = context.navigation) === null || _a === void 0 ? void 0 : _a.navigationTree) === null || _b === void 0 ? void 0 : _b.find(currentId);
90
- if (isButton && !(item === null || item === void 0 ? void 0 : item.hasChildren)) {
167
+ var hasKids = context.state ? hasChildren(context.state, currentId) : false;
168
+ // A leaf inside a NarrowAccordionDropdown should dismiss the popup.
169
+ if (!hasKids && context.closeParentDropdown) {
170
+ context.closeParentDropdown();
171
+ }
172
+ if (isButton && !hasKids) {
91
173
  return;
92
174
  }
93
- if (isOpened && !((_c = item === null || item === void 0 ? void 0 : item.value) === null || _c === void 0 ? void 0 : _c.isSubMenu) && !context.isSeparatedMenu) {
94
- (_d = item === null || item === void 0 ? void 0 : item.value) === null || _d === void 0 ? void 0 : _d.setIsOpened(false);
175
+ // An expanded item collapses on click (toggle), except in separated mode:
176
+ // - a top-level item on desktop keeps its column open on a repeated click
177
+ // (collapsing it would hide the whole column), and
178
+ // - touch (mobile/tablet) has its own BackButton toggle driven by SELECT.
179
+ var isTouchViewport = !!(context.isMobile || context.isTablet);
180
+ var isProtectedSeparatedTopLevel = context.isSeparatedMenu && !_isSubMenu && hasKids && !isTouchViewport;
181
+ if (isExpanded && !isProtectedSeparatedTopLevel && !(context.isSeparatedMenu && isTouchViewport)) {
182
+ context.dispatch({ type: 'CLOSE_NODE', id: currentId });
95
183
  }
96
184
  else {
97
- (_e = context.navigation) === null || _e === void 0 ? void 0 : _e.switchActiveMenuItem(currentId, isButton);
98
- var lastElementInTheHierarchy = !_isDropdown && !_isBackButton && !((_g = (_f = context.navigation) === null || _f === void 0 ? void 0 : _f.activeMenuItemTreeNode) === null || _g === void 0 ? void 0 : _g.hasChildren);
185
+ context.dispatch({ type: 'SELECT', id: currentId, isButton: !!isButton });
186
+ var lastElementInTheHierarchy = !_isDropdown && !_isBackButton && !hasKids;
99
187
  toggleIsShown(lastElementInTheHierarchy);
100
- setIsCollapsed(lastElementInTheHierarchy);
101
- setMouseIsOutside(lastElementInTheHierarchy);
102
188
  }
103
189
  };
104
190
  var handleFocus = function (e) {
105
191
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
106
- requestAnimationFrame(function () {
192
+ if (focusRafRef.current !== null) {
193
+ cancelAnimationFrame(focusRafRef.current);
194
+ }
195
+ focusRafRef.current = requestAnimationFrame(function () {
196
+ focusRafRef.current = null;
107
197
  if (keyListener.isTabPressed) {
108
198
  setIsFocusedByTab(true);
109
199
  }
@@ -113,42 +203,74 @@ var ClickableElement = forwardRef(function (_a, ref) {
113
203
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
114
204
  setIsFocusedByTab(false);
115
205
  };
116
- var Component = _isSubMenu || _isDropdown ? 'div' : 'li';
117
- var isHighlighted = isActive ||
118
- (isFirstLevelParentOfActiveMenuItem && !context.isOpened && context.isCollapsable) ||
119
- (isFirstLevelParentOfActiveMenuItem && context.isSeparatedMenu);
120
206
  var handleCollapse = function (e) {
121
- var _a, _b, _c, _d;
122
207
  if (disabled) {
123
208
  return;
124
209
  }
125
210
  e.stopPropagation();
126
- (_d = (_c = (_b = (_a = context.navigation) === null || _a === void 0 ? void 0 : _a.navigationTree) === null || _b === void 0 ? void 0 : _b.find(currentId)) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.setIsOpened(false);
211
+ context.dispatch({ type: 'CLOSE_NODE', id: currentId });
212
+ };
213
+ var subMenuIcon = useMemoIcon(children, { isOpened: isExpanded, onClick: handleCollapse });
214
+ var isNativeAnchor = Tag === 'a';
215
+ var handleKeyDown = function (e) {
216
+ if (isNativeAnchor && disabled && e.key === 'Enter') {
217
+ e.preventDefault();
218
+ }
219
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
127
220
  };
128
221
  var newProps = __assign({ className: cx(styles.root(theme), (_b = {},
129
- _b[styles.rootButton(theme)] = isButton,
222
+ _b[styles.rootLarge(theme)] = context.size === 'large' && !(_isSubMenu && isDesktopCollapsedMode),
223
+ _b[styles.rootButton(theme)] = !disabled,
130
224
  _b[styles.rootFocus(theme)] = isFocusedByTab,
131
225
  _b[styles.rootDisabled(theme)] = disabled,
132
226
  _b[styles.rootActive(theme)] = isHighlighted,
227
+ _b[styles.rootDropdownOpen(theme)] = (_isDropdown && _isDropdownOpen) || isAccordionOpen,
133
228
  _b), (_c = {},
134
229
  _c[styles.rootSubItemInSeparatedSubMenu(theme)] = context.isSeparatedMenu && _isSubMenu,
230
+ _c[styles.rootSubItemInSeparatedSubMenuButton(theme)] = !disabled && context.isSeparatedMenu && _isSubMenu,
135
231
  _c[styles.rootSubItemInSeparatedSubMenuActive(theme)] = isActive && context.isSeparatedMenu && _isSubMenu,
136
- _c), className), onClick: handleClick, onFocus: handleFocus, onBlur: handleBlur, children: (React.createElement(ItemContent, { _isSubMenu: _isSubMenu,
232
+ _c[styles.rootSubItemInDropdownActive(theme)] = isActive && !context.isSeparatedMenu && _isSubMenu && isDesktopCollapsedMode,
233
+ _c[styles.rootSubItemInDropdownButton(theme)] = !disabled && !context.isSeparatedMenu && _isSubMenu && isDesktopCollapsedMode,
234
+ _c), className), onClick: handleClick, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, children: (React.createElement(ItemContent, { _isSubMenu: _isSubMenu,
137
235
  // @ts-expect-error: SideMenuItem should have icon
138
- icon: _isSubMenu && !_isBackButton ? useMemoIcon(children, { isOpened: isOpened, onClick: handleCollapse }) : icon, isNestedSubMenu: isNestedSubMenu, caption: caption, subCaption: subCaption, marker: marker, _isBackButton: _isBackButton, _isDropdown: _isDropdown, _isAvatar: _isAvatar, disabled: disabled, noWrap: noWrap })), ref: ref, href: href, 'aria-current': isActive ? 'page' : undefined }, rest);
236
+ icon: _isSubMenu && !_isBackButton ? subMenuIcon : icon, isNestedSubMenu: isNestedSubMenu, caption: caption, subCaption: subCaption, marker: marker, _isBackButton: _isBackButton, _isDropdown: _isDropdown, _isAvatar: _isAvatar, disabled: disabled, noWrap: noWrap })), href: href, disabled: !isNativeAnchor ? disabled : undefined, 'aria-current': isActive ? 'page' : undefined }, rest);
139
237
  // Подсчет смещения вправо для текущего уровня вложенности
238
+ // NOTE: Probably it can be calculated using Navigation Tree
140
239
  var currentItemNestingLevel = (_e = context.currentItemNestingLevel) !== null && _e !== void 0 ? _e : 0;
141
240
  var nestingLevelPadding = {
142
- paddingLeft: (currentItemNestingLevel - 1) * parseInt(theme.sideMenuItemNestedPaddingLeft),
241
+ paddingLeft: Math.max(0, currentItemNestingLevel - 1) * parseInt(theme.sideMenuItemNestedPaddingLeft),
143
242
  };
243
+ // NOTE: In the collapsed-accordion path (`isCollapsedAccordionSection`) this element is
244
+ // wrapped by `NarrowAccordionDropdown` → `DropdownMenu` → `PopupMenu`. `PopupMenu` adds
245
+ // its own correct `aria-expanded`/`aria-controls` to the outer caption wrapper, but
246
+ // this inner focusable element still keeps the `aria-expanded` set below. Because
247
+ // `handleClick` bails out early in accordion mode, the reducer never marks the section
248
+ // as opened, so the inner element always reports `aria-expanded="false"` while the
249
+ // popup is actually open. Screen readers announce the focused element's state, so
250
+ // the user can hear "collapsed" for an open section.
251
+ //
252
+ // The proper fix is to either sync the dropdown's opened state into this element, or
253
+ // to omit `aria-expanded` here in accordion mode and make the outer caption wrapper
254
+ // the accessible control (focusable + correct `aria-expanded`).
255
+ var clickableElement = (React.createElement(Tag, __assign({ state: isActive ? 'active' : undefined, style: nestingLevelPadding }, newProps, { ref: ref, disabled: !isNativeAnchor ? disabled : undefined, "aria-disabled": isNativeAnchor && disabled ? 'true' : undefined, tabIndex: isNativeAnchor && disabled ? -1 : undefined }, (children ? { 'aria-expanded': isExpanded, 'aria-controls': currentId } : {}))));
256
+ var clickableElementWithHint = (React.createElement(ClickableElementWithHint, { hint: hint === null ? null : (hint !== null && hint !== void 0 ? hint : caption), isOpened: context.isOpened || (_isSubMenu && (context.isSeparatedMenu || isDesktopCollapsedMode)) }, clickableElement));
257
+ // Reset the child id counter on every render so children at this nesting level get stable,
258
+ // position-based generated ids across unmount → re-mount transitions (e.g. narrow
259
+ // accordion dropdown closing → inline submenu opening).
260
+ childIdCounterRef.current = 0;
261
+ var subMenuContextValue = useMemo(function () { return (__assign(__assign({ hasSeparatedSubMenu: hasSeparatedSubMenu }, context), { parentItemId: currentId, currentItemNestingLevel: currentItemNestingLevel + 1, childIdCounterRef: childIdCounterRef })); }, [hasSeparatedSubMenu, context, currentId, currentItemNestingLevel]);
262
+ // При клике на айтем без детей закрывать дропдаун
263
+ // айтем должен оставаться активным и при разворачивании меню корректно показываться в списке подменю
264
+ // При клике на активный элемент с детьми, он должен закрыться
144
265
  return (React.createElement(Component, (_d = { "data-tid": SideMenuDataTids.clickableElement }, _d[navigationAttribute] = currentId, _d),
145
- React.cloneElement(React.createElement(Tag, { state: isActive ? 'active' : undefined, style: nestingLevelPadding }), children
146
- ? __assign(__assign({}, newProps), { 'aria-expanded': children ? isOpened : undefined, 'aria-controls': children ? currentId : undefined }) : __assign({}, newProps)),
147
- React.createElement(SubMenu, { caption: caption, isSubMenu: _isSubMenu, isSeparatedMenu: context.isSeparatedMenu, htmlId: currentId, isOpened: isOpened },
148
- React.createElement(SideMenuContext.Provider, { value: __assign(__assign({ hasSubIcons: hasSubIcons }, context), { currentItemNestingLevel: currentItemNestingLevel + 1 }) }, children))));
266
+ isCollapsedAccordionSection && (React.createElement(NarrowAccordionDropdown, { caption: clickableElementWithHint, htmlId: currentId, childIdCounterRef: childIdCounterRef, disabled: disabled, onOpenChange: setIsAccordionOpen }, children)),
267
+ !isCollapsedAccordionSection && (React.createElement(React.Fragment, null,
268
+ clickableElementWithHint,
269
+ React.createElement(SubMenu, { caption: caption, isSubMenu: _isSubMenu, isSeparatedMenu: context.isSeparatedMenu, htmlId: currentId, isOpened: isExpanded },
270
+ React.createElement(SideMenuContext.Provider, { value: subMenuContextValue }, children))))));
149
271
  });
150
272
  ClickableElement.displayName = 'ClickableElement';
151
273
  var ClickableElementWithStaticFields = Object.assign(ClickableElement, {
152
274
  __KONTUR_REACT_UI__: 'ClickableElement',
153
275
  });
154
- export { ClickableElementWithStaticFields as ClickableElement };
276
+ export { ClickableElementWithStaticFields as ClickableElement, ClickableElementWithHint };
@@ -1,10 +1,15 @@
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
+ rootLarge(t: SideMenuTheme): string;
4
5
  rootButton(t: SideMenuTheme): string;
5
6
  rootSubItemInSeparatedSubMenu(t: SideMenuTheme): string;
7
+ rootSubItemInSeparatedSubMenuButton(t: SideMenuTheme): string;
6
8
  rootFocus(t: SideMenuTheme): string;
7
9
  rootDisabled(t: SideMenuTheme): string;
8
10
  rootActive(t: SideMenuTheme): string;
11
+ rootDropdownOpen(t: SideMenuTheme): string;
12
+ rootSubItemInDropdownActive(t: SideMenuTheme): string;
13
+ rootSubItemInDropdownButton(t: SideMenuTheme): string;
9
14
  rootSubItemInSeparatedSubMenuActive(t: SideMenuTheme): string;
10
15
  }>;
@@ -5,26 +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.sideMenuItemBgActive);
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);
35
+ },
36
+ rootSubItemInDropdownActive: function (t) {
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);
24
41
  },
25
42
  rootSubItemInSeparatedSubMenuActive: function (t) {
26
- return css(templateObject_7 || (templateObject_7 = __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);
27
44
  },
28
45
  });
29
46
  });
30
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
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;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const CollapseToggle: () => React.ReactElement | null;