@skbkontur/side-menu 0.1.1 → 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 CHANGED
@@ -3,6 +3,30 @@
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
+
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)
15
+
16
+ **Note:** Version bump only for package @skbkontur/side-menu
17
+
18
+
19
+
20
+
21
+
22
+ ## [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)
23
+
24
+ **Note:** Version bump only for package @skbkontur/side-menu
25
+
26
+
27
+
28
+
29
+
6
30
  ## [0.1.1](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.1.0...@skbkontur/side-menu@0.1.1) (2022-06-02)
7
31
 
8
32
  **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.1",
3
+ "version": "0.1.4",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
package/src/SideMenu.d.ts CHANGED
@@ -34,8 +34,8 @@ export declare class SideMenu extends React.Component<SideMenuComponentProps, Si
34
34
  constructor(props: SideMenuComponentProps);
35
35
  componentDidMount(): void;
36
36
  componentWillUnmount(): void;
37
- static Body: React.FC<import("@skbkontur/react-ui/internal/CommonWrapper").CommonProps>;
38
- static Footer: React.FC<import("@skbkontur/react-ui/internal/CommonWrapper").CommonProps>;
37
+ static Body: React.FC<import("./SideMenuBody").SideMenuBodyProps>;
38
+ static Footer: React.FC<import("./SideMenuFooter").SideMenuFooterProps>;
39
39
  static Header: typeof SideMenuHeader;
40
40
  static Item: typeof SideMenuItem;
41
41
  static SubItem: typeof SideMenuSubItem;
@@ -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: #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 "])));
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: relative;\n left: -10px;\n width: 20px;\n background: transparent;\n "], ["\n position: relative;\n left: -10px;\n width: 20px;\n background: transparent;\n "])));
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: #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 "])));
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: #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 "])));
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 "])));
@@ -5,5 +5,7 @@ import { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
5
5
  *
6
6
  * @visibleName SideMenu.Body
7
7
  */
8
- export declare type SideMenuBodyProps = CommonProps;
8
+ export declare type SideMenuBodyProps = CommonProps & {
9
+ children?: React.ReactNode;
10
+ };
9
11
  export declare const SideMenuBody: React.FC<SideMenuBodyProps>;
@@ -5,5 +5,7 @@ import { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
5
5
  *
6
6
  * @visibleName SideMenu.Footer
7
7
  */
8
- export declare type SideMenuFooterProps = CommonProps;
8
+ export declare type SideMenuFooterProps = CommonProps & {
9
+ children?: React.ReactNode;
10
+ };
9
11
  export declare const SideMenuFooter: React.FC<SideMenuFooterProps>;
@@ -5,7 +5,7 @@ declare type SideMenuHeaderState = {
5
5
  fixed: boolean;
6
6
  size: number;
7
7
  };
8
- export interface SideMenuHeaderProps extends LogotypeProps {
8
+ export interface SideMenuHeaderProps extends Partial<LogotypeProps> {
9
9
  iconUrl?: string;
10
10
  }
11
11
  /**
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { SideMenuContextType } from './SideMenuContext';
3
3
  export declare type SideMenuItemProps = {
4
- _onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
5
- _onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => void;
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;
@@ -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._onClick) {
51
- _this.props._onClick(e);
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)._onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, e);
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) {
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  declare type SideMenuOrganisationsProps = {
3
3
  icon?: React.ReactElement;
4
+ children?: React.ReactNode;
5
+ caption?: string;
4
6
  };
5
7
  /**
6
8
  * Список организаций
@@ -9,6 +11,7 @@ declare type SideMenuOrganisationsProps = {
9
11
  */
10
12
  export declare class SideMenuOrganisations extends React.Component<SideMenuOrganisationsProps> {
11
13
  static __KONTUR_REACT_UI__: string;
14
+ static defaultProps: Partial<SideMenuOrganisationsProps>;
12
15
  render(): JSX.Element;
13
16
  renderMain(): JSX.Element;
14
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 };
@@ -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)._onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, e);
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, { _onClick: this.handleClick, icon: icon, isSubMenu: true, _onKeyDown: this.handleKeyDown })),
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';
@@ -1,10 +1,14 @@
1
1
  import React from 'react';
2
+ import { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
3
+ export declare type SideMenuSubItemButtonsProps = CommonProps & {
4
+ children?: React.ReactNode;
5
+ };
2
6
  /**
3
7
  * Группа кнопок в отдельном подменю
4
8
  *
5
9
  * @visibleName SideMenu.SubItemButtons
6
10
  */
7
- export declare class SideMenuSubItemButtons extends React.Component {
11
+ export declare class SideMenuSubItemButtons extends React.Component<SideMenuSubItemButtonsProps> {
8
12
  static __KONTUR_REACT_UI__: string;
9
13
  render(): JSX.Element;
10
14
  renderMain(): JSX.Element;
@@ -1,10 +1,14 @@
1
1
  import React from 'react';
2
+ import { CommonProps } from '@skbkontur/react-ui/internal/CommonWrapper';
3
+ export declare type SideMenuSubItemHeaderProps = CommonProps & {
4
+ children?: React.ReactNode;
5
+ };
2
6
  /**
3
7
  * Заголовок списка второго уровня
4
8
  *
5
9
  * @visibleName SideMenu.SubItemHeader
6
10
  */
7
- export declare class SideMenuSubItemHeader extends React.Component {
11
+ export declare class SideMenuSubItemHeader extends React.Component<SideMenuSubItemHeaderProps> {
8
12
  static __KONTUR_REACT_UI__: string;
9
13
  static contextType: React.Context<import("./SideMenuContext").SideMenuContextType>;
10
14
  render(): JSX.Element;