@skbkontur/side-menu 0.9.1 → 0.9.3
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/hooks/useNumberOfTextLinesInItem.js +2 -1
- package/package.json +2 -2
- package/src/SideMenu/SideMenu.js +1 -1
- package/src/internal/InnerSubMenu.d.ts +2 -1
- package/src/internal/InnerSubMenu.js +3 -2
- package/src/internal/ItemContent/Icon.styles.js +1 -1
- package/src/internal/SeparatedSubMenu.d.ts +2 -1
- package/src/internal/SeparatedSubMenu.js +2 -1
- package/src/internal/SeparatedSubMenu.styles.js +1 -1
- package/src/internal/SubMenu.d.ts +2 -1
- package/utils/scripts.d.ts +1 -0
- package/utils/scripts.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.3](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.9.2...@skbkontur/side-menu@0.9.3) (2023-05-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **SideMenu:** change z-index for SidePage to 8000 ([1452080](https://git.skbkontur.ru/ui/ui-parking/commits/1452080fffc9079bccd3fbbabdd52461926c48c8))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.9.2](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.9.1...@skbkontur/side-menu@0.9.2) (2023-05-19)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @skbkontur/side-menu
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.9.1](https://git.skbkontur.ru/ui/ui-parking/compare/@skbkontur/side-menu@0.9.0...@skbkontur/side-menu@0.9.1) (2023-05-15)
|
|
7
26
|
|
|
8
27
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isBrowser } from '../utils/scripts';
|
|
1
2
|
export var useNumberOfTextLinesInItem = function (textRef, setLinesNumber, text, marker, size) {
|
|
2
3
|
if (text === void 0) { text = ''; }
|
|
3
4
|
if (marker === void 0) { marker = ''; }
|
|
@@ -25,7 +26,7 @@ export var useNumberOfTextLinesInItem = function (textRef, setLinesNumber, text,
|
|
|
25
26
|
return lineCount;
|
|
26
27
|
};
|
|
27
28
|
var fontSize = size === 'small' ? 14 : 16; //TODO после перехода на переменные темы заменить на side-menu-font-size-small и side-menu-font-size-large
|
|
28
|
-
var fontFamily = textRef.current &&
|
|
29
|
+
var fontFamily = textRef.current && isBrowser
|
|
29
30
|
? window.getComputedStyle(textRef.current).getPropertyValue('font-family')
|
|
30
31
|
: "'Lab Grotesque', 'Segoe UI', 'Helvetica Neue', Roboto, Arial, sans-serif";
|
|
31
32
|
var canvas = document.createElement('canvas');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skbkontur/side-menu",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"author": "Kontur",
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@skbkontur/react-ui": ">=4.5.0 <5",
|
|
18
|
-
"@skbkontur/react-ui-addons": ">=4.0.1",
|
|
19
18
|
"react": ">=16.9",
|
|
20
19
|
"react-dom": ">=16.9"
|
|
21
20
|
},
|
|
@@ -24,6 +23,7 @@
|
|
|
24
23
|
},
|
|
25
24
|
"dependencies": {
|
|
26
25
|
"@skbkontur/icons": "^0.16.0",
|
|
26
|
+
"@skbkontur/react-ui-addons": "^4.6.2",
|
|
27
27
|
"tslib": "^1"
|
|
28
28
|
}
|
|
29
29
|
}
|
package/src/SideMenu/SideMenu.js
CHANGED
|
@@ -184,7 +184,7 @@ var SideMenuInner = forwardRef(function (_a, ref) {
|
|
|
184
184
|
hasScrollBar: hasScrollBar,
|
|
185
185
|
setHasScrollBar: setHasScrollBar,
|
|
186
186
|
} },
|
|
187
|
-
React.createElement(ZIndex, { priority: isTabletOrMobile || isNarrowDesktop ?
|
|
187
|
+
React.createElement(ZIndex, { priority: isTabletOrMobile || isNarrowDesktop ? 8 : 0, className: cx((_b = {},
|
|
188
188
|
_b[jsStyles.root()] = true,
|
|
189
189
|
_b[jsStyles.rootForTabletsOrMobiles()] = isTabletOrMobile,
|
|
190
190
|
_b[jsStyles.shownRootForTabletsOrMobiles()] = isShown && isTabletOrMobile,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ZIndex } from '@skbkontur/react-ui/internal/ZIndex';
|
|
2
3
|
interface InnerSubMenuProps {
|
|
3
4
|
children?: React.ReactNode;
|
|
4
5
|
generatedId?: string;
|
|
5
6
|
}
|
|
6
|
-
declare const InnerSubMenuWithStaticFields: React.ForwardRefExoticComponent<InnerSubMenuProps & React.RefAttributes<
|
|
7
|
+
declare const InnerSubMenuWithStaticFields: React.ForwardRefExoticComponent<InnerSubMenuProps & React.RefAttributes<ZIndex>> & {
|
|
7
8
|
__KONTUR_REACT_UI__: string;
|
|
8
9
|
};
|
|
9
10
|
export { InnerSubMenuWithStaticFields as InnerSubMenu };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { isClickableSubElement } from '../../utils/scripts';
|
|
3
|
+
import { ZIndex } from '@skbkontur/react-ui/internal/ZIndex';
|
|
3
4
|
/**
|
|
4
5
|
* Подменю, раскрывающееся внутри основного меню
|
|
5
6
|
*
|
|
@@ -8,7 +9,7 @@ import { isClickableSubElement } from '../../utils/scripts';
|
|
|
8
9
|
var InnerSubMenu = forwardRef(function (_a, ref) {
|
|
9
10
|
var children = _a.children, generatedId = _a.generatedId;
|
|
10
11
|
var levelIndex = 0;
|
|
11
|
-
return (React.createElement(
|
|
12
|
+
return (React.createElement(ZIndex, { priority: 0, ref: ref }, React.Children.map(children, function (child) {
|
|
12
13
|
if (React.isValidElement(child)) {
|
|
13
14
|
if (
|
|
14
15
|
// @ts-expect-error: accessing private property
|
|
@@ -19,7 +20,7 @@ var InnerSubMenu = forwardRef(function (_a, ref) {
|
|
|
19
20
|
_generatedId: generatedId + "-" + oldIndex,
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
return React.cloneElement(child
|
|
23
|
+
return React.cloneElement(child);
|
|
23
24
|
}
|
|
24
25
|
return child;
|
|
25
26
|
})));
|
|
@@ -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 display: flex;\n align-items: center;\n padding: 0 8px;\n min-height: 32px;\n line-height: 20px;\n flex-shrink: 0;\n "], ["\n display: flex;\n align-items: center;\n padding: 0 8px;\n min-height: 32px;\n line-height: 20px;\n flex-shrink: 0;\n "])));
|
|
5
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding: 0 8px;\n min-height: 32px;\n line-height: 20px;\n flex-shrink: 0;\n box-sizing: content-box;\n "], ["\n display: flex;\n align-items: center;\n padding: 0 8px;\n min-height: 32px;\n line-height: 20px;\n flex-shrink: 0;\n box-sizing: content-box;\n "])));
|
|
6
6
|
},
|
|
7
7
|
rootMultiline: function () {
|
|
8
8
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: flex-start;\n align-items: flex-start;\n "], ["\n align-self: flex-start;\n align-items: flex-start;\n "])));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ZIndex } from '@skbkontur/react-ui/internal/ZIndex';
|
|
2
3
|
interface SeparatedSubMenuProps {
|
|
3
4
|
children?: React.ReactNode;
|
|
4
5
|
generatedId?: string;
|
|
@@ -6,7 +7,7 @@ interface SeparatedSubMenuProps {
|
|
|
6
7
|
href?: string;
|
|
7
8
|
caption?: string;
|
|
8
9
|
}
|
|
9
|
-
declare const SeparatedSubMenuWithStaticFields: React.ForwardRefExoticComponent<SeparatedSubMenuProps & React.RefAttributes<
|
|
10
|
+
declare const SeparatedSubMenuWithStaticFields: React.ForwardRefExoticComponent<SeparatedSubMenuProps & React.RefAttributes<ZIndex>> & {
|
|
10
11
|
__KONTUR_REACT_UI__: string;
|
|
11
12
|
};
|
|
12
13
|
export { SeparatedSubMenuWithStaticFields as SeparatedSubMenu };
|
|
@@ -9,6 +9,7 @@ import { BackButton } from './BackButton';
|
|
|
9
9
|
import { SideMenuDataTids } from '../../SideMenuDataTids';
|
|
10
10
|
import { ScrollContainer } from '@skbkontur/react-ui';
|
|
11
11
|
import { isIE11 } from '@skbkontur/react-ui/lib/client';
|
|
12
|
+
import { ZIndex } from '@skbkontur/react-ui/internal/ZIndex';
|
|
12
13
|
/**
|
|
13
14
|
* Отдельностоящее подменю
|
|
14
15
|
*
|
|
@@ -33,7 +34,7 @@ var SeparatedSubMenu = forwardRef(function (_a, ref) {
|
|
|
33
34
|
var levelIndex = 0;
|
|
34
35
|
var isDesktopOverlayMenu = (context.isDesktop || context.isNarrowDesktop) && !context.separatedMenuWithoutOverlay;
|
|
35
36
|
var isSeparatedSubMenuOverContent = (context.isTablet || isDesktopOverlayMenu) && !isIE11;
|
|
36
|
-
return (React.createElement(
|
|
37
|
+
return (React.createElement(ZIndex, { priority: context.separatedMenuWithoutOverlay ? 8 : 0, className: cx((_b = {},
|
|
37
38
|
_b[jsStyles.container()] = true,
|
|
38
39
|
_b[jsStyles.containerForTouchScreens()] = context.isTouchScreen,
|
|
39
40
|
_b[jsStylesForSeparatedSubMenu.root()] = true,
|
|
@@ -3,7 +3,7 @@ import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
|
3
3
|
import { sideMenuBoxShadow, sideMenuMinimizedWidth, sideMenuStandardWidth } from '../SideMenu/SideMenu.styles';
|
|
4
4
|
var styles = {
|
|
5
5
|
root: function () {
|
|
6
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n
|
|
6
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n background: #fff;\n left: 100%;\n overflow: auto;\n justify-content: flex-start;\n border-right: 1px solid #e5e5e5;\n "], ["\n position: absolute;\n top: 0;\n background: #fff;\n left: 100%;\n overflow: auto;\n justify-content: flex-start;\n border-right: 1px solid #e5e5e5;\n "])));
|
|
7
7
|
},
|
|
8
8
|
rootForMobiles: function () {
|
|
9
9
|
var headerHeight = '68px';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ZIndex } from '@skbkontur/react-ui/internal/ZIndex';
|
|
2
3
|
interface SubMenuProps {
|
|
3
4
|
children?: React.ReactNode;
|
|
4
5
|
generatedId?: string;
|
|
@@ -10,7 +11,7 @@ interface SubMenuProps {
|
|
|
10
11
|
href?: string;
|
|
11
12
|
caption?: string;
|
|
12
13
|
}
|
|
13
|
-
declare const SubMenuWithStaticFields: React.ForwardRefExoticComponent<SubMenuProps & React.RefAttributes<
|
|
14
|
+
declare const SubMenuWithStaticFields: React.ForwardRefExoticComponent<SubMenuProps & React.RefAttributes<ZIndex>> & {
|
|
14
15
|
__KONTUR_REACT_UI__: string;
|
|
15
16
|
};
|
|
16
17
|
export { SubMenuWithStaticFields as SubMenu };
|
package/utils/scripts.d.ts
CHANGED
|
@@ -8,5 +8,6 @@ export declare const getChildrenIdArray: (childrenArray: FlattedArrayElementType
|
|
|
8
8
|
export declare const getElementsChildren: (element: ReactElement, levelIndex: string) => FlattedArrayElementType[];
|
|
9
9
|
export declare const isParentOpened: (id: string | undefined, generatedId: string | undefined, openedParents: string[] | undefined) => boolean | "" | undefined;
|
|
10
10
|
export declare const isElementActive: (id: string | undefined, activeMenuItem: string | undefined | null) => boolean;
|
|
11
|
+
export declare const isBrowser: boolean;
|
|
11
12
|
export declare const isTouchDevice: () => boolean;
|
|
12
13
|
export declare const getIconSize: (_isSubMenu?: boolean | undefined, _isBackButton?: boolean | undefined) => 24 | 16 | undefined;
|
package/utils/scripts.js
CHANGED
|
@@ -73,8 +73,9 @@ export var isParentOpened = function (id, generatedId, openedParents) {
|
|
|
73
73
|
export var isElementActive = function (id, activeMenuItem) {
|
|
74
74
|
return !!id && !!activeMenuItem && id === activeMenuItem;
|
|
75
75
|
};
|
|
76
|
+
export var isBrowser = typeof window !== 'undefined';
|
|
76
77
|
export var isTouchDevice = function () {
|
|
77
|
-
return
|
|
78
|
+
return isBrowser && ('ontouchstart' in window || navigator.maxTouchPoints > 0);
|
|
78
79
|
};
|
|
79
80
|
export var getIconSize = function (_isSubMenu, _isBackButton) {
|
|
80
81
|
if (!_isSubMenu) {
|