@skbkontur/side-menu 1.4.2 → 1.5.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
+ # [1.5.0](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@1.4.2...@skbkontur/side-menu@1.5.0) (2023-09-05)
7
+
8
+
9
+ ### Features
10
+
11
+ * **SideMenu:** always show widget ([f26dabb](https://git.skbkontur.ru/ui/ui-parking/commits/f26dabb14620eb12cb42ffa29b04e98708f4a200))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [1.4.2](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@1.4.1...@skbkontur/side-menu@1.4.2) (2023-08-25)
7
18
 
8
19
  **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": "1.4.2",
3
+ "version": "1.5.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,7 +32,6 @@ var SideMenuInner = forwardRef(function (_a, ref) {
32
32
  var _b, _c, _d, _e;
33
33
  var children = _a.children, value = _a.value, onValueChange = _a.onValueChange, _f = _a.size, size = _f === void 0 ? 'small' : _f, _g = _a.isSeparatedMenu, isSeparatedMenu = _g === void 0 ? false : _g, className = _a.className, _h = _a.disableSwipe, disableSwipe = _h === void 0 ? true : _h, desktopMediaQuery = _a.desktopMediaQuery, narrowDesktopMediaQuery = _a.narrowDesktopMediaQuery, tabletMediaQuery = _a.tabletMediaQuery, mobileMediaQuery = _a.mobileMediaQuery, rest = __rest(_a, ["children", "value", "onValueChange", "size", "isSeparatedMenu", "className", "disableSwipe", "desktopMediaQuery", "narrowDesktopMediaQuery", "tabletMediaQuery", "mobileMediaQuery"]);
34
34
  var transitionTimer = useRef(null);
35
- var widgetTimer = useRef(null);
36
35
  var theme = getSideMenuTheme(useContext(ThemeContext));
37
36
  var customMediaQueries = {
38
37
  isMobileQuery: mobileMediaQuery || theme.sideMenuMobileMediaQuery,
@@ -50,23 +49,19 @@ var SideMenuInner = forwardRef(function (_a, ref) {
50
49
  var isTouchScreen = isTouchDevice() || isMobile || isTablet;
51
50
  var _k = useState(isNarrowDesktop), isMinimized = _k[0], setIsMinimized = _k[1];
52
51
  var _l = useState(false), isBeingTransitioned = _l[0], setIsBeingTransitioned = _l[1];
53
- var _m = useState(false), showWidget = _m[0], setShowWidget = _m[1];
54
- var _o = useState(value), activeMenuItem = _o[0], setActiveMenuItem = _o[1];
55
- var _p = useState(isDesktopQuery || isNarrowDesktop), isShown = _p[0], setIsShown = _p[1];
56
- var _q = useState(false), isSeparatedMenuShown = _q[0], setIsSeparatedMenuShown = _q[1];
57
- var _r = useState(true), isMouseOutside = _r[0], setIsMouseOutside = _r[1];
58
- var _s = useState('top'), scrollState = _s[0], setScrollState = _s[1];
59
- var _t = useState(false), hasScrollBar = _t[0], setHasScrollBar = _t[1];
60
- var _u = useState(0), mousePositionX = _u[0], setMousePositionX = _u[1];
61
- var _v = useState(0), headerHeight = _v[0], setHeaderHeight = _v[1];
52
+ var _m = useState(value), activeMenuItem = _m[0], setActiveMenuItem = _m[1];
53
+ var _o = useState(isDesktopQuery || isNarrowDesktop), isShown = _o[0], setIsShown = _o[1];
54
+ var _p = useState(false), isSeparatedMenuShown = _p[0], setIsSeparatedMenuShown = _p[1];
55
+ var _q = useState(true), isMouseOutside = _q[0], setIsMouseOutside = _q[1];
56
+ var _r = useState('top'), scrollState = _r[0], setScrollState = _r[1];
57
+ var _s = useState(false), hasScrollBar = _s[0], setHasScrollBar = _s[1];
58
+ var _t = useState(0), mousePositionX = _t[0], setMousePositionX = _t[1];
59
+ var _u = useState(0), headerHeight = _u[0], setHeaderHeight = _u[1];
62
60
  useEffect(function () {
63
61
  return function () {
64
62
  if (transitionTimer.current) {
65
63
  clearTimeout(transitionTimer.current);
66
64
  }
67
- if (widgetTimer.current) {
68
- clearTimeout(widgetTimer.current);
69
- }
70
65
  };
71
66
  }, []);
72
67
  useEffect(function () {
@@ -108,15 +103,8 @@ var SideMenuInner = forwardRef(function (_a, ref) {
108
103
  }
109
104
  isMouseOutside && showMinimizedRoot(false);
110
105
  setIsMouseOutside(false);
111
- widgetTimer.current = setTimeout(function () {
112
- setShowWidget(true);
113
- }, 500);
114
106
  };
115
107
  var handleMouseLeave = function () {
116
- if (widgetTimer.current) {
117
- clearTimeout(widgetTimer.current);
118
- }
119
- setShowWidget(false);
120
108
  if (isNarrowDesktop) {
121
109
  setIsMinimized(true);
122
110
  }
@@ -155,11 +143,11 @@ var SideMenuInner = forwardRef(function (_a, ref) {
155
143
  }
156
144
  };
157
145
  var isSideMenuOverContent = (isNarrowDesktop && !isMinimized) || (isMobile && isShown) || (isTablet && isShown && !isSeparatedMenuShown);
158
- var _w = useAnimateOnMount(!!isTabletOrMobile && !!isShown, burgerTransitionDuration, {
146
+ var _v = useAnimateOnMount(!!isTabletOrMobile && !!isShown, burgerTransitionDuration, {
159
147
  opacity: DEFAULT_THEME.sidePageBackingBgOpacity,
160
148
  }, {
161
149
  opacity: 0,
162
- }), shouldShowBackdrop = _w[0], backdropStyle = _w[1];
150
+ }), shouldShowBackdrop = _v[0], backdropStyle = _v[1];
163
151
  var isSideMenuOverflowing = (isTabletOrMobile && isShown) || (isNarrowDesktop && !isMinimized);
164
152
  return (React.createElement(SideMenuContext.Provider, { value: {
165
153
  isMinimized: isMinimized,
@@ -167,7 +155,6 @@ var SideMenuInner = forwardRef(function (_a, ref) {
167
155
  isBeingTransitioned: isBeingTransitioned,
168
156
  isSeparatedMenu: isSeparatedMenu,
169
157
  size: size,
170
- showWidget: showWidget,
171
158
  activeMenuItem: activeMenuItem,
172
159
  switchActiveMenuItem: switchActiveMenuItem,
173
160
  isDesktop: isDesktopQuery,
@@ -10,7 +10,6 @@ export interface SideMenuContextType {
10
10
  activeMenuItem?: string | null;
11
11
  switchActiveMenuItem?: (id: string) => void;
12
12
  hasSubIcons?: boolean;
13
- showWidget?: boolean;
14
13
  openedParents?: string[];
15
14
  isDesktop?: boolean;
16
15
  isNarrowDesktop?: boolean;
@@ -10,7 +10,7 @@ import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers';
10
10
  import { getDOMRect } from '@skbkontur/react-ui/lib/dom/getDOMRect';
11
11
  var SideMenuHeaderInner = forwardRef(function (_a, ref) {
12
12
  var _b;
13
- var className = _a.className, productLogo = _a.productLogo, konturLogo = _a.konturLogo, iconUrl = _a.iconUrl, style = _a.style, withWidget = _a.withWidget, dataTid = _a["data-tid"], rest = __rest(_a, ["className", "productLogo", "konturLogo", "iconUrl", "style", "withWidget", 'data-tid']);
13
+ var className = _a.className, productLogo = _a.productLogo, konturLogo = _a.konturLogo, iconUrl = _a.iconUrl, style = _a.style, _c = _a.withWidget, withWidget = _c === void 0 ? true : _c, dataTid = _a["data-tid"], rest = __rest(_a, ["className", "productLogo", "konturLogo", "iconUrl", "style", "withWidget", 'data-tid']);
14
14
  var context = useContext(SideMenuContext);
15
15
  var theme = getSideMenuTheme(useContext(ThemeContext));
16
16
  var headerWrapperRef = useRef(null);
@@ -49,17 +49,11 @@ var SideMenuLogotype = forwardRef(function (_a, ref) {
49
49
  setSize(24);
50
50
  }
51
51
  }, []);
52
- var getWidget = function (withWidget, isTouchScreen, isMinimizedInNarrowDesktop, showWidget) {
53
- if (withWidget !== undefined) {
54
- return withWidget;
55
- }
56
- if (isTouchScreen) {
57
- return true;
58
- }
59
- else if (isMinimizedInNarrowDesktop) {
52
+ var getWidget = function (withWidget, isMinimizedInNarrowDesktop) {
53
+ if (isMinimizedInNarrowDesktop) {
60
54
  return false;
61
55
  }
62
- return showWidget;
56
+ return withWidget;
63
57
  };
64
58
  var handleError = function () {
65
59
  setProductIconUrl(getStaticIconPath('kontur'));
@@ -78,7 +72,7 @@ var SideMenuLogotype = forwardRef(function (_a, ref) {
78
72
  _d[jsStyles.logoWrapperHidden()] = context.isMinimized,
79
73
  _d)) },
80
74
  (context.isTablet || context.isMobile) && React.createElement(Burger, null),
81
- React.createElement(Logotype, __assign({ ref: refLogotype, size: size, productLogo: productLogo, konturLogo: konturLogo, withWidget: getWidget(withWidget, context.isTouchScreen, context.isMinimized && context.isNarrowDesktop, context.showWidget) }, rest)))));
75
+ React.createElement(Logotype, __assign({ ref: refLogotype, size: size, productLogo: productLogo, konturLogo: konturLogo, withWidget: getWidget(withWidget, context.isMinimized && context.isNarrowDesktop) }, rest)))));
82
76
  });
83
77
  SideMenuLogotype.displayName = 'SideMenuLogotype';
84
78
  var SideMenuLogotypeWithStaticFields = Object.assign(SideMenuLogotype, { __KONTUR_REACT_UI__: 'SideMenuLogotype' });