@skbkontur/side-menu 3.2.7 → 3.3.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 (79) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +25 -6
  3. package/SideMenuDataTids.d.ts +3 -0
  4. package/SideMenuDataTids.js +7 -1
  5. package/hooks/useAnimateOnMount.js +9 -6
  6. package/hooks/useMemoIcon.js +18 -12
  7. package/index.js +17 -14
  8. package/internal/themes/SideMenuTheme.d.ts +5 -0
  9. package/internal/themes/SideMenuTheme.js +22 -10
  10. package/lib/theming/ThemeHelpers.js +20 -14
  11. package/lib/theming/ThemeTypes.js +2 -1
  12. package/lib/utils/memo.js +5 -1
  13. package/lib/utils/scripts.js +11 -5
  14. package/package.json +8 -4
  15. package/src/Navigation.js +21 -18
  16. package/src/SideMenu/SideMenu.d.ts +2 -0
  17. package/src/SideMenu/SideMenu.js +147 -113
  18. package/src/SideMenu/SideMenu.styles.js +31 -28
  19. package/src/SideMenuAvatar/SideMenuAvatar.js +14 -11
  20. package/src/SideMenuBody/SideMenuBody.js +21 -18
  21. package/src/SideMenuBody/SideMenuBody.styles.js +9 -6
  22. package/src/SideMenuContext.d.ts +3 -0
  23. package/src/SideMenuContext.js +5 -2
  24. package/src/SideMenuDivider/SideMenuDivider.js +14 -11
  25. package/src/SideMenuDivider/SideMenuDivider.styles.js +8 -5
  26. package/src/SideMenuDropdown/SideMenuDropdown.js +34 -21
  27. package/src/SideMenuDropdown/SideMenuDropdown.styles.js +12 -9
  28. package/src/SideMenuFooter/SideMenuFooter.js +24 -21
  29. package/src/SideMenuFooter/SideMenuFooter.styles.js +10 -7
  30. package/src/SideMenuHeader/SideMenuHeader.js +29 -26
  31. package/src/SideMenuHeader/SideMenuHeader.styles.js +12 -9
  32. package/src/SideMenuItem/SideMenuItem.js +10 -7
  33. package/src/SideMenuLink/SideMenuLink.js +12 -9
  34. package/src/SideMenuLink/SideMenuLink.styles.js +7 -4
  35. package/src/SideMenuNotifications/BellWidget.d.ts +11 -0
  36. package/src/SideMenuNotifications/BellWidget.js +87 -0
  37. package/src/SideMenuNotifications/BellWidgetError.d.ts +9 -0
  38. package/src/SideMenuNotifications/BellWidgetError.js +26 -0
  39. package/src/SideMenuNotifications/BellWidgetView.styles.d.ts +10 -0
  40. package/src/SideMenuNotifications/BellWidgetView.styles.js +31 -0
  41. package/src/SideMenuNotifications/SideMenuNotifications.d.ts +41 -0
  42. package/src/SideMenuNotifications/SideMenuNotifications.js +49 -0
  43. package/src/SideMenuNotifications/SideMenuNotifications.md +75 -0
  44. package/src/SideMenuNotifications/utils/getMarker.d.ts +1 -0
  45. package/src/SideMenuNotifications/utils/getMarker.js +12 -0
  46. package/src/SideMenuNotifications/utils/getNotificationsErrorMessages.d.ts +6 -0
  47. package/src/SideMenuNotifications/utils/getNotificationsErrorMessages.js +19 -0
  48. package/src/SideMenuOrganisations/SideMenuOrganisations.js +10 -7
  49. package/src/SideMenuSubItem/SideMenuSubItem.js +11 -8
  50. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +18 -15
  51. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +9 -6
  52. package/src/SideMenuSubLink/SideMenuSubLink.js +10 -7
  53. package/src/Tree.js +12 -9
  54. package/src/internal/BackButton.js +14 -11
  55. package/src/internal/Backdrop.js +15 -11
  56. package/src/internal/Backdrop.styles.js +8 -5
  57. package/src/internal/Burger.js +17 -12
  58. package/src/internal/Burger.styles.js +9 -6
  59. package/src/internal/ClickableElement.js +47 -44
  60. package/src/internal/ClickableElement.styles.js +15 -12
  61. package/src/internal/InnerSubMenu.js +14 -10
  62. package/src/internal/ItemContent/Caption.js +34 -31
  63. package/src/internal/ItemContent/Caption.styles.js +23 -20
  64. package/src/internal/ItemContent/Icon.js +25 -20
  65. package/src/internal/ItemContent/Icon.styles.js +14 -11
  66. package/src/internal/ItemContent/ItemContent.d.ts +1 -1
  67. package/src/internal/ItemContent/ItemContent.js +36 -33
  68. package/src/internal/ItemContent/ItemContent.styles.js +18 -15
  69. package/src/internal/ItemContent/Marker.js +21 -16
  70. package/src/internal/ItemContent/Marker.styles.js +15 -12
  71. package/src/internal/NestedMenu.js +19 -15
  72. package/src/internal/NestedMenu.styles.js +8 -5
  73. package/src/internal/RightBorder.js +22 -18
  74. package/src/internal/RightBorder.styles.js +9 -6
  75. package/src/internal/SeparatedSubMenu.js +40 -37
  76. package/src/internal/SeparatedSubMenu.styles.js +16 -13
  77. package/src/internal/SideMenuLogotype.js +34 -31
  78. package/src/internal/SideMenuLogotype.styles.js +17 -14
  79. package/src/internal/SubMenu.js +15 -11
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
+ # [3.3.0](https://git.skbkontur.ru/ui/ui-parking-2/compare/@skbkontur/side-menu@3.2.7...@skbkontur/side-menu@3.3.0) (2025-07-24)
7
+
8
+
9
+ ### Features
10
+
11
+ * **SideMenu:** add SideMenu.Notifications widget component ([06f80be](https://git.skbkontur.ru/ui/ui-parking-2/commits/06f80be441baffae42d30293d7c7e6e7ec02d432))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.2.7](https://git.skbkontur.ru/ui/ui-parking-2/compare/@skbkontur/side-menu@3.2.6...@skbkontur/side-menu@3.2.7) (2025-07-24)
7
18
 
8
19
 
package/README.md CHANGED
@@ -96,7 +96,7 @@ import { AttachLinkIcon } from '@skbkontur/icons/icons/AttachLinkIcon';
96
96
  </div>
97
97
  ```
98
98
 
99
- SideMenu с меню второго уровня в отдельной колонке
99
+ С меню второго уровня в отдельной колонке
100
100
 
101
101
  ```jsx harmony
102
102
  import { getKonturAvatarUrl } from '@skbkontur/react-ui-addons';
@@ -216,7 +216,7 @@ const renderModal = () => {
216
216
  </div>
217
217
  ```
218
218
 
219
- SideMenu с ручным управлением.
219
+ С ручным управлением
220
220
 
221
221
  Для управления активным пунктом меню используйте проп `activeItem`.
222
222
 
@@ -380,11 +380,9 @@ const items = [
380
380
  </div>
381
381
  </div>
382
382
  </div>
383
- ```
384
-
385
- где
386
383
 
387
- ```css static
384
+ <style>
385
+ {`
388
386
  .layout {
389
387
  display: flex;
390
388
  flex-direction: column;
@@ -404,6 +402,8 @@ const items = [
404
402
  height: 100%;
405
403
  }
406
404
  }
405
+ `}
406
+ </style>
407
407
  ```
408
408
 
409
409
 
@@ -486,6 +486,25 @@ const SideMenuReactRouterLink: React.FunctionComponent<SideMenuReactRouterLinkPr
486
486
 
487
487
  Пример в [песочнице](https://codesandbox.io/s/side-menu-react-router-dom-vtv6r8)
488
488
 
489
+ ## Подключение виджета уведомлений `SideMenu.Notifications`
490
+
491
+ - [Документация виджета уведомлений](https://wiki.skbkontur.ru/pages/viewpage.action?pageId=952721322)
492
+ - [Поддержка в ~notification-support](https://chat.skbkontur.ru/kontur/channels/notification-support)
493
+
494
+ ```jsx harmony
495
+ import { SideMenu } from '@skbkontur/side-menu';
496
+
497
+ <SideMenu>
498
+ <SideMenu.Body>
499
+ <SideMenu.Notifications
500
+ widgetApi={widgetApi}
501
+ count={count}
502
+ showDivider
503
+ />
504
+ </SideMenu.Body>
505
+ </SideMenu>
506
+ ```
507
+
489
508
  #### Пример кастомизации
490
509
 
491
510
  ```jsx harmony
@@ -6,4 +6,7 @@ export declare const SideMenuDataTids: {
6
6
  rightBorder: string;
7
7
  clickableElement: string;
8
8
  footer: string;
9
+ bellSideMenuDropdownButton: string;
10
+ bellCloseButton: string;
11
+ bellHeader: string;
9
12
  };
@@ -1,4 +1,7 @@
1
- export var SideMenuDataTids = {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SideMenuDataTids = void 0;
4
+ exports.SideMenuDataTids = {
2
5
  root: 'SideMenu__root',
3
6
  burger: 'SideMenu__burger',
4
7
  backButton: 'SideMenu__backButton',
@@ -6,4 +9,7 @@ export var SideMenuDataTids = {
6
9
  rightBorder: 'SideMenu__rightBorder',
7
10
  clickableElement: 'SideMenu__clickableElement',
8
11
  footer: 'SideMenu__footer',
12
+ bellSideMenuDropdownButton: 'SideMenu__bellDropdownButton',
13
+ bellCloseButton: 'SideMenu__bellCloseButton',
14
+ bellHeader: 'SideMenu__bellHeaderWidget',
9
15
  };
@@ -1,9 +1,12 @@
1
- import { __read } from "tslib";
2
- import { useEffect, useState } from 'react';
3
- export function useAnimateOnMount(isMounted, delayTime, mountStyles, unmountStyles) {
4
- var _a = __read(useState(isMounted ? mountStyles : unmountStyles), 2), style = _a[0], setStyle = _a[1];
5
- var _b = __read(useState(isMounted), 2), shouldShowComponent = _b[0], setShouldShowComponent = _b[1];
6
- useEffect(function () {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAnimateOnMount = useAnimateOnMount;
4
+ var tslib_1 = require("tslib");
5
+ var react_1 = require("react");
6
+ function useAnimateOnMount(isMounted, delayTime, mountStyles, unmountStyles) {
7
+ var _a = tslib_1.__read((0, react_1.useState)(isMounted ? mountStyles : unmountStyles), 2), style = _a[0], setStyle = _a[1];
8
+ var _b = tslib_1.__read((0, react_1.useState)(isMounted), 2), shouldShowComponent = _b[0], setShouldShowComponent = _b[1];
9
+ (0, react_1.useEffect)(function () {
7
10
  var timeoutId;
8
11
  if (isMounted) {
9
12
  setShouldShowComponent(true);
@@ -1,23 +1,29 @@
1
- import React, { useMemo } from 'react';
2
- import { ArrowCDownIcon16Regular } from '@skbkontur/icons/icons/ArrowCDownIcon/ArrowCDownIcon16Regular';
3
- import { ArrowCRightIcon16Regular } from '@skbkontur/icons/icons/ArrowCRightIcon/ArrowCRightIcon16Regular';
4
- import { ArrowCLeftIcon16Regular } from '@skbkontur/icons/icons/ArrowCLeftIcon/ArrowCLeftIcon16Regular';
5
- export var useMemoIcon = function (children, _a) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMemoBorderIcon = exports.useMemoIcon = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var react_1 = tslib_1.__importStar(require("react"));
6
+ var ArrowCDownIcon16Regular_1 = require("@skbkontur/icons/icons/ArrowCDownIcon/ArrowCDownIcon16Regular");
7
+ var ArrowCRightIcon16Regular_1 = require("@skbkontur/icons/icons/ArrowCRightIcon/ArrowCRightIcon16Regular");
8
+ var ArrowCLeftIcon16Regular_1 = require("@skbkontur/icons/icons/ArrowCLeftIcon/ArrowCLeftIcon16Regular");
9
+ var useMemoIcon = function (children, _a) {
6
10
  var isOpened = _a.isOpened, onClick = _a.onClick;
7
- return useMemo(function () {
11
+ return (0, react_1.useMemo)(function () {
8
12
  if (children) {
9
13
  if (isOpened) {
10
- return React.createElement(ArrowCDownIcon16Regular, { onClick: onClick });
14
+ return react_1.default.createElement(ArrowCDownIcon16Regular_1.ArrowCDownIcon16Regular, { onClick: onClick });
11
15
  }
12
- return React.createElement(ArrowCRightIcon16Regular, null);
16
+ return react_1.default.createElement(ArrowCRightIcon16Regular_1.ArrowCRightIcon16Regular, null);
13
17
  }
14
18
  }, [isOpened, children]);
15
19
  };
16
- export var useMemoBorderIcon = function (isCollapsed) {
17
- return useMemo(function () {
20
+ exports.useMemoIcon = useMemoIcon;
21
+ var useMemoBorderIcon = function (isCollapsed) {
22
+ return (0, react_1.useMemo)(function () {
18
23
  if (isCollapsed) {
19
- return React.createElement(ArrowCRightIcon16Regular, null);
24
+ return react_1.default.createElement(ArrowCRightIcon16Regular_1.ArrowCRightIcon16Regular, null);
20
25
  }
21
- return React.createElement(ArrowCLeftIcon16Regular, null);
26
+ return react_1.default.createElement(ArrowCLeftIcon16Regular_1.ArrowCLeftIcon16Regular, null);
22
27
  }, [isCollapsed]);
23
28
  };
29
+ exports.useMemoBorderIcon = useMemoBorderIcon;
package/index.js CHANGED
@@ -1,14 +1,17 @@
1
- export * from './src/SideMenu/SideMenu';
2
- export * from './src/SideMenuOrganisations/SideMenuOrganisations';
3
- export * from './src/SideMenuBody/SideMenuBody';
4
- export * from './src/SideMenuFooter/SideMenuFooter';
5
- export * from './src/SideMenuHeader/SideMenuHeader';
6
- export * from './src/SideMenuItem/SideMenuItem';
7
- export * from './src/SideMenuAvatar/SideMenuAvatar';
8
- export * from './src/SideMenuSubItem/SideMenuSubItem';
9
- export * from './src/SideMenuDivider/SideMenuDivider';
10
- export * from './src/SideMenuSubItemHeader/SideMenuSubItemHeader';
11
- export * from './src/SideMenuDropdown/SideMenuDropdown';
12
- export * from './src/SideMenuLink/SideMenuLink';
13
- export * from './src/SideMenuSubLink/SideMenuSubLink';
14
- export * from './lib/theming/ThemeTypes';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./src/SideMenu/SideMenu"), exports);
5
+ tslib_1.__exportStar(require("./src/SideMenuOrganisations/SideMenuOrganisations"), exports);
6
+ tslib_1.__exportStar(require("./src/SideMenuBody/SideMenuBody"), exports);
7
+ tslib_1.__exportStar(require("./src/SideMenuFooter/SideMenuFooter"), exports);
8
+ tslib_1.__exportStar(require("./src/SideMenuHeader/SideMenuHeader"), exports);
9
+ tslib_1.__exportStar(require("./src/SideMenuItem/SideMenuItem"), exports);
10
+ tslib_1.__exportStar(require("./src/SideMenuAvatar/SideMenuAvatar"), exports);
11
+ tslib_1.__exportStar(require("./src/SideMenuSubItem/SideMenuSubItem"), exports);
12
+ tslib_1.__exportStar(require("./src/SideMenuDivider/SideMenuDivider"), exports);
13
+ tslib_1.__exportStar(require("./src/SideMenuSubItemHeader/SideMenuSubItemHeader"), exports);
14
+ tslib_1.__exportStar(require("./src/SideMenuDropdown/SideMenuDropdown"), exports);
15
+ tslib_1.__exportStar(require("./src/SideMenuLink/SideMenuLink"), exports);
16
+ tslib_1.__exportStar(require("./src/SideMenuSubLink/SideMenuSubLink"), exports);
17
+ tslib_1.__exportStar(require("./lib/theming/ThemeTypes"), exports);
@@ -124,6 +124,11 @@ export declare class SideMenuTheme extends SideMenuTheme_base {
124
124
  static sideMenuHeaderPaddingBottom: string;
125
125
  static get sideMenuHeaderDividerColor(): string;
126
126
  static sideMenuHeaderPaddingTopForTouchScreens: string;
127
+ static sideMenuNotificationsMarkerBg: string;
128
+ /**
129
+ * от 400px до 784px
130
+ */
131
+ static sideMenuNotificationsWrapperHeight: string;
127
132
  }
128
133
  export declare const REACT_UI_SIDE_MENU_THEME_KEY = "__IS_REACT_UI_SIDE_MENU_THEME__";
129
134
  export declare const markAsSideMenuTheme: <T extends object>(theme: T) => T;
@@ -1,7 +1,10 @@
1
- import { __extends } from "tslib";
2
- import { exposeGetters } from '@skbkontur/react-ui/lib/theming/ThemeHelpers';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SideMenuThemeInternal = exports.isSideMenuTheme = exports.markAsSideMenuTheme = exports.REACT_UI_SIDE_MENU_THEME_KEY = exports.SideMenuTheme = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var ThemeHelpers_1 = require("@skbkontur/react-ui/lib/theming/ThemeHelpers");
3
6
  var SideMenuTheme = /** @class */ (function (_super) {
4
- __extends(SideMenuTheme, _super);
7
+ tslib_1.__extends(SideMenuTheme, _super);
5
8
  function SideMenuTheme() {
6
9
  return _super !== null && _super.apply(this, arguments) || this;
7
10
  }
@@ -264,18 +267,25 @@ var SideMenuTheme = /** @class */ (function (_super) {
264
267
  SideMenuTheme.sideMenuHeaderPaddingTop = '24px';
265
268
  SideMenuTheme.sideMenuHeaderPaddingBottom = '8px';
266
269
  SideMenuTheme.sideMenuHeaderPaddingTopForTouchScreens = '16px';
270
+ //#endregion
271
+ //#region SideMenuNotifications
272
+ SideMenuTheme.sideMenuNotificationsMarkerBg = '#222222';
273
+ /**
274
+ * от 400px до 784px
275
+ */
276
+ SideMenuTheme.sideMenuNotificationsWrapperHeight = 'calculated';
267
277
  return SideMenuTheme;
268
278
  }(/** @class */ (function () {
269
279
  function class_1() {
270
280
  }
271
281
  return class_1;
272
282
  }())));
273
- export { SideMenuTheme };
274
- export var REACT_UI_SIDE_MENU_THEME_KEY = '__IS_REACT_UI_SIDE_MENU_THEME__';
275
- export var markAsSideMenuTheme = function (theme) {
283
+ exports.SideMenuTheme = SideMenuTheme;
284
+ exports.REACT_UI_SIDE_MENU_THEME_KEY = '__IS_REACT_UI_SIDE_MENU_THEME__';
285
+ var markAsSideMenuTheme = function (theme) {
276
286
  var _a;
277
287
  return Object.create(theme, (_a = {},
278
- _a[REACT_UI_SIDE_MENU_THEME_KEY] = {
288
+ _a[exports.REACT_UI_SIDE_MENU_THEME_KEY] = {
279
289
  value: true,
280
290
  writable: false,
281
291
  enumerable: false,
@@ -283,9 +293,11 @@ export var markAsSideMenuTheme = function (theme) {
283
293
  },
284
294
  _a));
285
295
  };
286
- export var isSideMenuTheme = function (theme) {
296
+ exports.markAsSideMenuTheme = markAsSideMenuTheme;
297
+ var isSideMenuTheme = function (theme) {
287
298
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
288
299
  //@ts-ignore
289
- return theme[REACT_UI_SIDE_MENU_THEME_KEY] === true;
300
+ return theme[exports.REACT_UI_SIDE_MENU_THEME_KEY] === true;
290
301
  };
291
- export var SideMenuThemeInternal = exposeGetters(SideMenuTheme);
302
+ exports.isSideMenuTheme = isSideMenuTheme;
303
+ exports.SideMenuThemeInternal = (0, ThemeHelpers_1.exposeGetters)(SideMenuTheme);
@@ -1,7 +1,10 @@
1
- import { __values } from "tslib";
2
- import { isFunction } from '@skbkontur/react-ui/lib/utils';
3
- import { memo } from '../utils/memo';
4
- import { SideMenuThemeInternal, isSideMenuTheme, markAsSideMenuTheme } from '../../internal/themes/SideMenuTheme';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cssName = exports.memoizeStyle = exports.getSideMenuTheme = exports.createSideMenuTheme = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var utils_1 = require("@skbkontur/react-ui/lib/utils");
6
+ var memo_1 = require("../utils/memo");
7
+ var SideMenuTheme_1 = require("../../internal/themes/SideMenuTheme");
5
8
  /**
6
9
  * Creates SideMenuTheme out of ReactUI's Theme.
7
10
  *
@@ -12,12 +15,12 @@ import { SideMenuThemeInternal, isSideMenuTheme, markAsSideMenuTheme } from '../
12
15
  * (without need for users to do it manually in their apps),
13
16
  * and using ReactUI's ThemeContext.Provider for overriding them.
14
17
  */
15
- export var createSideMenuTheme = function (theme) {
18
+ var createSideMenuTheme = function (theme) {
16
19
  var e_1, _a;
17
- if (isSideMenuTheme(theme)) {
20
+ if ((0, SideMenuTheme_1.isSideMenuTheme)(theme)) {
18
21
  return theme;
19
22
  }
20
- var sideMenuTheme = Object.create(theme, Object.assign(Object.getOwnPropertyDescriptors(SideMenuThemeInternal), {}));
23
+ var sideMenuTheme = Object.create(theme, Object.assign(Object.getOwnPropertyDescriptors(SideMenuTheme_1.SideMenuThemeInternal), {}));
21
24
  var _loop_1 = function (key) {
22
25
  var descriptor = Object.getOwnPropertyDescriptor(sideMenuTheme, key);
23
26
  Object.defineProperty(sideMenuTheme, key, {
@@ -26,13 +29,13 @@ export var createSideMenuTheme = function (theme) {
26
29
  var get = descriptor.get, value = descriptor.value;
27
30
  // eslint-disable-next-line @typescript-eslint/naming-convention
28
31
  // @ts-ignore
29
- return theme[key] || (isFunction(get) ? get.call(this) : value);
32
+ return theme[key] || ((0, utils_1.isFunction)(get) ? get.call(this) : value);
30
33
  }
31
34
  },
32
35
  });
33
36
  };
34
37
  try {
35
- for (var _b = __values(Object.keys(sideMenuTheme)), _c = _b.next(); !_c.done; _c = _b.next()) {
38
+ for (var _b = tslib_1.__values(Object.keys(sideMenuTheme)), _c = _b.next(); !_c.done; _c = _b.next()) {
36
39
  var key = _c.value;
37
40
  _loop_1(key);
38
41
  }
@@ -44,10 +47,11 @@ export var createSideMenuTheme = function (theme) {
44
47
  }
45
48
  finally { if (e_1) throw e_1.error; }
46
49
  }
47
- return markAsSideMenuTheme(sideMenuTheme);
50
+ return (0, SideMenuTheme_1.markAsSideMenuTheme)(sideMenuTheme);
48
51
  };
49
- export var getSideMenuTheme = memo(function (theme) {
50
- return createSideMenuTheme(theme);
52
+ exports.createSideMenuTheme = createSideMenuTheme;
53
+ exports.getSideMenuTheme = (0, memo_1.memo)(function (theme) {
54
+ return (0, exports.createSideMenuTheme)(theme);
51
55
  });
52
56
  // eslint-disable-next-line @typescript-eslint/ban-types
53
57
  function isZeroArgs(fn) {
@@ -73,8 +77,10 @@ var memoize = function (fn) {
73
77
  return cache.get(arg);
74
78
  };
75
79
  };
76
- export var memoizeStyle = function (styles) {
80
+ var memoizeStyle = function (styles) {
77
81
  Object.keys(styles).forEach(function (className) { return (styles[className] = memoize(styles[className])); });
78
82
  return styles;
79
83
  };
80
- export var cssName = function (className) { return ".".concat(className); };
84
+ exports.memoizeStyle = memoizeStyle;
85
+ var cssName = function (className) { return ".".concat(className); };
86
+ exports.cssName = cssName;
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/lib/utils/memo.js CHANGED
@@ -1,4 +1,7 @@
1
- export var memo = function (fn) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.memo = void 0;
4
+ var memo = function (fn) {
2
5
  var cache = new WeakMap();
3
6
  return function (arg) {
4
7
  if (!cache.has(arg)) {
@@ -7,3 +10,4 @@ export var memo = function (fn) {
7
10
  return cache.get(arg);
8
11
  };
9
12
  };
13
+ exports.memo = memo;
@@ -1,10 +1,16 @@
1
- export var isBrowser = typeof window !== 'undefined';
2
- export var isTouchDevice = function () {
3
- return isBrowser && ('ontouchstart' in window || navigator.maxTouchPoints > 0);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateId = exports.isKonturIcon = exports.isTouchDevice = exports.isBrowser = void 0;
4
+ exports.isBrowser = typeof window !== 'undefined';
5
+ var isTouchDevice = function () {
6
+ return exports.isBrowser && ('ontouchstart' in window || navigator.maxTouchPoints > 0);
4
7
  };
5
- export var isKonturIcon = function (icon) {
8
+ exports.isTouchDevice = isTouchDevice;
9
+ var isKonturIcon = function (icon) {
6
10
  return Object.prototype.hasOwnProperty.call(icon === null || icon === void 0 ? void 0 : icon.type, '__KONTUR_ICON__');
7
11
  };
8
- export var generateId = function () {
12
+ exports.isKonturIcon = isKonturIcon;
13
+ var generateId = function () {
9
14
  return Date.now().toString(36) + Math.random().toString(36).substr(2);
10
15
  };
16
+ exports.generateId = generateId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skbkontur/side-menu",
3
- "version": "3.2.7",
3
+ "version": "3.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -9,8 +9,8 @@
9
9
  "license": "UNLICENSED",
10
10
  "scripts": {
11
11
  "clean": "git clean -fdxqe node_modules",
12
- "build": "yarn tsc",
13
- "lint": "yarn tsc --noEmit"
12
+ "build": "node node_modules/typescript/bin/tsc",
13
+ "lint": "tsc --noEmit -p tsconfig.json"
14
14
  },
15
15
  "author": "Kontur",
16
16
  "peerDependencies": {
@@ -19,11 +19,15 @@
19
19
  "react-dom": ">=16.9"
20
20
  },
21
21
  "devDependencies": {
22
- "@skbkontur/react-ui": "^5.0.0"
22
+ "@skbkontur/react-ui": "^5.0.0",
23
+ "typescript": "5.8.3"
23
24
  },
24
25
  "dependencies": {
26
+ "@skbkontur/bell-widget-npm-loader": "^0.2.3",
27
+ "@skbkontur/empty-state": "1.1.1",
25
28
  "@skbkontur/icons": "^1.19.0",
26
29
  "@skbkontur/react-ui-addons": "^5.2.1",
30
+ "@skbkontur/widget-consumer-react-utils": "^1.6.12",
27
31
  "tslib": "^2.8.0"
28
32
  }
29
33
  }
package/src/Navigation.js CHANGED
@@ -1,14 +1,17 @@
1
- import { __values } from "tslib";
2
- import { Tree } from './Tree';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MenuNavigation = exports.navigationAttributeBackButton = exports.navigationAttributeForSeparatedMenu = exports.navigationAttribute = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var Tree_1 = require("./Tree");
3
6
  var MENU_ROOT_ID = 'menu-root-id';
4
- export var navigationAttribute = 'data-navigation-id';
5
- export var navigationAttributeForSeparatedMenu = 'data-parent-navigation-id';
6
- export var navigationAttributeBackButton = 'data-navigation-back-button';
7
+ exports.navigationAttribute = 'data-navigation-id';
8
+ exports.navigationAttributeForSeparatedMenu = 'data-parent-navigation-id';
9
+ exports.navigationAttributeBackButton = 'data-navigation-back-button';
7
10
  var MenuNavigation = /** @class */ (function () {
8
11
  function MenuNavigation(options) {
9
12
  this.navigationTree = null;
10
13
  this.menuItemsIds = '';
11
- this.navigationTree = new Tree(MENU_ROOT_ID);
14
+ this.navigationTree = new Tree_1.Tree(MENU_ROOT_ID);
12
15
  this.activeMenuItemTreeNode = this.navigationTree.find(options.activeMenuItem);
13
16
  this.rootRef = options.rootRef;
14
17
  this.activeMenuItem = options.activeMenuItem;
@@ -25,15 +28,15 @@ var MenuNavigation = /** @class */ (function () {
25
28
  var _this = this;
26
29
  var _a;
27
30
  if ((_a = this.rootRef) === null || _a === void 0 ? void 0 : _a.current) {
28
- var menuItems = Array.from(this.rootRef.current.querySelectorAll("[".concat(navigationAttribute, "]"))).filter(function (item) { return !item.querySelector("[".concat(navigationAttributeBackButton, "]")); });
29
- var newItemsIds = menuItems.map(function (node) { return node.getAttribute(navigationAttribute); }).join('');
31
+ var menuItems = Array.from(this.rootRef.current.querySelectorAll("[".concat(exports.navigationAttribute, "]"))).filter(function (item) { return !item.querySelector("[".concat(exports.navigationAttributeBackButton, "]")); });
32
+ var newItemsIds = menuItems.map(function (node) { return node.getAttribute(exports.navigationAttribute); }).join('');
30
33
  if (this.menuItemsIds === newItemsIds) {
31
34
  return;
32
35
  }
33
36
  this.menuItemsIds = newItemsIds;
34
37
  menuItems.forEach(function (menuItem) {
35
38
  var _a, _b, _c;
36
- var id = menuItem.getAttribute(navigationAttribute);
39
+ var id = menuItem.getAttribute(exports.navigationAttribute);
37
40
  var parentId = _this.getParentId(menuItem);
38
41
  var oldValue = (_b = (_a = _this.navigationTree) === null || _a === void 0 ? void 0 : _a.find(id)) === null || _b === void 0 ? void 0 : _b.value;
39
42
  (_c = _this.navigationTree) === null || _c === void 0 ? void 0 : _c.insert(parentId, id, oldValue);
@@ -59,7 +62,7 @@ var MenuNavigation = /** @class */ (function () {
59
62
  var _b, _c, _d, _e, _f;
60
63
  if (!isButton) {
61
64
  try {
62
- for (var _g = __values(((_b = this.navigationTree) === null || _b === void 0 ? void 0 : _b.preOrderTraversal()) || []), _h = _g.next(); !_h.done; _h = _g.next()) {
65
+ for (var _g = tslib_1.__values(((_b = this.navigationTree) === null || _b === void 0 ? void 0 : _b.preOrderTraversal()) || []), _h = _g.next(); !_h.done; _h = _g.next()) {
63
66
  var node = _h.value;
64
67
  (_c = node.value) === null || _c === void 0 ? void 0 : _c.setIsActive(false);
65
68
  }
@@ -96,7 +99,7 @@ var MenuNavigation = /** @class */ (function () {
96
99
  var e_2, _a;
97
100
  var _b, _c, _d;
98
101
  try {
99
- for (var _e = __values(((_b = this.navigationTree) === null || _b === void 0 ? void 0 : _b.preOrderTraversal()) || []), _f = _e.next(); !_f.done; _f = _e.next()) {
102
+ for (var _e = tslib_1.__values(((_b = this.navigationTree) === null || _b === void 0 ? void 0 : _b.preOrderTraversal()) || []), _f = _e.next(); !_f.done; _f = _e.next()) {
100
103
  var node = _f.value;
101
104
  (_c = node.value) === null || _c === void 0 ? void 0 : _c.setIsFirstLevelParentOfActiveMenuItem(false);
102
105
  }
@@ -129,7 +132,7 @@ var MenuNavigation = /** @class */ (function () {
129
132
  var _b, _c, _d, _e;
130
133
  if (!((_b = treeNode.value) === null || _b === void 0 ? void 0 : _b.isSubMenu) || firstLevelParentChanged) {
131
134
  try {
132
- for (var _f = __values(((_c = this.navigationTree) === null || _c === void 0 ? void 0 : _c.preOrderTraversal()) || []), _g = _f.next(); !_g.done; _g = _f.next()) {
135
+ for (var _f = tslib_1.__values(((_c = this.navigationTree) === null || _c === void 0 ? void 0 : _c.preOrderTraversal()) || []), _g = _f.next(); !_g.done; _g = _f.next()) {
133
136
  var node = _g.value;
134
137
  (_d = node.value) === null || _d === void 0 ? void 0 : _d.setIsOpened(false);
135
138
  }
@@ -158,17 +161,17 @@ var MenuNavigation = /** @class */ (function () {
158
161
  MenuNavigation.prototype.getParentId = function (menuItem) {
159
162
  var _a, _b, _c;
160
163
  var parentElement;
161
- var clickableElementSelector = "[".concat(navigationAttribute, "]");
162
- var separatedMenuSelector = "[".concat(navigationAttributeForSeparatedMenu, "]");
164
+ var clickableElementSelector = "[".concat(exports.navigationAttribute, "]");
165
+ var separatedMenuSelector = "[".concat(exports.navigationAttributeForSeparatedMenu, "]");
163
166
  parentElement = (_a = menuItem.parentElement) === null || _a === void 0 ? void 0 : _a.closest(clickableElementSelector);
164
167
  if (!parentElement) {
165
168
  var separatedMenu = menuItem.closest(separatedMenuSelector);
166
169
  if (separatedMenu) {
167
- var firstLevelMenuId = separatedMenu.getAttribute(navigationAttributeForSeparatedMenu);
168
- parentElement = (_c = (_b = this.rootRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.querySelector("[".concat(navigationAttribute, "=\"").concat(firstLevelMenuId, "\"]"));
170
+ var firstLevelMenuId = separatedMenu.getAttribute(exports.navigationAttributeForSeparatedMenu);
171
+ parentElement = (_c = (_b = this.rootRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.querySelector("[".concat(exports.navigationAttribute, "=\"").concat(firstLevelMenuId, "\"]"));
169
172
  }
170
173
  }
171
- return (parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute(navigationAttribute)) || MENU_ROOT_ID;
174
+ return (parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute(exports.navigationAttribute)) || MENU_ROOT_ID;
172
175
  };
173
176
  MenuNavigation.prototype.switchVisibilityOfSeparatedMenu = function () {
174
177
  var _a, _b, _c, _d, _e, _f;
@@ -189,4 +192,4 @@ var MenuNavigation = /** @class */ (function () {
189
192
  };
190
193
  return MenuNavigation;
191
194
  }());
192
- export { MenuNavigation };
195
+ exports.MenuNavigation = MenuNavigation;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
3
3
  import { SideMenuOrganisations } from '../SideMenuOrganisations/SideMenuOrganisations';
4
+ import { SideMenuNotifications } from '../SideMenuNotifications/SideMenuNotifications';
4
5
  import { SideMenuBody } from '../SideMenuBody/SideMenuBody';
5
6
  import { SideMenuFooter } from '../SideMenuFooter/SideMenuFooter';
6
7
  import { SideMenuHeader } from '../SideMenuHeader/SideMenuHeader';
@@ -78,6 +79,7 @@ interface SubComponents {
78
79
  SubItemHeader: typeof SideMenuSubItemHeader;
79
80
  Avatar: typeof SideMenuAvatar;
80
81
  Organisations: typeof SideMenuOrganisations;
82
+ Notifications: typeof SideMenuNotifications;
81
83
  Divider: typeof SideMenuDivider;
82
84
  Dropdown: typeof SideMenuDropdown;
83
85
  Link: typeof SideMenuLink;