@skbkontur/side-menu 0.12.2 → 0.13.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.13.0](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.12.2...@skbkontur/side-menu@0.13.0) (2023-06-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * **SideMenu:** add basic semantic ([e986397](https://git.skbkontur.ru/ui/ui-parking/commits/e986397737b395eed7086a99b7a12b6bc45ea8ae))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.12.2](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.12.1...@skbkontur/side-menu@0.12.2) (2023-06-08)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skbkontur/side-menu",
3
- "version": "0.12.2",
3
+ "version": "0.13.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -3,7 +3,7 @@ import React, { forwardRef, useContext, useEffect, useRef, useState } from 'reac
3
3
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
4
4
  import { isIE11 } from '@skbkontur/react-ui/lib/client';
5
5
  import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
6
- import { customStyles, jsStyles } from './SideMenu.styles';
6
+ import { jsStylesForSideMenu, customStyles } from './SideMenu.styles';
7
7
  import { SideMenuOrganisations } from '../SideMenuOrganisations/SideMenuOrganisations';
8
8
  import { SideMenuContext } from '../SideMenuContext';
9
9
  import { SideMenuBody } from '../SideMenuBody/SideMenuBody';
@@ -190,31 +190,31 @@ var SideMenuInner = forwardRef(function (_a, ref) {
190
190
  setHeaderHeight: setHeaderHeight,
191
191
  } },
192
192
  React.createElement(ZIndex, { priority: isSideMenuOverflowing ? 8 : 0, className: cx((_b = {},
193
- _b[jsStyles.root()] = true,
193
+ _b[jsStylesForSideMenu.root()] = true,
194
194
  _b[customStyles.rootForTabletsOrMobiles(headerHeight)] = isTabletOrMobile,
195
- _b[jsStyles.shownRootForTabletsOrMobiles()] = isShown && isTabletOrMobile,
196
- _b[jsStyles.rootForNarrowDesktops(theme)] = isNarrowDesktop,
197
- _b[jsStyles.separatedRootForNarrowDesktops(theme)] = separatedMenuWithoutOverlay && isSeparatedMenuShown && isNarrowDesktop,
198
- _b[jsStyles.separatedRootForDesktops(theme)] = separatedMenuWithoutOverlay && isSeparatedMenuShown && isDesktopQuery,
195
+ _b[jsStylesForSideMenu.shownRootForTabletsOrMobiles()] = isShown && isTabletOrMobile,
196
+ _b[jsStylesForSideMenu.rootForNarrowDesktops(theme)] = isNarrowDesktop,
197
+ _b[jsStylesForSideMenu.separatedRootForNarrowDesktops(theme)] = separatedMenuWithoutOverlay && isSeparatedMenuShown && isNarrowDesktop,
198
+ _b[jsStylesForSideMenu.separatedRootForDesktops(theme)] = separatedMenuWithoutOverlay && isSeparatedMenuShown && isDesktopQuery,
199
199
  _b)) },
200
200
  React.createElement(React.Fragment, null,
201
201
  shouldShowBackdrop && React.createElement(Backdrop, { style: backdropStyle }),
202
202
  React.createElement(RenderLayer, { onClickOutside: function () { return handleIsShown(false); } },
203
203
  React.createElement("aside", __assign({ className: cx((_c = {},
204
- _c[jsStyles.wrapper()] = true,
205
- _c[jsStyles.wrapperIE()] = isIE11,
206
- _c[jsStyles.wrapperWithShadow(theme)] = isSideMenuOverContent,
204
+ _c[jsStylesForSideMenu.wrapper()] = true,
205
+ _c[jsStylesForSideMenu.wrapperIE()] = isIE11,
206
+ _c[jsStylesForSideMenu.wrapperWithShadow(theme)] = isSideMenuOverContent,
207
207
  _c), className), "data-tid": SideMenuDataTids.root, ref: ref }, rest, { onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseMove: showMinimizedRootForNarrowDesktopWithOverlay }),
208
208
  React.createElement("div", { className: cx((_d = {},
209
- _d[jsStyles.container(theme)] = true,
210
- _d[jsStyles.collapsedContainerForTabletsOrMobiles()] = !isShown && !isBeingTransitioned,
211
- _d[jsStyles.minimizedContainer(theme)] = isMinimized,
212
- _d[jsStyles.innerContainer()] = !isSeparatedMenu,
213
- _d[jsStyles.containerForTouchScreens(theme)] = isTouchScreen,
214
- _d[jsStyles.separatedContainerForMobiles(theme)] = isMobile && isSeparatedMenuShown && (isShown || isBeingTransitioned),
209
+ _d[jsStylesForSideMenu.container(theme)] = true,
210
+ _d[jsStylesForSideMenu.collapsedContainerForTabletsOrMobiles()] = !isShown && !isBeingTransitioned,
211
+ _d[jsStylesForSideMenu.minimizedContainer(theme)] = isMinimized,
212
+ _d[jsStylesForSideMenu.innerContainer()] = !isSeparatedMenu,
213
+ _d[jsStylesForSideMenu.containerForTouchScreens(theme)] = isTouchScreen,
214
+ _d[jsStylesForSideMenu.separatedContainerForMobiles(theme)] = isMobile && isSeparatedMenuShown && (isShown || isBeingTransitioned),
215
215
  _d)) },
216
216
  React.createElement("div", { className: cx((_e = {},
217
- _e[jsStyles.contentWrapper()] = true,
217
+ _e[jsStylesForSideMenu.contentWrapper()] = true,
218
218
  _e)) }, children)),
219
219
  !disableSwipe && isDesktopQuery && !isSeparatedMenuShown && (React.createElement(RightBorder, { setIsMinimized: setIsMinimized }))))))));
220
220
  });
@@ -2,7 +2,7 @@ import { SideMenuTheme } from '../../lib/theming/ThemeTypes';
2
2
  export declare const customStyles: {
3
3
  rootForTabletsOrMobiles(headerHeight?: number | undefined): string;
4
4
  };
5
- export declare const jsStyles: {
5
+ export declare const jsStylesForSideMenu: {
6
6
  root(): string;
7
7
  shownRootForTabletsOrMobiles(): string;
8
8
  rootForNarrowDesktops(t: SideMenuTheme): string;
@@ -18,4 +18,5 @@ export declare const jsStyles: {
18
18
  wrapperIE(): string;
19
19
  wrapperWithShadow(t: SideMenuTheme): string;
20
20
  collapsedContainerForTabletsOrMobiles(): string;
21
+ list(): string;
21
22
  };
@@ -49,11 +49,14 @@ var styles = {
49
49
  collapsedContainerForTabletsOrMobiles: function () {
50
50
  return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n background-color: transparent;\n "], ["\n background-color: transparent;\n "])));
51
51
  },
52
+ list: function () {
53
+ return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n list-style: none;\n padding: 0;\n margin: 0;\n "], ["\n list-style: none;\n padding: 0;\n margin: 0;\n "])));
54
+ },
52
55
  };
53
56
  export var customStyles = {
54
57
  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
+ return css(templateObject_17 || (templateObject_17 = __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);
56
59
  },
57
60
  };
58
- export var jsStyles = memoizeStyle(styles);
59
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16;
61
+ export var jsStylesForSideMenu = memoizeStyle(styles);
62
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17;
@@ -8,6 +8,6 @@ export interface SideMenuAvatarProps extends UserAvatarProps, Omit<SideMenuDropd
8
8
  *
9
9
  * @visibleName SideMenu.Avatar
10
10
  */
11
- export declare const SideMenuAvatar: React.ForwardRefExoticComponent<SideMenuAvatarProps & React.RefAttributes<HTMLDivElement>> & {
11
+ export declare const SideMenuAvatar: React.ForwardRefExoticComponent<SideMenuAvatarProps & React.RefAttributes<HTMLLIElement>> & {
12
12
  __KONTUR_REACT_UI__: string;
13
13
  };
@@ -8,8 +8,9 @@ import { SideMenuContext } from '../SideMenuContext';
8
8
  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
+ import { jsStylesForSideMenu } from '../SideMenu/SideMenu.styles';
11
12
  var SideMenuBodyInner = forwardRef(function (_a, ref) {
12
- var _b;
13
+ var _b, _c;
13
14
  var className = _a.className, children = _a.children, rest = __rest(_a, ["className", "children"]);
14
15
  var context = useContext(SideMenuContext);
15
16
  var scrollContainerRef = useRef(null);
@@ -32,13 +33,14 @@ var SideMenuBodyInner = forwardRef(function (_a, ref) {
32
33
  }, [context.activeMenuItem, context.isShown]);
33
34
  var theme = getSideMenuTheme(useContext(ThemeContext));
34
35
  if (context.isShown) {
35
- return (React.createElement("div", { ref: mergeRefs([ref, sideMenuBodyRef]), style: { overflow: 'hidden', height: '100%' } },
36
+ return (React.createElement("div", { ref: mergeRefs([ref, sideMenuBodyRef]), className: cx((_b = {}, _b[jsStyles.root(theme)] = true, _b), className) },
36
37
  React.createElement(ScrollContainer, { style: { position: 'static' }, onScrollStateChangeY: function (state) {
37
38
  var _a;
38
39
  (_a = context.setScrollState) === null || _a === void 0 ? void 0 : _a.call(context, state);
39
40
  }, 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)))));
41
+ React.createElement("nav", null,
42
+ React.createElement("ul", __assign({ className: cx((_c = {}, _c[jsStylesForSideMenu.list()] = true, _c[jsStyles.wrapper(theme)] = true, _c)) }, rest),
43
+ React.createElement(InnerBody, null, children))))));
42
44
  }
43
45
  return null;
44
46
  });
@@ -1,4 +1,5 @@
1
1
  import { SideMenuTheme } from '../../lib/theming/ThemeTypes';
2
2
  export declare const jsStyles: {
3
3
  root(t: SideMenuTheme): string;
4
+ wrapper(t: SideMenuTheme): string;
4
5
  };
@@ -3,8 +3,11 @@ 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 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);
6
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n margin: 0 ", ";\n height: 100%;\n overflow: hidden;\n "], ["\n flex-grow: 1;\n margin: 0 ", ";\n height: 100%;\n overflow: hidden;\n "])), t.sideMenuMarginX);
7
+ },
8
+ wrapper: function (t) {
9
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-bottom: ", ";\n "], ["\n padding-bottom: ", ";\n "])), t.sideMenuBodyPaddingBottom);
7
10
  },
8
11
  };
9
12
  export var jsStyles = memoizeStyle(styles);
10
- var templateObject_1;
13
+ var templateObject_1, templateObject_2;
@@ -16,6 +16,6 @@ export interface SideMenuDropdownProps extends CommonProps, Omit<DropdownMenuPro
16
16
  *
17
17
  * @visibleName SideMenu.Dropdown
18
18
  */
19
- export declare const SideMenuDropdown: React.ForwardRefExoticComponent<SideMenuDropdownProps & React.RefAttributes<HTMLDivElement>> & {
19
+ export declare const SideMenuDropdown: React.ForwardRefExoticComponent<SideMenuDropdownProps & React.RefAttributes<HTMLLIElement>> & {
20
20
  __KONTUR_REACT_UI__: string;
21
21
  };
@@ -11,7 +11,7 @@ var SideMenuDropdownInner = forwardRef(function (_a, ref) {
11
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, _isAvatar = _a._isAvatar, rest = __rest(_a, ["icon", "id", "_generatedId", "_avatar", "children", "caption", "subCaption", "className", "disableAnimations", "menuWidth", "_isAvatar"]);
12
12
  var context = useContext(SideMenuContext);
13
13
  var theme = getSideMenuTheme(useContext(ThemeContext));
14
- return (React.createElement("div", { className: cx((_b = {}, _b[jsStyles.wrapper()] = true, _b), className), ref: ref },
14
+ return (React.createElement("li", { className: cx((_b = {}, _b[jsStyles.wrapper()] = true, _b), className), ref: ref },
15
15
  React.createElement(DropdownMenu, __assign({ caption: React.createElement("div", { className: cx((_c = {},
16
16
  _c[jsStyles.label(theme)] = true,
17
17
  _c[jsStyles.labelForTouchScreens(theme)] = context.isTouchScreen,
@@ -5,6 +5,7 @@ import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
5
5
  import { jsStyles } from './SideMenuFooter.styles';
6
6
  import { getItemId } from '../../lib/utils/scripts';
7
7
  import { SideMenuContext } from '../SideMenuContext';
8
+ import { jsStylesForSideMenu } from '../SideMenu/SideMenu.styles';
8
9
  import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
9
10
  var SideMenuFooterInner = forwardRef(function (_a, ref) {
10
11
  var _b;
@@ -20,14 +21,15 @@ var SideMenuFooterInner = forwardRef(function (_a, ref) {
20
21
  _b[jsStyles.root(theme)] = true,
21
22
  _b[jsStyles.rootFixed(theme)] = isFixed,
22
23
  _b[jsStyles.rootTransitioned()] = context.isBeingTransitioned,
23
- _b), className), ref: ref }, rest), React.Children.map(children, function (child, index) {
24
- if (React.isValidElement(child)) {
25
- return React.cloneElement(child, {
26
- _generatedId: getItemId('footer', index++),
27
- });
28
- }
29
- return child;
30
- })));
24
+ _b), className), ref: ref }, rest),
25
+ React.createElement("ul", { className: jsStylesForSideMenu.list() }, React.Children.map(children, function (child, index) {
26
+ if (React.isValidElement(child)) {
27
+ return React.cloneElement(child, {
28
+ _generatedId: getItemId('footer', index++),
29
+ });
30
+ }
31
+ return child;
32
+ }))));
31
33
  }
32
34
  return null;
33
35
  });
@@ -5,6 +5,6 @@ import { SideMenuDropdownProps } from '../SideMenuDropdown/SideMenuDropdown';
5
5
  *
6
6
  * @visibleName SideMenu.Organisations
7
7
  */
8
- export declare const SideMenuOrganisations: React.ForwardRefExoticComponent<SideMenuDropdownProps & React.RefAttributes<HTMLDivElement>> & {
8
+ export declare const SideMenuOrganisations: React.ForwardRefExoticComponent<SideMenuDropdownProps & React.RefAttributes<HTMLLIElement>> & {
9
9
  __KONTUR_REACT_UI__: string;
10
10
  };
@@ -7,6 +7,6 @@ export interface SideMenuSubItemProps extends Omit<SideMenuItemProps, 'icon'>, P
7
7
  *
8
8
  * @visibleName SideMenu.SubItem
9
9
  */
10
- export declare const SideMenuSubItem: React.ForwardRefExoticComponent<SideMenuSubItemProps & React.RefAttributes<HTMLDivElement>> & {
10
+ export declare const SideMenuSubItem: React.ForwardRefExoticComponent<SideMenuSubItemProps & React.RefAttributes<HTMLLIElement>> & {
11
11
  __KONTUR_REACT_UI__: string;
12
12
  };
@@ -10,13 +10,13 @@ var SideMenuSubItemInner = forwardRef(function (_a, ref) {
10
10
  var context = useContext(SideMenuContext);
11
11
  var isOpened = useOpenedSubElementState(id, _generatedId, context.openedParents, context.activeMenuItem);
12
12
  var icon = useMemoIcon(children, isOpened);
13
- return (React.createElement("div", { ref: ref },
13
+ return (React.createElement("li", { ref: ref },
14
14
  React.createElement(SideMenuItem
15
15
  /*@ts-expect-error: SideMenuItem should have icon */
16
16
  , __assign({
17
17
  /*@ts-expect-error: SideMenuItem should have icon */
18
- icon: icon, _isSubMenu: true, id: id, _generatedId: _generatedId }, rest)),
19
- children && isOpened && React.createElement(NestedMenu, { _generatedId: _generatedId }, children)));
18
+ icon: icon, _isSubMenu: true, id: id, _generatedId: _generatedId, "aria-expanded": children ? isOpened : undefined, "aria-controls": children ? "" + (id || _generatedId) : undefined }, rest)),
19
+ children && isOpened && (React.createElement(NestedMenu, { _generatedId: _generatedId, htmlId: "" + (id || _generatedId) }, children))));
20
20
  });
21
21
  SideMenuSubItemInner.displayName = 'SideMenuSubItem';
22
22
  /**
@@ -11,6 +11,6 @@ export interface SideMenuSubLinkProps extends Omit<SideMenuLinkProps, 'icon'>, P
11
11
  *
12
12
  * @visibleName SideMenu.SubLink
13
13
  */
14
- export declare const SideMenuSubLink: React.ForwardRefExoticComponent<SideMenuSubLinkProps & React.RefAttributes<HTMLDivElement>> & {
14
+ export declare const SideMenuSubLink: React.ForwardRefExoticComponent<SideMenuSubLinkProps & React.RefAttributes<HTMLLIElement>> & {
15
15
  __KONTUR_REACT_UI__: string;
16
16
  };
@@ -10,13 +10,13 @@ var SideMenuSubLinkInner = forwardRef(function (_a, ref) {
10
10
  var context = useContext(SideMenuContext);
11
11
  var isOpened = useOpenedSubElementState(id, _generatedId, context.openedParents, context.activeMenuItem);
12
12
  var icon = useMemoIcon(children, isOpened);
13
- return (React.createElement("div", { ref: ref },
13
+ return (React.createElement("li", { ref: ref },
14
14
  React.createElement(SideMenuLink
15
15
  /*@ts-expect-error: SideMenuItem should have icon */
16
16
  , __assign({
17
17
  /*@ts-expect-error: SideMenuItem should have icon */
18
- icon: icon, _isSubMenu: true, _isNestedSubMenu: _isNestedSubMenu, id: id, _generatedId: _generatedId }, rest)),
19
- children && isOpened && React.createElement(NestedMenu, { _generatedId: _generatedId }, children)));
18
+ icon: icon, _isSubMenu: true, _isNestedSubMenu: _isNestedSubMenu, id: id, _generatedId: _generatedId, "aria-expanded": children ? isOpened : undefined, "aria-controls": children ? "" + (id || _generatedId) : undefined }, rest)),
19
+ children && isOpened && (React.createElement(NestedMenu, { _generatedId: _generatedId, htmlId: "" + (id || _generatedId) }, children))));
20
20
  });
21
21
  SideMenuSubLinkInner.displayName = 'SideMenuSubLink';
22
22
  /**
@@ -95,17 +95,20 @@ var ClickableElement = forwardRef(function (_a, ref) {
95
95
  };
96
96
  var shouldHighlightTopLevelItemWhenSubItemSelectedInSeparatedMenu = isOpened && !_isSubMenu && context.isSeparatedMenu;
97
97
  var shouldHighlightTopLevelItemWhenMenuIsMinimized = isOpened && !_isSubMenu && context.isNarrowDesktop && context.isMinimized;
98
- return (React.createElement("div", null,
99
- React.cloneElement(React.createElement(Tag, null), __assign({ className: cx((_b = {},
100
- _b[jsStyles.root(theme)] = true,
101
- _b[jsStyles.rootSubItemInSeparatedSubMenu(theme)] = context.isSeparatedMenu && _isSubMenu,
102
- _b[jsStyles.focusedRoot(theme)] = isFocusedByTab,
103
- _b[jsStyles.activeRoot(theme)] = isActive ||
104
- shouldHighlightTopLevelItemWhenSubItemSelectedInSeparatedMenu ||
105
- shouldHighlightTopLevelItemWhenMenuIsMinimized,
106
- _b[jsStyles.activeRootSubItemInSeparatedSubMenu(theme)] = isActive && context.isSeparatedMenu && _isSubMenu,
107
- _b), className), onClick: handleClick, onFocus: handleFocus, onBlur: handleBlur, children: (React.createElement(ItemContent, { _isSubMenu: _isSubMenu, icon: icon, _isNestedSubMenu: _isNestedSubMenu, caption: caption, subCaption: subCaption, marker: marker, _avatar: _avatar, _isBackButton: _isBackButton, _isDropdown: _isDropdown, _isAvatar: _isAvatar })), ref: ref }, rest)),
108
- React.createElement(SubMenu, { generatedId: _generatedId, id: id, href: rest.href, caption: caption, isSubMenu: _isSubMenu, isSeparatedMenu: context.isSeparatedMenu, isOpened: isOpened, isMinimized: context.isMinimized }, children)));
98
+ var Component = _isSubMenu || _isDropdown ? 'div' : 'li';
99
+ var newProps = __assign({ className: cx((_b = {},
100
+ _b[jsStyles.root(theme)] = true,
101
+ _b[jsStyles.rootSubItemInSeparatedSubMenu(theme)] = context.isSeparatedMenu && _isSubMenu,
102
+ _b[jsStyles.focusedRoot(theme)] = isFocusedByTab,
103
+ _b[jsStyles.activeRoot(theme)] = isActive ||
104
+ shouldHighlightTopLevelItemWhenSubItemSelectedInSeparatedMenu ||
105
+ shouldHighlightTopLevelItemWhenMenuIsMinimized,
106
+ _b[jsStyles.activeRootSubItemInSeparatedSubMenu(theme)] = isActive && context.isSeparatedMenu && _isSubMenu,
107
+ _b), className), onClick: handleClick, onFocus: handleFocus, onBlur: handleBlur, children: (React.createElement(ItemContent, { _isSubMenu: _isSubMenu, icon: icon, _isNestedSubMenu: _isNestedSubMenu, caption: caption, subCaption: subCaption, marker: marker, _avatar: _avatar, _isBackButton: _isBackButton, _isDropdown: _isDropdown, _isAvatar: _isAvatar })), ref: ref }, rest);
108
+ return (React.createElement(Component, null,
109
+ React.cloneElement(React.createElement(Tag, null), children
110
+ ? __assign(__assign({}, newProps), { 'aria-expanded': isOpened, 'aria-controls': "" + (id || _generatedId) }) : __assign({}, newProps)),
111
+ React.createElement(SubMenu, { generatedId: _generatedId, id: id, href: rest.href, caption: caption, isSubMenu: _isSubMenu, isSeparatedMenu: context.isSeparatedMenu, isOpened: isOpened, isMinimized: context.isMinimized, htmlId: "" + (id || _generatedId) }, children)));
109
112
  });
110
113
  ClickableElement.displayName = 'ClickableElement';
111
114
  var ClickableElementWithStaticFields = Object.assign(ClickableElement, {
@@ -2,8 +2,9 @@ import React from 'react';
2
2
  interface InnerSubMenuProps {
3
3
  children?: React.ReactNode;
4
4
  generatedId?: string;
5
+ htmlId: string;
5
6
  }
6
- declare const InnerSubMenuWithStaticFields: React.ForwardRefExoticComponent<InnerSubMenuProps & React.RefAttributes<HTMLDivElement>> & {
7
+ declare const InnerSubMenuWithStaticFields: React.ForwardRefExoticComponent<InnerSubMenuProps & React.RefAttributes<HTMLUListElement>> & {
7
8
  __KONTUR_REACT_UI__: string;
8
9
  };
9
10
  export { InnerSubMenuWithStaticFields as InnerSubMenu };
@@ -1,14 +1,15 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import { isClickableSubElement } from '../../lib/utils/scripts';
3
+ import { jsStylesForSideMenu } from '../SideMenu/SideMenu.styles';
3
4
  /**
4
5
  * Подменю, раскрывающееся внутри основного меню
5
6
  *
6
7
  * @visibleName InnerSubMenu
7
8
  */
8
9
  var InnerSubMenu = forwardRef(function (_a, ref) {
9
- var children = _a.children, generatedId = _a.generatedId;
10
+ var children = _a.children, generatedId = _a.generatedId, htmlId = _a.htmlId;
10
11
  var levelIndex = 0;
11
- return (React.createElement("div", { ref: ref }, React.Children.map(children, function (child) {
12
+ return (React.createElement("ul", { ref: ref, id: htmlId, className: jsStylesForSideMenu.list() }, React.Children.map(children, function (child) {
12
13
  if (React.isValidElement(child)) {
13
14
  if (
14
15
  // @ts-expect-error: accessing private property
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  export interface NestedMenuProps {
3
3
  _generatedId?: string;
4
4
  children: React.ReactNode;
5
+ htmlId: string;
5
6
  }
6
7
  declare const NestedMenuWithStaticFields: React.ForwardRefExoticComponent<NestedMenuProps & React.RefAttributes<HTMLDivElement>> & {
7
8
  __KONTUR_REACT_UI__: string;
@@ -3,16 +3,22 @@ import { jsStyles } from './NestedMenu.styles';
3
3
  import { isClickableSubElement } from '../../lib/utils/scripts';
4
4
  import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
5
5
  import { ThemeContext } from '@skbkontur/react-ui';
6
+ import { jsStylesForSideMenu } from '../SideMenu/SideMenu.styles';
7
+ import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
6
8
  /**
7
9
  * Вложенное подменю
8
10
  *
9
11
  * @visibleName NestedMenu
10
12
  */
11
13
  var NestedMenu = forwardRef(function (_a, ref) {
12
- var _generatedId = _a._generatedId, children = _a.children;
14
+ var _b;
15
+ var _generatedId = _a._generatedId, children = _a.children, htmlId = _a.htmlId;
13
16
  var theme = getSideMenuTheme(useContext(ThemeContext));
14
17
  var levelIndex = 0;
15
- return (React.createElement("div", { className: jsStyles.root(theme) }, React.Children.map(children, function (child) {
18
+ return (React.createElement("ul", { className: cx((_b = {},
19
+ _b[jsStylesForSideMenu.list()] = true,
20
+ _b[jsStyles.root(theme)] = true,
21
+ _b)), id: htmlId }, React.Children.map(children, function (child) {
16
22
  if (React.isValidElement(child) &&
17
23
  // @ts-expect-error: accessing private property
18
24
  isClickableSubElement(child.type.__KONTUR_REACT_UI__)) {
@@ -5,6 +5,7 @@ interface SeparatedSubMenuProps {
5
5
  id?: string;
6
6
  href?: string;
7
7
  caption?: string;
8
+ htmlId: string;
8
9
  }
9
10
  declare const SeparatedSubMenuWithStaticFields: React.ForwardRefExoticComponent<SeparatedSubMenuProps & React.RefAttributes<HTMLDivElement>> & {
10
11
  __KONTUR_REACT_UI__: string;
@@ -2,8 +2,8 @@ import { __assign } from "tslib";
2
2
  import React, { forwardRef, useContext } from 'react';
3
3
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
4
4
  import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
5
- import { jsStyles } from '../SideMenu/SideMenu.styles';
6
- import { customStyles, jsStylesForSeparatedSubMenu } from './SeparatedSubMenu.styles';
5
+ import { jsStylesForSideMenu } from '../SideMenu/SideMenu.styles';
6
+ import { customStyles, jsStyles } from './SeparatedSubMenu.styles';
7
7
  import { SideMenuContext } from '../SideMenuContext';
8
8
  import { isClickableSubElement } from '../../lib/utils/scripts';
9
9
  import { BackButton } from './BackButton';
@@ -18,7 +18,7 @@ import { isIE11 } from '@skbkontur/react-ui/lib/client';
18
18
  */
19
19
  var SeparatedSubMenu = forwardRef(function (_a, ref) {
20
20
  var _b, _c;
21
- var children = _a.children, generatedId = _a.generatedId, id = _a.id, href = _a.href, caption = _a.caption;
21
+ var children = _a.children, generatedId = _a.generatedId, id = _a.id, href = _a.href, caption = _a.caption, htmlId = _a.htmlId;
22
22
  var context = useContext(SideMenuContext);
23
23
  var theme = getSideMenuTheme(useContext(ThemeContext));
24
24
  var isSubItemWithChildren = function (child) {
@@ -37,21 +37,22 @@ var SeparatedSubMenu = forwardRef(function (_a, ref) {
37
37
  var isDesktopOverlayMenu = (context.isDesktop || context.isNarrowDesktop) && !context.separatedMenuWithoutOverlay;
38
38
  var isSeparatedSubMenuOverContent = (context.isTablet || isDesktopOverlayMenu) && !isIE11;
39
39
  return (React.createElement("div", { className: cx((_b = {},
40
- _b[jsStyles.container(theme)] = true,
41
- _b[jsStyles.containerForTouchScreens(theme)] = context.isTouchScreen,
42
- _b[jsStylesForSeparatedSubMenu.root(theme)] = true,
40
+ _b[jsStylesForSideMenu.container(theme)] = true,
41
+ _b[jsStylesForSideMenu.containerForTouchScreens(theme)] = context.isTouchScreen,
42
+ _b[jsStyles.root(theme)] = true,
43
43
  _b[customStyles.rootForMobiles(context.headerHeight)] = context.isMobile,
44
- _b[jsStylesForSeparatedSubMenu.rootWithoutOverlay(theme)] = context.separatedMenuWithoutOverlay && context.isDesktop,
45
- _b[jsStylesForSeparatedSubMenu.rootWithoutOverlayForNarrowDesktop(theme)] = context.separatedMenuWithoutOverlay && context.isNarrowDesktop,
46
- _b[jsStylesForSeparatedSubMenu.rootWithShadow(theme)] = isSeparatedSubMenuOverContent,
44
+ _b[jsStyles.rootWithoutOverlay(theme)] = context.separatedMenuWithoutOverlay && context.isDesktop,
45
+ _b[jsStyles.rootWithoutOverlayForNarrowDesktop(theme)] = context.separatedMenuWithoutOverlay && context.isNarrowDesktop,
46
+ _b[jsStyles.rootWithShadow(theme)] = isSeparatedSubMenuOverContent,
47
47
  _b)), ref: ref, "data-tid": SideMenuDataTids.separatedSubMenu },
48
48
  React.createElement(ScrollContainer, { onScrollStateChangeY: function (state) {
49
49
  var _a;
50
50
  (_a = context.setScrollState) === null || _a === void 0 ? void 0 : _a.call(context, state);
51
51
  }, hideScrollBar: true },
52
- React.createElement("div", { className: cx((_c = {},
53
- _c[jsStylesForSeparatedSubMenu.contentWrapper(theme)] = true,
54
- _c[jsStylesForSeparatedSubMenu.contentWrapperForMobiles()] = context.isMobile,
52
+ React.createElement("ul", { className: cx((_c = {},
53
+ _c[jsStylesForSideMenu.list()] = true,
54
+ _c[jsStyles.contentWrapper(theme)] = true,
55
+ _c[jsStyles.contentWrapperForMobiles()] = context.isMobile,
55
56
  _c)) },
56
57
  context.isMobile && React.createElement(BackButton, { caption: caption, id: id, href: href, generatedId: generatedId }),
57
58
  React.createElement(SideMenuContext.Provider, { value: __assign({ hasSubIcons: hasSubItems(children) }, context) }, React.Children.map(children, function (child) {
@@ -2,7 +2,7 @@ import { SideMenuTheme } from '../../lib/theming/ThemeTypes';
2
2
  export declare const customStyles: {
3
3
  rootForMobiles(headerHeight?: number | undefined): string;
4
4
  };
5
- export declare const jsStylesForSeparatedSubMenu: {
5
+ export declare const jsStyles: {
6
6
  root(t: SideMenuTheme): string;
7
7
  rootWithoutOverlayForNarrowDesktop(t: SideMenuTheme): string;
8
8
  rootWithoutOverlay(t: SideMenuTheme): string;
@@ -26,5 +26,5 @@ export var customStyles = {
26
26
  return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n height: calc(100vh - ", "px);\n left: 0;\n top: ", "px;\n "], ["\n height: calc(100vh - ", "px);\n left: 0;\n top: ", "px;\n "])), headerHeight, headerHeight);
27
27
  },
28
28
  };
29
- export var jsStylesForSeparatedSubMenu = memoizeStyle(styles);
29
+ export var jsStyles = memoizeStyle(styles);
30
30
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
@@ -9,8 +9,9 @@ interface SubMenuProps {
9
9
  id?: string;
10
10
  href?: string;
11
11
  caption?: string;
12
+ htmlId: string;
12
13
  }
13
- declare const SubMenuWithStaticFields: React.ForwardRefExoticComponent<SubMenuProps & React.RefAttributes<HTMLDivElement>> & {
14
+ declare const SubMenuWithStaticFields: React.ForwardRefExoticComponent<SubMenuProps & React.RefAttributes<HTMLDivElement | HTMLUListElement>> & {
14
15
  __KONTUR_REACT_UI__: string;
15
16
  };
16
17
  export { SubMenuWithStaticFields as SubMenu };
@@ -8,16 +8,16 @@ import { SideMenuContext } from '../SideMenuContext';
8
8
  * @visibleName InnerSubMenu
9
9
  */
10
10
  var SubMenu = forwardRef(function (_a, ref) {
11
- var children = _a.children, isOpened = _a.isOpened, isSubMenu = _a.isSubMenu, isMinimized = _a.isMinimized, isSeparatedMenu = _a.isSeparatedMenu, generatedId = _a.generatedId, id = _a.id, href = _a.href, caption = _a.caption;
11
+ var children = _a.children, isOpened = _a.isOpened, isSubMenu = _a.isSubMenu, isMinimized = _a.isMinimized, isSeparatedMenu = _a.isSeparatedMenu, generatedId = _a.generatedId, id = _a.id, href = _a.href, caption = _a.caption, htmlId = _a.htmlId;
12
12
  var context = useContext(SideMenuContext);
13
13
  var shouldHideOverlayMenu = isMinimized && !context.separatedMenuWithoutOverlay;
14
14
  if (!children || !isOpened || isSubMenu || shouldHideOverlayMenu) {
15
15
  return null;
16
16
  }
17
17
  if (isSeparatedMenu && (context.isShown || context.isBeingTransitioned)) {
18
- return (React.createElement(SeparatedSubMenu, { generatedId: generatedId, id: id, href: href, ref: ref, caption: caption }, children));
18
+ return (React.createElement(SeparatedSubMenu, { generatedId: generatedId, id: id, href: href, ref: ref, caption: caption, htmlId: htmlId }, children));
19
19
  }
20
- return (React.createElement(InnerSubMenu, { generatedId: generatedId, ref: ref }, children));
20
+ return (React.createElement(InnerSubMenu, { generatedId: generatedId, ref: ref, htmlId: htmlId }, children));
21
21
  });
22
22
  SubMenu.displayName = 'SubMenu';
23
23
  var SubMenuWithStaticFields = Object.assign(SubMenu, { __KONTUR_REACT_UI__: 'SubMenu' });