@skbkontur/side-menu 5.0.0-alpha.4 → 5.0.0-beta.1
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 +32 -0
- package/README.md +2 -2
- package/internal/themes/SideMenuDarkTheme.js +7 -6
- package/internal/themes/SideMenuTheme.d.ts +16 -0
- package/internal/themes/SideMenuTheme.js +38 -8
- package/lib/theming/ThemeHelpers.js +4 -0
- package/package.json +7 -7
- package/src/SideMenu/SideMenu.d.ts +1 -0
- package/src/SideMenu/SideMenu.js +29 -34
- package/src/SideMenu/SideMenu.styles.d.ts +4 -5
- package/src/SideMenu/SideMenu.styles.js +26 -36
- package/src/SideMenuBody/SideMenuBody.js +2 -1
- package/src/SideMenuBody/SideMenuBody.styles.js +1 -2
- package/src/SideMenuContext.d.ts +1 -8
- package/src/SideMenuDivider/SideMenuDivider.js +4 -2
- package/src/SideMenuDivider/SideMenuDivider.styles.d.ts +1 -0
- package/src/SideMenuDivider/SideMenuDivider.styles.js +6 -3
- package/src/SideMenuDropdown/SideMenuDropdown.js +7 -7
- package/src/SideMenuDropdown/SideMenuDropdown.styles.d.ts +0 -1
- package/src/SideMenuDropdown/SideMenuDropdown.styles.js +4 -8
- package/src/SideMenuFooter/SideMenuFooter.js +6 -29
- package/src/SideMenuFooter/SideMenuFooter.styles.js +3 -4
- package/src/SideMenuHeader/SideMenuHeader.js +4 -1
- package/src/SideMenuHeader/SideMenuHeader.styles.d.ts +2 -0
- package/src/SideMenuHeader/SideMenuHeader.styles.js +12 -5
- package/src/SideMenuNotifications/BellWidget.js +13 -6
- package/src/SideMenuNotifications/BellWidgetError.js +6 -3
- package/src/SideMenuNotifications/BellWidgetView.styles.d.ts +7 -4
- package/src/SideMenuNotifications/BellWidgetView.styles.js +20 -9
- package/src/SideMenuNotifications/utils/getWrapperHeightClass.d.ts +11 -0
- package/src/SideMenuNotifications/utils/getWrapperHeightClass.js +10 -0
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +1 -0
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.d.ts +1 -0
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +5 -2
- package/src/internal/ClickableElement.d.ts +3 -1
- package/src/internal/ClickableElement.js +35 -36
- package/src/internal/InnerSubMenu.js +4 -0
- package/src/internal/ItemContent/Caption.js +4 -4
- package/src/internal/ItemContent/Caption.styles.d.ts +2 -0
- package/src/internal/ItemContent/Caption.styles.js +14 -8
- package/src/internal/ItemContent/Icon.js +1 -0
- package/src/internal/ItemContent/Icon.styles.d.ts +1 -0
- package/src/internal/ItemContent/Icon.styles.js +13 -10
- package/src/internal/ItemContent/ItemContent.js +26 -5
- package/src/internal/ItemContent/ItemContent.styles.d.ts +0 -1
- package/src/internal/ItemContent/ItemContent.styles.js +2 -6
- package/src/internal/ItemContent/Marker.js +1 -1
- package/src/internal/NarrowAccordionDropdown.d.ts +1 -2
- package/src/internal/NarrowAccordionDropdown.js +9 -14
- package/src/internal/SideMenuLogotype.js +29 -3
- package/src/internal/SideMenuLogotype.styles.d.ts +2 -0
- package/src/internal/SideMenuLogotype.styles.js +13 -6
- package/src/internal/subMenuItems.d.ts +3 -0
- package/src/internal/subMenuItems.js +43 -0
- package/src/state/reducer.js +46 -26
|
@@ -14,8 +14,9 @@ var SideMenuBodyInner = forwardRef(function (_a, ref) {
|
|
|
14
14
|
var sideMenuStyles = useStyles(getSideMenuStyles);
|
|
15
15
|
var styles = useStyles(getStyles);
|
|
16
16
|
var cx = useEmotion().cx;
|
|
17
|
+
var isTabletOrMobile = context.isTablet || context.isMobile;
|
|
17
18
|
return (React.createElement("div", { ref: ref, className: cx(styles.root(theme), (_b = {},
|
|
18
|
-
_b[sideMenuStyles.hidden()] = !context.isOpened &&
|
|
19
|
+
_b[sideMenuStyles.hidden()] = !context.isOpened && isTabletOrMobile,
|
|
19
20
|
_b[sideMenuStyles.itemsContainerCollapsed(theme)] = !context.isOpened,
|
|
20
21
|
_b[sideMenuStyles.itemsContainerCollapsedLarge(theme)] = !context.isOpened && context.size === 'large',
|
|
21
22
|
_b)) },
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
|
-
import { transitionDuration } from '../SideMenu/SideMenu.js';
|
|
4
3
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
5
4
|
var css = _a.css;
|
|
6
5
|
return ({
|
|
7
6
|
root: function (t) {
|
|
8
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n margin: 0 ", ";\n min-height: 100%;\n
|
|
7
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-grow: 1;\n margin: 0 ", ";\n min-height: 100%;\n "], ["\n flex-grow: 1;\n margin: 0 ", ";\n min-height: 100%;\n "])), t.sideMenuItemsMarginX);
|
|
9
8
|
},
|
|
10
9
|
wrapper: function (t) {
|
|
11
10
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-bottom: ", ";\n "], ["\n padding-bottom: ", ";\n "])), t.sideMenuBodyPaddingBottom);
|
package/src/SideMenuContext.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ScrollContainerScrollStateY } from '@skbkontur/react-ui/components/ScrollContainer';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RefObject } from 'react';
|
|
3
3
|
import type { showScrollBarType } from './SideMenu/SideMenu.js';
|
|
4
4
|
import { type Action, type SideMenuState } from './state/types.js';
|
|
5
5
|
export interface SideMenuContextType {
|
|
@@ -37,12 +37,5 @@ export interface SideMenuContextType {
|
|
|
37
37
|
openDropdownCount?: number;
|
|
38
38
|
currentItemNestingLevel?: number;
|
|
39
39
|
closeParentDropdown?: () => void;
|
|
40
|
-
/**
|
|
41
|
-
* A mutable counter reset to 0 on each parent render and incremented by each child during
|
|
42
|
-
* its `useState` initializer. Produces a stable, position-based index so generated ids
|
|
43
|
-
* survive unmount → re-mount (e.g. narrow accordion dropdown closing → inline submenu
|
|
44
|
-
* opening) without explicit `id` props.
|
|
45
|
-
*/
|
|
46
|
-
childIdCounterRef?: MutableRefObject<number>;
|
|
47
40
|
}
|
|
48
41
|
export declare const SideMenuContext: import("react").Context<SideMenuContextType>;
|
|
@@ -14,11 +14,13 @@ var SideMenuDividerInner = forwardRef(function (_a, ref) {
|
|
|
14
14
|
var context = useContext(SideMenuContext);
|
|
15
15
|
var isLarge = context.size === 'large';
|
|
16
16
|
var isSubItem = !!context.currentItemNestingLevel && !context.isSeparatedMenu;
|
|
17
|
+
var isInSeparatedSubMenu = !!context.currentItemNestingLevel && !!context.isSeparatedMenu;
|
|
17
18
|
return (React.createElement("hr", __assign({ className: cx(styles.root(theme), (_b = {},
|
|
18
|
-
_b[styles.rootOpened(theme)] = context.isOpened,
|
|
19
|
+
_b[styles.rootOpened(theme)] = context.isOpened && !isInSeparatedSubMenu,
|
|
19
20
|
_b[styles.rootSubItem(theme)] = context.isOpened && isSubItem,
|
|
20
|
-
_b[styles.rootWithoutItemIcons(theme)] = context.isOpened && !
|
|
21
|
+
_b[styles.rootWithoutItemIcons(theme)] = context.isOpened && !context.currentItemNestingLevel && !context.hasItemIcons,
|
|
21
22
|
_b[styles.rootSubItemWithoutItemIcons(theme)] = context.isOpened && isSubItem && !context.hasItemIcons,
|
|
23
|
+
_b[styles.rootInSeparatedSubMenu(theme)] = isInSeparatedSubMenu,
|
|
22
24
|
_b[styles.rootLarge(theme)] = isLarge,
|
|
23
25
|
_b), className), ref: ref }, rest)));
|
|
24
26
|
});
|
|
@@ -5,5 +5,6 @@ export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").Styl
|
|
|
5
5
|
rootSubItem(t: SideMenuTheme): string;
|
|
6
6
|
rootWithoutItemIcons(t: SideMenuTheme): string;
|
|
7
7
|
rootSubItemWithoutItemIcons(t: SideMenuTheme): string;
|
|
8
|
+
rootInSeparatedSubMenu(t: SideMenuTheme): string;
|
|
8
9
|
rootLarge(t: SideMenuTheme): string;
|
|
9
10
|
}>;
|
|
@@ -4,7 +4,7 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
4
4
|
var css = _a.css;
|
|
5
5
|
return ({
|
|
6
6
|
root: function (t) {
|
|
7
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height:
|
|
7
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 0;\n border: none;\n border-top: 1px solid ", ";\n margin: ", " ", " ", ";\n "], ["\n height: 0;\n border: none;\n border-top: 1px solid ", ";\n margin: ", " ", " ", ";\n "])), t.sideMenuDividerBg, t.sideMenuDividerMarginTop, t.sideMenuDividerMarginX, t.sideMenuDividerMarginBottom);
|
|
8
8
|
},
|
|
9
9
|
rootOpened: function (t) {
|
|
10
10
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuDividerMarginLeft);
|
|
@@ -18,9 +18,12 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
18
18
|
rootSubItemWithoutItemIcons: function (t) {
|
|
19
19
|
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuSubItemCaptionMarginLeftWithoutIcons);
|
|
20
20
|
},
|
|
21
|
+
rootInSeparatedSubMenu: function (t) {
|
|
22
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), t.sideMenuDividerMarginLeftInSeparatedSubMenu);
|
|
23
|
+
},
|
|
21
24
|
rootLarge: function (t) {
|
|
22
|
-
return css(
|
|
25
|
+
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-top: ", ";\n margin-bottom: ", ";\n "], ["\n margin-top: ", ";\n margin-bottom: ", ";\n "])), t.sideMenuDividerMarginTopLarge, t.sideMenuDividerMarginBottomLarge);
|
|
23
26
|
},
|
|
24
27
|
});
|
|
25
28
|
});
|
|
26
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
29
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
@@ -8,11 +8,11 @@ import { SideMenuContext } from '../SideMenuContext.js';
|
|
|
8
8
|
import { SideMenuItem } from '../SideMenuItem/SideMenuItem.js';
|
|
9
9
|
import { getStyles } from './SideMenuDropdown.styles.js';
|
|
10
10
|
var SideMenuDropdownInner = forwardRef(function (_a, ref) {
|
|
11
|
-
var _b
|
|
11
|
+
var _b;
|
|
12
12
|
var icon = _a.icon, id = _a.id, children = _a.children, caption = _a.caption, marker = _a.marker, subCaption = _a.subCaption, className = _a.className, menuWidth = _a.menuWidth, _isAvatar = _a._isAvatar, onClose = _a.onClose, onOpen = _a.onOpen, ariaLabel = _a["aria-label"], rest = __rest(_a, ["icon", "id", "children", "caption", "marker", "subCaption", "className", "menuWidth", "_isAvatar", "onClose", "onOpen", 'aria-label']);
|
|
13
13
|
var context = useContext(SideMenuContext);
|
|
14
14
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
15
|
-
var
|
|
15
|
+
var _c = __read(useState(false), 2), isMenuOpen = _c[0], setIsMenuOpen = _c[1];
|
|
16
16
|
var cx = useEmotion().cx;
|
|
17
17
|
var styles = useStyles(getStyles);
|
|
18
18
|
var dropdownChildren = useMemo(function () {
|
|
@@ -32,11 +32,11 @@ var SideMenuDropdownInner = forwardRef(function (_a, ref) {
|
|
|
32
32
|
return child;
|
|
33
33
|
});
|
|
34
34
|
}, [children, context.toggleIsOpened]);
|
|
35
|
-
return (React.createElement("li", { className: cx(styles.wrapper(),
|
|
36
|
-
React.createElement(DropdownMenu, __assign({ ref: ref, caption: React.createElement("div", { className: cx(styles.label(theme), (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
return (React.createElement("li", { className: cx(styles.wrapper(), className) },
|
|
36
|
+
React.createElement(DropdownMenu, __assign({ ref: ref, caption: React.createElement("div", { className: cx(styles.label(theme), (_b = {},
|
|
37
|
+
_b[styles.labelTouchScreen(theme)] = context.isTouchScreen,
|
|
38
|
+
_b[styles.labelCollapsed()] = !context.isOpened,
|
|
39
|
+
_b)) },
|
|
40
40
|
React.createElement(SideMenuItem, { "aria-label": ariaLabel, icon: icon, caption: caption, subCaption: subCaption, marker: marker, id: id, _isDropdown: true, _isDropdownOpen: isMenuOpen, _isAvatar: _isAvatar })), positions: ['top left'], disableAnimations: true, menuWidth: menuWidth, onOpen: function () {
|
|
41
41
|
setIsMenuOpen(true);
|
|
42
42
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
|
-
import {
|
|
3
|
+
import { compactDesktopMenu } from '../SideMenu/SideMenu.styles.js';
|
|
4
4
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
5
5
|
var css = _a.css, injectGlobal = _a.injectGlobal;
|
|
6
6
|
var _unused = injectGlobal(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n [data-tid='MenuItem']:active {\n background: rgba(0, 0, 0, 0.1) !important;\n transition: background 80ms ease-out;\n }\n "], ["\n [data-tid='MenuItem']:active {\n background: rgba(0, 0, 0, 0.1) !important;\n transition: background 80ms ease-out;\n }\n "])));
|
|
7
7
|
return {
|
|
8
8
|
label: function (t) {
|
|
9
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: calc(\n ", " - 2 * ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n min-width: 0;\n
|
|
9
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: calc(\n ", " - 2 * ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n min-width: 0;\n ", "\n "], ["\n width: calc(\n ", " - 2 * ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n min-width: 0;\n ", "\n "])), t.sideMenuWidth, t.sideMenuItemsMarginX, compactDesktopMenu(t, "max-width: max(0px, calc(100cqw - 2 * ".concat(t.sideMenuItemsMarginX, " - var(--side-menu-footer-trailing-reserved-width, 0px)));")));
|
|
10
10
|
},
|
|
11
11
|
labelTouchScreen: function (t) {
|
|
12
12
|
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: calc(\n ", " - 2 *\n ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n "], ["\n width: calc(\n ", " - 2 *\n ", " - var(--side-menu-footer-trailing-reserved-width, 0px)\n );\n "])), t.sideMenuWidthTouchScreen, t.sideMenuItemsMarginX);
|
|
@@ -15,15 +15,11 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
15
15
|
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "])));
|
|
16
16
|
},
|
|
17
17
|
wrapper: function () {
|
|
18
|
-
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n
|
|
18
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n min-width: 0;\n "], ["\n min-width: 0;\n "])));
|
|
19
19
|
},
|
|
20
20
|
collapsedDropdownList: function (t) {
|
|
21
21
|
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n min-width: calc(", " - 8px);\n max-width: calc(", " - 8px);\n "], ["\n min-width: calc(", " - 8px);\n max-width: calc(", " - 8px);\n "])), t.sideMenuCollapsedDropdownMinWidth, t.sideMenuCollapsedDropdownMaxWidth);
|
|
22
22
|
},
|
|
23
|
-
// В свёрнутом меню подпись скрыта, а бейдж выступает за границы пункта — не обрезаем его
|
|
24
|
-
wrapperCollapsed: function () {
|
|
25
|
-
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n overflow: visible;\n "], ["\n overflow: visible;\n "])));
|
|
26
|
-
},
|
|
27
23
|
};
|
|
28
24
|
});
|
|
29
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6
|
|
25
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -3,11 +3,10 @@ import { getDOMRect } from '@skbkontur/react-ui/lib/dom/getDOMRect';
|
|
|
3
3
|
import { mergeRefs } from '@skbkontur/react-ui/lib/mergeRefs';
|
|
4
4
|
import { useEmotion, useStyles } from '@skbkontur/react-ui/lib/renderEnvironment';
|
|
5
5
|
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
6
|
-
import React, { forwardRef, useContext, useEffect,
|
|
6
|
+
import React, { forwardRef, useContext, useEffect, useRef, useState } from 'react';
|
|
7
7
|
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers.js';
|
|
8
8
|
import { flattenChildren } from '../../lib/utils/scripts.js';
|
|
9
9
|
import { SideMenuDataTids } from '../../SideMenuDataTids.js';
|
|
10
|
-
import { transitionDuration } from '../SideMenu/SideMenu.js';
|
|
11
10
|
import { getStyles as getSideMenuStyles } from '../SideMenu/SideMenu.styles.js';
|
|
12
11
|
import { SideMenuContext } from '../SideMenuContext.js';
|
|
13
12
|
import { getStyles } from './SideMenuFooter.styles.js';
|
|
@@ -27,35 +26,13 @@ var SideMenuFooterInner = forwardRef(function (_a, ref) {
|
|
|
27
26
|
(_a = context.setFooterHeight) === null || _a === void 0 ? void 0 : _a.call(context, getDOMRect(footerRef.current).height);
|
|
28
27
|
}
|
|
29
28
|
}, [children, context.isOpened, context.setFooterHeight]);
|
|
30
|
-
// При сворачивании кнопка сворачивания переезжает из строки аватара в отдельную строку
|
|
31
|
-
// (и обратно), из-за чего высота футера меняется скачком, а пункты футера подпрыгивают.
|
|
32
|
-
// Футер прижат к низу меню, поэтому плавно доводим его от прежнего положения к новому.
|
|
33
|
-
var prevHeightRef = useRef(null);
|
|
34
|
-
useLayoutEffect(function () {
|
|
35
|
-
var _a;
|
|
36
|
-
var node = footerRef.current;
|
|
37
|
-
var prevHeight = prevHeightRef.current;
|
|
38
|
-
if (!node || prevHeight === null || typeof node.animate !== 'function') {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
var offset = getDOMRect(node).height - prevHeight;
|
|
42
|
-
var prefersReducedMotion = (_a = globalThis.matchMedia) === null || _a === void 0 ? void 0 : _a.call(globalThis, '(prefers-reduced-motion: reduce)').matches;
|
|
43
|
-
if (offset && !prefersReducedMotion) {
|
|
44
|
-
node.animate([{ transform: "translateY(".concat(offset, "px)") }, { transform: 'translateY(0)' }], {
|
|
45
|
-
duration: transitionDuration,
|
|
46
|
-
easing: 'ease-out',
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}, [context.isOpened]);
|
|
50
|
-
useLayoutEffect(function () {
|
|
51
|
-
prevHeightRef.current = footerRef.current ? getDOMRect(footerRef.current).height : null;
|
|
52
|
-
});
|
|
53
29
|
var isTabletOrMobile = context.isTablet || context.isMobile;
|
|
54
30
|
var isLarge = context.size === 'large';
|
|
55
31
|
var showCollapseToggle = (context.isDesktop || context.isNarrowDesktop) && !context.disableCollapsing;
|
|
56
32
|
var showTrailingItem = showCollapseToggle && context.isOpened;
|
|
57
33
|
var footerItems = flattenChildren(children);
|
|
58
34
|
var isEmpty = footerItems.length === 0;
|
|
35
|
+
var useCollapsedMargins = !context.isOpened || isEmpty;
|
|
59
36
|
var trailingItem = showTrailingItem ? footerItems[footerItems.length - 1] : null;
|
|
60
37
|
var leadingItems = trailingItem ? footerItems.slice(0, -1) : footerItems;
|
|
61
38
|
useEffect(function () {
|
|
@@ -64,11 +41,11 @@ var SideMenuFooterInner = forwardRef(function (_a, ref) {
|
|
|
64
41
|
if (!isTabletOrMobile || context.isOpened) {
|
|
65
42
|
return (React.createElement("footer", __assign({ "data-tid": SideMenuDataTids.footer, "data-visual-state-fixed": isFixed, className: cx(styles.root(theme), (_b = {},
|
|
66
43
|
_b[styles.rootLarge(theme)] = isLarge,
|
|
67
|
-
_b[sideMenuStyles.itemsContainerCollapsed(theme)] =
|
|
68
|
-
_b[sideMenuStyles.itemsContainerCollapsedLarge(theme)] =
|
|
44
|
+
_b[sideMenuStyles.itemsContainerCollapsed(theme)] = useCollapsedMargins,
|
|
45
|
+
_b[sideMenuStyles.itemsContainerCollapsedLarge(theme)] = useCollapsedMargins && isLarge,
|
|
69
46
|
_b[styles.rootFixed(theme)] = isFixed,
|
|
70
|
-
_b[styles.rootFixedCollapsed(theme)] = isFixed &&
|
|
71
|
-
_b[styles.rootFixedCollapsedLarge(theme)] = isFixed &&
|
|
47
|
+
_b[styles.rootFixedCollapsed(theme)] = isFixed && useCollapsedMargins,
|
|
48
|
+
_b[styles.rootFixedCollapsedLarge(theme)] = isFixed && useCollapsedMargins && isLarge,
|
|
72
49
|
_b[styles.rootTransitionedTabletAndMobile()] = context.isBeingTransitioned && isTabletOrMobile,
|
|
73
50
|
_b), className), ref: mergeRefs(footerRef, ref) }, rest),
|
|
74
51
|
leadingItems.length > 0 && React.createElement("ul", { className: cx(sideMenuStyles.list(), styles.list()) }, leadingItems),
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
|
-
import { transitionDuration } from '../SideMenu/SideMenu.js';
|
|
4
3
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
5
4
|
var css = _a.css;
|
|
6
5
|
return ({
|
|
7
6
|
root: function (t) {
|
|
8
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: ", ";\n padding-top: ", ";\n margin: 0 ", ";\n background-color: inherit;\n
|
|
7
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: ", ";\n padding-top: ", ";\n margin: 0 ", ";\n background-color: inherit;\n "], ["\n display: flex;\n flex-direction: column;\n flex-grow: 0;\n position: sticky;\n bottom: 0;\n padding-bottom: ", ";\n padding-top: ", ";\n margin: 0 ", ";\n background-color: inherit;\n "])), t.sideMenuFooterPaddingBottom, t.sideMenuFooterPaddingTop, t.sideMenuItemsMarginX);
|
|
9
8
|
},
|
|
10
9
|
rootLarge: function (t) {
|
|
11
10
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-bottom: ", ";\n "], ["\n padding-bottom: ", ";\n "])), t.sideMenuFooterPaddingBottomLarge);
|
|
@@ -14,7 +13,7 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
14
13
|
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-width: 0;\n "], ["\n display: flex;\n flex-direction: column;\n min-width: 0;\n "])));
|
|
15
14
|
},
|
|
16
15
|
trailingRow: function () {
|
|
17
|
-
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n min-width: 0;\n "], ["\n display: flex;\n align-items: center;\n min-width: 0;\n "])));
|
|
16
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: flex-end;\n min-width: 0;\n "], ["\n display: flex;\n align-items: center;\n justify-content: flex-end;\n min-width: 0;\n "])));
|
|
18
17
|
},
|
|
19
18
|
trailingItem: function (t) {
|
|
20
19
|
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n flex: 1 1 auto;\n min-width: 0;\n --side-menu-footer-trailing-reserved-width: calc(\n ", " + ", "\n );\n "], ["\n flex: 1 1 auto;\n min-width: 0;\n --side-menu-footer-trailing-reserved-width: calc(\n ", " + ", "\n );\n "])), t.sideMenuCollapseToggleSize, t.sideMenuCollapseToggleOffsetRight);
|
|
@@ -36,7 +35,7 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
36
35
|
},
|
|
37
36
|
// Разделитель выравнивается по разделителю шапки, а не по краям пунктов
|
|
38
37
|
rootFixed: function (t) {
|
|
39
|
-
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n
|
|
38
|
+
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n border-top: 1px solid ", ";\n }\n "], ["\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n border-top: 1px solid ", ";\n }\n "])), t.sideMenuMarginX, t.sideMenuItemsMarginX, t.sideMenuMarginX, t.sideMenuItemsMarginX, t.sideMenuFooterDividerColor);
|
|
40
39
|
},
|
|
41
40
|
rootFixedCollapsed: function (t) {
|
|
42
41
|
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n &::before {\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n }\n "], ["\n &::before {\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n }\n "])), t.sideMenuMarginX, t.sideMenuItemsMarginXCollapsed, t.sideMenuMarginX, t.sideMenuItemsMarginXCollapsed);
|
|
@@ -16,6 +16,7 @@ var SideMenuHeaderInner = forwardRef(function (_a, ref) {
|
|
|
16
16
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
17
17
|
var headerWrapperRef = useRef(null);
|
|
18
18
|
var isTabletOrMobile = context.isTablet || context.isMobile;
|
|
19
|
+
var showDivider = !!context.hasScrollBar && context.scrollState !== 'top';
|
|
19
20
|
var isSeparatedMenuShown = separatedShown(context.state);
|
|
20
21
|
useEffect(function () {
|
|
21
22
|
var _a;
|
|
@@ -26,8 +27,10 @@ var SideMenuHeaderInner = forwardRef(function (_a, ref) {
|
|
|
26
27
|
var styles = useStyles(getStyles);
|
|
27
28
|
var cx = useEmotion().cx;
|
|
28
29
|
return (React.createElement("header", { className: cx(styles.root(theme), (_b = {},
|
|
29
|
-
_b[styles.fixedRoot(theme)] =
|
|
30
|
+
_b[styles.fixedRoot(theme)] = showDivider,
|
|
31
|
+
_b[styles.fixedRootTabletAndMobile(theme)] = showDivider && isTabletOrMobile,
|
|
30
32
|
_b[styles.rootCollapsedDesktop(theme)] = !context.isOpened && !isTabletOrMobile,
|
|
33
|
+
_b[styles.rootOpeningDesktop(theme)] = context.isOpened && !isTabletOrMobile,
|
|
31
34
|
_b[styles.rootTabletAndMobile(theme)] = isTabletOrMobile,
|
|
32
35
|
_b[styles.rootCollapsedTabletAndMobile()] = isTabletOrMobile && !context.isOpened,
|
|
33
36
|
_b[styles.rootWithSeparatedMenuShownMobile(theme)] = context.isOpened && context.isMobile && isSeparatedMenuShown,
|
|
@@ -2,8 +2,10 @@ import type { SideMenuTheme } from '../../lib/theming/ThemeTypes.js';
|
|
|
2
2
|
export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").StylesGetter<{
|
|
3
3
|
root(t: SideMenuTheme): string;
|
|
4
4
|
rootCollapsedDesktop(t: SideMenuTheme): string;
|
|
5
|
+
rootOpeningDesktop(t: SideMenuTheme): string;
|
|
5
6
|
rootTabletAndMobile(t: SideMenuTheme): string;
|
|
6
7
|
rootCollapsedTabletAndMobile(): string;
|
|
7
8
|
rootWithSeparatedMenuShownMobile(t: SideMenuTheme): string;
|
|
8
9
|
fixedRoot(t: SideMenuTheme): string;
|
|
10
|
+
fixedRootTabletAndMobile(t: SideMenuTheme): string;
|
|
9
11
|
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { memoizeGetStyles } from '../../lib/theming/ThemeHelpers.js';
|
|
3
|
+
import { compactDesktopMenu } from '../SideMenu/SideMenu.styles.js';
|
|
3
4
|
export var getStyles = memoizeGetStyles(function (_a) {
|
|
4
5
|
var css = _a.css;
|
|
5
6
|
return ({
|
|
@@ -9,18 +10,24 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
9
10
|
rootCollapsedDesktop: function (t) {
|
|
10
11
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-top: ", ";\n padding-bottom: ", ";\n "], ["\n padding-top: ", ";\n padding-bottom: ", ";\n "])), t.sideMenuHeaderPaddingTopCollapsed, t.sideMenuHeaderPaddingBottomCollapsed);
|
|
11
12
|
},
|
|
13
|
+
rootOpeningDesktop: function (t) {
|
|
14
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), compactDesktopMenu(t, "padding-top: ".concat(t.sideMenuHeaderPaddingTopCollapsed, "; padding-bottom: ").concat(t.sideMenuHeaderPaddingBottomCollapsed, ";")));
|
|
15
|
+
},
|
|
12
16
|
rootTabletAndMobile: function (t) {
|
|
13
|
-
return css(
|
|
17
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding-top: ", ";\n margin-left: ", ";\n "], ["\n padding-top: ", ";\n margin-left: ", ";\n "])), t.sideMenuHeaderPaddingTopTabletAndMobile, t.sideMenuHeaderMarginLeftTabletAndMobile);
|
|
14
18
|
},
|
|
15
19
|
rootCollapsedTabletAndMobile: function () {
|
|
16
|
-
return css(
|
|
20
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background: transparent;\n "], ["\n background: transparent;\n "])));
|
|
17
21
|
},
|
|
18
22
|
rootWithSeparatedMenuShownMobile: function (t) {
|
|
19
|
-
return css(
|
|
23
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background: ", ";\n z-index: 9000;\n "], ["\n background: ", ";\n z-index: 9000;\n "])), t.sideMenuSeparatedSubMenuBg);
|
|
20
24
|
},
|
|
21
25
|
fixedRoot: function (t) {
|
|
22
|
-
return css(
|
|
26
|
+
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n &::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-top: 1px solid ", ";\n }\n "], ["\n &::after {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-top: 1px solid ", ";\n }\n "])), t.sideMenuHeaderDividerColor);
|
|
27
|
+
},
|
|
28
|
+
fixedRootTabletAndMobile: function (t) {
|
|
29
|
+
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n &::after {\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n }\n "], ["\n &::after {\n left: calc(", " - ", ");\n right: calc(", " - ", ");\n }\n "])), t.sideMenuMarginX, t.sideMenuHeaderMarginLeftTabletAndMobile, t.sideMenuHeaderMarginLeftTabletAndMobile, t.sideMenuMarginX);
|
|
23
30
|
},
|
|
24
31
|
});
|
|
25
32
|
});
|
|
26
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
33
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
|
@@ -2,7 +2,6 @@ import { __awaiter, __generator } from "tslib";
|
|
|
2
2
|
import { IconXRegular20 } from '@skbkontur/icons/IconXRegular20';
|
|
3
3
|
import { createFailure, createSuccess, isFailure } from '@skbkontur/operation-result';
|
|
4
4
|
import { Button } from '@skbkontur/react-ui/components/Button/Button';
|
|
5
|
-
import { Center } from '@skbkontur/react-ui/components/Center/Center';
|
|
6
5
|
import { Spinner } from '@skbkontur/react-ui/components/Spinner/Spinner';
|
|
7
6
|
import { useStyles, useEmotion } from '@skbkontur/react-ui/lib/renderEnvironment';
|
|
8
7
|
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
@@ -11,9 +10,11 @@ import React, { useContext } from 'react';
|
|
|
11
10
|
import { SideMenuTheme } from '../../internal/themes/SideMenuTheme.js';
|
|
12
11
|
import { getSideMenuTheme } from '../../lib/theming/ThemeHelpers.js';
|
|
13
12
|
import { SideMenuDataTids } from '../../SideMenuDataTids.js';
|
|
13
|
+
import { SideMenuContext } from '../SideMenuContext.js';
|
|
14
14
|
import { BellWidgetError } from './BellWidgetError.js';
|
|
15
15
|
import { getCustomStyles, getStyles } from './BellWidgetView.styles.js';
|
|
16
16
|
import { BELL_SIDE_MENU_DATA_ITEM } from './SideMenuNotifications.js';
|
|
17
|
+
import { getWrapperHeightClass } from './utils/getWrapperHeightClass.js';
|
|
17
18
|
var getBtnTopPosition = function () {
|
|
18
19
|
var _a;
|
|
19
20
|
var bellDropDownItem = document.querySelector("[data-item=\"".concat(BELL_SIDE_MENU_DATA_ITEM, "\"]"));
|
|
@@ -22,6 +23,8 @@ var getBtnTopPosition = function () {
|
|
|
22
23
|
export var BellWidget = function (props) {
|
|
23
24
|
var widgetApi = props.widgetApi, onClose = props.onClose, renderErrorButton = props.renderErrorButton, renderErrorMessage = props.renderErrorMessage, onError = props.onError, redirect = props.redirect;
|
|
24
25
|
var theme = getSideMenuTheme(useContext(ThemeContext));
|
|
26
|
+
var context = useContext(SideMenuContext);
|
|
27
|
+
var isMobile = Boolean(context.isMobile);
|
|
25
28
|
var styles = useStyles(getStyles);
|
|
26
29
|
var customStyles = useStyles(getCustomStyles);
|
|
27
30
|
var cx = useEmotion().cx;
|
|
@@ -72,16 +75,20 @@ export var BellWidget = function (props) {
|
|
|
72
75
|
var buttonCloseTheme = {
|
|
73
76
|
btnBorderRadiusMedium: '20px',
|
|
74
77
|
};
|
|
75
|
-
var wrapperHeightClass =
|
|
76
|
-
|
|
77
|
-
:
|
|
78
|
-
|
|
78
|
+
var wrapperHeightClass = getWrapperHeightClass({
|
|
79
|
+
hasCustomWrapperHeight: hasCustomWrapperHeight,
|
|
80
|
+
theme: theme,
|
|
81
|
+
isMobile: isMobile,
|
|
82
|
+
btnTopPosition: btnTopPosition,
|
|
83
|
+
customStyles: customStyles,
|
|
84
|
+
});
|
|
85
|
+
return (React.createElement("div", { className: cx(styles.root(), isMobile ? styles.rootMobile() : styles.rootDesktop(), wrapperHeightClass) },
|
|
79
86
|
React.createElement("div", { className: styles.header(), "data-tid": SideMenuDataTids.bellHeader },
|
|
80
87
|
React.createElement("span", { className: styles.headerText() }, "\u0423\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F"),
|
|
81
88
|
React.createElement(Button, { use: "text", size: "medium", width: 40, icon: React.createElement(IconXRegular20, null), onClick: onClose, theme: buttonCloseTheme, "data-tid": SideMenuDataTids.bellCloseButton, "aria-label": "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F" })),
|
|
82
89
|
React.createElement(WidgetRenderer, { renderWidget: renderWidget, renderFault: function (_a) {
|
|
83
90
|
var fault = _a.fault, retryRender = _a.retryRender;
|
|
84
91
|
return (React.createElement(BellWidgetError, { renderErrorButton: renderErrorButton, error: fault, renderErrorMessage: renderErrorMessage, retryRender: retryRender }));
|
|
85
|
-
}, loader: React.createElement(
|
|
92
|
+
}, loader: React.createElement("div", { className: styles.centeredContent() },
|
|
86
93
|
React.createElement(Spinner, { caption: "\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043C \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F..." })) })));
|
|
87
94
|
};
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
+
import * as colors from '@skbkontur/colors/tokens-default/light';
|
|
1
2
|
import { EmptyState } from '@skbkontur/empty-state';
|
|
2
3
|
import { IconArrowUiAuthLoginRegular64 } from '@skbkontur/icons/IconArrowUiAuthLoginRegular64';
|
|
3
4
|
import { IconWarningTriangleSolid64 } from '@skbkontur/icons/IconWarningTriangleSolid64';
|
|
4
|
-
import {
|
|
5
|
+
import { useStyles } from '@skbkontur/react-ui/lib/renderEnvironment';
|
|
5
6
|
import React from 'react';
|
|
7
|
+
import { getStyles } from './BellWidgetView.styles.js';
|
|
6
8
|
import { getErrorMessages } from './utils/getNotificationsErrorMessages.js';
|
|
7
9
|
export var BellWidgetError = function (_a) {
|
|
8
10
|
var renderErrorButton = _a.renderErrorButton, error = _a.error, renderErrorMessage = _a.renderErrorMessage, retryRender = _a.retryRender;
|
|
11
|
+
var styles = useStyles(getStyles);
|
|
9
12
|
if (renderErrorMessage) {
|
|
10
13
|
return React.createElement(React.Fragment, null, renderErrorMessage(error, retryRender));
|
|
11
14
|
}
|
|
12
15
|
var isNotAuthorizedError = error.type === 'userNotAuthorized';
|
|
13
16
|
var errorButton = renderErrorButton === null || renderErrorButton === void 0 ? void 0 : renderErrorButton(error, retryRender);
|
|
14
17
|
var _b = getErrorMessages(isNotAuthorizedError), titleMessage = _b.titleMessage, errorMessage = _b.errorMessage;
|
|
15
|
-
var icon = isNotAuthorizedError ? (React.createElement(IconArrowUiAuthLoginRegular64, { color:
|
|
16
|
-
return (React.createElement(
|
|
18
|
+
var icon = isNotAuthorizedError ? (React.createElement(IconArrowUiAuthLoginRegular64, { color: colors.shapeBoldWarning })) : (React.createElement(IconWarningTriangleSolid64, { color: colors.shapeBoldWarning }));
|
|
19
|
+
return (React.createElement("div", { className: styles.centeredContent() },
|
|
17
20
|
React.createElement(EmptyState, { use: "status" },
|
|
18
21
|
React.createElement(EmptyState.Header, { icon: icon }, titleMessage),
|
|
19
22
|
React.createElement(EmptyState.Body, null, errorMessage),
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { type Emotion } from '../../lib/theming/ThemeHelpers.js';
|
|
2
2
|
export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").StylesGetter<{
|
|
3
3
|
root(): string;
|
|
4
|
+
rootMobile(): string;
|
|
5
|
+
rootDesktop(): string;
|
|
4
6
|
widgetWrapper(): string;
|
|
7
|
+
centeredContent(): string;
|
|
5
8
|
header(): string;
|
|
6
9
|
headerText(): string;
|
|
7
10
|
}>;
|
|
8
|
-
interface CustomStyles {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
export interface CustomStyles {
|
|
12
|
+
defaultHeightDesktop: (offsetTop: number) => string;
|
|
13
|
+
defaultHeightMobile: (mobilePopupHeightOffset: string) => string;
|
|
14
|
+
customHeight: (value?: string) => string;
|
|
11
15
|
}
|
|
12
16
|
export declare const getCustomStyles: ({ css }: Emotion) => CustomStyles;
|
|
13
|
-
export {};
|
|
@@ -4,31 +4,42 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
4
4
|
var css = _a.css;
|
|
5
5
|
return ({
|
|
6
6
|
root: function () {
|
|
7
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: 400px;\n max-height: 784px;\n
|
|
7
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: 400px;\n max-height: 784px;\n max-width: 100vw;\n "], ["\n display: flex;\n flex-direction: column;\n min-height: 400px;\n max-height: 784px;\n max-width: 100vw;\n "])));
|
|
8
|
+
},
|
|
9
|
+
rootMobile: function () {
|
|
10
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n "], ["\n width: 100%;\n "])));
|
|
11
|
+
},
|
|
12
|
+
rootDesktop: function () {
|
|
13
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 448px;\n "], ["\n width: 448px;\n "])));
|
|
8
14
|
},
|
|
9
15
|
widgetWrapper: function () {
|
|
10
|
-
return css(
|
|
16
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n min-height: 0;\n flex-grow: 1;\n "], ["\n min-height: 0;\n flex-grow: 1;\n "])));
|
|
17
|
+
},
|
|
18
|
+
centeredContent: function () {
|
|
19
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex: 1;\n min-height: 0;\n overflow: auto;\n align-items: center;\n justify-content: center;\n "], ["\n display: flex;\n flex: 1;\n min-height: 0;\n overflow: auto;\n align-items: center;\n justify-content: center;\n "])));
|
|
11
20
|
},
|
|
12
21
|
header: function () {
|
|
13
|
-
return css(
|
|
22
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n padding: 6px 6px 0 20px;\n align-items: center;\n justify-content: space-between;\n "], ["\n display: flex;\n padding: 6px 6px 0 20px;\n align-items: center;\n justify-content: space-between;\n "])));
|
|
14
23
|
},
|
|
15
24
|
headerText: function () {
|
|
16
|
-
return css(
|
|
25
|
+
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n font-size: 18px;\n line-height: 24px;\n font-weight: 700;\n "], ["\n font-size: 18px;\n line-height: 24px;\n font-weight: 700;\n "])));
|
|
17
26
|
},
|
|
18
27
|
});
|
|
19
28
|
});
|
|
20
29
|
export var getCustomStyles = function (_a) {
|
|
21
30
|
var css = _a.css;
|
|
22
31
|
return ({
|
|
23
|
-
|
|
24
|
-
if (offsetTop === void 0) { offsetTop = 0; }
|
|
32
|
+
defaultHeightDesktop: function (offsetTop) {
|
|
25
33
|
var offsetBottom = '20px';
|
|
26
|
-
return css(
|
|
34
|
+
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n height: calc(100vh - ", "px - ", ");\n "], ["\n height: calc(100vh - ", "px - ", ");\n "])), offsetTop, offsetBottom);
|
|
35
|
+
},
|
|
36
|
+
defaultHeightMobile: function (mobilePopupHeightOffset) {
|
|
37
|
+
return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n height: calc(100vh - (", "));\n max-height: calc(100vh - (", "));\n\n @supports (height: 100dvh) {\n height: calc(100dvh - (", "));\n max-height: calc(100dvh - (", "));\n }\n "], ["\n height: calc(100vh - (", "));\n max-height: calc(100vh - (", "));\n\n @supports (height: 100dvh) {\n height: calc(100dvh - (", "));\n max-height: calc(100dvh - (", "));\n }\n "])), mobilePopupHeightOffset, mobilePopupHeightOffset, mobilePopupHeightOffset, mobilePopupHeightOffset);
|
|
27
38
|
},
|
|
28
39
|
customHeight: function (value) {
|
|
29
40
|
if (value === void 0) { value = ''; }
|
|
30
|
-
return css(
|
|
41
|
+
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n height: ", ";\n "], ["\n height: ", ";\n "])), value);
|
|
31
42
|
},
|
|
32
43
|
});
|
|
33
44
|
};
|
|
34
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
45
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SideMenuTheme } from '../../../lib/theming/ThemeTypes.js';
|
|
2
|
+
import type { CustomStyles } from '../BellWidgetView.styles.js';
|
|
3
|
+
interface GetWrapperHeightClassParameters {
|
|
4
|
+
hasCustomWrapperHeight: boolean;
|
|
5
|
+
theme: SideMenuTheme;
|
|
6
|
+
isMobile: boolean;
|
|
7
|
+
btnTopPosition: number;
|
|
8
|
+
customStyles: CustomStyles;
|
|
9
|
+
}
|
|
10
|
+
export declare const getWrapperHeightClass: ({ hasCustomWrapperHeight, theme, isMobile, btnTopPosition, customStyles, }: GetWrapperHeightClassParameters) => string;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var getWrapperHeightClass = function (_a) {
|
|
2
|
+
var hasCustomWrapperHeight = _a.hasCustomWrapperHeight, theme = _a.theme, isMobile = _a.isMobile, btnTopPosition = _a.btnTopPosition, customStyles = _a.customStyles;
|
|
3
|
+
if (hasCustomWrapperHeight) {
|
|
4
|
+
return customStyles.customHeight(theme.sideMenuNotificationsWrapperHeight);
|
|
5
|
+
}
|
|
6
|
+
if (isMobile) {
|
|
7
|
+
return customStyles.defaultHeightMobile(theme.sideMenuNotificationsMobilePopupHeightOffset);
|
|
8
|
+
}
|
|
9
|
+
return customStyles.defaultHeightDesktop(btnTopPosition);
|
|
10
|
+
};
|
|
@@ -16,6 +16,7 @@ var SideMenuSubItemHeaderInner = forwardRef(function (_a, ref) {
|
|
|
16
16
|
_b[styles.rootWithoutItemIcons(theme)] = context.isOpened && !context.isSeparatedMenu && !context.hasItemIcons,
|
|
17
17
|
_b[styles.rootInDropdown()] = !context.isOpened && !context.isSeparatedMenu,
|
|
18
18
|
_b[styles.rootInSeparatedSubMenu(theme)] = context.isSeparatedMenu,
|
|
19
|
+
_b[styles.rootInSeparatedSubMenuLarge(theme)] = context.isSeparatedMenu && context.size === 'large',
|
|
19
20
|
_b), className), ref: ref }, rest), children));
|
|
20
21
|
});
|
|
21
22
|
SideMenuSubItemHeaderInner.displayName = 'SideMenuSubItemHeader';
|
|
@@ -3,5 +3,6 @@ export declare const getStyles: import("../../lib/theming/ThemeHelpers.js").Styl
|
|
|
3
3
|
root(t: SideMenuTheme): string;
|
|
4
4
|
rootWithoutItemIcons(t: SideMenuTheme): string;
|
|
5
5
|
rootInDropdown(): string;
|
|
6
|
+
rootInSeparatedSubMenuLarge(t: SideMenuTheme): string;
|
|
6
7
|
rootInSeparatedSubMenu(t: SideMenuTheme): string;
|
|
7
8
|
}>;
|
|
@@ -12,9 +12,12 @@ export var getStyles = memoizeGetStyles(function (_a) {
|
|
|
12
12
|
rootInDropdown: function () {
|
|
13
13
|
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: 12px 8px 4px 8px;\n "], ["\n padding: 12px 8px 4px 8px;\n "])));
|
|
14
14
|
},
|
|
15
|
+
rootInSeparatedSubMenuLarge: function (t) {
|
|
16
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: ", ";\n line-height: ", ";\n "], ["\n font-size: ", ";\n line-height: ", ";\n "])), t.sideMenuSubItemHeaderFontSizeLargeInSeparatedSubMenu, t.sideMenuSubItemHeaderLineHeightLargeInSeparatedSubMenu);
|
|
17
|
+
},
|
|
15
18
|
rootInSeparatedSubMenu: function (t) {
|
|
16
|
-
return css(
|
|
19
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding: ", ";\n line-height: 16px;\n color: ", ";\n "], ["\n padding: ", ";\n line-height: 16px;\n color: ", ";\n "])), t.sideMenuSubItemHeaderPaddingInSeparatedSubMenu, t.sideMenuSubItemHeaderColorInSeparatedSubMenu);
|
|
17
20
|
},
|
|
18
21
|
});
|
|
19
22
|
});
|
|
20
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
23
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -5,7 +5,7 @@ export interface CommonClickableElementProps extends CommonProps {
|
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
/** Иконка. */
|
|
7
7
|
icon?: React.ReactElement;
|
|
8
|
-
/** Визуальный маркер. */
|
|
8
|
+
/** Визуальный маркер. Числа больше 99 отображаются как «99+». Строки отображаются как переданы. */
|
|
9
9
|
marker?: ReactNode;
|
|
10
10
|
/** Заголовок элемента. */
|
|
11
11
|
caption?: ReactNode;
|
|
@@ -37,6 +37,8 @@ export interface CommonClickableElementProps extends CommonProps {
|
|
|
37
37
|
_isAvatar?: boolean;
|
|
38
38
|
/** @ignore */
|
|
39
39
|
_isBackButton?: boolean;
|
|
40
|
+
/** @ignore */
|
|
41
|
+
_generatedId?: string;
|
|
40
42
|
}
|
|
41
43
|
export interface ClickableElementProps extends CommonClickableElementProps {
|
|
42
44
|
element: 'a' | 'button' | React.ComponentType<any>;
|