@skbkontur/side-menu 0.1.3 → 0.1.4
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 +8 -0
- package/README.md +2 -2
- package/package.json +2 -2
- 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,14 @@
|
|
|
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.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)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @skbkontur/side-menu
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [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)
|
|
7
15
|
|
|
8
16
|
**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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skbkontur/side-menu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@skbkontur/react-ui": "4.0.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@skbkontur/react-icons": "^5.2.
|
|
26
|
+
"@skbkontur/react-icons": "^5.2.3",
|
|
27
27
|
"tslib": "^1"
|
|
28
28
|
}
|
|
29
29
|
}
|
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';
|