@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.
- package/CHANGELOG.md +11 -0
- package/hooks/useAnimateOnMount.js +8 -9
- package/hooks/useMemoIcon.js +9 -10
- package/index.js +1 -1
- package/internal/themes/SideMenuTheme.js +200 -278
- package/lib/theming/ThemeHelpers.js +23 -38
- package/lib/utils/memo.js +3 -3
- package/lib/utils/scripts.js +4 -4
- package/package.json +3 -3
- package/src/Navigation.js +73 -118
- package/src/SideMenu/SideMenu.js +175 -181
- package/src/SideMenu/SideMenu.styles.js +140 -71
- package/src/SideMenuAvatar/SideMenuAvatar.d.ts +1 -1
- package/src/SideMenuAvatar/SideMenuAvatar.js +9 -10
- package/src/SideMenuBody/SideMenuBody.js +16 -18
- package/src/SideMenuBody/SideMenuBody.styles.js +13 -9
- package/src/SideMenuContext.d.ts +1 -1
- package/src/SideMenuContext.js +1 -1
- package/src/SideMenuDivider/SideMenuDivider.js +9 -11
- package/src/SideMenuDivider/SideMenuDivider.styles.js +10 -7
- package/src/SideMenuDropdown/SideMenuDropdown.d.ts +1 -1
- package/src/SideMenuDropdown/SideMenuDropdown.js +29 -33
- package/src/SideMenuDropdown/SideMenuDropdown.styles.js +21 -14
- package/src/SideMenuFooter/SideMenuFooter.js +19 -21
- package/src/SideMenuFooter/SideMenuFooter.styles.js +21 -11
- package/src/SideMenuHeader/SideMenuHeader.js +24 -28
- package/src/SideMenuHeader/SideMenuHeader.styles.js +30 -15
- package/src/SideMenuItem/SideMenuItem.js +5 -6
- package/src/SideMenuLink/SideMenuLink.js +7 -9
- package/src/SideMenuLink/SideMenuLink.styles.js +7 -6
- package/src/SideMenuNotifications/BellWidget.js +50 -71
- package/src/SideMenuNotifications/BellWidgetError.js +12 -13
- package/src/SideMenuNotifications/BellWidgetView.styles.js +43 -18
- package/src/SideMenuNotifications/SideMenuNotifications.js +22 -23
- package/src/SideMenuNotifications/utils/getNotificationsErrorMessages.js +11 -11
- package/src/SideMenuOrganisations/SideMenuOrganisations.js +5 -6
- package/src/SideMenuSubItem/SideMenuSubItem.js +5 -6
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +14 -16
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +14 -9
- package/src/SideMenuSubLink/SideMenuSubLink.js +5 -5
- package/src/Tree.js +34 -110
- package/src/internal/BackButton.js +13 -16
- package/src/internal/Backdrop.js +13 -11
- package/src/internal/Backdrop.styles.js +12 -7
- package/src/internal/Burger.js +11 -11
- package/src/internal/Burger.styles.js +10 -8
- package/src/internal/ClickableElement.js +90 -82
- package/src/internal/ClickableElement.styles.js +44 -20
- package/src/internal/InnerSubMenu.js +12 -14
- package/src/internal/ItemContent/Caption.js +43 -47
- package/src/internal/ItemContent/Caption.styles.js +78 -33
- package/src/internal/ItemContent/Icon.js +24 -26
- package/src/internal/ItemContent/Icon.styles.js +45 -19
- package/src/internal/ItemContent/ItemContent.js +37 -40
- package/src/internal/ItemContent/ItemContent.styles.js +61 -27
- package/src/internal/ItemContent/Marker.js +19 -21
- package/src/internal/ItemContent/Marker.styles.js +55 -21
- package/src/internal/NestedMenu.js +17 -19
- package/src/internal/NestedMenu.styles.js +7 -7
- package/src/internal/RightBorder.js +21 -22
- package/src/internal/RightBorder.styles.js +22 -9
- package/src/internal/SeparatedSubMenu.js +43 -48
- package/src/internal/SeparatedSubMenu.styles.js +53 -27
- package/src/internal/SideMenuLogotype.js +43 -47
- package/src/internal/SideMenuLogotype.styles.js +44 -20
- package/src/internal/SubMenu.js +10 -12
|
@@ -1,80 +1,149 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.jsStylesForSideMenu = exports.customStyles = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
return (0, Emotion_1.css)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
return (0, Emotion_1.css)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return (0, Emotion_1.css)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
4
|
+
const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
|
|
5
|
+
const ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
|
|
6
|
+
const SideMenu_1 = require("./SideMenu");
|
|
7
|
+
const styles = {
|
|
8
|
+
root() {
|
|
9
|
+
return (0, Emotion_1.css) `
|
|
10
|
+
position: relative;
|
|
11
|
+
height: 100%;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
`;
|
|
14
|
+
},
|
|
15
|
+
shownRootForTabletsOrMobiles() {
|
|
16
|
+
return (0, Emotion_1.css) `
|
|
17
|
+
@supports (height: 100dvh) {
|
|
18
|
+
height: 100dvh;
|
|
19
|
+
}
|
|
20
|
+
position: absolute;
|
|
21
|
+
height: 100%;
|
|
22
|
+
`;
|
|
23
|
+
},
|
|
24
|
+
transitionedRootForTabletsOrMobiles() {
|
|
25
|
+
return (0, Emotion_1.css) `
|
|
26
|
+
position: absolute;
|
|
27
|
+
`;
|
|
28
|
+
},
|
|
29
|
+
rootForNarrowDesktops(t) {
|
|
30
|
+
return (0, Emotion_1.css) `
|
|
31
|
+
width: ${t.sideMenuMinimizedWidth};
|
|
32
|
+
`;
|
|
33
|
+
},
|
|
34
|
+
separatedRootForNarrowDesktops(t) {
|
|
35
|
+
return (0, Emotion_1.css) `
|
|
36
|
+
width: calc(${t.sideMenuMinimizedWidth} + ${t.sideMenuWidth});
|
|
37
|
+
background: ${t.sideMenuSeparatedSubMenuBgColor};
|
|
38
|
+
`;
|
|
39
|
+
},
|
|
40
|
+
separatedRootForTouchScreens(t) {
|
|
41
|
+
return (0, Emotion_1.css) `
|
|
42
|
+
width: calc(${t.sideMenuMinimizedWidth} + ${t.sideMenuWidthForTouchScreens});
|
|
43
|
+
background: ${t.sideMenuSeparatedSubMenuBgColor};
|
|
44
|
+
`;
|
|
45
|
+
},
|
|
46
|
+
separatedRootForTouchScreensForDesktops(t) {
|
|
47
|
+
return (0, Emotion_1.css) `
|
|
48
|
+
width: calc(${t.sideMenuWidthForTouchScreens} + ${t.sideMenuWidthForTouchScreens});
|
|
49
|
+
background: ${t.sideMenuSeparatedSubMenuBgColor};
|
|
50
|
+
`;
|
|
51
|
+
},
|
|
52
|
+
separatedRootForDesktops(t) {
|
|
53
|
+
return (0, Emotion_1.css) `
|
|
54
|
+
width: calc(${t.sideMenuWidth} + ${t.sideMenuWidth});
|
|
55
|
+
background: ${t.sideMenuSeparatedSubMenuBgColor};
|
|
56
|
+
`;
|
|
57
|
+
},
|
|
58
|
+
container(t) {
|
|
59
|
+
return (0, Emotion_1.css) `
|
|
60
|
+
width: ${t.sideMenuWidth};
|
|
61
|
+
height: 100%;
|
|
62
|
+
background: ${t.sideMenuBgColor};
|
|
63
|
+
position: relative;
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
transition: width ${SideMenu_1.transitionDuration}ms ease-out;
|
|
66
|
+
`;
|
|
67
|
+
},
|
|
68
|
+
minimizedContainer(t) {
|
|
69
|
+
return (0, Emotion_1.css) `
|
|
70
|
+
width: ${t.sideMenuMinimizedWidth} !important;
|
|
71
|
+
`;
|
|
72
|
+
},
|
|
73
|
+
containerForTouchScreens(t) {
|
|
74
|
+
return (0, Emotion_1.css) `
|
|
75
|
+
width: ${t.sideMenuWidthForTouchScreens};
|
|
76
|
+
`;
|
|
77
|
+
},
|
|
78
|
+
separatedContainerForMobiles(t) {
|
|
79
|
+
return (0, Emotion_1.css) `
|
|
80
|
+
background: ${t.sideMenuSeparatedSubMenuBgColor};
|
|
81
|
+
`;
|
|
82
|
+
},
|
|
83
|
+
contentWrapper(t) {
|
|
84
|
+
return (0, Emotion_1.css) `
|
|
85
|
+
min-height: 100%;
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
justify-content: space-between;
|
|
89
|
+
width: ${t.sideMenuWidth};
|
|
90
|
+
`;
|
|
91
|
+
},
|
|
92
|
+
contentWrapperForTouchScreens(t) {
|
|
93
|
+
return (0, Emotion_1.css) `
|
|
94
|
+
width: ${t.sideMenuWidthForTouchScreens};
|
|
95
|
+
`;
|
|
96
|
+
},
|
|
97
|
+
minimizedContentWrapper() {
|
|
98
|
+
return (0, Emotion_1.css) `
|
|
99
|
+
width: 100%;
|
|
100
|
+
`;
|
|
101
|
+
},
|
|
102
|
+
wrapper() {
|
|
103
|
+
return (0, Emotion_1.css) `
|
|
104
|
+
height: 100%;
|
|
105
|
+
display: inline-flex;
|
|
106
|
+
position: relative;
|
|
107
|
+
`;
|
|
108
|
+
},
|
|
109
|
+
wrapperIE() {
|
|
110
|
+
const ieRootWrapperCorrection = 15;
|
|
111
|
+
return (0, Emotion_1.css) `
|
|
112
|
+
position: relative;
|
|
113
|
+
top: -${ieRootWrapperCorrection};
|
|
114
|
+
height: calc(100% + ${ieRootWrapperCorrection});
|
|
115
|
+
`;
|
|
116
|
+
},
|
|
117
|
+
wrapperWithShadow(t) {
|
|
118
|
+
return (0, Emotion_1.css) `
|
|
119
|
+
box-shadow: ${t.sideMenuBoxShadow};
|
|
120
|
+
`;
|
|
121
|
+
},
|
|
122
|
+
collapsedContainerForTabletsOrMobiles() {
|
|
123
|
+
return (0, Emotion_1.css) `
|
|
124
|
+
background-color: transparent;
|
|
125
|
+
`;
|
|
126
|
+
},
|
|
127
|
+
list() {
|
|
128
|
+
return (0, Emotion_1.css) `
|
|
129
|
+
list-style: none;
|
|
130
|
+
padding: 0;
|
|
131
|
+
margin: 0;
|
|
132
|
+
`;
|
|
133
|
+
},
|
|
134
|
+
hidden() {
|
|
135
|
+
return (0, Emotion_1.css) `
|
|
136
|
+
display: none;
|
|
137
|
+
`;
|
|
72
138
|
},
|
|
73
139
|
};
|
|
74
140
|
exports.customStyles = {
|
|
75
|
-
rootForTabletsOrMobiles
|
|
76
|
-
return (0, Emotion_1.css)
|
|
141
|
+
rootForTabletsOrMobiles(headerHeight) {
|
|
142
|
+
return (0, Emotion_1.css) `
|
|
143
|
+
height: ${headerHeight}px;
|
|
144
|
+
top: 0;
|
|
145
|
+
transition: height ${SideMenu_1.burgerTransitionDuration}ms ease-out;
|
|
146
|
+
`;
|
|
77
147
|
},
|
|
78
148
|
};
|
|
79
149
|
exports.jsStylesForSideMenu = (0, ThemeHelpers_1.memoizeStyle)(styles);
|
|
80
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { UserAvatarProps } from '@skbkontur/react-ui-addons/';
|
|
2
|
+
import type { UserAvatarProps } from '@skbkontur/react-ui-addons/components/UserAvatar';
|
|
3
3
|
import type { SideMenuDropdownProps } from '../SideMenuDropdown/SideMenuDropdown';
|
|
4
4
|
export interface SideMenuAvatarProps extends Omit<UserAvatarProps, 'style'>, Omit<SideMenuDropdownProps, 'icon'>, Partial<Pick<SideMenuDropdownProps, 'icon' | 'onOpen' | 'onClose'>> {
|
|
5
5
|
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SideMenuAvatar = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return (react_1.default.createElement(SideMenuDropdown_1.SideMenuDropdown, tslib_1.__assign({ icon: react_1.default.createElement(react_ui_addons_1.UserAvatar, { userName: userName, avatarUrl: avatarUrl, style: { width: theme.sideMenuAvatarSize, height: theme.sideMenuAvatarSize } }), caption: userName || caption, menuWidth: menuWidth, positions: ['top left'], _isAvatar: true, ref: ref }, rest), children));
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const UserAvatar_1 = require("@skbkontur/react-ui-addons/components/UserAvatar");
|
|
7
|
+
const ThemeContext_1 = require("@skbkontur/react-ui/lib/theming/ThemeContext");
|
|
8
|
+
const SideMenuDropdown_1 = require("../SideMenuDropdown/SideMenuDropdown");
|
|
9
|
+
const ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
|
|
10
|
+
const SideMenuAvatarInner = (0, react_1.forwardRef)(({ userName, avatarUrl, children, icon, caption, menuWidth = 200, ...rest }, ref) => {
|
|
11
|
+
const theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
|
|
12
|
+
return (react_1.default.createElement(SideMenuDropdown_1.SideMenuDropdown, { icon: react_1.default.createElement(UserAvatar_1.UserAvatar, { userName: userName, avatarUrl: avatarUrl, style: { width: theme.sideMenuAvatarSize, height: theme.sideMenuAvatarSize } }), caption: userName || caption, menuWidth: menuWidth, positions: ['top left'], _isAvatar: true, ref: ref, ...rest }, children));
|
|
14
13
|
});
|
|
15
14
|
SideMenuAvatarInner.displayName = 'SideMenuAvatar';
|
|
16
15
|
/**
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SideMenuBody = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_b[SideMenu_styles_1.jsStylesForSideMenu.hidden()] = !context.isOpened && (context.isMobile || context.isTablet),
|
|
20
|
-
_b)) },
|
|
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 SideMenu_styles_1 = require("../SideMenu/SideMenu.styles");
|
|
11
|
+
const SideMenuBody_styles_1 = require("./SideMenuBody.styles");
|
|
12
|
+
const SideMenuBodyInner = (0, react_1.forwardRef)(({ className, children, ...rest }, ref) => {
|
|
13
|
+
const context = (0, react_1.useContext)(SideMenuContext_1.SideMenuContext);
|
|
14
|
+
const theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
|
|
15
|
+
return (react_1.default.createElement("div", { ref: ref, className: (0, Emotion_1.cx)({
|
|
16
|
+
[SideMenuBody_styles_1.jsStyles.root(theme)]: true,
|
|
17
|
+
[SideMenu_styles_1.jsStylesForSideMenu.hidden()]: !context.isOpened && (context.isMobile || context.isTablet),
|
|
18
|
+
}) },
|
|
21
19
|
react_1.default.createElement("nav", null,
|
|
22
|
-
react_1.default.createElement("ul",
|
|
20
|
+
react_1.default.createElement("ul", { className: (0, Emotion_1.cx)({ [SideMenu_styles_1.jsStylesForSideMenu.list()]: true, [SideMenuBody_styles_1.jsStyles.wrapper(theme)]: true }), ...rest }, children))));
|
|
23
21
|
});
|
|
24
22
|
SideMenuBodyInner.displayName = 'SideMenuBody';
|
|
25
23
|
/**
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.jsStyles = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
flex-grow: 1;
|
|
10
|
+
margin: 0 ${t.sideMenuMarginX};
|
|
11
|
+
min-height: 100%;
|
|
12
|
+
`;
|
|
10
13
|
},
|
|
11
|
-
wrapper
|
|
12
|
-
return (0, Emotion_1.css)
|
|
14
|
+
wrapper(t) {
|
|
15
|
+
return (0, Emotion_1.css) `
|
|
16
|
+
padding-bottom: ${t.sideMenuBodyPaddingBottom};
|
|
17
|
+
`;
|
|
13
18
|
},
|
|
14
19
|
};
|
|
15
20
|
exports.jsStyles = (0, ThemeHelpers_1.memoizeStyle)(styles);
|
|
16
|
-
var templateObject_1, templateObject_2;
|
package/src/SideMenuContext.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
-
import type { ScrollContainerScrollStateY } from '@skbkontur/react-ui';
|
|
2
|
+
import type { ScrollContainerScrollStateY } from '@skbkontur/react-ui/components/ScrollContainer';
|
|
3
3
|
import type { showScrollBarType } from './SideMenu/SideMenu';
|
|
4
4
|
import type { MenuNavigation } from './Navigation';
|
|
5
5
|
export interface SideMenuContextType {
|
package/src/SideMenuContext.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SideMenuDivider = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(react_ui_1.ThemeContext));
|
|
14
|
-
return react_1.default.createElement("hr", tslib_1.__assign({ className: (0, Emotion_1.cx)((_b = {}, _b[SideMenuDivider_styles_1.jsStyles.root(theme)] = true, _b), className), ref: ref }, rest));
|
|
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 ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
|
|
9
|
+
const SideMenuDivider_styles_1 = require("./SideMenuDivider.styles");
|
|
10
|
+
const SideMenuDividerInner = (0, react_1.forwardRef)(({ className, ...rest }, ref) => {
|
|
11
|
+
const theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
|
|
12
|
+
return react_1.default.createElement("hr", { className: (0, Emotion_1.cx)({ [SideMenuDivider_styles_1.jsStyles.root(theme)]: true }, className), ref: ref, ...rest });
|
|
15
13
|
});
|
|
16
14
|
SideMenuDividerInner.displayName = 'SideMenuDivider';
|
|
17
15
|
/**
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.jsStyles = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
+
height: 1px;
|
|
10
|
+
border: none;
|
|
11
|
+
background: ${t.sideMenuDividerBgColor};
|
|
12
|
+
margin: ${t.sideMenuDividerMarginY} ${t.sideMenuDividerMarginX};
|
|
13
|
+
`;
|
|
10
14
|
},
|
|
11
15
|
};
|
|
12
16
|
exports.jsStyles = (0, ThemeHelpers_1.memoizeStyle)(styles);
|
|
13
|
-
var templateObject_1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { DropdownMenuProps } from '@skbkontur/react-ui';
|
|
2
|
+
import type { DropdownMenuProps } from '@skbkontur/react-ui/components/DropdownMenu';
|
|
3
3
|
import type { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
|
|
4
4
|
import type { SideMenuItemProps } from '../SideMenuItem/SideMenuItem';
|
|
5
5
|
export interface SideMenuDropdownProps extends CommonProps, Omit<DropdownMenuProps, 'caption' | 'disableAnimations'>, Pick<SideMenuItemProps, 'icon' | 'caption' | 'marker' | 'id' | 'subCaption' | '_isAvatar'> {
|
|
@@ -1,43 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SideMenuDropdown = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(_a = context.handleDropDownOpen) === null || _a === void 0 ? void 0 : _a.call(context);
|
|
20
|
-
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const DropdownMenu_1 = require("@skbkontur/react-ui/components/DropdownMenu");
|
|
7
|
+
const ThemeContext_1 = require("@skbkontur/react-ui/lib/theming/ThemeContext");
|
|
8
|
+
const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
|
|
9
|
+
const SideMenuItem_1 = require("../SideMenuItem/SideMenuItem");
|
|
10
|
+
const SideMenuContext_1 = require("../SideMenuContext");
|
|
11
|
+
const ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
|
|
12
|
+
const SideMenuDropdown_styles_1 = require("./SideMenuDropdown.styles");
|
|
13
|
+
const SideMenuDropdownInner = (0, react_1.forwardRef)(({ icon, id, children, caption, marker, subCaption, className, menuWidth, _isAvatar, onClose, onOpen, ...rest }, ref) => {
|
|
14
|
+
const context = (0, react_1.useContext)(SideMenuContext_1.SideMenuContext);
|
|
15
|
+
const theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
|
|
16
|
+
const handleOpen = () => {
|
|
17
|
+
context.handleDropDownOpen?.();
|
|
18
|
+
onOpen?.();
|
|
21
19
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
(
|
|
25
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
20
|
+
const handleClose = () => {
|
|
21
|
+
context.handleDropDownClose?.();
|
|
22
|
+
onClose?.();
|
|
26
23
|
};
|
|
27
|
-
return (react_1.default.createElement("li", { className: (0, Emotion_1.cx)(
|
|
28
|
-
react_1.default.createElement(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
react_1.default.createElement(SideMenuItem_1.SideMenuItem, { icon: icon, caption: caption, subCaption: subCaption, marker: marker, id: id, _isDropdown: true, _isAvatar: _isAvatar })), positions: ['top left'], disableAnimations: true, menuWidth: menuWidth, onOpen: handleOpen, onClose: handleClose
|
|
24
|
+
return (react_1.default.createElement("li", { className: (0, Emotion_1.cx)({ [SideMenuDropdown_styles_1.jsStyles.wrapper()]: true }, className), ref: ref },
|
|
25
|
+
react_1.default.createElement(DropdownMenu_1.DropdownMenu, { caption: react_1.default.createElement("div", { className: (0, Emotion_1.cx)({
|
|
26
|
+
[SideMenuDropdown_styles_1.jsStyles.label(theme)]: true,
|
|
27
|
+
[SideMenuDropdown_styles_1.jsStyles.labelForTouchScreens(theme)]: context.isTouchScreen,
|
|
28
|
+
[SideMenuDropdown_styles_1.jsStyles.minimizedLabel()]: !context.isOpened,
|
|
29
|
+
}) },
|
|
30
|
+
react_1.default.createElement(SideMenuItem_1.SideMenuItem, { icon: icon, caption: caption, subCaption: subCaption, marker: marker, id: id, _isDropdown: true, _isAvatar: _isAvatar })), positions: ['top left'], disableAnimations: true, menuWidth: menuWidth, onOpen: handleOpen, onClose: handleClose, ...rest }, react_1.default.Children.map(children, (child) => {
|
|
34
31
|
// @ts-expect-error: accessing private property
|
|
35
|
-
if (react_1.default.isValidElement(child) &&
|
|
32
|
+
if (react_1.default.isValidElement(child) && child?.type.__KONTUR_REACT_UI__ === 'MenuItem') {
|
|
36
33
|
return react_1.default.cloneElement(child, {
|
|
37
|
-
onClick:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
(_c = (_b = child.props).onClick) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
34
|
+
onClick: () => {
|
|
35
|
+
context.toggleIsOpened?.();
|
|
36
|
+
child.props.onClick?.();
|
|
41
37
|
},
|
|
42
38
|
});
|
|
43
39
|
}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.jsStyles = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
const Emotion_1 = require("@skbkontur/react-ui/lib/theming/Emotion");
|
|
5
|
+
const ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
|
|
6
|
+
const SideMenu_1 = require("../SideMenu/SideMenu");
|
|
7
|
+
const styles = {
|
|
8
|
+
label(t) {
|
|
9
|
+
return (0, Emotion_1.css) `
|
|
10
|
+
width: calc(${t.sideMenuWidth} - 2 * ${t.sideMenuMarginX});
|
|
11
|
+
transition: width ${SideMenu_1.transitionDuration}ms ease-out;
|
|
12
|
+
`;
|
|
11
13
|
},
|
|
12
|
-
labelForTouchScreens
|
|
13
|
-
return (0, Emotion_1.css)
|
|
14
|
+
labelForTouchScreens(t) {
|
|
15
|
+
return (0, Emotion_1.css) `
|
|
16
|
+
width: calc(${t.sideMenuWidthForTouchScreens} - 2 * ${t.sideMenuMarginX});
|
|
17
|
+
`;
|
|
14
18
|
},
|
|
15
|
-
minimizedLabel
|
|
16
|
-
return (0, Emotion_1.css)
|
|
19
|
+
minimizedLabel() {
|
|
20
|
+
return (0, Emotion_1.css) `
|
|
21
|
+
width: 100%;
|
|
22
|
+
`;
|
|
17
23
|
},
|
|
18
|
-
wrapper
|
|
19
|
-
return (0, Emotion_1.css)
|
|
24
|
+
wrapper() {
|
|
25
|
+
return (0, Emotion_1.css) `
|
|
26
|
+
overflow-x: hidden;
|
|
27
|
+
`;
|
|
20
28
|
},
|
|
21
29
|
};
|
|
22
30
|
exports.jsStyles = (0, ThemeHelpers_1.memoizeStyle)(styles);
|
|
23
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SideMenuFooter = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _c = tslib_1.__read((0, react_1.useState)(false), 2), isFixed = _c[0], setIsFixed = _c[1];
|
|
19
|
-
(0, react_1.useEffect)(function () {
|
|
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 SideMenu_styles_1 = require("../SideMenu/SideMenu.styles");
|
|
10
|
+
const ThemeHelpers_1 = require("../../lib/theming/ThemeHelpers");
|
|
11
|
+
const SideMenuDataTids_1 = require("../../SideMenuDataTids");
|
|
12
|
+
const SideMenuFooter_styles_1 = require("./SideMenuFooter.styles");
|
|
13
|
+
const SideMenuFooterInner = (0, react_1.forwardRef)(({ className, children, ...rest }, ref) => {
|
|
14
|
+
const context = (0, react_1.useContext)(SideMenuContext_1.SideMenuContext);
|
|
15
|
+
const theme = (0, ThemeHelpers_1.getSideMenuTheme)((0, react_1.useContext)(ThemeContext_1.ThemeContext));
|
|
16
|
+
const [isFixed, setIsFixed] = (0, react_1.useState)(false);
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
20
18
|
setIsFixed(!!context.hasScrollBar && !(context.scrollState === 'bottom'));
|
|
21
19
|
}, [context.hasScrollBar, context.scrollState]);
|
|
22
20
|
if (!(context.isMobile || context.isTablet) || (context.isOpened && (context.isMobile || context.isTablet))) {
|
|
23
|
-
return (react_1.default.createElement("footer",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
return (react_1.default.createElement("footer", { "data-tid": SideMenuDataTids_1.SideMenuDataTids.footer, "data-visual-state-fixed": isFixed, className: (0, Emotion_1.cx)({
|
|
22
|
+
[SideMenuFooter_styles_1.jsStyles.root(theme)]: true,
|
|
23
|
+
[SideMenuFooter_styles_1.jsStyles.rootFixed(theme)]: isFixed,
|
|
24
|
+
[SideMenuFooter_styles_1.jsStyles.rootTransitionedForTabletsOrMobiles()]: context.isBeingTransitioned && (context.isMobile || context.isTablet),
|
|
25
|
+
}, className), ref: ref, ...rest },
|
|
28
26
|
react_1.default.createElement("ul", { className: SideMenu_styles_1.jsStylesForSideMenu.list() }, children)));
|
|
29
27
|
}
|
|
30
28
|
return null;
|