@skbkontur/side-menu 0.7.3 → 0.7.4

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,14 @@
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.7.4](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.7.3...@skbkontur/side-menu@0.7.4) (2023-03-30)
7
+
8
+ **Note:** Version bump only for package @skbkontur/side-menu
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.7.3](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.7.2...@skbkontur/side-menu@0.7.3) (2023-03-30)
7
15
 
8
16
  **Note:** Version bump only for package @skbkontur/side-menu
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skbkontur/side-menu",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -14,13 +14,13 @@
14
14
  },
15
15
  "author": "Kontur",
16
16
  "peerDependencies": {
17
- "@skbkontur/react-ui": ">=4 <5",
17
+ "@skbkontur/react-ui": ">=4.5.0 <5",
18
18
  "@skbkontur/react-ui-addons": ">=4.0.1",
19
19
  "react": ">=16.9",
20
20
  "react-dom": ">=16.9"
21
21
  },
22
22
  "devDependencies": {
23
- "@skbkontur/react-ui": "4.5.0"
23
+ "@skbkontur/react-ui": "4.13.0"
24
24
  },
25
25
  "dependencies": {
26
26
  "@skbkontur/icons": "^0.15.0",
@@ -1,7 +1,7 @@
1
1
  import { __assign, __rest } from "tslib";
2
2
  import React, { forwardRef, useEffect, useState } from 'react';
3
3
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
4
- import { isIE11, isSafari } from '@skbkontur/react-ui/lib/client';
4
+ import { isIE11 } from '@skbkontur/react-ui/lib/client';
5
5
  import { jsStyles, sideMenuMinimizedWidth, sideMenuStandardWidth } from './SideMenu.styles';
6
6
  import { SideMenuOrganisations } from '../SideMenuOrganisations/SideMenuOrganisations';
7
7
  import { SideMenuContext } from '../SideMenuContext';
@@ -26,7 +26,6 @@ import { ZIndex } from '@skbkontur/react-ui/internal/ZIndex';
26
26
  var SideMenuInner = forwardRef(function (_a, ref) {
27
27
  var _b, _c, _d, _e;
28
28
  var children = _a.children, value = _a.value, onValueChange = _a.onValueChange, _f = _a.size, size = _f === void 0 ? 'small' : _f, _g = _a.isSeparatedMenu, isSeparatedMenu = _g === void 0 ? false : _g, className = _a.className, _h = _a.disableSwipe, disableSwipe = _h === void 0 ? true : _h, _j = _a.desktopMediaQuery, desktopMediaQuery = _j === void 0 ? '(min-width: 1200px)' : _j, _k = _a.narrowDesktopMediaQuery, narrowDesktopMediaQuery = _k === void 0 ? '(min-width: 992px)' : _k, _l = _a.tabletMediaQuery, tabletMediaQuery = _l === void 0 ? '(min-width: 768px)' : _l, _m = _a.mobileMediaQuery, mobileMediaQuery = _m === void 0 ? '(min-width: 0px)' : _m, _o = _a.separatedMenuWithOverlay, separatedMenuWithOverlay = _o === void 0 ? false : _o, rest = __rest(_a, ["children", "value", "onValueChange", "size", "isSeparatedMenu", "className", "disableSwipe", "desktopMediaQuery", "narrowDesktopMediaQuery", "tabletMediaQuery", "mobileMediaQuery", "separatedMenuWithOverlay"]);
29
- var scrollTimer = null;
30
29
  var transitionTimer = null;
31
30
  var widgetTimer;
32
31
  var customMediaQueries = {
@@ -45,22 +44,15 @@ var SideMenuInner = forwardRef(function (_a, ref) {
45
44
  var isTouchScreen = isTouchDevice() || isMobile || isTablet;
46
45
  var separatedMenuWithoutOverlay = isSeparatedMenu && !separatedMenuWithOverlay;
47
46
  var _q = useState(isNarrowDesktop), isMinimized = _q[0], setIsMinimized = _q[1];
48
- var _r = useState(false), hasScrollBar = _r[0], setHasScrollBar = _r[1];
49
- var _s = useState(false), isBeingTransitioned = _s[0], setIsBeingTransitioned = _s[1];
50
- var _t = useState('#2291ff'), productColor = _t[0], setProductColor = _t[1];
51
- var _u = useState(false), showWidget = _u[0], setShowWidget = _u[1];
52
- var _v = useState(value), activeMenuItem = _v[0], setActiveMenuItem = _v[1];
53
- var _w = useState(isDesktopQuery || isNarrowDesktop), isShown = _w[0], setIsShown = _w[1];
54
- var _x = useState(false), isSeparatedMenuShown = _x[0], setIsSeparatedMenuShown = _x[1];
55
- var _y = useState(true), isMouseOutside = _y[0], setIsMouseOutside = _y[1];
56
- var _z = useState(false), isMobileSeparatedMenuScrolling = _z[0], setIsMobileSeparatedMenuScrolling = _z[1];
57
- useEffect(function () {
58
- return function () {
59
- if (scrollTimer) {
60
- clearTimeout(scrollTimer);
61
- }
62
- };
63
- });
47
+ var _r = useState(false), isBeingTransitioned = _r[0], setIsBeingTransitioned = _r[1];
48
+ var _s = useState('#2291ff'), productColor = _s[0], setProductColor = _s[1];
49
+ var _t = useState(false), showWidget = _t[0], setShowWidget = _t[1];
50
+ var _u = useState(value), activeMenuItem = _u[0], setActiveMenuItem = _u[1];
51
+ var _v = useState(isDesktopQuery || isNarrowDesktop), isShown = _v[0], setIsShown = _v[1];
52
+ var _w = useState(false), isSeparatedMenuShown = _w[0], setIsSeparatedMenuShown = _w[1];
53
+ var _x = useState(true), isMouseOutside = _x[0], setIsMouseOutside = _x[1];
54
+ var _y = useState('top'), scrollState = _y[0], setScrollState = _y[1];
55
+ var _z = useState(false), hasScrollBar = _z[0], setHasScrollBar = _z[1];
64
56
  useEffect(function () {
65
57
  if (isNarrowDesktop || isDesktopQuery) {
66
58
  setIsShown(true);
@@ -72,6 +64,12 @@ var SideMenuInner = forwardRef(function (_a, ref) {
72
64
  setIsMinimized(true);
73
65
  }
74
66
  }, [isNarrowDesktop, isDesktopQuery]);
67
+ useEffect(function () {
68
+ if (isTablet || isMobile) {
69
+ setIsMinimized(false);
70
+ setIsShown(false);
71
+ }
72
+ }, [isTablet, isMobile]);
75
73
  useEffect(function () {
76
74
  setActiveMenuItem(value);
77
75
  }, [value]);
@@ -88,21 +86,6 @@ var SideMenuInner = forwardRef(function (_a, ref) {
88
86
  }, 1000);
89
87
  }
90
88
  };
91
- var handleScroll = function (event) {
92
- var element = event.target;
93
- if (Math.floor(element.scrollHeight - element.scrollTop) === element.clientHeight) {
94
- return;
95
- }
96
- if (!hasScrollBar) {
97
- setHasScrollBar(true);
98
- }
99
- if (scrollTimer) {
100
- clearTimeout(scrollTimer);
101
- }
102
- scrollTimer = setTimeout(function () {
103
- setHasScrollBar(false);
104
- }, 200);
105
- };
106
89
  var handleMouseEnter = function () {
107
90
  if (separatedMenuWithoutOverlay && isSeparatedMenuShown && isNarrowDesktop) {
108
91
  return;
@@ -168,10 +151,12 @@ var SideMenuInner = forwardRef(function (_a, ref) {
168
151
  setIsSeparatedMenuShown: setIsSeparatedMenuShown,
169
152
  separatedMenuWithoutOverlay: separatedMenuWithoutOverlay,
170
153
  setIsMouseOutside: setIsMouseOutside,
171
- isMobileSeparatedMenuScrolling: isMobileSeparatedMenuScrolling,
172
- setIsMobileSeparatedMenuScrolling: setIsMobileSeparatedMenuScrolling,
154
+ scrollState: scrollState,
155
+ setScrollState: setScrollState,
156
+ hasScrollBar: hasScrollBar,
157
+ setHasScrollBar: setHasScrollBar,
173
158
  } },
174
- React.createElement(ZIndex, { priority: isTabletOrMobile ? 'Sidepage' : 0, className: cx((_b = {},
159
+ React.createElement(ZIndex, { priority: isTabletOrMobile || isNarrowDesktop ? 'Sidepage' : 0, className: cx((_b = {},
175
160
  _b[jsStyles.root()] = true,
176
161
  _b[jsStyles.rootForTabletsOrMobiles()] = isTabletOrMobile,
177
162
  _b[jsStyles.shownRootForTabletsOrMobiles()] = isShown && isTabletOrMobile,
@@ -190,15 +175,13 @@ var SideMenuInner = forwardRef(function (_a, ref) {
190
175
  React.createElement("div", { className: cx((_d = {},
191
176
  _d[jsStyles.container()] = true,
192
177
  _d[jsStyles.collapsedContainerForTabletsOrMobiles()] = !isShown,
193
- _d[jsStyles.containerSafari()] = isSafari,
194
178
  _d[jsStyles.minimizedContainer()] = isMinimized,
195
179
  _d[jsStyles.innerContainer()] = !isSeparatedMenu,
196
180
  _d[jsStyles.containerForTouchScreens()] = isTouchScreen,
197
181
  _d[jsStyles.separatedContainerForMobiles()] = isMobile && isSeparatedMenuShown && isShown,
198
- _d)), onScroll: handleScroll },
182
+ _d)) },
199
183
  React.createElement("div", { className: cx((_e = {},
200
184
  _e[jsStyles.contentWrapper()] = true,
201
- _e[jsStyles.contentWrapperWithoutScrollBar()] = !hasScrollBar,
202
185
  _e[jsStyles.collapsedContentWrapperForTabletsOrMobiles()] = !isShown || isSeparatedMenuShown,
203
186
  _e)) }, children)),
204
187
  !disableSwipe && isDesktopQuery && !isSeparatedMenuShown && (React.createElement(RightBorder, { setIsMinimized: setIsMinimized }))))))));
@@ -2,6 +2,7 @@ export declare const sideMenuMinimizedWidth = "72px";
2
2
  export declare const sideMenuStandardWidth = "232px";
3
3
  export declare const sideMenuForTouchScreenWidth = "328px";
4
4
  export declare const sideMenuBoxShadow = "4px 4px 24px rgba(0, 0, 0, 0.24)";
5
+ export declare const sideMenuMarginX = "16px";
5
6
  export declare const jsStyles: {
6
7
  root(): string;
7
8
  rootForTabletsOrMobiles(): string;
@@ -10,8 +11,6 @@ export declare const jsStyles: {
10
11
  separatedRootForNarrowDesktops(): string;
11
12
  separatedRootForDesktops(): string;
12
13
  container(): string;
13
- containerSafari(): string;
14
- contentWrapperWithoutScrollBar(): string;
15
14
  collapsedContentWrapperForTabletsOrMobiles(): string;
16
15
  minimizedContainer(): string;
17
16
  innerContainer(): string;
@@ -4,6 +4,7 @@ export var sideMenuMinimizedWidth = '72px';
4
4
  export var sideMenuStandardWidth = '232px';
5
5
  export var sideMenuForTouchScreenWidth = '328px';
6
6
  export var sideMenuBoxShadow = '4px 4px 24px rgba(0, 0, 0, 0.24)';
7
+ export var sideMenuMarginX = '16px';
7
8
  var styles = {
8
9
  root: function () {
9
10
  return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n height: 100%;\n flex-shrink: 0;\n "], ["\n position: relative;\n height: 100%;\n flex-shrink: 0;\n "])));
@@ -26,43 +27,37 @@ var styles = {
26
27
  container: function () {
27
28
  return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n width: ", ";\n height: 100%;\n background: #f6f6f6;\n position: relative;\n box-sizing: border-box;\n transition: width 1s;\n "], ["\n width: ", ";\n height: 100%;\n background: #f6f6f6;\n position: relative;\n box-sizing: border-box;\n transition: width 1s;\n "])), sideMenuStandardWidth);
28
29
  },
29
- containerSafari: function () {
30
- return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n &::-webkit-scrollbar {\n display: block;\n width: 10px;\n }\n &::-webkit-scrollbar-track {\n background: #f1f1f1;\n }\n &::-webkit-scrollbar-thumb {\n background: #888;\n }\n "], ["\n &::-webkit-scrollbar {\n display: block;\n width: 10px;\n }\n &::-webkit-scrollbar-track {\n background: #f1f1f1;\n }\n &::-webkit-scrollbar-thumb {\n background: #888;\n }\n "])));
31
- },
32
- contentWrapperWithoutScrollBar: function () {
33
- return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n -ms-overflow-style: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n width: 0;\n }\n "], ["\n -ms-overflow-style: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n width: 0;\n }\n "])));
34
- },
35
30
  collapsedContentWrapperForTabletsOrMobiles: function () {
36
- return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n overflow: hidden;\n "], ["\n overflow: hidden;\n "])));
31
+ return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n overflow: hidden;\n "], ["\n overflow: hidden;\n "])));
37
32
  },
38
33
  minimizedContainer: function () {
39
- return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n width: ", " !important;\n "], ["\n width: ", " !important;\n "])), sideMenuMinimizedWidth);
34
+ return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n width: ", " !important;\n "], ["\n width: ", " !important;\n "])), sideMenuMinimizedWidth);
40
35
  },
41
36
  innerContainer: function () {
42
- return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n overflow-x: hidden;\n "], ["\n overflow-x: hidden;\n "])));
37
+ return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n overflow-x: hidden;\n "], ["\n overflow-x: hidden;\n "])));
43
38
  },
44
39
  containerForTouchScreens: function () {
45
- return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), sideMenuForTouchScreenWidth);
40
+ return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), sideMenuForTouchScreenWidth);
46
41
  },
47
42
  separatedContainerForMobiles: function () {
48
- return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n background: #fff;\n "], ["\n background: #fff;\n "])));
43
+ return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n background: #fff;\n "], ["\n background: #fff;\n "])));
49
44
  },
50
45
  contentWrapper: function () {
51
- return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n height: calc(100% - 24px);\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n overflow-x: hidden;\n overflow-y: auto;\n padding: 0 16px 24px;\n "], ["\n height: calc(100% - 24px);\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n overflow-x: hidden;\n overflow-y: auto;\n padding: 0 16px 24px;\n "])));
46
+ return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n overflow-x: hidden;\n overflow-y: auto;\n "], ["\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n overflow-x: hidden;\n overflow-y: auto;\n "])));
52
47
  },
53
48
  wrapper: function () {
54
- return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n height: 100%;\n display: inline-flex;\n position: relative;\n "], ["\n height: 100%;\n display: inline-flex;\n position: relative;\n "])));
49
+ return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n height: 100%;\n display: inline-flex;\n position: relative;\n "], ["\n height: 100%;\n display: inline-flex;\n position: relative;\n "])));
55
50
  },
56
51
  wrapperIE: function () {
57
52
  var ieRootWrapperCorrection = 15;
58
- return css(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n position: relative;\n top: -", "px;\n height: calc(100% + ", "px);\n "], ["\n position: relative;\n top: -", "px;\n height: calc(100% + ", "px);\n "])), ieRootWrapperCorrection, ieRootWrapperCorrection);
53
+ return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n position: relative;\n top: -", "px;\n height: calc(100% + ", "px);\n "], ["\n position: relative;\n top: -", "px;\n height: calc(100% + ", "px);\n "])), ieRootWrapperCorrection, ieRootWrapperCorrection);
59
54
  },
60
55
  wrapperWithShadow: function () {
61
- return css(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n box-shadow: ", ";\n "], ["\n box-shadow: ", ";\n "])), sideMenuBoxShadow);
56
+ return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n box-shadow: ", ";\n "], ["\n box-shadow: ", ";\n "])), sideMenuBoxShadow);
62
57
  },
63
58
  collapsedContainerForTabletsOrMobiles: function () {
64
- return css(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n background-color: transparent;\n "], ["\n background-color: transparent;\n "])));
59
+ return css(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n background-color: transparent;\n "], ["\n background-color: transparent;\n "])));
65
60
  },
66
61
  };
67
62
  export var jsStyles = memoizeStyle(styles);
68
- 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, templateObject_18, templateObject_19;
63
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
3
+ import { ScrollContainer } from '@skbkontur/react-ui';
3
4
  export interface SideMenuBodyProps extends CommonProps {
4
5
  children?: React.ReactNode;
5
6
  }
@@ -8,6 +9,6 @@ export interface SideMenuBodyProps extends CommonProps {
8
9
  *
9
10
  * @visibleName SideMenu.Body
10
11
  */
11
- export declare const SideMenuBody: React.ForwardRefExoticComponent<SideMenuBodyProps & React.RefAttributes<HTMLDivElement>> & {
12
+ export declare const SideMenuBody: React.ForwardRefExoticComponent<SideMenuBodyProps & React.RefAttributes<ScrollContainer>> & {
12
13
  __KONTUR_REACT_UI__: string;
13
14
  };
@@ -1,16 +1,37 @@
1
1
  import { __assign, __rest } from "tslib";
2
- import React, { forwardRef, useContext } from 'react';
2
+ import React, { forwardRef, useContext, useEffect, useRef } from 'react';
3
3
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
4
4
  import { jsStyles } from './SideMenuBody.styles';
5
5
  import { InnerBody } from '../internal/InnerBody';
6
6
  import { SideMenuContext } from '../SideMenuContext';
7
+ import { ScrollContainer, ScrollContainerDataTids } from '@skbkontur/react-ui';
8
+ import { mergeRefs } from '@skbkontur/react-ui/lib/utils';
7
9
  var SideMenuBodyInner = forwardRef(function (_a, ref) {
8
10
  var _b;
9
11
  var className = _a.className, children = _a.children, rest = __rest(_a, ["className", "children"]);
10
12
  var context = useContext(SideMenuContext);
13
+ var scrollContainerRef = useRef(null);
14
+ var setScrollContainerInnerPosition = function () {
15
+ var scrollContainerInner = document.querySelector("[data-tid=" + ScrollContainerDataTids.inner + "]");
16
+ if (scrollContainerInner) {
17
+ scrollContainerInner.style.position = 'static';
18
+ }
19
+ };
20
+ useEffect(function () {
21
+ setTimeout(function () {
22
+ var _a, _b;
23
+ // @ts-expect-error: accessing private method
24
+ (_a = context.setHasScrollBar) === null || _a === void 0 ? void 0 : _a.call(context, (_b = scrollContainerRef.current) === null || _b === void 0 ? void 0 : _b.hasScrollBar('y'));
25
+ }, 50);
26
+ setScrollContainerInnerPosition();
27
+ }, [context.activeMenuItem, context.isShown]);
11
28
  if (context.isShown) {
12
- return (React.createElement("div", __assign({ className: cx((_b = {}, _b[jsStyles.root()] = true, _b), className), ref: ref }, rest),
13
- React.createElement(InnerBody, null, children)));
29
+ return (React.createElement(ScrollContainer, { style: { position: 'static' }, onScrollStateChangeY: function (state) {
30
+ var _a;
31
+ (_a = context.setScrollState) === null || _a === void 0 ? void 0 : _a.call(context, state);
32
+ }, hideScrollBar: true, ref: mergeRefs([ref, scrollContainerRef]) },
33
+ React.createElement("div", __assign({ className: cx((_b = {}, _b[jsStyles.root()] = true, _b), className) }, rest),
34
+ React.createElement(InnerBody, null, children))));
14
35
  }
15
36
  return null;
16
37
  });
@@ -1,8 +1,9 @@
1
1
  import { __makeTemplateObject } from "tslib";
2
2
  import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
3
+ import { sideMenuMarginX } from '../SideMenu/SideMenu.styles';
3
4
  var styles = {
4
5
  root: function () {
5
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n padding-bottom: 16px;\n margin-top: 0;\n "], ["\n flex-grow: 1;\n padding-bottom: 16px;\n margin-top: 0;\n "])));
6
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n padding-bottom: 8px;\n margin: 0 ", ";\n "], ["\n flex-grow: 1;\n padding-bottom: 8px;\n margin: 0 ", ";\n "])), sideMenuMarginX);
6
7
  },
7
8
  };
8
9
  export var jsStyles = memoizeStyle(styles);
@@ -1,4 +1,5 @@
1
1
  import { FlattedArrayElementType } from './internal/InnerBody';
2
+ import { ScrollContainerScrollStateY } from '@skbkontur/react-ui';
2
3
  export interface SideMenuContextType {
3
4
  isMinimized?: boolean;
4
5
  setIsMinimized?: (isMinimized: boolean) => void;
@@ -24,7 +25,9 @@ export interface SideMenuContextType {
24
25
  setIsSeparatedMenuShown?: (separatedMenuIsShown: boolean) => void;
25
26
  separatedMenuWithoutOverlay?: boolean;
26
27
  setIsMouseOutside?: (v: boolean) => void;
27
- isMobileSeparatedMenuScrolling?: boolean;
28
- setIsMobileSeparatedMenuScrolling?: (isScrolling: boolean) => void;
28
+ scrollState?: ScrollContainerScrollStateY;
29
+ setScrollState?: (state: ScrollContainerScrollStateY) => void;
30
+ hasScrollBar?: boolean;
31
+ setHasScrollBar?: (hasScrollBar: boolean) => void;
29
32
  }
30
33
  export declare const SideMenuContext: import("react").Context<SideMenuContextType>;
@@ -1,40 +1,43 @@
1
1
  import { __assign, __rest } from "tslib";
2
2
  import React, { forwardRef, useContext } from 'react';
3
3
  import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
4
- import { DEFAULT_THEME, DropdownMenu, ThemeFactory } from '@skbkontur/react-ui';
4
+ import { DropdownMenu, ThemeFactory } from '@skbkontur/react-ui';
5
5
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
6
6
  import { jsStyles } from './SideMenuDropdown.styles';
7
7
  import { SideMenuItem } from '../SideMenuItem/SideMenuItem';
8
8
  import { SideMenuContext } from '../SideMenuContext';
9
9
  var SideMenuDropdownInner = forwardRef(function (_a, ref) {
10
- var _b, _c;
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, className = _a.className, _e = _a.disableAnimations, disableAnimations = _e === void 0 ? false : _e, menuWidth = _a.menuWidth, rest = __rest(_a, ["icon", "id", "_generatedId", "_avatar", "children", "caption", "className", "disableAnimations", "menuWidth"]);
10
+ var _b;
11
+ var icon = _a.icon, id = _a.id, _generatedId = _a._generatedId, _avatar = _a._avatar, children = _a.children, _c = _a.caption, caption = _c === void 0 ? 'СКБ Контур' : _c, className = _a.className, _d = _a.disableAnimations, disableAnimations = _d === void 0 ? false : _d, menuWidth = _a.menuWidth, rest = __rest(_a, ["icon", "id", "_generatedId", "_avatar", "children", "caption", "className", "disableAnimations", "menuWidth"]);
12
12
  var context = useContext(SideMenuContext);
13
13
  var label = (React.createElement("div", { className: cx((_b = {},
14
14
  _b[jsStyles.label()] = true,
15
15
  _b[jsStyles.minimizedLabel()] = context.isMinimized,
16
16
  _b)) },
17
17
  React.createElement(SideMenuItem, { icon: icon, caption: caption, _avatar: _avatar, id: id, _isDropdown: true })));
18
- return (React.createElement(ThemeContext.Provider, { value: ThemeFactory.create({
19
- menuItemHoverBg: '#f6f6f6',
20
- menuItemHoverColor: '#222',
21
- popupBorderRadius: '8px',
22
- menuItemPaddingX: '32px',
23
- }, DEFAULT_THEME) },
24
- React.createElement("div", { className: cx((_c = {}, _c[jsStyles.wrapper()] = true, _c), className), ref: ref },
25
- React.createElement(DropdownMenu, __assign({ caption: label, positions: ['top left'], disableAnimations: true, menuWidth: menuWidth }, rest), React.Children.map(children, function (child) {
26
- // @ts-expect-error: accessing private property
27
- if (React.isValidElement(child) && (child === null || child === void 0 ? void 0 : child.type.__KONTUR_REACT_UI__) === 'MenuItem') {
28
- return React.cloneElement(child, {
29
- onClick: function () {
30
- var _a, _b, _c;
31
- (_a = context.toggleIsShown) === null || _a === void 0 ? void 0 : _a.call(context);
32
- (_c = (_b = child.props).onClick) === null || _c === void 0 ? void 0 : _c.call(_b);
33
- },
34
- });
35
- }
36
- return child;
37
- })))));
18
+ return (React.createElement(ThemeContext.Consumer, null, function (theme) {
19
+ var _a;
20
+ return (React.createElement(ThemeContext.Provider, { value: ThemeFactory.create({
21
+ menuItemHoverBg: '#f6f6f6',
22
+ menuItemHoverColor: '#222',
23
+ popupBorderRadius: '8px',
24
+ menuItemPaddingX: '32px',
25
+ }, theme) },
26
+ React.createElement("div", { className: cx((_a = {}, _a[jsStyles.wrapper()] = true, _a), className), ref: ref },
27
+ React.createElement(DropdownMenu, __assign({ caption: label, positions: ['top left'], disableAnimations: true, menuWidth: menuWidth }, rest), React.Children.map(children, function (child) {
28
+ // @ts-expect-error: accessing private property
29
+ if (React.isValidElement(child) && (child === null || child === void 0 ? void 0 : child.type.__KONTUR_REACT_UI__) === 'MenuItem') {
30
+ return React.cloneElement(child, {
31
+ onClick: function () {
32
+ var _a, _b, _c;
33
+ (_a = context.toggleIsShown) === null || _a === void 0 ? void 0 : _a.call(context);
34
+ (_c = (_b = child.props).onClick) === null || _c === void 0 ? void 0 : _c.call(_b);
35
+ },
36
+ });
37
+ }
38
+ return child;
39
+ })))));
40
+ }));
38
41
  });
39
42
  SideMenuDropdownInner.displayName = 'SideMenuDropdown';
40
43
  /**
@@ -8,6 +8,6 @@ export interface SideMenuFooterProps extends CommonProps {
8
8
  *
9
9
  * @visibleName SideMenu.Footer
10
10
  */
11
- export declare const SideMenuFooter: React.FC<SideMenuFooterProps> & {
11
+ export declare const SideMenuFooter: React.ForwardRefExoticComponent<SideMenuFooterProps & React.RefAttributes<HTMLDivElement>> & {
12
12
  __KONTUR_REACT_UI__: string;
13
13
  };
@@ -1,5 +1,5 @@
1
1
  import { __assign, __rest } from "tslib";
2
- import React, { forwardRef, useContext } from 'react';
2
+ import React, { forwardRef, useContext, useEffect, useState } from 'react';
3
3
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
4
4
  import { jsStyles } from './SideMenuFooter.styles';
5
5
  import { getItemId } from '../../utils/scripts';
@@ -8,8 +8,12 @@ var SideMenuFooterInner = forwardRef(function (_a, ref) {
8
8
  var _b;
9
9
  var className = _a.className, children = _a.children, rest = __rest(_a, ["className", "children"]);
10
10
  var context = useContext(SideMenuContext);
11
+ var _c = useState(false), isFixed = _c[0], setIsFixed = _c[1];
12
+ useEffect(function () {
13
+ setIsFixed(!!context.hasScrollBar && !(context.scrollState === 'bottom'));
14
+ }, [context.hasScrollBar, context.scrollState]);
11
15
  if (context.isShown) {
12
- return (React.createElement("footer", __assign({ className: cx((_b = {}, _b[jsStyles.root()] = true, _b), className), ref: ref }, rest), React.Children.map(children, function (child, index) {
16
+ return (React.createElement("footer", __assign({ className: cx((_b = {}, _b[jsStyles.root()] = true, _b[jsStyles.rootFixed()] = isFixed, _b), className), ref: ref }, rest), React.Children.map(children, function (child, index) {
13
17
  if (React.isValidElement(child)) {
14
18
  return React.cloneElement(child, {
15
19
  _generatedId: getItemId('footer', index++),
@@ -1,3 +1,4 @@
1
1
  export declare const jsStyles: {
2
2
  root(): string;
3
+ rootFixed(): string;
3
4
  };
@@ -1,9 +1,13 @@
1
1
  import { __makeTemplateObject } from "tslib";
2
2
  import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
3
+ import { sideMenuMarginX } from '../SideMenu/SideMenu.styles';
3
4
  var styles = {
4
5
  root: function () {
5
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 0;\n "], ["\n flex-grow: 0;\n "])));
6
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: 24px;\n padding-top: 8px;\n margin: 0 ", ";\n "], ["\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: 24px;\n padding-top: 8px;\n margin: 0 ", ";\n "])), sideMenuMarginX);
7
+ },
8
+ rootFixed: function () {
9
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n box-shadow: inset 0 1px 0 #e6e6e6;\n "], ["\n box-shadow: inset 0 1px 0 #e6e6e6;\n "])));
6
10
  },
7
11
  };
8
12
  export var jsStyles = memoizeStyle(styles);
9
- var templateObject_1;
13
+ var templateObject_1, templateObject_2;
@@ -1,5 +1,5 @@
1
1
  import { __assign, __rest } from "tslib";
2
- import React, { forwardRef, useContext, useEffect, useRef, useState } from 'react';
2
+ import React, { forwardRef, useContext, useRef } from 'react';
3
3
  import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
4
4
  import { mergeRefs } from '@skbkontur/react-ui/lib/utils';
5
5
  import { jsStyles } from './SideMenuHeader.styles';
@@ -10,29 +10,9 @@ var SideMenuHeaderInner = forwardRef(function (_a, ref) {
10
10
  var className = _a.className, productLogo = _a.productLogo, konturLogo = _a.konturLogo, iconUrl = _a.iconUrl, style = _a.style, withWidget = _a.withWidget, rest = __rest(_a, ["className", "productLogo", "konturLogo", "iconUrl", "style", "withWidget"]);
11
11
  var context = useContext(SideMenuContext);
12
12
  var headerWrapperRef = useRef(null);
13
- var _c = useState(false), isFixed = _c[0], setIsFixed = _c[1];
14
- var checkFixed = function () {
15
- if (headerWrapperRef.current && headerWrapperRef.current.offsetTop > 0) {
16
- setIsFixed(true);
17
- }
18
- else {
19
- setIsFixed(false);
20
- }
21
- };
22
- useEffect(function () {
23
- if (!context.isSeparatedMenuShown) {
24
- window.addEventListener('scroll', checkFixed, true);
25
- }
26
- return function () {
27
- window.removeEventListener('scroll', checkFixed, true);
28
- };
29
- });
30
- useEffect(function () {
31
- context.isMobileSeparatedMenuScrolling !== undefined && setIsFixed(context.isMobileSeparatedMenuScrolling);
32
- }, [context.isMobileSeparatedMenuScrolling]);
33
13
  return (React.createElement("header", __assign({ className: cx((_b = {},
34
14
  _b[jsStyles.root()] = true,
35
- _b[jsStyles.fixedRoot()] = isFixed,
15
+ _b[jsStyles.fixedRoot()] = context.isShown && !(context.scrollState === 'top'),
36
16
  _b[jsStyles.minimizedRoot()] = context.isMinimized || context.isBeingTransitioned,
37
17
  _b[jsStyles.collapsedRootForTabletsOrMobiles()] = !context.isShown,
38
18
  _b[jsStyles.rootWithSeparatedMenuShown()] = context.isShown && context.isMobile && context.isSeparatedMenuShown,
@@ -1,9 +1,10 @@
1
1
  import { __makeTemplateObject } from "tslib";
2
2
  import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
3
+ import { sideMenuMarginX } from '../SideMenu/SideMenu.styles';
3
4
  var headerWrapperPaddingX = '8px';
4
5
  var styles = {
5
6
  root: function () {
6
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: sticky;\n width: calc(100% - 2 * ", ");\n top: 0;\n background: #f6f6f6;\n z-index: 1;\n padding: 24px ", " 16px;\n "], ["\n position: sticky;\n width: calc(100% - 2 * ", ");\n top: 0;\n background: #f6f6f6;\n z-index: 1;\n padding: 24px ", " 16px;\n "])), headerWrapperPaddingX, headerWrapperPaddingX);
7
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: sticky;\n width: calc(100% - 2 * ", " - 2 * ", ");\n top: 0;\n background: #f6f6f6;\n z-index: 1;\n padding: 24px ", " 16px;\n margin: 0 ", ";\n "], ["\n position: sticky;\n width: calc(100% - 2 * ", " - 2 * ", ");\n top: 0;\n background: #f6f6f6;\n z-index: 1;\n padding: 24px ", " 16px;\n margin: 0 ", ";\n "])), headerWrapperPaddingX, sideMenuMarginX, headerWrapperPaddingX, sideMenuMarginX);
7
8
  },
8
9
  minimizedRoot: function () {
9
10
  return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 54px;\n padding-left: 0 !important;\n padding-right: 0;\n "], ["\n width: 54px;\n padding-left: 0 !important;\n padding-right: 0;\n "])));
@@ -15,7 +16,7 @@ var styles = {
15
16
  return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n background: #fff;\n "], ["\n background: #fff;\n "])));
16
17
  },
17
18
  fixedRoot: function () {
18
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n box-shadow: inset 0 -1px 0 #e6e6e6;\n "], ["\n box-shadow: inset 0 -1px 0 #e6e6e6;\n "])));
19
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding-bottom: 8px;\n box-shadow: inset 0 -1px 0 #e6e6e6;\n "], ["\n padding-bottom: 8px;\n box-shadow: inset 0 -1px 0 #e6e6e6;\n "])));
19
20
  },
20
21
  };
21
22
  export var jsStyles = memoizeStyle(styles);
@@ -6,9 +6,8 @@ import { jsStylesForSeparatedSubMenu } from './SeparatedSubMenu.styles';
6
6
  import { SideMenuContext } from '../SideMenuContext';
7
7
  import { isClickableSubElement } from '../../utils/scripts';
8
8
  import { BackButton } from './BackButton';
9
- import { mergeRefs } from '@skbkontur/react-ui/lib/utils';
10
9
  import { SideMenuDataTids } from '../../SideMenuDataTids';
11
- import { useMobileSeparatedMenuScroll } from '../../hooks/useMobileSeparatedMenuScroll';
10
+ import { ScrollContainer } from '@skbkontur/react-ui';
12
11
  import { isIE11 } from '@skbkontur/react-ui/lib/client';
13
12
  /**
14
13
  * Отдельностоящее подменю
@@ -16,7 +15,7 @@ import { isIE11 } from '@skbkontur/react-ui/lib/client';
16
15
  * @visibleName SeparatedSubMenu
17
16
  */
18
17
  var SeparatedSubMenu = forwardRef(function (_a, ref) {
19
- var _b;
18
+ var _b, _c;
20
19
  var children = _a.children, generatedId = _a.generatedId, id = _a.id, href = _a.href, caption = _a.caption;
21
20
  var context = useContext(SideMenuContext);
22
21
  var isSubItemWithChildren = function (child) {
@@ -31,7 +30,6 @@ var SeparatedSubMenu = forwardRef(function (_a, ref) {
31
30
  return child;
32
31
  });
33
32
  };
34
- var separatedMenuRef = useMobileSeparatedMenuScroll();
35
33
  var levelIndex = 0;
36
34
  var isDesktopOverlayMenu = (context.isDesktop || context.isNarrowDesktop) && !context.separatedMenuWithoutOverlay;
37
35
  var isSeparatedSubMenuOverContent = (context.isTablet || isDesktopOverlayMenu) && !isIE11;
@@ -43,22 +41,30 @@ var SeparatedSubMenu = forwardRef(function (_a, ref) {
43
41
  _b[jsStylesForSeparatedSubMenu.rootWithoutOverlay()] = context.separatedMenuWithoutOverlay && context.isDesktop,
44
42
  _b[jsStylesForSeparatedSubMenu.rootWithoutOverlayForNarrowDesktop()] = context.separatedMenuWithoutOverlay && context.isNarrowDesktop,
45
43
  _b[jsStylesForSeparatedSubMenu.rootWithShadow()] = isSeparatedSubMenuOverContent,
46
- _b)), ref: mergeRefs([separatedMenuRef, ref]), "data-tid": SideMenuDataTids.separatedSubMenu },
47
- context.isMobile && React.createElement(BackButton, { caption: caption, id: id, href: href, generatedId: generatedId }),
48
- React.createElement(SideMenuContext.Provider, { value: __assign({ hasSubIcons: hasSubItems(children) }, context) }, React.Children.map(children, function (child) {
49
- if (React.isValidElement(child)) {
50
- if (
51
- // @ts-expect-error: accessing private property
52
- isClickableSubElement(child.type.__KONTUR_REACT_UI__)) {
53
- var oldIndex = levelIndex;
54
- levelIndex++;
55
- return React.cloneElement(child, {
56
- _generatedId: generatedId + "-" + oldIndex,
57
- });
58
- }
59
- return child;
60
- }
61
- }))));
44
+ _b)), ref: ref, "data-tid": SideMenuDataTids.separatedSubMenu },
45
+ React.createElement(ScrollContainer, { onScrollStateChangeY: function (state) {
46
+ var _a;
47
+ (_a = context.setScrollState) === null || _a === void 0 ? void 0 : _a.call(context, state);
48
+ }, hideScrollBar: true },
49
+ React.createElement("div", { className: cx((_c = {},
50
+ _c[jsStylesForSeparatedSubMenu.contentWrapper()] = true,
51
+ _c[jsStylesForSeparatedSubMenu.contentWrapperForMobiles()] = context.isMobile,
52
+ _c)) },
53
+ context.isMobile && React.createElement(BackButton, { caption: caption, id: id, href: href, generatedId: generatedId }),
54
+ React.createElement(SideMenuContext.Provider, { value: __assign({ hasSubIcons: hasSubItems(children) }, context) }, React.Children.map(children, function (child) {
55
+ if (React.isValidElement(child)) {
56
+ if (
57
+ // @ts-expect-error: accessing private property
58
+ isClickableSubElement(child.type.__KONTUR_REACT_UI__)) {
59
+ var oldIndex = levelIndex;
60
+ levelIndex++;
61
+ return React.cloneElement(child, {
62
+ _generatedId: generatedId + "-" + oldIndex,
63
+ });
64
+ }
65
+ return child;
66
+ }
67
+ }))))));
62
68
  });
63
69
  SeparatedSubMenu.displayName = 'SeparatedSubMenu';
64
70
  var SeparatedSubMenuWithStaticFields = Object.assign(SeparatedSubMenu, { __KONTUR_REACT_UI__: 'SeparatedSubMenu' });
@@ -4,4 +4,6 @@ export declare const jsStylesForSeparatedSubMenu: {
4
4
  rootWithoutOverlayForNarrowDesktop(): string;
5
5
  rootWithoutOverlay(): string;
6
6
  rootWithShadow(): string;
7
+ contentWrapper(): string;
8
+ contentWrapperForMobiles(): string;
7
9
  };
@@ -3,11 +3,11 @@ import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
3
3
  import { sideMenuBoxShadow, sideMenuMinimizedWidth, sideMenuStandardWidth } from '../SideMenu/SideMenu.styles';
4
4
  var styles = {
5
5
  root: function () {
6
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n z-index: 8000;\n background: #fff;\n left: 100%;\n overflow: auto;\n justify-content: flex-start;\n padding: 24px 16px;\n border-right: 1px solid #e5e5e5;\n "], ["\n position: absolute;\n top: 0;\n z-index: 8000;\n background: #fff;\n left: 100%;\n overflow: auto;\n justify-content: flex-start;\n padding: 24px 16px;\n border-right: 1px solid #e5e5e5;\n "])));
6
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n z-index: 8000;\n background: #fff;\n left: 100%;\n overflow: auto;\n justify-content: flex-start;\n border-right: 1px solid #e5e5e5;\n "], ["\n position: absolute;\n top: 0;\n z-index: 8000;\n background: #fff;\n left: 100%;\n overflow: auto;\n justify-content: flex-start;\n border-right: 1px solid #e5e5e5;\n "])));
7
7
  },
8
8
  rootForMobiles: function () {
9
9
  var headerHeight = '68px';
10
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: calc(100vh - ", ");\n left: 0;\n top: ", ";\n padding-top: 0;\n "], ["\n height: calc(100vh - ", ");\n left: 0;\n top: ", ";\n padding-top: 0;\n "])), headerHeight, headerHeight);
10
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: calc(100vh - ", ");\n left: 0;\n top: ", ";\n "], ["\n height: calc(100vh - ", ");\n left: 0;\n top: ", ";\n "])), headerHeight, headerHeight);
11
11
  },
12
12
  rootWithoutOverlayForNarrowDesktop: function () {
13
13
  return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n left: ", ";\n z-index: -1;\n "], ["\n left: ", ";\n z-index: -1;\n "])), sideMenuMinimizedWidth);
@@ -18,6 +18,12 @@ var styles = {
18
18
  rootWithShadow: function () {
19
19
  return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n box-shadow: ", ";\n clip-path: inset(0 -24px 0 0);\n border-right: none;\n "], ["\n box-shadow: ", ";\n clip-path: inset(0 -24px 0 0);\n border-right: none;\n "])), sideMenuBoxShadow);
20
20
  },
21
+ contentWrapper: function () {
22
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding: 24px 16px;\n "], ["\n padding: 24px 16px;\n "])));
23
+ },
24
+ contentWrapperForMobiles: function () {
25
+ return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-top: 0;\n "], ["\n padding-top: 0;\n "])));
26
+ },
21
27
  };
22
28
  export var jsStylesForSeparatedSubMenu = memoizeStyle(styles);
23
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
29
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
@@ -1 +0,0 @@
1
- export declare const useMobileSeparatedMenuScroll: () => import("react").RefObject<HTMLDivElement>;
@@ -1,21 +0,0 @@
1
- import { useContext, useEffect, useRef } from 'react';
2
- import { SideMenuContext } from '../src/SideMenuContext';
3
- export var useMobileSeparatedMenuScroll = function () {
4
- var separatedMenuRef = useRef(null);
5
- var context = useContext(SideMenuContext);
6
- var checkScroll = function () {
7
- var _a, _b;
8
- var isScrolledToTop = ((_a = separatedMenuRef.current) === null || _a === void 0 ? void 0 : _a.scrollTop) === 0;
9
- (_b = context.setIsMobileSeparatedMenuScrolling) === null || _b === void 0 ? void 0 : _b.call(context, !isScrolledToTop);
10
- };
11
- useEffect(function () {
12
- var _a;
13
- context.isMobile && ((_a = separatedMenuRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', checkScroll, true));
14
- return function () {
15
- var _a, _b;
16
- (_a = separatedMenuRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', checkScroll, true);
17
- (_b = context.setIsMobileSeparatedMenuScrolling) === null || _b === void 0 ? void 0 : _b.call(context, false);
18
- };
19
- }, []);
20
- return separatedMenuRef;
21
- };