@skbkontur/side-menu 0.1.2 → 0.2.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 +27 -0
- package/README.md +2 -2
- package/package.json +1 -1
- package/src/SideMenu.styles.js +5 -5
- package/src/SideMenuItem.d.ts +2 -2
- package/src/SideMenuItem.js +3 -3
- package/src/SideMenuOrganisations.d.ts +2 -0
- package/src/SideMenuOrganisations.js +4 -1
- package/src/SideMenuSubItem.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.2.0](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.1.4...@skbkontur/side-menu@0.2.0) (2022-07-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add new icons ([381b7a9](https://git.skbkontur.ru/ui/ui-parking/commits/381b7a957404fa36ed389dd249f38fde8024ffcc))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.1.4](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.1.2...@skbkontur/side-menu@0.1.4) (2022-07-01)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @skbkontur/side-menu
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [0.1.3](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.1.2...@skbkontur/side-menu@0.1.3) (2022-06-22)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @skbkontur/side-menu
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [0.1.2](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.1.1...@skbkontur/side-menu@0.1.2) (2022-06-14)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @skbkontur/side-menu
|
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ const myTheme = ThemeFactory.create({addonsSideMenuHeaderPosition: 'sticky', add
|
|
|
64
64
|
<SideMenu.Avatar
|
|
65
65
|
userName={'Ишматова Елена'}
|
|
66
66
|
avatarUrl={getKonturAvatarUrl({
|
|
67
|
-
userId: ''
|
|
67
|
+
userId: '992408aa-050e-41e9-9a48-6bf2f2f20d94'
|
|
68
68
|
})}
|
|
69
69
|
/>
|
|
70
70
|
</SideMenu.Footer>
|
|
@@ -176,7 +176,7 @@ const myTheme = ThemeFactory.create({ addonsSideMenuHeaderPosition: 'sticky', ad
|
|
|
176
176
|
<SideMenu.Avatar
|
|
177
177
|
userName={'Ишматова Елена'}
|
|
178
178
|
avatarUrl={getKonturAvatarUrl({
|
|
179
|
-
userId: ''
|
|
179
|
+
userId: '992408aa-050e-41e9-9a48-6bf2f2f20d94'
|
|
180
180
|
})}
|
|
181
181
|
/>
|
|
182
182
|
</SideMenu.Footer>
|
package/package.json
CHANGED
package/src/SideMenu.styles.js
CHANGED
|
@@ -2,7 +2,7 @@ import { __makeTemplateObject } from "tslib";
|
|
|
2
2
|
import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
3
|
var styles = {
|
|
4
4
|
root: function () {
|
|
5
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 232px;\n height: 100%;\n background: #
|
|
5
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 232px;\n height: 100%;\n background: #f6f6f6;\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: #f6f6f6;\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
6
|
},
|
|
7
7
|
rootSafari: function () {
|
|
8
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 "])));
|
|
@@ -17,13 +17,13 @@ var styles = {
|
|
|
17
17
|
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n overflow-x: hidden;\n "], ["\n overflow-x: hidden;\n "])));
|
|
18
18
|
},
|
|
19
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 "])));
|
|
20
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n height: 100%;\n display: inline-flex;\n position: relative;\n "], ["\n height: 100%;\n display: inline-flex;\n position: relative;\n "])));
|
|
21
21
|
},
|
|
22
22
|
rootWrapperIE: function () {
|
|
23
23
|
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: relative;\n top: -15px;\n "], ["\n position: relative;\n top: -15px;\n "])));
|
|
24
24
|
},
|
|
25
25
|
rightBorder: function () {
|
|
26
|
-
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n position:
|
|
26
|
+
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n position: absolute;\n width: 20px;\n height: 100%;\n right: -10px;\n background: transparent;\n "], ["\n position: absolute;\n width: 20px;\n height: 100%;\n right: -10px;\n background: transparent;\n "])));
|
|
27
27
|
},
|
|
28
28
|
resizableRightBorder: function () {
|
|
29
29
|
return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n cursor: col-resize;\n "], ["\n cursor: col-resize;\n "])));
|
|
@@ -35,7 +35,7 @@ var styles = {
|
|
|
35
35
|
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n flex-grow: 0;\n "], ["\n flex-grow: 0;\n "])));
|
|
36
36
|
},
|
|
37
37
|
headerWrapper: function () {
|
|
38
|
-
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n position: sticky;\n width: 186px;\n top: 0;\n background: #
|
|
38
|
+
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n position: sticky;\n width: 186px;\n top: 0;\n background: #f6f6f6;\n z-index: 1;\n padding: 24px 8px 16px;\n "], ["\n position: sticky;\n width: 186px;\n top: 0;\n background: #f6f6f6;\n z-index: 1;\n padding: 24px 8px 16px;\n "])));
|
|
39
39
|
},
|
|
40
40
|
headerMinimisedWrapper: function () {
|
|
41
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 "])));
|
|
@@ -44,7 +44,7 @@ var styles = {
|
|
|
44
44
|
return css(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n border-bottom: 1px solid #e6e6e6;\n "], ["\n border-bottom: 1px solid #e6e6e6;\n "])));
|
|
45
45
|
},
|
|
46
46
|
item: function () {
|
|
47
|
-
return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n width: 100%;\n background: #
|
|
47
|
+
return css(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n width: 100%;\n background: #f6f6f6;\n border-radius: 8px;\n box-sizing: border-box;\n cursor: pointer;\n &:hover {\n background: rgba(255, 255, 255, 0.48);\n }\n &:focus {\n outline: none;\n }\n "], ["\n width: 100%;\n background: #f6f6f6;\n border-radius: 8px;\n box-sizing: border-box;\n cursor: pointer;\n &:hover {\n background: rgba(255, 255, 255, 0.48);\n }\n &:focus {\n outline: none;\n }\n "])));
|
|
48
48
|
},
|
|
49
49
|
subItem: function () {
|
|
50
50
|
return css(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n background: #fff;\n "], ["\n background: #fff;\n "])));
|
package/src/SideMenuItem.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SideMenuContextType } from './SideMenuContext';
|
|
3
3
|
export declare type SideMenuItemProps = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
5
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
icon?: React.ReactElement;
|
|
8
8
|
marker?: string;
|
package/src/SideMenuItem.js
CHANGED
|
@@ -47,8 +47,8 @@ var SideMenuItem = /** @class */ (function (_super) {
|
|
|
47
47
|
React.createElement(SideMenuThemeContext.Provider, { value: __assign({ hasSubIcons: hasSubItems }, _this.context) }, _this.props.children))));
|
|
48
48
|
};
|
|
49
49
|
_this.handleClick = function (e) {
|
|
50
|
-
if (_this.props.
|
|
51
|
-
_this.props.
|
|
50
|
+
if (_this.props.onClick) {
|
|
51
|
+
_this.props.onClick(e);
|
|
52
52
|
}
|
|
53
53
|
_this.setActive();
|
|
54
54
|
_this.setState({ isOpened: !!_this.props.children });
|
|
@@ -69,7 +69,7 @@ var SideMenuItem = /** @class */ (function (_super) {
|
|
|
69
69
|
_this.setState({ isOpened: !_this.props.children ? false : !_this.state.isOpened });
|
|
70
70
|
_this.setActive();
|
|
71
71
|
}
|
|
72
|
-
(_b = (_a = _this.props).
|
|
72
|
+
(_b = (_a = _this.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
73
73
|
};
|
|
74
74
|
_this.setActive = function () {
|
|
75
75
|
if (_this.props.isSubMenu) {
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
declare type SideMenuOrganisationsProps = {
|
|
3
3
|
icon?: React.ReactElement;
|
|
4
4
|
children?: React.ReactNode;
|
|
5
|
+
caption?: string;
|
|
5
6
|
};
|
|
6
7
|
/**
|
|
7
8
|
* Список организаций
|
|
@@ -10,6 +11,7 @@ declare type SideMenuOrganisationsProps = {
|
|
|
10
11
|
*/
|
|
11
12
|
export declare class SideMenuOrganisations extends React.Component<SideMenuOrganisationsProps> {
|
|
12
13
|
static __KONTUR_REACT_UI__: string;
|
|
14
|
+
static defaultProps: Partial<SideMenuOrganisationsProps>;
|
|
13
15
|
render(): JSX.Element;
|
|
14
16
|
renderMain(): JSX.Element;
|
|
15
17
|
}
|
|
@@ -20,7 +20,7 @@ var SideMenuOrganisations = /** @class */ (function (_super) {
|
|
|
20
20
|
};
|
|
21
21
|
SideMenuOrganisations.prototype.renderMain = function () {
|
|
22
22
|
var label = (React.createElement("div", { className: jsStyles.dropdownLabel() },
|
|
23
|
-
React.createElement(SideMenuItem, { icon: this.props.icon, caption:
|
|
23
|
+
React.createElement(SideMenuItem, { icon: this.props.icon, caption: this.props.caption })));
|
|
24
24
|
return (React.createElement(ThemeContext.Provider, { value: ThemeFactory.create({
|
|
25
25
|
menuItemHoverBg: '#f6f6f6',
|
|
26
26
|
menuItemHoverColor: '#222',
|
|
@@ -32,6 +32,9 @@ var SideMenuOrganisations = /** @class */ (function (_super) {
|
|
|
32
32
|
React.createElement(DropdownMenu, { caption: label, menuWidth: '240px', positions: ['top left'] }, this.props.children)))));
|
|
33
33
|
};
|
|
34
34
|
SideMenuOrganisations.__KONTUR_REACT_UI__ = 'SideMenuOrganisations';
|
|
35
|
+
SideMenuOrganisations.defaultProps = {
|
|
36
|
+
caption: 'СКБ Контур',
|
|
37
|
+
};
|
|
35
38
|
return SideMenuOrganisations;
|
|
36
39
|
}(React.Component));
|
|
37
40
|
export { SideMenuOrganisations };
|
package/src/SideMenuSubItem.js
CHANGED
|
@@ -22,7 +22,7 @@ var SideMenuSubItem = /** @class */ (function (_super) {
|
|
|
22
22
|
if (e.key === 'Enter') {
|
|
23
23
|
_this.setState({ isOpened: true });
|
|
24
24
|
}
|
|
25
|
-
(_b = (_a = _this.props).
|
|
25
|
+
(_b = (_a = _this.props).onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
26
26
|
};
|
|
27
27
|
_this.state = {
|
|
28
28
|
isOpened: false,
|
|
@@ -44,7 +44,7 @@ var SideMenuSubItem = /** @class */ (function (_super) {
|
|
|
44
44
|
}
|
|
45
45
|
return (React.createElement(CommonWrapper, __assign({}, this.props),
|
|
46
46
|
React.createElement("div", null,
|
|
47
|
-
React.createElement(SideMenuItem, __assign({}, this.props, {
|
|
47
|
+
React.createElement(SideMenuItem, __assign({}, this.props, { onClick: this.handleClick, icon: icon, isSubMenu: true, onKeyDown: this.handleKeyDown })),
|
|
48
48
|
this.props.children && this.state.isOpened && (React.createElement("div", { className: jsStyles.subItemMenu() }, this.props.children)))));
|
|
49
49
|
};
|
|
50
50
|
SideMenuSubItem.__KONTUR_REACT_UI__ = 'SideMenuSubItem';
|