@skbkontur/side-menu 0.9.4 → 0.9.5
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/package.json +1 -1
- package/src/SideMenuDropdown/SideMenuDropdown.js +17 -27
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.9.5](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.9.4...@skbkontur/side-menu@0.9.5) (2023-05-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @skbkontur/side-menu
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [0.9.4](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.9.3...@skbkontur/side-menu@0.9.4) (2023-05-24)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @skbkontur/side-menu
|
package/package.json
CHANGED
|
@@ -1,43 +1,33 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import React, { forwardRef, useContext } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { DropdownMenu, ThemeFactory } from '@skbkontur/react-ui';
|
|
3
|
+
import { DropdownMenu } from '@skbkontur/react-ui';
|
|
5
4
|
import { cx } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
6
5
|
import { jsStyles } from './SideMenuDropdown.styles';
|
|
7
6
|
import { SideMenuItem } from '../SideMenuItem/SideMenuItem';
|
|
8
7
|
import { SideMenuContext } from '../SideMenuContext';
|
|
9
8
|
var SideMenuDropdownInner = forwardRef(function (_a, ref) {
|
|
10
|
-
var _b;
|
|
11
|
-
var icon = _a.icon, id = _a.id, _generatedId = _a._generatedId, _avatar = _a._avatar, children = _a.children,
|
|
9
|
+
var _b, _c;
|
|
10
|
+
var icon = _a.icon, id = _a.id, _generatedId = _a._generatedId, _avatar = _a._avatar, children = _a.children, _d = _a.caption, caption = _d === void 0 ? 'СКБ Контур' : _d, subCaption = _a.subCaption, className = _a.className, _e = _a.disableAnimations, disableAnimations = _e === void 0 ? false : _e, menuWidth = _a.menuWidth, rest = __rest(_a, ["icon", "id", "_generatedId", "_avatar", "children", "caption", "subCaption", "className", "disableAnimations", "menuWidth"]);
|
|
12
11
|
var context = useContext(SideMenuContext);
|
|
13
12
|
var label = (React.createElement("div", { className: cx((_b = {},
|
|
14
13
|
_b[jsStyles.label()] = true,
|
|
15
14
|
_b[jsStyles.minimizedLabel()] = context.isMinimized,
|
|
16
15
|
_b)) },
|
|
17
16
|
React.createElement(SideMenuItem, { icon: icon, caption: caption, subCaption: subCaption, _avatar: _avatar, id: id, _isDropdown: true })));
|
|
18
|
-
return (React.createElement(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var _a, _b, _c;
|
|
33
|
-
(_a = context.toggleIsShown) === null || _a === void 0 ? void 0 : _a.call(context);
|
|
34
|
-
(_c = (_b = child.props).onClick) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return child;
|
|
39
|
-
})))));
|
|
40
|
-
}));
|
|
17
|
+
return (React.createElement("div", { className: cx((_c = {}, _c[jsStyles.wrapper()] = true, _c), className), ref: ref },
|
|
18
|
+
React.createElement(DropdownMenu, __assign({ caption: label, positions: ['top left'], disableAnimations: true, menuWidth: menuWidth }, rest), React.Children.map(children, function (child) {
|
|
19
|
+
// @ts-expect-error: accessing private property
|
|
20
|
+
if (React.isValidElement(child) && (child === null || child === void 0 ? void 0 : child.type.__KONTUR_REACT_UI__) === 'MenuItem') {
|
|
21
|
+
return React.cloneElement(child, {
|
|
22
|
+
onClick: function () {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
(_a = context.toggleIsShown) === null || _a === void 0 ? void 0 : _a.call(context);
|
|
25
|
+
(_c = (_b = child.props).onClick) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return child;
|
|
30
|
+
}))));
|
|
41
31
|
});
|
|
42
32
|
SideMenuDropdownInner.displayName = 'SideMenuDropdown';
|
|
43
33
|
/**
|