@skbkontur/side-menu 0.1.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 +19 -0
- package/README.md +186 -0
- package/index.d.ts +11 -0
- package/index.js +11 -0
- package/package.json +29 -0
- package/src/SideMenu.d.ts +60 -0
- package/src/SideMenu.js +163 -0
- package/src/SideMenu.styles.d.ts +54 -0
- package/src/SideMenu.styles.js +162 -0
- package/src/SideMenuAvatar.d.ts +25 -0
- package/src/SideMenuAvatar.js +47 -0
- package/src/SideMenuBody.d.ts +9 -0
- package/src/SideMenuBody.js +16 -0
- package/src/SideMenuContext.d.ts +15 -0
- package/src/SideMenuContext.js +2 -0
- package/src/SideMenuDivider.d.ts +11 -0
- package/src/SideMenuDivider.js +25 -0
- package/src/SideMenuDropdownMenuSeparator.d.ts +11 -0
- package/src/SideMenuDropdownMenuSeparator.js +25 -0
- package/src/SideMenuFooter.d.ts +9 -0
- package/src/SideMenuFooter.js +7 -0
- package/src/SideMenuHeader.d.ts +31 -0
- package/src/SideMenuHeader.js +86 -0
- package/src/SideMenuItem.d.ts +42 -0
- package/src/SideMenuItem.js +184 -0
- package/src/SideMenuOrganisations.d.ts +15 -0
- package/src/SideMenuOrganisations.js +37 -0
- package/src/SideMenuSubItem.d.ts +20 -0
- package/src/SideMenuSubItem.js +54 -0
- package/src/SideMenuSubItemButtons.d.ts +11 -0
- package/src/SideMenuSubItemButtons.js +25 -0
- package/src/SideMenuSubItemHeader.d.ts +12 -0
- package/src/SideMenuSubItemHeader.js +27 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
2
|
+
import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
+
var styles = {
|
|
4
|
+
root: function () {
|
|
5
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 232px;\n height: 100%;\n background: #f0f0f0;\n padding: 0 16px 24px;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n position: relative;\n box-sizing: border-box;\n transition: width 1s;\n "], ["\n width: 232px;\n height: 100%;\n background: #f0f0f0;\n padding: 0 16px 24px;\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n position: relative;\n box-sizing: border-box;\n transition: width 1s;\n "])));
|
|
6
|
+
},
|
|
7
|
+
rootSafari: function () {
|
|
8
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n &::-webkit-scrollbar {\n display: block;\n width: 10px;\n }\n &::-webkit-scrollbar-track {\n background: #f1f1f1;\n }\n &::-webkit-scrollbar-thumb {\n background: #888;\n }\n "], ["\n &::-webkit-scrollbar {\n display: block;\n width: 10px;\n }\n &::-webkit-scrollbar-track {\n background: #f1f1f1;\n }\n &::-webkit-scrollbar-thumb {\n background: #888;\n }\n "])));
|
|
9
|
+
},
|
|
10
|
+
rootWithoutScrollBar: function () {
|
|
11
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n -ms-overflow-style: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n width: 0;\n "], ["\n -ms-overflow-style: none;\n scrollbar-width: none;\n &::-webkit-scrollbar {\n display: none;\n width: 0;\n "])));
|
|
12
|
+
},
|
|
13
|
+
minimisedRoot: function () {
|
|
14
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 72px !important;\n "], ["\n width: 72px !important;\n "])));
|
|
15
|
+
},
|
|
16
|
+
rootWithInnerSubMenu: function () {
|
|
17
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n overflow-x: hidden;\n "], ["\n overflow-x: hidden;\n "])));
|
|
18
|
+
},
|
|
19
|
+
rootWrapper: function () {
|
|
20
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n height: 100%;\n display: inline-flex;\n "], ["\n height: 100%;\n display: inline-flex;\n "])));
|
|
21
|
+
},
|
|
22
|
+
rootWrapperIE: function () {
|
|
23
|
+
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: relative;\n top: -15px;\n "], ["\n position: relative;\n top: -15px;\n "])));
|
|
24
|
+
},
|
|
25
|
+
rightBorder: function () {
|
|
26
|
+
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n position: relative;\n left: -10px;\n width: 20px;\n background: transparent;\n "], ["\n position: relative;\n left: -10px;\n width: 20px;\n background: transparent;\n "])));
|
|
27
|
+
},
|
|
28
|
+
resizableRightBorder: function () {
|
|
29
|
+
return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n cursor: col-resize;\n "], ["\n cursor: col-resize;\n "])));
|
|
30
|
+
},
|
|
31
|
+
body: function () {
|
|
32
|
+
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n flex-grow: 1;\n padding-bottom: 16px;\n margin-top: 0;\n "], ["\n flex-grow: 1;\n padding-bottom: 16px;\n margin-top: 0;\n "])));
|
|
33
|
+
},
|
|
34
|
+
footer: function () {
|
|
35
|
+
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n flex-grow: 0;\n "], ["\n flex-grow: 0;\n "])));
|
|
36
|
+
},
|
|
37
|
+
headerWrapper: function () {
|
|
38
|
+
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n position: sticky;\n width: 186px;\n top: 0;\n background: #f0f0f0;\n z-index: 1;\n padding: 24px 8px 16px;\n "], ["\n position: sticky;\n width: 186px;\n top: 0;\n background: #f0f0f0;\n z-index: 1;\n padding: 24px 8px 16px;\n "])));
|
|
39
|
+
},
|
|
40
|
+
headerMinimisedWrapper: function () {
|
|
41
|
+
return css(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n width: 54px;\n padding-left: 0 !important;\n padding-right: 0;\n "], ["\n width: 54px;\n padding-left: 0 !important;\n padding-right: 0;\n "])));
|
|
42
|
+
},
|
|
43
|
+
headerFixedWrapper: function () {
|
|
44
|
+
return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n border-bottom: 1px solid #e6e6e6;\n "], ["\n border-bottom: 1px solid #e6e6e6;\n "])));
|
|
45
|
+
},
|
|
46
|
+
item: function () {
|
|
47
|
+
return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n width: 100%;\n background: #f0f0f0;\n border-radius: 8px;\n box-sizing: border-box;\n cursor: pointer;\n &:hover {\n background: #f6f6f6;\n }\n &:focus {\n outline: none;\n }\n "], ["\n width: 100%;\n background: #f0f0f0;\n border-radius: 8px;\n box-sizing: border-box;\n cursor: pointer;\n &:hover {\n background: #f6f6f6;\n }\n &:focus {\n outline: none;\n }\n "])));
|
|
48
|
+
},
|
|
49
|
+
subItem: function () {
|
|
50
|
+
return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n background: #fff;\n "], ["\n background: #fff;\n "])));
|
|
51
|
+
},
|
|
52
|
+
focusedItem: function () {
|
|
53
|
+
return css(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n box-shadow: inset 0 0 0 2px #1c7edf;\n "], ["\n box-shadow: inset 0 0 0 2px #1c7edf;\n "])));
|
|
54
|
+
},
|
|
55
|
+
activeItem: function () {
|
|
56
|
+
return css(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n background: #fff !important;\n "], ["\n background: #fff !important;\n "])));
|
|
57
|
+
},
|
|
58
|
+
activeSubItem: function () {
|
|
59
|
+
return css(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n background: #f2f2f2 !important;\n "], ["\n background: #f2f2f2 !important;\n "])));
|
|
60
|
+
},
|
|
61
|
+
itemWrapper: function () {
|
|
62
|
+
return css(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding-top: 4px;\n padding-bottom: 4px;\n "], ["\n display: flex;\n align-items: center;\n padding-top: 4px;\n padding-bottom: 4px;\n "])));
|
|
63
|
+
},
|
|
64
|
+
itemMultilineWrapper: function () {
|
|
65
|
+
return css(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n padding-top: 8px;\n padding-bottom: 8px;\n "], ["\n padding-top: 8px;\n padding-bottom: 8px;\n "])));
|
|
66
|
+
},
|
|
67
|
+
itemLargeWrapper: function () {
|
|
68
|
+
return css(templateObject_22 || (templateObject_22 = __makeTemplateObject(["\n padding-top: 9px;\n padding-bottom: 9px;\n "], ["\n padding-top: 9px;\n padding-bottom: 9px;\n "])));
|
|
69
|
+
},
|
|
70
|
+
subItemLargeWrapper: function () {
|
|
71
|
+
return css(templateObject_23 || (templateObject_23 = __makeTemplateObject(["\n padding-top: 5px !important;\n padding-bottom: 5px !important;\n "], ["\n padding-top: 5px !important;\n padding-bottom: 5px !important;\n "])));
|
|
72
|
+
},
|
|
73
|
+
itemLargeMultilineWrapper: function () {
|
|
74
|
+
return css(templateObject_24 || (templateObject_24 = __makeTemplateObject(["\n padding-top: 8px;\n padding-bottom: 8px;\n "], ["\n padding-top: 8px;\n padding-bottom: 8px;\n "])));
|
|
75
|
+
},
|
|
76
|
+
itemLargeWrapperWithoutIcon: function () {
|
|
77
|
+
return css(templateObject_25 || (templateObject_25 = __makeTemplateObject(["\n padding-top: 13px !important;\n padding-bottom: 13px !important;\n "], ["\n padding-top: 13px !important;\n padding-bottom: 13px !important;\n "])));
|
|
78
|
+
},
|
|
79
|
+
subItemWrapper: function () {
|
|
80
|
+
return css(templateObject_26 || (templateObject_26 = __makeTemplateObject(["\n padding-top: 4px;\n padding-bottom: 4px;\n "], ["\n padding-top: 4px;\n padding-bottom: 4px;\n "])));
|
|
81
|
+
},
|
|
82
|
+
itemWrapperWithoutIcon: function () {
|
|
83
|
+
return css(templateObject_27 || (templateObject_27 = __makeTemplateObject(["\n min-height: 20px;\n padding-top: 10px !important;\n padding-bottom: 10px !important;\n "], ["\n min-height: 20px;\n padding-top: 10px !important;\n padding-bottom: 10px !important;\n "])));
|
|
84
|
+
},
|
|
85
|
+
itemText: function () {
|
|
86
|
+
return css(templateObject_28 || (templateObject_28 = __makeTemplateObject(["\n line-height: 20px;\n margin-right: 8px;\n "], ["\n line-height: 20px;\n margin-right: 8px;\n "])));
|
|
87
|
+
},
|
|
88
|
+
itemTextTransitioned: function () {
|
|
89
|
+
return css(templateObject_29 || (templateObject_29 = __makeTemplateObject(["\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n "], ["\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n "])));
|
|
90
|
+
},
|
|
91
|
+
itemTextMultiline: function () {
|
|
92
|
+
return css(templateObject_30 || (templateObject_30 = __makeTemplateObject(["\n align-self: flex-start;\n "], ["\n align-self: flex-start;\n "])));
|
|
93
|
+
},
|
|
94
|
+
subItemText: function () {
|
|
95
|
+
return css(templateObject_31 || (templateObject_31 = __makeTemplateObject(["\n margin-left: 4px;\n "], ["\n margin-left: 4px;\n "])));
|
|
96
|
+
},
|
|
97
|
+
itemTextWithoutItemIcon: function () {
|
|
98
|
+
return css(templateObject_32 || (templateObject_32 = __makeTemplateObject(["\n margin-left: 40px;\n "], ["\n margin-left: 40px;\n "])));
|
|
99
|
+
},
|
|
100
|
+
itemTextWithoutColumnIcons: function () {
|
|
101
|
+
return css(templateObject_33 || (templateObject_33 = __makeTemplateObject(["\n margin-left: 12px;\n "], ["\n margin-left: 12px;\n "])));
|
|
102
|
+
},
|
|
103
|
+
subItemTextWithoutColumnIcons: function () {
|
|
104
|
+
return css(templateObject_34 || (templateObject_34 = __makeTemplateObject(["\n margin-left: 8px;\n "], ["\n margin-left: 8px;\n "])));
|
|
105
|
+
},
|
|
106
|
+
itemTextLarge: function () {
|
|
107
|
+
return css(templateObject_35 || (templateObject_35 = __makeTemplateObject(["\n font-size: 16px;\n line-height: 22px;\n "], ["\n font-size: 16px;\n line-height: 22px;\n "])));
|
|
108
|
+
},
|
|
109
|
+
divider: function () {
|
|
110
|
+
return css(templateObject_36 || (templateObject_36 = __makeTemplateObject(["\n background: #d6d6d6;\n height: 1px;\n border: none;\n margin: 4px 8px;\n "], ["\n background: #d6d6d6;\n height: 1px;\n border: none;\n margin: 4px 8px;\n "])));
|
|
111
|
+
},
|
|
112
|
+
icon: function () {
|
|
113
|
+
return css(templateObject_37 || (templateObject_37 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding: 0 8px;\n min-height: 32px;\n line-height: 20px;\n "], ["\n display: flex;\n align-items: center;\n padding: 0 8px;\n min-height: 32px;\n line-height: 20px;\n "])));
|
|
114
|
+
},
|
|
115
|
+
iconMultiline: function () {
|
|
116
|
+
return css(templateObject_38 || (templateObject_38 = __makeTemplateObject(["\n align-self: flex-start;\n align-items: flex-start;\n "], ["\n align-self: flex-start;\n align-items: flex-start;\n "])));
|
|
117
|
+
},
|
|
118
|
+
iconLarge: function () {
|
|
119
|
+
return css(templateObject_39 || (templateObject_39 = __makeTemplateObject(["\n min-height: 30px;\n line-height: 22px;\n "], ["\n min-height: 30px;\n line-height: 22px;\n "])));
|
|
120
|
+
},
|
|
121
|
+
iconSubItemLarge: function () {
|
|
122
|
+
return css(templateObject_40 || (templateObject_40 = __makeTemplateObject(["\n min-height: 22px;\n "], ["\n min-height: 22px;\n "])));
|
|
123
|
+
},
|
|
124
|
+
iconSubItem: function () {
|
|
125
|
+
return css(templateObject_41 || (templateObject_41 = __makeTemplateObject(["\n padding-left: 20px;\n padding-right: 0;\n min-height: 20px;\n line-height: 16px;\n "], ["\n padding-left: 20px;\n padding-right: 0;\n min-height: 20px;\n line-height: 16px;\n "])));
|
|
126
|
+
},
|
|
127
|
+
avatarIcon: function () {
|
|
128
|
+
return css(templateObject_42 || (templateObject_42 = __makeTemplateObject(["\n padding: 0 4px;\n "], ["\n padding: 0 4px;\n "])));
|
|
129
|
+
},
|
|
130
|
+
headerIcon: function () {
|
|
131
|
+
return css(templateObject_43 || (templateObject_43 = __makeTemplateObject(["\n padding: 0 4px;\n "], ["\n padding: 0 4px;\n "])));
|
|
132
|
+
},
|
|
133
|
+
marker: function () {
|
|
134
|
+
return css(templateObject_44 || (templateObject_44 = __makeTemplateObject(["\n padding-right: 6px;\n padding-left: 6px;\n background: #2291ff;\n border-radius: 9999px;\n margin-left: auto;\n margin-right: 8px;\n color: #fff;\n line-height: 20px;\n font-weight: 700;\n "], ["\n padding-right: 6px;\n padding-left: 6px;\n background: #2291ff;\n border-radius: 9999px;\n margin-left: auto;\n margin-right: 8px;\n color: #fff;\n line-height: 20px;\n font-weight: 700;\n "])));
|
|
135
|
+
},
|
|
136
|
+
markerMultiline: function () {
|
|
137
|
+
return css(templateObject_45 || (templateObject_45 = __makeTemplateObject(["\n align-self: flex-start;\n "], ["\n align-self: flex-start;\n "])));
|
|
138
|
+
},
|
|
139
|
+
dropdownMenuSeparator: function () {
|
|
140
|
+
return css(templateObject_46 || (templateObject_46 = __makeTemplateObject(["\n margin: 4px 32px;\n background-color: #ebebeb;\n height: 1px;\n border: 0;\n "], ["\n margin: 4px 32px;\n background-color: #ebebeb;\n height: 1px;\n border: 0;\n "])));
|
|
141
|
+
},
|
|
142
|
+
subItemHeader: function () {
|
|
143
|
+
return css(templateObject_47 || (templateObject_47 = __makeTemplateObject(["\n font-size: 12px;\n color: rgba(0, 0, 0, 0.48);\n padding: 10px 8px 2px 40px;\n "], ["\n font-size: 12px;\n color: rgba(0, 0, 0, 0.48);\n padding: 10px 8px 2px 40px;\n "])));
|
|
144
|
+
},
|
|
145
|
+
separatedMenu: function () {
|
|
146
|
+
return css(templateObject_48 || (templateObject_48 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n background: #fff;\n left: 100%;\n overflow: auto;\n justify-content: flex-start;\n padding-top: 24px;\n "], ["\n position: absolute;\n top: 0;\n background: #fff;\n left: 100%;\n overflow: auto;\n justify-content: flex-start;\n padding-top: 24px;\n "])));
|
|
147
|
+
},
|
|
148
|
+
buttonsGroup: function () {
|
|
149
|
+
return css(templateObject_49 || (templateObject_49 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n padding-bottom: 16px;\n & span:not(:first-child) {\n margin-top: 8px;\n }\n "], ["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n padding-bottom: 16px;\n & span:not(:first-child) {\n margin-top: 8px;\n }\n "])));
|
|
150
|
+
},
|
|
151
|
+
dropdownWrapper: function () {
|
|
152
|
+
return css(templateObject_50 || (templateObject_50 = __makeTemplateObject(["\n overflow-x: hidden;\n "], ["\n overflow-x: hidden;\n "])));
|
|
153
|
+
},
|
|
154
|
+
dropdownLabel: function () {
|
|
155
|
+
return css(templateObject_51 || (templateObject_51 = __makeTemplateObject(["\n width: 200px;\n "], ["\n width: 200px;\n "])));
|
|
156
|
+
},
|
|
157
|
+
subItemMenu: function () {
|
|
158
|
+
return css(templateObject_52 || (templateObject_52 = __makeTemplateObject(["\n padding-left: 16px;\n "], ["\n padding-left: 16px;\n "])));
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
export var jsStyles = memoizeStyle(styles);
|
|
162
|
+
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, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31, templateObject_32, templateObject_33, templateObject_34, templateObject_35, templateObject_36, templateObject_37, templateObject_38, templateObject_39, templateObject_40, templateObject_41, templateObject_42, templateObject_43, templateObject_44, templateObject_45, templateObject_46, templateObject_47, templateObject_48, templateObject_49, templateObject_50, templateObject_51, templateObject_52;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
|
|
3
|
+
import { UserAvatarProps } from '@skbkontur/react-ui-addons/components/UserAvatar';
|
|
4
|
+
declare type SideMenuAvatarInterface = {
|
|
5
|
+
onLogout?: () => void;
|
|
6
|
+
};
|
|
7
|
+
declare type DefaultProps = {
|
|
8
|
+
cabinetUrl: string;
|
|
9
|
+
};
|
|
10
|
+
export declare type SideMenuAvatarProps = CommonProps & UserAvatarProps & SideMenuAvatarInterface & Partial<DefaultProps>;
|
|
11
|
+
declare type SideMenuAvatarComponentProps = CommonProps & UserAvatarProps & SideMenuAvatarInterface & DefaultProps;
|
|
12
|
+
/**
|
|
13
|
+
* Аватар пользователя
|
|
14
|
+
*
|
|
15
|
+
* @visibleName SideMenu.Avatar
|
|
16
|
+
*/
|
|
17
|
+
export declare class SideMenuAvatar extends React.Component<SideMenuAvatarComponentProps> {
|
|
18
|
+
static __KONTUR_REACT_UI__: string;
|
|
19
|
+
static defaultProps: {
|
|
20
|
+
cabinetUrl: string;
|
|
21
|
+
};
|
|
22
|
+
render(): JSX.Element;
|
|
23
|
+
renderMain(): JSX.Element;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { __assign, __extends } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ThemeContext } from '@skbkontur/react-ui/lib/theming/ThemeContext';
|
|
4
|
+
import { CommonWrapper } from '@skbkontur/react-ui/internal/CommonWrapper';
|
|
5
|
+
import { DEFAULT_THEME, DropdownMenu, MenuItem, ThemeFactory } from '@skbkontur/react-ui';
|
|
6
|
+
import { UserAvatar } from '@skbkontur/react-ui-addons/components/UserAvatar';
|
|
7
|
+
import { jsStyles } from './SideMenu.styles';
|
|
8
|
+
import { SideMenuItem } from './SideMenuItem';
|
|
9
|
+
import { SideMenuDropdownMenuSeparator } from './SideMenuDropdownMenuSeparator';
|
|
10
|
+
/**
|
|
11
|
+
* Аватар пользователя
|
|
12
|
+
*
|
|
13
|
+
* @visibleName SideMenu.Avatar
|
|
14
|
+
*/
|
|
15
|
+
var SideMenuAvatar = /** @class */ (function (_super) {
|
|
16
|
+
__extends(SideMenuAvatar, _super);
|
|
17
|
+
function SideMenuAvatar() {
|
|
18
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
19
|
+
}
|
|
20
|
+
SideMenuAvatar.prototype.render = function () {
|
|
21
|
+
return this.renderMain();
|
|
22
|
+
};
|
|
23
|
+
SideMenuAvatar.prototype.renderMain = function () {
|
|
24
|
+
var _a = this.props, cabinetUrl = _a.cabinetUrl, userName = _a.userName, onLogout = _a.onLogout;
|
|
25
|
+
var label = (React.createElement("div", { className: jsStyles.dropdownLabel() },
|
|
26
|
+
React.createElement(SideMenuItem, { icon: React.createElement(UserAvatar, __assign({}, this.props)), caption: userName })));
|
|
27
|
+
return (React.createElement(ThemeContext.Provider, { value: ThemeFactory.create({
|
|
28
|
+
menuItemHoverBg: '#f6f6f6',
|
|
29
|
+
menuItemHoverColor: '#222',
|
|
30
|
+
popupBorderRadius: '8px',
|
|
31
|
+
menuItemPaddingX: '32px',
|
|
32
|
+
}, DEFAULT_THEME) },
|
|
33
|
+
React.createElement(CommonWrapper, __assign({}, this.props),
|
|
34
|
+
React.createElement("div", { className: jsStyles.dropdownWrapper() },
|
|
35
|
+
React.createElement(DropdownMenu, { caption: label, menuWidth: 200, positions: ['top left'] },
|
|
36
|
+
React.createElement(MenuItem, { href: cabinetUrl, target: "_blank" }, "\u041B\u0438\u0447\u043D\u044B\u0439 \u043A\u0430\u0431\u0438\u043D\u0435\u0442"),
|
|
37
|
+
React.createElement(MenuItem, null, "\u0411\u0435\u0437\u043E\u043F\u0430\u0441\u043D\u043E\u0441\u0442\u044C"),
|
|
38
|
+
React.createElement(SideMenuDropdownMenuSeparator, null),
|
|
39
|
+
React.createElement(MenuItem, { onClick: onLogout }, "\u0412\u044B\u0439\u0442\u0438"))))));
|
|
40
|
+
};
|
|
41
|
+
SideMenuAvatar.__KONTUR_REACT_UI__ = 'SideMenuAvatar';
|
|
42
|
+
SideMenuAvatar.defaultProps = {
|
|
43
|
+
cabinetUrl: 'https://cabinet.kontur.ru',
|
|
44
|
+
};
|
|
45
|
+
return SideMenuAvatar;
|
|
46
|
+
}(React.Component));
|
|
47
|
+
export { SideMenuAvatar };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
|
|
3
|
+
/**
|
|
4
|
+
* Основной контейнер для меню
|
|
5
|
+
*
|
|
6
|
+
* @visibleName SideMenu.Body
|
|
7
|
+
*/
|
|
8
|
+
export declare type SideMenuBodyProps = CommonProps;
|
|
9
|
+
export declare const SideMenuBody: React.FC<SideMenuBodyProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import React, { useContext, useState } from 'react';
|
|
3
|
+
import { CommonWrapper } from '@skbkontur/react-ui/internal/CommonWrapper';
|
|
4
|
+
import { SideMenuThemeContext } from './SideMenuContext';
|
|
5
|
+
import { jsStyles } from './SideMenu.styles';
|
|
6
|
+
export var SideMenuBody = function (props) {
|
|
7
|
+
var _a = useState(false), hasIcons = _a[0], setHasIcons = _a[1];
|
|
8
|
+
var oldContext = useContext(SideMenuThemeContext);
|
|
9
|
+
var setHasIconsTemp = function () {
|
|
10
|
+
setHasIcons(true);
|
|
11
|
+
};
|
|
12
|
+
return (React.createElement(SideMenuThemeContext.Provider, { value: __assign({ hasIcons: hasIcons, setHasIcons: setHasIconsTemp }, oldContext) },
|
|
13
|
+
React.createElement(CommonWrapper, __assign({}, props),
|
|
14
|
+
React.createElement("div", { className: jsStyles.body() }, props.children))));
|
|
15
|
+
};
|
|
16
|
+
SideMenuBody.__KONTUR_REACT_UI__ = 'SideMenuBody';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SideMenuContextType {
|
|
3
|
+
isMinimised?: boolean;
|
|
4
|
+
isTransitioned?: boolean;
|
|
5
|
+
isSeparatedMenu?: boolean;
|
|
6
|
+
size?: 'small' | 'large';
|
|
7
|
+
hasIcons?: boolean;
|
|
8
|
+
setHasIcons?: () => void;
|
|
9
|
+
activeItem?: React.ReactNode;
|
|
10
|
+
setActiveItem?: (item: React.ReactNode) => void;
|
|
11
|
+
activeSubItem?: React.ReactNode;
|
|
12
|
+
setActiveSubItem?: (item: React.ReactNode) => void;
|
|
13
|
+
hasSubIcons?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const SideMenuThemeContext: React.Context<SideMenuContextType>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Разделитель в главном меню
|
|
4
|
+
*
|
|
5
|
+
* @visibleName SideMenu.Divider
|
|
6
|
+
*/
|
|
7
|
+
export declare class SideMenuDivider extends React.Component {
|
|
8
|
+
static __KONTUR_REACT_UI__: string;
|
|
9
|
+
render(): JSX.Element;
|
|
10
|
+
renderMain(): JSX.Element;
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { __assign, __extends } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { CommonWrapper } from '@skbkontur/react-ui/internal/CommonWrapper';
|
|
4
|
+
import { jsStyles } from './SideMenu.styles';
|
|
5
|
+
/**
|
|
6
|
+
* Разделитель в главном меню
|
|
7
|
+
*
|
|
8
|
+
* @visibleName SideMenu.Divider
|
|
9
|
+
*/
|
|
10
|
+
var SideMenuDivider = /** @class */ (function (_super) {
|
|
11
|
+
__extends(SideMenuDivider, _super);
|
|
12
|
+
function SideMenuDivider() {
|
|
13
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
14
|
+
}
|
|
15
|
+
SideMenuDivider.prototype.render = function () {
|
|
16
|
+
return this.renderMain();
|
|
17
|
+
};
|
|
18
|
+
SideMenuDivider.prototype.renderMain = function () {
|
|
19
|
+
return (React.createElement(CommonWrapper, __assign({}, this.props),
|
|
20
|
+
React.createElement("hr", { className: jsStyles.divider() })));
|
|
21
|
+
};
|
|
22
|
+
SideMenuDivider.__KONTUR_REACT_UI__ = 'SideMenuDivider';
|
|
23
|
+
return SideMenuDivider;
|
|
24
|
+
}(React.Component));
|
|
25
|
+
export { SideMenuDivider };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Разделитель в выпадающих меню
|
|
4
|
+
*
|
|
5
|
+
* @visibleName SideMenu.DropdownMenuSeparator
|
|
6
|
+
*/
|
|
7
|
+
export declare class SideMenuDropdownMenuSeparator extends React.Component {
|
|
8
|
+
static __KONTUR_REACT_UI__: string;
|
|
9
|
+
render(): JSX.Element;
|
|
10
|
+
renderMain(): JSX.Element;
|
|
11
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { __assign, __extends } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { CommonWrapper } from '@skbkontur/react-ui/internal/CommonWrapper';
|
|
4
|
+
import { jsStyles } from './SideMenu.styles';
|
|
5
|
+
/**
|
|
6
|
+
* Разделитель в выпадающих меню
|
|
7
|
+
*
|
|
8
|
+
* @visibleName SideMenu.DropdownMenuSeparator
|
|
9
|
+
*/
|
|
10
|
+
var SideMenuDropdownMenuSeparator = /** @class */ (function (_super) {
|
|
11
|
+
__extends(SideMenuDropdownMenuSeparator, _super);
|
|
12
|
+
function SideMenuDropdownMenuSeparator() {
|
|
13
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
14
|
+
}
|
|
15
|
+
SideMenuDropdownMenuSeparator.prototype.render = function () {
|
|
16
|
+
return this.renderMain();
|
|
17
|
+
};
|
|
18
|
+
SideMenuDropdownMenuSeparator.prototype.renderMain = function () {
|
|
19
|
+
return (React.createElement(CommonWrapper, __assign({}, this.props),
|
|
20
|
+
React.createElement("hr", { className: jsStyles.dropdownMenuSeparator() })));
|
|
21
|
+
};
|
|
22
|
+
SideMenuDropdownMenuSeparator.__KONTUR_REACT_UI__ = 'SideMenuDropdownMenuSeparator';
|
|
23
|
+
return SideMenuDropdownMenuSeparator;
|
|
24
|
+
}(React.Component));
|
|
25
|
+
export { SideMenuDropdownMenuSeparator };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
|
|
3
|
+
/**
|
|
4
|
+
* Нижняя часть меню
|
|
5
|
+
*
|
|
6
|
+
* @visibleName SideMenu.Footer
|
|
7
|
+
*/
|
|
8
|
+
export declare type SideMenuFooterProps = CommonProps;
|
|
9
|
+
export declare const SideMenuFooter: React.FC<SideMenuFooterProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { CommonWrapper } from '@skbkontur/react-ui/internal/CommonWrapper';
|
|
4
|
+
import { jsStyles } from './SideMenu.styles';
|
|
5
|
+
export var SideMenuFooter = function (props) { return (React.createElement(CommonWrapper, __assign({}, props),
|
|
6
|
+
React.createElement("footer", { className: jsStyles.footer() }, props.children))); };
|
|
7
|
+
SideMenuFooter.__KONTUR_REACT_UI__ = 'SideMenuFooter';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LogotypeProps } from '@skbkontur/react-ui-addons/components/Logotype';
|
|
3
|
+
declare type SideMenuHeaderState = {
|
|
4
|
+
withWidget: boolean;
|
|
5
|
+
fixed: boolean;
|
|
6
|
+
size: number;
|
|
7
|
+
};
|
|
8
|
+
export interface SideMenuHeaderProps extends LogotypeProps {
|
|
9
|
+
iconUrl?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Контейнер для логотипа
|
|
13
|
+
*
|
|
14
|
+
* @visibleName SideMenu.Header
|
|
15
|
+
*/
|
|
16
|
+
export declare class SideMenuHeader extends React.Component<SideMenuHeaderProps, SideMenuHeaderState> {
|
|
17
|
+
static __KONTUR_REACT_UI__: string;
|
|
18
|
+
static contextType: React.Context<import("./SideMenuContext").SideMenuContextType>;
|
|
19
|
+
private widgetTimer;
|
|
20
|
+
private readonly headerWrapperRef;
|
|
21
|
+
constructor(props: SideMenuHeaderProps);
|
|
22
|
+
componentDidMount: () => void;
|
|
23
|
+
componentWillUnmount(): void;
|
|
24
|
+
private checkFixed;
|
|
25
|
+
render(): JSX.Element;
|
|
26
|
+
renderMain(): JSX.Element;
|
|
27
|
+
private handleMouseEnter;
|
|
28
|
+
private handleMouseLeave;
|
|
29
|
+
private static changeCamelCaseToKebabCase;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { __assign, __extends } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
4
|
+
import { CommonWrapper } from '@skbkontur/react-ui/internal/CommonWrapper';
|
|
5
|
+
import { Logotype } from '@skbkontur/react-ui-addons/components/Logotype';
|
|
6
|
+
import { jsStyles } from './SideMenu.styles';
|
|
7
|
+
import { SideMenuThemeContext } from './SideMenuContext';
|
|
8
|
+
/**
|
|
9
|
+
* Контейнер для логотипа
|
|
10
|
+
*
|
|
11
|
+
* @visibleName SideMenu.Header
|
|
12
|
+
*/
|
|
13
|
+
var SideMenuHeader = /** @class */ (function (_super) {
|
|
14
|
+
__extends(SideMenuHeader, _super);
|
|
15
|
+
function SideMenuHeader(props) {
|
|
16
|
+
var _this = _super.call(this, props) || this;
|
|
17
|
+
_this.componentDidMount = function () {
|
|
18
|
+
window.addEventListener('scroll', _this.checkFixed, true);
|
|
19
|
+
if (_this.headerWrapperRef.current &&
|
|
20
|
+
_this.headerWrapperRef.current.scrollWidth > _this.headerWrapperRef.current.clientWidth) {
|
|
21
|
+
_this.setState({ size: 24 });
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
_this.checkFixed = function () {
|
|
25
|
+
if (_this.headerWrapperRef.current && _this.headerWrapperRef.current.offsetTop > 0) {
|
|
26
|
+
_this.setState({ fixed: true });
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
_this.setState({ fixed: false });
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
_this.handleMouseEnter = function () {
|
|
33
|
+
_this.widgetTimer = setTimeout(function () {
|
|
34
|
+
_this.setState({ withWidget: true });
|
|
35
|
+
}, 500);
|
|
36
|
+
};
|
|
37
|
+
_this.handleMouseLeave = function () {
|
|
38
|
+
if (_this.widgetTimer) {
|
|
39
|
+
clearTimeout(_this.widgetTimer);
|
|
40
|
+
}
|
|
41
|
+
_this.setState({ withWidget: false });
|
|
42
|
+
};
|
|
43
|
+
_this.state = {
|
|
44
|
+
withWidget: false,
|
|
45
|
+
fixed: false,
|
|
46
|
+
size: 28,
|
|
47
|
+
};
|
|
48
|
+
_this.headerWrapperRef = React.createRef();
|
|
49
|
+
return _this;
|
|
50
|
+
}
|
|
51
|
+
SideMenuHeader.prototype.componentWillUnmount = function () {
|
|
52
|
+
if (this.widgetTimer) {
|
|
53
|
+
clearTimeout(this.widgetTimer);
|
|
54
|
+
}
|
|
55
|
+
window.removeEventListener('scroll', this.checkFixed, true);
|
|
56
|
+
};
|
|
57
|
+
SideMenuHeader.prototype.render = function () {
|
|
58
|
+
return this.renderMain();
|
|
59
|
+
};
|
|
60
|
+
SideMenuHeader.prototype.renderMain = function () {
|
|
61
|
+
var _a;
|
|
62
|
+
var name = 'kontur';
|
|
63
|
+
if (this.props.productLogo && typeof this.props.productLogo.type === 'function') {
|
|
64
|
+
name = this.props.productLogo.type.name;
|
|
65
|
+
var capitalLetters = name.match(/[A-Z]/g);
|
|
66
|
+
if (capitalLetters && capitalLetters.length > 1) {
|
|
67
|
+
name = SideMenuHeader.changeCamelCaseToKebabCase(name, capitalLetters[1]);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return (React.createElement(CommonWrapper, __assign({}, this.props),
|
|
71
|
+
React.createElement("header", { className: cx((_a = {},
|
|
72
|
+
_a[jsStyles.headerWrapper()] = true,
|
|
73
|
+
_a[jsStyles.headerFixedWrapper()] = this.state.fixed,
|
|
74
|
+
_a[jsStyles.headerMinimisedWrapper()] = this.context.isMinimised || this.context.isTransitioned,
|
|
75
|
+
_a)), ref: this.headerWrapperRef }, this.context.isMinimised || this.context.isTransitioned ? (React.createElement("img", { className: jsStyles.headerIcon(), src: this.props.iconUrl || "https://s.kontur.ru/common-v2/icons-products/" + name + "/" + name + "-32.png", alt: name })) : (React.createElement("div", { onMouseEnter: this.handleMouseEnter, onMouseLeave: this.handleMouseLeave },
|
|
76
|
+
React.createElement(Logotype, __assign({ size: this.state.size }, this.props, { withWidget: this.state.withWidget })))))));
|
|
77
|
+
};
|
|
78
|
+
SideMenuHeader.changeCamelCaseToKebabCase = function (str, capitalLetter) {
|
|
79
|
+
var index = str.split('').indexOf(capitalLetter);
|
|
80
|
+
return str.substring(0, index) + '-' + str.substring(index);
|
|
81
|
+
};
|
|
82
|
+
SideMenuHeader.__KONTUR_REACT_UI__ = 'SideMenuHeader';
|
|
83
|
+
SideMenuHeader.contextType = SideMenuThemeContext;
|
|
84
|
+
return SideMenuHeader;
|
|
85
|
+
}(React.Component));
|
|
86
|
+
export { SideMenuHeader };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SideMenuContextType } from './SideMenuContext';
|
|
3
|
+
export declare type SideMenuItemProps = {
|
|
4
|
+
_onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
5
|
+
_onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
icon?: React.ReactElement;
|
|
8
|
+
marker?: string;
|
|
9
|
+
caption?: string;
|
|
10
|
+
isSubMenu?: boolean;
|
|
11
|
+
parent?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
declare type SideMenuItemState = {
|
|
14
|
+
isOpened: boolean;
|
|
15
|
+
focusedByTab: boolean;
|
|
16
|
+
isMultiline: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Элемент списка
|
|
20
|
+
*
|
|
21
|
+
* @visibleName SideMenu.Item
|
|
22
|
+
*/
|
|
23
|
+
export declare class SideMenuItem extends React.Component<SideMenuItemProps, SideMenuItemState> {
|
|
24
|
+
static __KONTUR_REACT_UI__: string;
|
|
25
|
+
static contextType: React.Context<SideMenuContextType>;
|
|
26
|
+
private previousContext;
|
|
27
|
+
private readonly textRef;
|
|
28
|
+
private separatedMenu;
|
|
29
|
+
constructor(props: SideMenuItemProps);
|
|
30
|
+
componentDidMount(): void;
|
|
31
|
+
componentDidUpdate(): void;
|
|
32
|
+
render(): JSX.Element;
|
|
33
|
+
renderMain(): JSX.Element;
|
|
34
|
+
private renderInnerSubMenu;
|
|
35
|
+
private renderSeparatedSubMenu;
|
|
36
|
+
private handleClick;
|
|
37
|
+
private handleFocus;
|
|
38
|
+
private handleBlur;
|
|
39
|
+
private handleKeyDown;
|
|
40
|
+
private setActive;
|
|
41
|
+
}
|
|
42
|
+
export {};
|