@skbkontur/side-menu 3.3.3 → 3.3.5-19a67.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 (66) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/hooks/useAnimateOnMount.js +8 -9
  3. package/hooks/useMemoIcon.js +9 -10
  4. package/index.js +1 -1
  5. package/internal/themes/SideMenuTheme.js +200 -278
  6. package/lib/theming/ThemeHelpers.js +23 -38
  7. package/lib/utils/memo.js +3 -3
  8. package/lib/utils/scripts.js +4 -4
  9. package/package.json +3 -3
  10. package/src/Navigation.js +73 -118
  11. package/src/SideMenu/SideMenu.js +175 -181
  12. package/src/SideMenu/SideMenu.styles.js +140 -71
  13. package/src/SideMenuAvatar/SideMenuAvatar.d.ts +1 -1
  14. package/src/SideMenuAvatar/SideMenuAvatar.js +9 -10
  15. package/src/SideMenuBody/SideMenuBody.js +16 -18
  16. package/src/SideMenuBody/SideMenuBody.styles.js +13 -9
  17. package/src/SideMenuContext.d.ts +1 -1
  18. package/src/SideMenuContext.js +1 -1
  19. package/src/SideMenuDivider/SideMenuDivider.js +9 -11
  20. package/src/SideMenuDivider/SideMenuDivider.styles.js +10 -7
  21. package/src/SideMenuDropdown/SideMenuDropdown.d.ts +1 -1
  22. package/src/SideMenuDropdown/SideMenuDropdown.js +29 -33
  23. package/src/SideMenuDropdown/SideMenuDropdown.styles.js +21 -14
  24. package/src/SideMenuFooter/SideMenuFooter.js +19 -21
  25. package/src/SideMenuFooter/SideMenuFooter.styles.js +21 -11
  26. package/src/SideMenuHeader/SideMenuHeader.js +24 -28
  27. package/src/SideMenuHeader/SideMenuHeader.styles.js +30 -15
  28. package/src/SideMenuItem/SideMenuItem.js +5 -6
  29. package/src/SideMenuLink/SideMenuLink.js +7 -9
  30. package/src/SideMenuLink/SideMenuLink.styles.js +7 -6
  31. package/src/SideMenuNotifications/BellWidget.js +50 -71
  32. package/src/SideMenuNotifications/BellWidgetError.js +12 -13
  33. package/src/SideMenuNotifications/BellWidgetView.styles.js +43 -18
  34. package/src/SideMenuNotifications/SideMenuNotifications.js +22 -23
  35. package/src/SideMenuNotifications/utils/getNotificationsErrorMessages.js +11 -11
  36. package/src/SideMenuOrganisations/SideMenuOrganisations.js +5 -6
  37. package/src/SideMenuSubItem/SideMenuSubItem.js +5 -6
  38. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +14 -16
  39. package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +14 -9
  40. package/src/SideMenuSubLink/SideMenuSubLink.js +5 -5
  41. package/src/Tree.js +34 -110
  42. package/src/internal/BackButton.js +13 -16
  43. package/src/internal/Backdrop.js +13 -11
  44. package/src/internal/Backdrop.styles.js +12 -7
  45. package/src/internal/Burger.js +11 -11
  46. package/src/internal/Burger.styles.js +10 -8
  47. package/src/internal/ClickableElement.js +90 -82
  48. package/src/internal/ClickableElement.styles.js +44 -20
  49. package/src/internal/InnerSubMenu.js +12 -14
  50. package/src/internal/ItemContent/Caption.js +43 -47
  51. package/src/internal/ItemContent/Caption.styles.js +78 -33
  52. package/src/internal/ItemContent/Icon.js +24 -26
  53. package/src/internal/ItemContent/Icon.styles.js +45 -19
  54. package/src/internal/ItemContent/ItemContent.js +37 -40
  55. package/src/internal/ItemContent/ItemContent.styles.js +61 -27
  56. package/src/internal/ItemContent/Marker.js +19 -21
  57. package/src/internal/ItemContent/Marker.styles.js +55 -21
  58. package/src/internal/NestedMenu.js +17 -19
  59. package/src/internal/NestedMenu.styles.js +7 -7
  60. package/src/internal/RightBorder.js +21 -22
  61. package/src/internal/RightBorder.styles.js +22 -9
  62. package/src/internal/SeparatedSubMenu.js +43 -48
  63. package/src/internal/SeparatedSubMenu.styles.js +53 -27
  64. package/src/internal/SideMenuLogotype.js +43 -47
  65. package/src/internal/SideMenuLogotype.styles.js +44 -20
  66. package/src/internal/SubMenu.js +10 -12
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Icon = void 0;
4
- var tslib_1 = require("tslib");
5
- var react_1 = tslib_1.__importStar(require("react"));
6
- var Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
7
- var ThemeContext_1 = require("@skbkontur/react-ui/lib/theming/ThemeContext");
8
- var SideMenuContext_1 = require("../../SideMenuContext");
9
- var ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
10
- var scripts_1 = require("../../../lib/utils/scripts");
11
- var Icon_styles_1 = require("./Icon.styles");
12
- var getIconSize = function (theme, _isSubMenu, _isBackButton) {
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = tslib_1.__importStar(require("react"));
6
+ const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
7
+ const ThemeContext_1 = require("@skbkontur/react-ui/lib/theming/ThemeContext");
8
+ const SideMenuContext_1 = require("../../SideMenuContext");
9
+ const ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
10
+ const scripts_1 = require("../../../lib/utils/scripts");
11
+ const Icon_styles_1 = require("./Icon.styles");
12
+ const getIconSize = (theme, _isSubMenu, _isBackButton) => {
13
13
  if (!_isSubMenu) {
14
14
  return parseInt(theme.sideMenuIconSize);
15
15
  }
@@ -17,14 +17,12 @@ var getIconSize = function (theme, _isSubMenu, _isBackButton) {
17
17
  return parseInt(theme.sideMenuIconSubItemSize);
18
18
  }
19
19
  };
20
- var Icon = function (_a) {
21
- var _b;
22
- var icon = _a.icon, _isSubMenu = _a._isSubMenu, isMultiline = _a.isMultiline, _c = _a._isBackButton, _isBackButton = _c === void 0 ? false : _c, disabled = _a.disabled;
23
- var context = (0, react_1.useContext)(SideMenuContext_1.SideMenuContext);
24
- var isSeparatedMenu = context.isSeparatedMenu, size = context.size;
25
- var theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
26
- var renderIcon = function () {
27
- var iconColor = _isSubMenu && !disabled ? theme.sideMenuIconSubItemColor : undefined;
20
+ const Icon = ({ icon, _isSubMenu, isMultiline, _isBackButton = false, disabled }) => {
21
+ const context = (0, react_1.useContext)(SideMenuContext_1.SideMenuContext);
22
+ const { isSeparatedMenu, size } = context;
23
+ const theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
24
+ const renderIcon = () => {
25
+ const iconColor = _isSubMenu && !disabled ? theme.sideMenuIconSubItemColor : undefined;
28
26
  if ((0, scripts_1.isKonturIcon)(icon)) {
29
27
  return react_1.default.cloneElement(icon, {
30
28
  size: getIconSize(theme, _isSubMenu, _isBackButton),
@@ -34,14 +32,14 @@ var Icon = function (_a) {
34
32
  }
35
33
  return icon;
36
34
  };
37
- return (react_1.default.createElement("span", { className: (0, Emotion_1.cx)((_b = {},
38
- _b[Icon_styles_1.jsStyles.root(theme)] = true,
39
- _b[Icon_styles_1.jsStyles.rootMultiline()] = isMultiline && (context.isOpened || _isSubMenu),
40
- _b[Icon_styles_1.jsStyles.rootLarge(theme)] = size === 'large',
41
- _b[Icon_styles_1.jsStyles.rootSubItem(theme)] = _isSubMenu,
42
- _b[Icon_styles_1.jsStyles.rootSubItemSeparatedMenu(theme)] = isSeparatedMenu && _isSubMenu,
43
- _b[Icon_styles_1.jsStyles.rootSubItemLarge(theme)] = _isSubMenu && size === 'large',
44
- _b[Icon_styles_1.jsStyles.rootBackButton(theme)] = _isBackButton,
45
- _b)) }, renderIcon()));
35
+ return (react_1.default.createElement("span", { className: (0, Emotion_1.cx)({
36
+ [Icon_styles_1.jsStyles.root(theme)]: true,
37
+ [Icon_styles_1.jsStyles.rootMultiline()]: isMultiline && (context.isOpened || _isSubMenu),
38
+ [Icon_styles_1.jsStyles.rootLarge(theme)]: size === 'large',
39
+ [Icon_styles_1.jsStyles.rootSubItem(theme)]: _isSubMenu,
40
+ [Icon_styles_1.jsStyles.rootSubItemSeparatedMenu(theme)]: isSeparatedMenu && _isSubMenu,
41
+ [Icon_styles_1.jsStyles.rootSubItemLarge(theme)]: _isSubMenu && size === 'large',
42
+ [Icon_styles_1.jsStyles.rootBackButton(theme)]: _isBackButton,
43
+ }) }, renderIcon()));
46
44
  };
47
45
  exports.Icon = Icon;
@@ -1,31 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.jsStyles = void 0;
4
- var tslib_1 = require("tslib");
5
- var Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
6
- var ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
7
- var styles = {
8
- root: function (t) {
9
- return (0, Emotion_1.css)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n display: flex;\n align-items: center;\n margin: ", " ", " ", " ", ";\n min-height: ", ";\n line-height: ", ";\n flex-shrink: 0;\n box-sizing: content-box;\n "], ["\n display: flex;\n align-items: center;\n margin: ", " ", " ", " ", ";\n min-height: ", ";\n line-height: ", ";\n flex-shrink: 0;\n box-sizing: content-box;\n "])), t.sideMenuIconMarginY, t.sideMenuIconMarginRight, t.sideMenuIconMarginY, t.sideMenuIconMarginLeft, t.sideMenuIconMinHeight, t.sideMenuIconLineHeight);
4
+ const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
5
+ const ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
6
+ const styles = {
7
+ root(t) {
8
+ return (0, Emotion_1.css) `
9
+ display: flex;
10
+ align-items: center;
11
+ margin: ${t.sideMenuIconMarginY} ${t.sideMenuIconMarginRight} ${t.sideMenuIconMarginY} ${t.sideMenuIconMarginLeft};
12
+ min-height: ${t.sideMenuIconMinHeight};
13
+ line-height: ${t.sideMenuIconLineHeight};
14
+ flex-shrink: 0;
15
+ box-sizing: content-box;
16
+ `;
10
17
  },
11
- rootMultiline: function () {
12
- return (0, Emotion_1.css)(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n align-self: flex-start;\n margin-top: -2px;\n "], ["\n align-self: flex-start;\n margin-top: -2px;\n "])));
18
+ rootMultiline() {
19
+ return (0, Emotion_1.css) `
20
+ align-self: flex-start;
21
+ margin-top: -2px;
22
+ `;
13
23
  },
14
- rootLarge: function (t) {
15
- return (0, Emotion_1.css)(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n min-height: ", ";\n line-height: ", ";\n margin-top: 0;\n "], ["\n min-height: ", ";\n line-height: ", ";\n margin-top: 0;\n "])), t.sideMenuIconLargeMinHeight, t.sideMenuIconLargeLineHeight);
24
+ rootLarge(t) {
25
+ return (0, Emotion_1.css) `
26
+ min-height: ${t.sideMenuIconLargeMinHeight};
27
+ line-height: ${t.sideMenuIconLargeLineHeight};
28
+ margin-top: 0;
29
+ `;
16
30
  },
17
- rootSubItemLarge: function (t) {
18
- return (0, Emotion_1.css)(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n min-height: ", ";\n "], ["\n min-height: ", ";\n "])), t.sideMenuIconLargeSubItemMinHeight);
31
+ rootSubItemLarge(t) {
32
+ return (0, Emotion_1.css) `
33
+ min-height: ${t.sideMenuIconLargeSubItemMinHeight};
34
+ `;
19
35
  },
20
- rootSubItem: function (t) {
21
- return (0, Emotion_1.css)(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n margin: 0;\n padding-left: ", ";\n padding-right: ", ";\n min-height: ", ";\n line-height: ", ";\n "], ["\n margin: 0;\n padding-left: ", ";\n padding-right: ", ";\n min-height: ", ";\n line-height: ", ";\n "])), t.sideMenuIconSubItemPaddingLeft, t.sideMenuIconSubItemPaddingRight, t.sideMenuIconSubItemMinHeight, t.sideMenuIconSubItemLineHeight);
36
+ rootSubItem(t) {
37
+ return (0, Emotion_1.css) `
38
+ margin: 0;
39
+ padding-left: ${t.sideMenuIconSubItemPaddingLeft};
40
+ padding-right: ${t.sideMenuIconSubItemPaddingRight};
41
+ min-height: ${t.sideMenuIconSubItemMinHeight};
42
+ line-height: ${t.sideMenuIconSubItemLineHeight};
43
+ `;
22
44
  },
23
- rootSubItemSeparatedMenu: function (t) {
24
- return (0, Emotion_1.css)(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n padding-left: ", ";\n "], ["\n padding-left: ", ";\n "])), t.sideMenuIconWithSeparatedSubMenuSubItemPaddingLeft);
45
+ rootSubItemSeparatedMenu(t) {
46
+ return (0, Emotion_1.css) `
47
+ padding-left: ${t.sideMenuIconWithSeparatedSubMenuSubItemPaddingLeft};
48
+ `;
25
49
  },
26
- rootBackButton: function (t) {
27
- return (0, Emotion_1.css)(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n padding-left: ", ";\n padding-right: ", ";\n "], ["\n padding-left: ", ";\n padding-right: ", ";\n "])), t.sideMenuBackButtonIconPaddingLeft, t.sideMenuBackButtonIconPaddingRight);
50
+ rootBackButton(t) {
51
+ return (0, Emotion_1.css) `
52
+ padding-left: ${t.sideMenuBackButtonIconPaddingLeft};
53
+ padding-right: ${t.sideMenuBackButtonIconPaddingRight};
54
+ `;
28
55
  },
29
56
  };
30
57
  exports.jsStyles = (0, ThemeHelpers_1.memoizeStyle)(styles);
31
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ItemContent = void 0;
4
- var tslib_1 = require("tslib");
5
- var react_1 = tslib_1.__importStar(require("react"));
6
- var Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
7
- var react_ui_1 = require("@skbkontur/react-ui");
8
- var SideMenuContext_1 = require("../../SideMenuContext");
9
- var ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
10
- var ItemContent_styles_1 = require("./ItemContent.styles");
11
- var Icon_1 = require("./Icon");
12
- var Caption_1 = require("./Caption");
13
- var Marker_1 = require("./Marker");
14
- var getCaptionLineHeight = function (theme, isTouchScreen, _isSubMenu, size) {
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = tslib_1.__importStar(require("react"));
6
+ const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
7
+ const ThemeContext_1 = require("@skbkontur/react-ui/lib/theming/ThemeContext");
8
+ const SideMenuContext_1 = require("../../SideMenuContext");
9
+ const ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
10
+ const ItemContent_styles_1 = require("./ItemContent.styles");
11
+ const Icon_1 = require("./Icon");
12
+ const Caption_1 = require("./Caption");
13
+ const Marker_1 = require("./Marker");
14
+ const getCaptionLineHeight = (theme, isTouchScreen, _isSubMenu, size) => {
15
15
  if (isTouchScreen) {
16
16
  if (_isSubMenu) {
17
17
  return theme.sideMenuCaptionSubItemLineHeightForTouchScreens;
@@ -26,16 +26,13 @@ var getCaptionLineHeight = function (theme, isTouchScreen, _isSubMenu, size) {
26
26
  /**
27
27
  * Контент для SideMenuItem или SideMenuLink
28
28
  */
29
- var ItemContent = (0, react_1.forwardRef)(function (_a, ref) {
30
- var _b, _c;
31
- var _d;
32
- var _isSubMenu = _a._isSubMenu, icon = _a.icon, isNestedSubMenu = _a.isNestedSubMenu, caption = _a.caption, subCaption = _a.subCaption, marker = _a.marker, _isBackButton = _a._isBackButton, _isDropdown = _a._isDropdown, _isAvatar = _a._isAvatar, disabled = _a.disabled;
33
- var context = (0, react_1.useContext)(SideMenuContext_1.SideMenuContext);
34
- var size = context.size, isTouchScreen = context.isTouchScreen;
35
- var textRef = (0, react_1.useRef)(null);
36
- var _e = tslib_1.__read((0, react_1.useState)(false), 2), isMultiline = _e[0], setIsMultiline = _e[1];
37
- var theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(react_ui_1.ThemeContext));
38
- (0, react_1.useEffect)(function () {
29
+ const ItemContent = (0, react_1.forwardRef)(({ _isSubMenu, icon, isNestedSubMenu, caption, subCaption, marker, _isBackButton, _isDropdown, _isAvatar, disabled }, ref) => {
30
+ const context = (0, react_1.useContext)(SideMenuContext_1.SideMenuContext);
31
+ const { size, isTouchScreen } = context;
32
+ const textRef = (0, react_1.useRef)(null);
33
+ const [isMultiline, setIsMultiline] = (0, react_1.useState)(false);
34
+ const theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
35
+ (0, react_1.useEffect)(() => {
39
36
  if (subCaption) {
40
37
  setIsMultiline(true);
41
38
  return;
@@ -43,31 +40,31 @@ var ItemContent = (0, react_1.forwardRef)(function (_a, ref) {
43
40
  if (!textRef.current || _isBackButton || _isDropdown) {
44
41
  return;
45
42
  }
46
- var captionLineHeight = getCaptionLineHeight(theme, context.isTouchScreen, _isSubMenu, size);
47
- var isMultiline = parseInt(captionLineHeight) < textRef.current.offsetHeight;
43
+ const captionLineHeight = getCaptionLineHeight(theme, context.isTouchScreen, _isSubMenu, size);
44
+ const isMultiline = parseInt(captionLineHeight) < textRef.current.offsetHeight;
48
45
  if (isMultiline) {
49
46
  setIsMultiline(true);
50
47
  }
51
- }, [caption, context.isBeingTransitioned, (_d = context.navigation) === null || _d === void 0 ? void 0 : _d.activeMenuItem]);
52
- return (react_1.default.createElement("div", { className: (0, Emotion_1.cx)((_b = {},
53
- _b[ItemContent_styles_1.jsStyles.root(theme)] = true,
54
- _b[ItemContent_styles_1.jsStyles.subItemRoot(theme)] = _isSubMenu,
55
- _b[ItemContent_styles_1.jsStyles.largeRoot(theme)] = size === 'large' && !_isSubMenu,
56
- _b[ItemContent_styles_1.jsStyles.subItemLargeRoot(theme)] = size === 'large' && _isSubMenu,
57
- _b[ItemContent_styles_1.jsStyles.multilineRoot(theme)] = isMultiline && !_isSubMenu && context.isOpened,
58
- _b[ItemContent_styles_1.jsStyles.largeMultilineRoot(theme)] = isMultiline && size === 'large',
59
- _b[ItemContent_styles_1.jsStyles.rootForTouchScreens(theme)] = isTouchScreen,
60
- _b[ItemContent_styles_1.jsStyles.subItemRootForTouchScreens(theme)] = isTouchScreen && _isSubMenu,
61
- _b)), ref: ref },
48
+ }, [caption, context.isBeingTransitioned, context.navigation?.activeMenuItem]);
49
+ return (react_1.default.createElement("div", { className: (0, Emotion_1.cx)({
50
+ [ItemContent_styles_1.jsStyles.root(theme)]: true,
51
+ [ItemContent_styles_1.jsStyles.subItemRoot(theme)]: _isSubMenu,
52
+ [ItemContent_styles_1.jsStyles.largeRoot(theme)]: size === 'large' && !_isSubMenu,
53
+ [ItemContent_styles_1.jsStyles.subItemLargeRoot(theme)]: size === 'large' && _isSubMenu,
54
+ [ItemContent_styles_1.jsStyles.multilineRoot(theme)]: isMultiline && !_isSubMenu && context.isOpened,
55
+ [ItemContent_styles_1.jsStyles.largeMultilineRoot(theme)]: isMultiline && size === 'large',
56
+ [ItemContent_styles_1.jsStyles.rootForTouchScreens(theme)]: isTouchScreen,
57
+ [ItemContent_styles_1.jsStyles.subItemRootForTouchScreens(theme)]: isTouchScreen && _isSubMenu,
58
+ }), ref: ref },
62
59
  icon && (react_1.default.createElement(Icon_1.Icon, { icon: icon, _isSubMenu: _isSubMenu, isMultiline: isMultiline, _isBackButton: _isBackButton, _isAvatar: _isAvatar, disabled: disabled })),
63
- react_1.default.createElement("div", { className: (0, Emotion_1.cx)((_c = {},
64
- _c[ItemContent_styles_1.jsStyles.textAndMarkerWrapper()] = true,
65
- _c[ItemContent_styles_1.jsStyles.textAndMarkerWrapperDropdown()] = _isDropdown,
66
- _c[ItemContent_styles_1.jsStyles.textAndMarkerWrapperMinimized()] = !context.isOpened && !_isSubMenu,
67
- _c)) },
60
+ react_1.default.createElement("div", { className: (0, Emotion_1.cx)({
61
+ [ItemContent_styles_1.jsStyles.textAndMarkerWrapper()]: true,
62
+ [ItemContent_styles_1.jsStyles.textAndMarkerWrapperDropdown()]: _isDropdown,
63
+ [ItemContent_styles_1.jsStyles.textAndMarkerWrapperMinimized()]: !context.isOpened && !_isSubMenu,
64
+ }) },
68
65
  react_1.default.createElement(Caption_1.Caption, { _isSubMenu: _isSubMenu, isNestedSubMenu: isNestedSubMenu, hasIcon: !!icon, isMultiline: isMultiline, caption: caption, subCaption: subCaption, _isBackButton: _isBackButton, _isDropdown: _isDropdown, _isAvatar: _isAvatar, ref: textRef })),
69
66
  marker !== undefined && (react_1.default.createElement(Marker_1.Marker, { isMultiline: isMultiline, marker: marker, _isSubMenu: _isSubMenu, isMinimized: !context.isOpened, disabled: disabled }))));
70
67
  });
71
68
  ItemContent.displayName = 'ItemContent';
72
- var ItemContentWithStaticFields = Object.assign(ItemContent, { __KONTUR_REACT_UI__: 'ItemContent' });
69
+ const ItemContentWithStaticFields = Object.assign(ItemContent, { __KONTUR_REACT_UI__: 'ItemContent' });
73
70
  exports.ItemContent = ItemContentWithStaticFields;
@@ -1,43 +1,77 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.jsStyles = void 0;
4
- var tslib_1 = require("tslib");
5
- var Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
6
- var ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
7
- var styles = {
8
- root: function (t) {
9
- return (0, Emotion_1.css)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n display: flex;\n align-items: center;\n padding-top: ", ";\n padding-bottom: ", ";\n position: relative;\n "], ["\n display: flex;\n align-items: center;\n padding-top: ", ";\n padding-bottom: ", ";\n position: relative;\n "])), t.sideMenuItemContentPaddingY, t.sideMenuItemContentPaddingY);
4
+ const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
5
+ const ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
6
+ const styles = {
7
+ root(t) {
8
+ return (0, Emotion_1.css) `
9
+ display: flex;
10
+ align-items: center;
11
+ padding-top: ${t.sideMenuItemContentPaddingY};
12
+ padding-bottom: ${t.sideMenuItemContentPaddingY};
13
+ position: relative;
14
+ `;
10
15
  },
11
- largeRoot: function (t) {
12
- return (0, Emotion_1.css)(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "], ["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "])), t.sideMenuItemContentLargePaddingY, t.sideMenuItemContentLargePaddingY);
16
+ largeRoot(t) {
17
+ return (0, Emotion_1.css) `
18
+ padding-top: ${t.sideMenuItemContentLargePaddingY} !important;
19
+ padding-bottom: ${t.sideMenuItemContentLargePaddingY} !important;
20
+ `;
13
21
  },
14
- subItemLargeRoot: function (t) {
15
- return (0, Emotion_1.css)(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "], ["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "])), t.sideMenuSubItemContentLargePaddingY, t.sideMenuSubItemContentLargePaddingY);
22
+ subItemLargeRoot(t) {
23
+ return (0, Emotion_1.css) `
24
+ padding-top: ${t.sideMenuSubItemContentLargePaddingY} !important;
25
+ padding-bottom: ${t.sideMenuSubItemContentLargePaddingY} !important;
26
+ `;
16
27
  },
17
- multilineRoot: function (t) {
18
- return (0, Emotion_1.css)(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "], ["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "])), t.sideMenuItemContentMultilinePaddingTop, t.sideMenuItemContentMultilinePaddingBottom);
28
+ multilineRoot(t) {
29
+ return (0, Emotion_1.css) `
30
+ padding-top: ${t.sideMenuItemContentMultilinePaddingTop} !important;
31
+ padding-bottom: ${t.sideMenuItemContentMultilinePaddingBottom} !important;
32
+ `;
19
33
  },
20
- largeMultilineRoot: function (t) {
21
- return (0, Emotion_1.css)(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "], ["\n padding-top: ", " !important;\n padding-bottom: ", " !important;\n "])), t.sideMenuItemContentLargeMultilinePaddingTop, t.sideMenuItemContentLargeMultilinePaddingBottom);
34
+ largeMultilineRoot(t) {
35
+ return (0, Emotion_1.css) `
36
+ padding-top: ${t.sideMenuItemContentLargeMultilinePaddingTop} !important;
37
+ padding-bottom: ${t.sideMenuItemContentLargeMultilinePaddingBottom} !important;
38
+ `;
22
39
  },
23
- rootForTouchScreens: function (t) {
24
- return (0, Emotion_1.css)(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuItemContentPaddingYForTouchScreens, t.sideMenuItemContentPaddingYForTouchScreens);
40
+ rootForTouchScreens(t) {
41
+ return (0, Emotion_1.css) `
42
+ padding-top: ${t.sideMenuItemContentPaddingYForTouchScreens};
43
+ padding-bottom: ${t.sideMenuItemContentPaddingYForTouchScreens};
44
+ `;
25
45
  },
26
- subItemRootForTouchScreens: function (t) {
27
- return (0, Emotion_1.css)(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuSubItemContentPaddingYForTouchScreens, t.sideMenuSubItemContentPaddingYForTouchScreens);
46
+ subItemRootForTouchScreens(t) {
47
+ return (0, Emotion_1.css) `
48
+ padding-top: ${t.sideMenuSubItemContentPaddingYForTouchScreens};
49
+ padding-bottom: ${t.sideMenuSubItemContentPaddingYForTouchScreens};
50
+ `;
28
51
  },
29
- subItemRoot: function (t) {
30
- return (0, Emotion_1.css)(templateObject_8 || (templateObject_8 = tslib_1.__makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuSubItemContentPaddingY, t.sideMenuSubItemContentPaddingY);
52
+ subItemRoot(t) {
53
+ return (0, Emotion_1.css) `
54
+ padding-top: ${t.sideMenuSubItemContentPaddingY};
55
+ padding-bottom: ${t.sideMenuSubItemContentPaddingY};
56
+ `;
31
57
  },
32
- textAndMarkerWrapper: function () {
33
- return (0, Emotion_1.css)(templateObject_9 || (templateObject_9 = tslib_1.__makeTemplateObject(["\n display: flex;\n flex-grow: 1;\n align-items: center;\n min-width: 0;\n "], ["\n display: flex;\n flex-grow: 1;\n align-items: center;\n min-width: 0;\n "])));
58
+ textAndMarkerWrapper() {
59
+ return (0, Emotion_1.css) `
60
+ display: flex;
61
+ flex-grow: 1;
62
+ align-items: center;
63
+ min-width: 0;
64
+ `;
34
65
  },
35
- textAndMarkerWrapperDropdown: function () {
36
- return (0, Emotion_1.css)(templateObject_10 || (templateObject_10 = tslib_1.__makeTemplateObject(["\n overflow: hidden;\n "], ["\n overflow: hidden;\n "])));
66
+ textAndMarkerWrapperDropdown() {
67
+ return (0, Emotion_1.css) `
68
+ overflow: hidden;
69
+ `;
37
70
  },
38
- textAndMarkerWrapperMinimized: function () {
39
- return (0, Emotion_1.css)(templateObject_11 || (templateObject_11 = tslib_1.__makeTemplateObject(["\n display: none;\n "], ["\n display: none;\n "])));
71
+ textAndMarkerWrapperMinimized() {
72
+ return (0, Emotion_1.css) `
73
+ display: none;
74
+ `;
40
75
  },
41
76
  };
42
77
  exports.jsStyles = (0, ThemeHelpers_1.memoizeStyle)(styles);
43
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
@@ -1,26 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Marker = void 0;
4
- var tslib_1 = require("tslib");
5
- var Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
6
- var react_1 = tslib_1.__importStar(require("react"));
7
- var react_ui_1 = require("@skbkontur/react-ui");
8
- var ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
9
- var Marker_styles_1 = require("./Marker.styles");
10
- var Marker = function (_a) {
11
- var _b;
12
- var isMultiline = _a.isMultiline, marker = _a.marker, _isSubMenu = _a._isSubMenu, disabled = _a.disabled, isMinimized = _a.isMinimized;
13
- var theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(react_ui_1.ThemeContext));
14
- var emptyMarker = marker === true || marker === '';
15
- return (react_1.default.createElement("span", { className: (0, Emotion_1.cx)((_b = {},
16
- _b[Marker_styles_1.jsStyles.root(theme)] = true,
17
- _b[Marker_styles_1.jsStyles.rootDisabled(theme)] = disabled,
18
- _b[Marker_styles_1.jsStyles.rootEmpty(theme)] = emptyMarker,
19
- _b[Marker_styles_1.jsStyles.rootMultiline(theme)] = isMultiline,
20
- _b[Marker_styles_1.jsStyles.rootSubMenu(theme)] = _isSubMenu,
21
- _b[Marker_styles_1.jsStyles.rootSubMenuEmpty(theme)] = _isSubMenu && emptyMarker,
22
- _b[Marker_styles_1.jsStyles.rootMinimized()] = isMinimized && !_isSubMenu,
23
- _b[Marker_styles_1.jsStyles.rootEmptyMinimized()] = emptyMarker && isMinimized && !_isSubMenu,
24
- _b)) }, marker));
4
+ const tslib_1 = require("tslib");
5
+ const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
6
+ const react_1 = tslib_1.__importStar(require("react"));
7
+ const ThemeContext_1 = require("@skbkontur/react-ui/lib/theming/ThemeContext");
8
+ const ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
9
+ const Marker_styles_1 = require("./Marker.styles");
10
+ const Marker = ({ isMultiline, marker, _isSubMenu, disabled, isMinimized }) => {
11
+ const theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
12
+ const emptyMarker = marker === true || marker === '';
13
+ return (react_1.default.createElement("span", { className: (0, Emotion_1.cx)({
14
+ [Marker_styles_1.jsStyles.root(theme)]: true,
15
+ [Marker_styles_1.jsStyles.rootDisabled(theme)]: disabled,
16
+ [Marker_styles_1.jsStyles.rootEmpty(theme)]: emptyMarker,
17
+ [Marker_styles_1.jsStyles.rootMultiline(theme)]: isMultiline,
18
+ [Marker_styles_1.jsStyles.rootSubMenu(theme)]: _isSubMenu,
19
+ [Marker_styles_1.jsStyles.rootSubMenuEmpty(theme)]: _isSubMenu && emptyMarker,
20
+ [Marker_styles_1.jsStyles.rootMinimized()]: isMinimized && !_isSubMenu,
21
+ [Marker_styles_1.jsStyles.rootEmptyMinimized()]: emptyMarker && isMinimized && !_isSubMenu,
22
+ }) }, marker));
25
23
  };
26
24
  exports.Marker = Marker;
@@ -1,34 +1,68 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.jsStyles = void 0;
4
- var tslib_1 = require("tslib");
5
- var Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
6
- var ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
7
- var styles = {
8
- root: function (t) {
9
- return (0, Emotion_1.css)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n padding: ", " ", ";\n background: ", ";\n border-radius: 9999px;\n margin-left: auto;\n margin-right: ", ";\n color: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n min-width: 8px;\n min-height: 8px;\n text-align: center;\n flex-shrink: 0;\n "], ["\n padding: ", " ", ";\n background: ", ";\n border-radius: 9999px;\n margin-left: auto;\n margin-right: ", ";\n color: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n min-width: 8px;\n min-height: 8px;\n text-align: center;\n flex-shrink: 0;\n "])), t.sideMenuMarkerPaddingY, t.sideMenuMarkerPaddingX, t.sideMenuMarkerBg, t.sideMenuMarkerMarginRight, t.sideMenuMarkerColor, t.sideMenuMarkerFontSize, t.sideMenuMarkerLineHeight, t.sideMenuMarkerFontWeight);
4
+ const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
5
+ const ThemeHelpers_1 = require("../../../lib/theming/ThemeHelpers");
6
+ const styles = {
7
+ root(t) {
8
+ return (0, Emotion_1.css) `
9
+ padding: ${t.sideMenuMarkerPaddingY} ${t.sideMenuMarkerPaddingX};
10
+ background: ${t.sideMenuMarkerBg};
11
+ border-radius: 9999px;
12
+ margin-left: auto;
13
+ margin-right: ${t.sideMenuMarkerMarginRight};
14
+ color: ${t.sideMenuMarkerColor};
15
+ font-size: ${t.sideMenuMarkerFontSize};
16
+ line-height: ${t.sideMenuMarkerLineHeight};
17
+ font-weight: ${t.sideMenuMarkerFontWeight};
18
+ min-width: 8px;
19
+ min-height: 8px;
20
+ text-align: center;
21
+ flex-shrink: 0;
22
+ `;
10
23
  },
11
- rootEmpty: function (t) {
12
- return (0, Emotion_1.css)(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n padding: 0;\n margin-right: calc(", " + ", ");\n "], ["\n padding: 0;\n margin-right: calc(", " + ", ");\n "])), t.sideMenuMarkerMarginRight, t.sideMenuMarkerPaddingX);
24
+ rootEmpty(t) {
25
+ return (0, Emotion_1.css) `
26
+ padding: 0;
27
+ margin-right: calc(${t.sideMenuMarkerMarginRight} + ${t.sideMenuMarkerPaddingX});
28
+ `;
13
29
  },
14
- rootDisabled: function (t) {
15
- return (0, Emotion_1.css)(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), t.sideMenuMarkerBgDisabled);
30
+ rootDisabled(t) {
31
+ return (0, Emotion_1.css) `
32
+ background: ${t.sideMenuMarkerBgDisabled};
33
+ `;
16
34
  },
17
- rootMultiline: function (t) {
18
- return (0, Emotion_1.css)(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n align-self: flex-start;\n margin-top: ", ";\n "], ["\n align-self: flex-start;\n margin-top: ", ";\n "])), t.sideMenuMarkerMultilineMarginTop);
35
+ rootMultiline(t) {
36
+ return (0, Emotion_1.css) `
37
+ align-self: flex-start;
38
+ margin-top: ${t.sideMenuMarkerMultilineMarginTop};
39
+ `;
19
40
  },
20
- rootSubMenu: function (t) {
21
- return (0, Emotion_1.css)(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n background: transparent;\n color: ", ";\n font-weight: ", ";\n "], ["\n background: transparent;\n color: ", ";\n font-weight: ", ";\n "])), t.sideMenuMarkerSubItemColor, t.sideMenuSubItemMarkerFontWeight);
41
+ rootSubMenu(t) {
42
+ return (0, Emotion_1.css) `
43
+ background: transparent;
44
+ color: ${t.sideMenuMarkerSubItemColor};
45
+ font-weight: ${t.sideMenuSubItemMarkerFontWeight};
46
+ `;
22
47
  },
23
- rootSubMenuEmpty: function (t) {
24
- return (0, Emotion_1.css)(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n background: ", ";\n "], ["\n background: ", ";\n "])), t.sideMenuSubItemEmptyMarkerBg);
48
+ rootSubMenuEmpty(t) {
49
+ return (0, Emotion_1.css) `
50
+ background: ${t.sideMenuSubItemEmptyMarkerBg};
51
+ `;
25
52
  },
26
- rootMinimized: function () {
27
- return (0, Emotion_1.css)(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n position: absolute;\n right: 0;\n top: 0;\n margin: 0;\n "], ["\n position: absolute;\n right: 0;\n top: 0;\n margin: 0;\n "])));
53
+ rootMinimized() {
54
+ return (0, Emotion_1.css) `
55
+ position: absolute;
56
+ right: 0;
57
+ top: 0;
58
+ margin: 0;
59
+ `;
28
60
  },
29
- rootEmptyMinimized: function () {
30
- return (0, Emotion_1.css)(templateObject_8 || (templateObject_8 = tslib_1.__makeTemplateObject(["\n right: 4px;\n top: 4px;\n "], ["\n right: 4px;\n top: 4px;\n "])));
61
+ rootEmptyMinimized() {
62
+ return (0, Emotion_1.css) `
63
+ right: 4px;
64
+ top: 4px;
65
+ `;
31
66
  },
32
67
  };
33
68
  exports.jsStyles = (0, ThemeHelpers_1.memoizeStyle)(styles);
34
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
@@ -1,30 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NestedMenu = void 0;
4
- var tslib_1 = require("tslib");
5
- var react_1 = tslib_1.__importStar(require("react"));
6
- var react_ui_1 = require("@skbkontur/react-ui");
7
- var Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
8
- var ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
9
- var SideMenu_styles_1 = require("../SideMenu/SideMenu.styles");
10
- var SideMenuContext_1 = require("../SideMenuContext");
11
- var NestedMenu_styles_1 = require("./NestedMenu.styles");
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = tslib_1.__importStar(require("react"));
6
+ const ThemeContext_1 = require("@skbkontur/react-ui/lib/theming/ThemeContext");
7
+ const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
8
+ const ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
9
+ const SideMenu_styles_1 = require("../SideMenu/SideMenu.styles");
10
+ const SideMenuContext_1 = require("../SideMenuContext");
11
+ const NestedMenu_styles_1 = require("./NestedMenu.styles");
12
12
  /**
13
13
  * Вложенное подменю
14
14
  *
15
15
  * @visibleName NestedMenu
16
16
  */
17
- var NestedMenu = (0, react_1.forwardRef)(function (_a, ref) {
18
- var _b;
19
- var children = _a.children, htmlId = _a.htmlId, isOpened = _a.isOpened;
20
- var theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(react_ui_1.ThemeContext));
21
- var context = (0, react_1.useContext)(SideMenuContext_1.SideMenuContext);
22
- return (react_1.default.createElement("ul", { ref: ref, className: (0, Emotion_1.cx)((_b = {},
23
- _b[SideMenu_styles_1.jsStylesForSideMenu.list()] = true,
24
- _b[SideMenu_styles_1.jsStylesForSideMenu.hidden()] = !isOpened || (!context.isOpened && (context.isMobile || context.isTablet)),
25
- _b[NestedMenu_styles_1.jsStyles.root(theme)] = true,
26
- _b)), id: htmlId }, children));
17
+ const NestedMenu = (0, react_1.forwardRef)(({ children, htmlId, isOpened }, ref) => {
18
+ const theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
19
+ const context = (0, react_1.useContext)(SideMenuContext_1.SideMenuContext);
20
+ return (react_1.default.createElement("ul", { ref: ref, className: (0, Emotion_1.cx)({
21
+ [SideMenu_styles_1.jsStylesForSideMenu.list()]: true,
22
+ [SideMenu_styles_1.jsStylesForSideMenu.hidden()]: !isOpened || (!context.isOpened && (context.isMobile || context.isTablet)),
23
+ [NestedMenu_styles_1.jsStyles.root(theme)]: true,
24
+ }), id: htmlId }, children));
27
25
  });
28
26
  NestedMenu.displayName = 'NestedMenu';
29
- var NestedMenuWithStaticFields = Object.assign(NestedMenu, { __KONTUR_REACT_UI__: 'NestedMenu' });
27
+ const NestedMenuWithStaticFields = Object.assign(NestedMenu, { __KONTUR_REACT_UI__: 'NestedMenu' });
30
28
  exports.NestedMenu = NestedMenuWithStaticFields;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.jsStyles = void 0;
4
- var tslib_1 = require("tslib");
5
- var Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
6
- var ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
7
- var styles = {
8
- root: function (t) {
9
- return (0, Emotion_1.css)(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n padding-left: ", ";\n "], ["\n padding-left: ", ";\n "])), t.sideMenuNestedMenuPaddingLeft);
4
+ const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
5
+ const ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
6
+ const styles = {
7
+ root(t) {
8
+ return (0, Emotion_1.css) `
9
+ padding-left: ${t.sideMenuNestedMenuPaddingLeft};
10
+ `;
10
11
  },
11
12
  };
12
13
  exports.jsStyles = (0, ThemeHelpers_1.memoizeStyle)(styles);
13
- var templateObject_1;