@skbkontur/side-menu 0.6.2 → 0.7.1
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/README.md +204 -1
- package/hooks/useActiveState.js +5 -5
- package/hooks/useMobileSeparatedMenuScroll.js +2 -2
- package/hooks/useOpenedSubElementState.js +4 -4
- package/package.json +1 -1
- package/src/SideMenu/SideMenu.d.ts +3 -0
- package/src/SideMenu/SideMenu.js +100 -63
- package/src/SideMenu/SideMenu.styles.d.ts +22 -14
- package/src/SideMenu/SideMenu.styles.js +45 -29
- package/src/SideMenuBody/SideMenuBody.js +1 -1
- package/src/SideMenuBody/SideMenuBody.styles.d.ts +1 -1
- package/src/SideMenuBody/SideMenuBody.styles.js +1 -1
- package/src/SideMenuContext.d.ts +9 -6
- package/src/SideMenuDivider/SideMenuDivider.js +1 -1
- package/src/SideMenuDivider/SideMenuDivider.styles.d.ts +1 -1
- package/src/SideMenuDivider/SideMenuDivider.styles.js +1 -1
- package/src/SideMenuDropdown/SideMenuDropdown.js +3 -3
- package/src/SideMenuDropdown/SideMenuDropdown.styles.d.ts +3 -3
- package/src/SideMenuDropdown/SideMenuDropdown.styles.js +3 -3
- package/src/SideMenuFooter/SideMenuFooter.js +1 -1
- package/src/SideMenuFooter/SideMenuFooter.styles.d.ts +1 -1
- package/src/SideMenuFooter/SideMenuFooter.styles.js +1 -1
- package/src/SideMenuHeader/SideMenuHeader.js +8 -8
- package/src/SideMenuHeader/SideMenuHeader.styles.d.ts +5 -5
- package/src/SideMenuHeader/SideMenuHeader.styles.js +5 -5
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.js +1 -1
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.d.ts +2 -2
- package/src/SideMenuSubItemHeader/SideMenuSubItemHeader.styles.js +2 -2
- package/src/internal/BackButton.js +1 -1
- package/src/internal/Backdrop.js +1 -1
- package/src/internal/Backdrop.styles.d.ts +1 -1
- package/src/internal/Backdrop.styles.js +1 -1
- package/src/internal/Burger.js +1 -1
- package/src/internal/Burger.styles.d.ts +1 -1
- package/src/internal/Burger.styles.js +1 -1
- package/src/internal/ClickableElement.js +53 -17
- package/src/internal/ClickableElement.styles.d.ts +5 -5
- package/src/internal/ClickableElement.styles.js +5 -5
- package/src/internal/InnerBody.js +1 -1
- package/src/internal/InnerBody.styles.d.ts +1 -1
- package/src/internal/InnerBody.styles.js +1 -1
- package/src/internal/ItemContent/Caption.js +13 -13
- package/src/internal/ItemContent/Caption.styles.d.ts +12 -12
- package/src/internal/ItemContent/Caption.styles.js +12 -12
- package/src/internal/ItemContent/Icon.js +8 -8
- package/src/internal/ItemContent/Icon.styles.d.ts +8 -8
- package/src/internal/ItemContent/Icon.styles.js +8 -8
- package/src/internal/ItemContent/ItemContent.js +10 -10
- package/src/internal/ItemContent/ItemContent.styles.d.ts +8 -8
- package/src/internal/ItemContent/ItemContent.styles.js +8 -8
- package/src/internal/ItemContent/Marker.js +2 -2
- package/src/internal/ItemContent/Marker.styles.d.ts +2 -2
- package/src/internal/ItemContent/Marker.styles.js +2 -2
- package/src/internal/NestedMenu.js +1 -1
- package/src/internal/NestedMenu.styles.d.ts +1 -1
- package/src/internal/NestedMenu.styles.js +1 -1
- package/src/internal/RightBorder.d.ts +1 -1
- package/src/internal/RightBorder.js +5 -5
- package/src/internal/RightBorder.styles.d.ts +3 -3
- package/src/internal/RightBorder.styles.js +3 -3
- package/src/internal/SeparatedSubMenu.js +10 -4
- package/src/internal/SeparatedSubMenu.styles.d.ts +5 -2
- package/src/internal/SeparatedSubMenu.styles.js +13 -3
- package/src/internal/SideMenuLogotype.js +3 -3
- package/src/internal/SideMenuLogotype.styles.d.ts +2 -2
- package/src/internal/SideMenuLogotype.styles.js +2 -2
- package/src/internal/SubMenu.d.ts +1 -1
- package/src/internal/SubMenu.js +6 -3
- package/utils/scripts.d.ts +2 -2
- package/utils/scripts.js +5 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
3
|
var styles = {
|
|
4
|
-
|
|
4
|
+
divider: function () {
|
|
5
5
|
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: #d6d6d6;\n margin-left: 8px;\n margin-right: 8px;\n "], ["\n background: #d6d6d6;\n margin-left: 8px;\n margin-right: 8px;\n "])));
|
|
6
6
|
},
|
|
7
7
|
};
|
|
@@ -6,20 +6,20 @@ export var Caption = forwardRef(function (_a, ref) {
|
|
|
6
6
|
var _b;
|
|
7
7
|
var _isSubMenu = _a._isSubMenu, _isNestedSubMenu = _a._isNestedSubMenu, hasShortcutImage = _a.hasShortcutImage, caption = _a.caption, isMultiline = _a.isMultiline, _isBackButton = _a._isBackButton;
|
|
8
8
|
var context = useContext(SideMenuContext);
|
|
9
|
-
var
|
|
9
|
+
var isBeingTransitioned = context.isBeingTransitioned, isSeparatedMenu = context.isSeparatedMenu, size = context.size, isTouchScreen = context.isTouchScreen, hasSubIcons = context.hasSubIcons;
|
|
10
10
|
return (React.createElement("p", { className: cx((_b = {},
|
|
11
|
-
_b[jsStyles.
|
|
12
|
-
_b[jsStyles.
|
|
13
|
-
_b[jsStyles.
|
|
14
|
-
_b[jsStyles.
|
|
15
|
-
_b[jsStyles.
|
|
16
|
-
_b[jsStyles.
|
|
17
|
-
_b[jsStyles.
|
|
18
|
-
_b[jsStyles.
|
|
19
|
-
_b[jsStyles.
|
|
20
|
-
_b[jsStyles.
|
|
21
|
-
_b[jsStyles.
|
|
22
|
-
_b[jsStyles.
|
|
11
|
+
_b[jsStyles.root()] = true,
|
|
12
|
+
_b[jsStyles.rootBeingTransitioned()] = isBeingTransitioned && !_isSubMenu,
|
|
13
|
+
_b[jsStyles.rootSubItem()] = _isSubMenu,
|
|
14
|
+
_b[jsStyles.rootSubItemSeparatedMenuTopLevel()] = isSeparatedMenu && !_isNestedSubMenu && _isSubMenu,
|
|
15
|
+
_b[jsStyles.rootNestedItemSeparatedMenu()] = isSeparatedMenu && _isNestedSubMenu && !hasShortcutImage,
|
|
16
|
+
_b[jsStyles.rootWithoutItemIcon()] = !hasShortcutImage && !isSeparatedMenu,
|
|
17
|
+
_b[jsStyles.rootSubItemWithoutColumnIcons()] = _isSubMenu && isSeparatedMenu && !hasSubIcons,
|
|
18
|
+
_b[jsStyles.rootLarge()] = size === 'large',
|
|
19
|
+
_b[jsStyles.rootMultiline()] = isMultiline,
|
|
20
|
+
_b[jsStyles.rootForTouchScreens()] = isTouchScreen,
|
|
21
|
+
_b[jsStyles.rootSubItemForTouchScreens()] = isTouchScreen && _isSubMenu,
|
|
22
|
+
_b[jsStyles.rootInBackButton()] = _isBackButton,
|
|
23
23
|
_b)), ref: ref }, caption));
|
|
24
24
|
});
|
|
25
25
|
Caption.displayName = 'Caption';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export declare const jsStyles: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
root(): string;
|
|
3
|
+
rootBeingTransitioned(): string;
|
|
4
|
+
rootMultiline(): string;
|
|
5
|
+
rootForTouchScreens(): string;
|
|
6
|
+
rootSubItem(): string;
|
|
7
|
+
rootSubItemForTouchScreens(): string;
|
|
8
|
+
rootSubItemSeparatedMenuTopLevel(): string;
|
|
9
|
+
rootNestedItemSeparatedMenu(): string;
|
|
10
|
+
rootWithoutItemIcon(): string;
|
|
11
|
+
rootSubItemWithoutColumnIcons(): string;
|
|
12
|
+
rootLarge(): string;
|
|
13
|
+
rootInBackButton(): string;
|
|
14
14
|
};
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
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
5
|
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n line-height: 20px;\n margin: 0 8px 0 0;\n "], ["\n line-height: 20px;\n margin: 0 8px 0 0;\n "])));
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
rootBeingTransitioned: function () {
|
|
8
8
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n "], ["\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n "])));
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
rootMultiline: function () {
|
|
11
11
|
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n align-self: flex-start;\n "], ["\n align-self: flex-start;\n "])));
|
|
12
12
|
},
|
|
13
|
-
|
|
13
|
+
rootForTouchScreens: function () {
|
|
14
14
|
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: 18px;\n line-height: 24px;\n "], ["\n font-size: 18px;\n line-height: 24px;\n "])));
|
|
15
15
|
},
|
|
16
|
-
|
|
16
|
+
rootSubItem: function () {
|
|
17
17
|
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-left: 4px;\n "], ["\n margin-left: 4px;\n "])));
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
rootSubItemForTouchScreens: function () {
|
|
20
20
|
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-size: 16px;\n line-height: 22px;\n "], ["\n font-size: 16px;\n line-height: 22px;\n "])));
|
|
21
21
|
},
|
|
22
|
-
|
|
22
|
+
rootSubItemSeparatedMenuTopLevel: function () {
|
|
23
23
|
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin: 0 8px;\n "], ["\n margin: 0 8px;\n "])));
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
rootNestedItemSeparatedMenu: function () {
|
|
26
26
|
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n margin-left: 25px;\n "], ["\n margin-left: 25px;\n "])));
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
rootWithoutItemIcon: function () {
|
|
29
29
|
return css(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n margin-left: 40px;\n "], ["\n margin-left: 40px;\n "])));
|
|
30
30
|
},
|
|
31
|
-
|
|
31
|
+
rootSubItemWithoutColumnIcons: function () {
|
|
32
32
|
return css(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n margin-left: 8px;\n "], ["\n margin-left: 8px;\n "])));
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
rootLarge: function () {
|
|
35
35
|
return css(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n font-size: 16px !important;\n line-height: 22px !important;\n "], ["\n font-size: 16px !important;\n line-height: 22px !important;\n "])));
|
|
36
36
|
},
|
|
37
|
-
|
|
37
|
+
rootInBackButton: function () {
|
|
38
38
|
return css(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n font-weight: 700;\n font-size: 20px;\n line-height: 28px;\n padding-top: 5px;\n padding-bottom: 5px;\n "], ["\n font-weight: 700;\n font-size: 20px;\n line-height: 28px;\n padding-top: 5px;\n padding-bottom: 5px;\n "])));
|
|
39
39
|
},
|
|
40
40
|
};
|
|
@@ -13,14 +13,14 @@ export var Icon = function (_a) {
|
|
|
13
13
|
color: _isSubMenu ? '#858585' : undefined,
|
|
14
14
|
disableCompensation: !_isBackButton,
|
|
15
15
|
className: cx((_b = {},
|
|
16
|
-
_b[jsStyles.
|
|
17
|
-
_b[jsStyles.
|
|
18
|
-
_b[jsStyles.
|
|
19
|
-
_b[jsStyles.
|
|
20
|
-
_b[jsStyles.
|
|
21
|
-
_b[jsStyles.
|
|
22
|
-
_b[jsStyles.
|
|
23
|
-
_b[jsStyles.
|
|
16
|
+
_b[jsStyles.root()] = true,
|
|
17
|
+
_b[jsStyles.rootMultiline()] = isMultiline && !context.isMinimized,
|
|
18
|
+
_b[jsStyles.rootLarge()] = size === 'large',
|
|
19
|
+
_b[jsStyles.rootMultilineLarge()] = size === 'large' && isMultiline,
|
|
20
|
+
_b[jsStyles.rootSubItem()] = _isSubMenu,
|
|
21
|
+
_b[jsStyles.rootSubItemSeparatedMenu()] = isSeparatedMenu && _isSubMenu,
|
|
22
|
+
_b[jsStyles.rootSubItemLarge()] = _isSubMenu && size === 'large',
|
|
23
|
+
_b[jsStyles.rootBackButton()] = _isBackButton,
|
|
24
24
|
_b)),
|
|
25
25
|
});
|
|
26
26
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare const jsStyles: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
root(): string;
|
|
3
|
+
rootMultiline(): string;
|
|
4
|
+
rootLarge(): string;
|
|
5
|
+
rootMultilineLarge(): string;
|
|
6
|
+
rootSubItemLarge(): string;
|
|
7
|
+
rootSubItem(): string;
|
|
8
|
+
rootSubItemSeparatedMenu(): string;
|
|
9
|
+
rootBackButton(): string;
|
|
10
10
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
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
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 "])));
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
rootMultiline: function () {
|
|
8
8
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n min-height: 0;\n align-self: flex-start;\n align-items: flex-start;\n "], ["\n min-height: 0;\n align-self: flex-start;\n align-items: flex-start;\n "])));
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
rootLarge: function () {
|
|
11
11
|
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n min-height: 30px;\n line-height: 22px;\n "], ["\n min-height: 30px;\n line-height: 22px;\n "])));
|
|
12
12
|
},
|
|
13
|
-
|
|
13
|
+
rootMultilineLarge: function () {
|
|
14
14
|
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n min-height: 0;\n "], ["\n min-height: 0;\n "])));
|
|
15
15
|
},
|
|
16
|
-
|
|
16
|
+
rootSubItemLarge: function () {
|
|
17
17
|
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n min-height: 22px;\n "], ["\n min-height: 22px;\n "])));
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
rootSubItem: function () {
|
|
20
20
|
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-left: 20px;\n padding-right: 0;\n min-height: 20px;\n line-height: 16px;\n "], ["\n padding-left: 20px;\n padding-right: 0;\n min-height: 20px;\n line-height: 16px;\n "])));
|
|
21
21
|
},
|
|
22
|
-
|
|
22
|
+
rootSubItemSeparatedMenu: function () {
|
|
23
23
|
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-left: 4px;\n "], ["\n padding-left: 4px;\n "])));
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
rootBackButton: function () {
|
|
26
26
|
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n padding-left: 10px;\n padding-right: 6px;\n "], ["\n padding-left: 10px;\n padding-right: 6px;\n "])));
|
|
27
27
|
},
|
|
28
28
|
};
|
|
@@ -18,21 +18,21 @@ var ItemContent = forwardRef(function (_a, ref) {
|
|
|
18
18
|
var _c = useState(false), isMultiline = _c[0], setIsMultiline = _c[1];
|
|
19
19
|
useEffect(function () {
|
|
20
20
|
!_isBackButton && useNumberOfTextLinesInItem(textRef, setIsMultiline);
|
|
21
|
-
}, [textRef.current]);
|
|
21
|
+
}, [textRef.current, context.isBeingTransitioned]);
|
|
22
22
|
var hasShortcutImage = !!icon || !!_avatar;
|
|
23
23
|
return (React.createElement("div", { className: cx((_b = {},
|
|
24
|
-
_b[jsStyles.
|
|
25
|
-
_b[jsStyles.
|
|
26
|
-
_b[jsStyles.
|
|
27
|
-
_b[jsStyles.
|
|
28
|
-
_b[jsStyles.
|
|
29
|
-
_b[jsStyles.
|
|
30
|
-
_b[jsStyles.
|
|
31
|
-
_b[jsStyles.
|
|
24
|
+
_b[jsStyles.root()] = true,
|
|
25
|
+
_b[jsStyles.multilineRoot()] = isMultiline,
|
|
26
|
+
_b[jsStyles.subItemRoot()] = _isSubMenu,
|
|
27
|
+
_b[jsStyles.largeRoot()] = context.size === 'large',
|
|
28
|
+
_b[jsStyles.subItemLargeRoot()] = context.size === 'large' && _isSubMenu,
|
|
29
|
+
_b[jsStyles.largeMultilineRoot()] = isMultiline && context.size === 'large',
|
|
30
|
+
_b[jsStyles.rootForTouchScreens()] = context.isTouchScreen,
|
|
31
|
+
_b[jsStyles.subItemRootForTouchScreens()] = context.isTouchScreen && _isSubMenu,
|
|
32
32
|
_b)), ref: ref },
|
|
33
33
|
icon && React.createElement(Icon, { icon: icon, _isSubMenu: _isSubMenu, isMultiline: isMultiline, _isBackButton: _isBackButton }),
|
|
34
34
|
_avatar && React.createElement(Avatar, { _avatar: _avatar }),
|
|
35
|
-
!context.
|
|
35
|
+
(!context.isMinimized || (context.isMinimized && _isSubMenu)) && (React.createElement("div", { className: jsStyles.textAndMarkerWrapper() },
|
|
36
36
|
React.createElement(Caption, { _isSubMenu: _isSubMenu, _isNestedSubMenu: _isNestedSubMenu, hasShortcutImage: hasShortcutImage, isMultiline: isMultiline, caption: caption, _isBackButton: _isBackButton, ref: textRef }),
|
|
37
37
|
marker && React.createElement(Marker, { isMultiline: isMultiline, marker: marker })))));
|
|
38
38
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export declare const jsStyles: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
root(): string;
|
|
3
|
+
multilineRoot(): string;
|
|
4
|
+
largeRoot(): string;
|
|
5
|
+
subItemLargeRoot(): string;
|
|
6
|
+
largeMultilineRoot(): string;
|
|
7
|
+
rootForTouchScreens(): string;
|
|
8
|
+
subItemRootForTouchScreens(): string;
|
|
9
|
+
subItemRoot(): string;
|
|
10
10
|
textAndMarkerWrapper(): string;
|
|
11
11
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
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
5
|
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding-top: 4px;\n padding-bottom: 4px;\n "], ["\n display: flex;\n align-items: center;\n padding-top: 4px;\n padding-bottom: 4px;\n "])));
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
multilineRoot: function () {
|
|
8
8
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-top: 8px;\n padding-bottom: 8px;\n "], ["\n padding-top: 8px;\n padding-bottom: 8px;\n "])));
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
largeRoot: function () {
|
|
11
11
|
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding-top: 9px !important;\n padding-bottom: 9px !important;\n "], ["\n padding-top: 9px !important;\n padding-bottom: 9px !important;\n "])));
|
|
12
12
|
},
|
|
13
|
-
|
|
13
|
+
subItemLargeRoot: function () {
|
|
14
14
|
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding-top: 5px !important;\n padding-bottom: 5px !important;\n "], ["\n padding-top: 5px !important;\n padding-bottom: 5px !important;\n "])));
|
|
15
15
|
},
|
|
16
|
-
|
|
16
|
+
largeMultilineRoot: function () {
|
|
17
17
|
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding-top: 8px;\n padding-bottom: 8px;\n "], ["\n padding-top: 8px;\n padding-bottom: 8px;\n "])));
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
rootForTouchScreens: function () {
|
|
20
20
|
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding-top: 8px;\n padding-bottom: 8px;\n "], ["\n padding-top: 8px;\n padding-bottom: 8px;\n "])));
|
|
21
21
|
},
|
|
22
|
-
|
|
22
|
+
subItemRootForTouchScreens: function () {
|
|
23
23
|
return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n padding-top: 9px;\n padding-bottom: 9px;\n "], ["\n padding-top: 9px;\n padding-bottom: 9px;\n "])));
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
subItemRoot: function () {
|
|
26
26
|
return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n padding-top: 4px;\n padding-bottom: 4px;\n "], ["\n padding-top: 4px;\n padding-bottom: 4px;\n "])));
|
|
27
27
|
},
|
|
28
28
|
textAndMarkerWrapper: function () {
|
|
@@ -5,7 +5,7 @@ export var Marker = function (_a) {
|
|
|
5
5
|
var _b;
|
|
6
6
|
var isMultiline = _a.isMultiline, marker = _a.marker;
|
|
7
7
|
return (React.createElement("span", { className: cx((_b = {},
|
|
8
|
-
_b[jsStyles.
|
|
9
|
-
_b[jsStyles.
|
|
8
|
+
_b[jsStyles.root()] = true,
|
|
9
|
+
_b[jsStyles.rootMultiline()] = isMultiline,
|
|
10
10
|
_b)) }, marker));
|
|
11
11
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
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
5
|
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-right: 6px;\n padding-left: 6px;\n background: #2291ff;\n border-radius: 9999px;\n margin-left: auto;\n margin-right: 8px;\n color: #fff;\n line-height: 20px;\n font-weight: 700;\n "], ["\n padding-right: 6px;\n padding-left: 6px;\n background: #2291ff;\n border-radius: 9999px;\n margin-left: auto;\n margin-right: 8px;\n color: #fff;\n line-height: 20px;\n font-weight: 700;\n "])));
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
rootMultiline: function () {
|
|
8
8
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: flex-start;\n "], ["\n align-self: flex-start;\n "])));
|
|
9
9
|
},
|
|
10
10
|
};
|
|
@@ -9,7 +9,7 @@ import { isClickableSubElement } from '../../utils/scripts';
|
|
|
9
9
|
var NestedMenu = forwardRef(function (_a, ref) {
|
|
10
10
|
var _generatedId = _a._generatedId, children = _a.children;
|
|
11
11
|
var levelIndex = 0;
|
|
12
|
-
return (React.createElement("div", { className: jsStyles.
|
|
12
|
+
return (React.createElement("div", { className: jsStyles.root() }, React.Children.map(children, function (child) {
|
|
13
13
|
if (React.isValidElement(child) &&
|
|
14
14
|
// @ts-expect-error: accessing private property
|
|
15
15
|
isClickableSubElement(child.type.__KONTUR_REACT_UI__)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
5
|
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding-left: 16px;\n "], ["\n padding-left: 16px;\n "])));
|
|
6
6
|
},
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface RightBorderProps {
|
|
3
|
-
|
|
3
|
+
setIsMinimized: (value: boolean) => void;
|
|
4
4
|
}
|
|
5
5
|
declare const RightBorderWithStaticFields: React.ForwardRefExoticComponent<RightBorderProps & React.RefAttributes<HTMLDivElement>> & {
|
|
6
6
|
__KONTUR_REACT_UI__: string;
|
|
@@ -9,7 +9,7 @@ import { SideMenuContext } from '../SideMenuContext';
|
|
|
9
9
|
*/
|
|
10
10
|
var RightBorder = forwardRef(function (_a, ref) {
|
|
11
11
|
var _b;
|
|
12
|
-
var
|
|
12
|
+
var setIsMinimized = _a.setIsMinimized;
|
|
13
13
|
var context = useContext(SideMenuContext);
|
|
14
14
|
var resizeTimer = null;
|
|
15
15
|
var _c = useState(false), isAbleToResize = _c[0], setIsAbleToResize = _c[1];
|
|
@@ -35,7 +35,7 @@ var RightBorder = forwardRef(function (_a, ref) {
|
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
if (event.pageX < startX && isAbleToResize) {
|
|
38
|
-
|
|
38
|
+
setIsMinimized(true);
|
|
39
39
|
}
|
|
40
40
|
return;
|
|
41
41
|
};
|
|
@@ -62,9 +62,9 @@ var RightBorder = forwardRef(function (_a, ref) {
|
|
|
62
62
|
};
|
|
63
63
|
});
|
|
64
64
|
return (React.createElement("div", { className: cx((_b = {},
|
|
65
|
-
_b[jsStyles.
|
|
66
|
-
_b[jsStyles.
|
|
67
|
-
_b)), ref: rightBorderRef || ref, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, isAbleToResize && React.createElement("div", { className: customStyles.
|
|
65
|
+
_b[jsStyles.root()] = true,
|
|
66
|
+
_b[jsStyles.resizableRoot()] = isAbleToResize,
|
|
67
|
+
_b)), ref: rightBorderRef || ref, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave }, isAbleToResize && React.createElement("div", { className: customStyles.rootHovered(context.productColor) })));
|
|
68
68
|
});
|
|
69
69
|
RightBorder.displayName = 'RightBorder';
|
|
70
70
|
var RightBorderWithStaticFields = Object.assign(RightBorder, { __KONTUR_REACT_UI__: 'RightBorder' });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const customStyles: {
|
|
2
|
-
|
|
2
|
+
rootHovered(color?: string | undefined): string;
|
|
3
3
|
};
|
|
4
4
|
export declare const jsStyles: {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
root(): string;
|
|
6
|
+
resizableRoot(): string;
|
|
7
7
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
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
5
|
return css(templateObject_1 || (templateObject_1 = __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 "])));
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
resizableRoot: function () {
|
|
8
8
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n cursor: col-resize;\n "], ["\n cursor: col-resize;\n "])));
|
|
9
9
|
},
|
|
10
10
|
};
|
|
11
11
|
export var customStyles = {
|
|
12
|
-
|
|
12
|
+
rootHovered: function (color) {
|
|
13
13
|
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n width: 2px;\n background: ", ";\n height: 100%;\n left: 9px;\n "], ["\n position: absolute;\n width: 2px;\n background: ", ";\n height: 100%;\n left: 9px;\n "])), color);
|
|
14
14
|
},
|
|
15
15
|
};
|
|
@@ -9,6 +9,7 @@ import { BackButton } from './BackButton';
|
|
|
9
9
|
import { mergeRefs } from '@skbkontur/react-ui/lib/utils';
|
|
10
10
|
import { SideMenuDataTids } from '../../SideMenuDataTids';
|
|
11
11
|
import { useMobileSeparatedMenuScroll } from '../../hooks/useMobileSeparatedMenuScroll';
|
|
12
|
+
import { isIE11 } from '@skbkontur/react-ui/lib/client';
|
|
12
13
|
/**
|
|
13
14
|
* Отдельностоящее подменю
|
|
14
15
|
*
|
|
@@ -32,11 +33,16 @@ var SeparatedSubMenu = forwardRef(function (_a, ref) {
|
|
|
32
33
|
};
|
|
33
34
|
var separatedMenuRef = useMobileSeparatedMenuScroll();
|
|
34
35
|
var levelIndex = 0;
|
|
36
|
+
var isDesktopOverlayMenu = (context.isDesktop || context.isNarrowDesktop) && !context.separatedMenuWithoutOverlay;
|
|
37
|
+
var isSeparatedSubMenuOverContent = (context.isTablet || isDesktopOverlayMenu) && !isIE11;
|
|
35
38
|
return (React.createElement("div", { className: cx((_b = {},
|
|
36
|
-
_b[jsStyles.
|
|
37
|
-
_b[jsStyles.
|
|
38
|
-
_b[jsStylesForSeparatedSubMenu.
|
|
39
|
-
_b[jsStylesForSeparatedSubMenu.
|
|
39
|
+
_b[jsStyles.container()] = true,
|
|
40
|
+
_b[jsStyles.containerForTouchScreens()] = context.isTouchScreen,
|
|
41
|
+
_b[jsStylesForSeparatedSubMenu.root()] = true,
|
|
42
|
+
_b[jsStylesForSeparatedSubMenu.rootForMobiles()] = context.isMobile,
|
|
43
|
+
_b[jsStylesForSeparatedSubMenu.rootWithoutOverlay()] = context.separatedMenuWithoutOverlay && context.isDesktop,
|
|
44
|
+
_b[jsStylesForSeparatedSubMenu.rootWithoutOverlayForNarrowDesktop()] = context.separatedMenuWithoutOverlay && context.isNarrowDesktop,
|
|
45
|
+
_b[jsStylesForSeparatedSubMenu.rootWithShadow()] = isSeparatedSubMenuOverContent,
|
|
40
46
|
_b)), ref: mergeRefs([separatedMenuRef, ref]), "data-tid": SideMenuDataTids.separatedSubMenu },
|
|
41
47
|
context.isMobile && React.createElement(BackButton, { caption: caption, id: id, href: href, generatedId: generatedId }),
|
|
42
48
|
React.createElement(SideMenuContext.Provider, { value: __assign({ hasSubIcons: hasSubItems(children) }, context) }, React.Children.map(children, function (child) {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare const jsStylesForSeparatedSubMenu: {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
root(): string;
|
|
3
|
+
rootForMobiles(): string;
|
|
4
|
+
rootWithoutOverlayForNarrowDesktop(): string;
|
|
5
|
+
rootWithoutOverlay(): string;
|
|
6
|
+
rootWithShadow(): string;
|
|
4
7
|
};
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
|
+
import { sideMenuBoxShadow, sideMenuMinimizedWidth, sideMenuStandardWidth } from '../SideMenu/SideMenu.styles';
|
|
3
4
|
var styles = {
|
|
4
|
-
|
|
5
|
+
root: function () {
|
|
5
6
|
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n z-index: 8000;\n background: #fff;\n left: 100%;\n overflow: auto;\n justify-content: flex-start;\n padding: 24px 16px;\n border-right: 1px solid #e5e5e5;\n "], ["\n position: absolute;\n top: 0;\n z-index: 8000;\n background: #fff;\n left: 100%;\n overflow: auto;\n justify-content: flex-start;\n padding: 24px 16px;\n border-right: 1px solid #e5e5e5;\n "])));
|
|
6
7
|
},
|
|
7
|
-
|
|
8
|
+
rootForMobiles: function () {
|
|
8
9
|
var headerHeight = '68px';
|
|
9
10
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: calc(100vh - ", ");\n left: 0;\n top: ", ";\n padding-top: 0;\n "], ["\n height: calc(100vh - ", ");\n left: 0;\n top: ", ";\n padding-top: 0;\n "])), headerHeight, headerHeight);
|
|
10
11
|
},
|
|
12
|
+
rootWithoutOverlayForNarrowDesktop: function () {
|
|
13
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n left: ", ";\n z-index: -1;\n "], ["\n left: ", ";\n z-index: -1;\n "])), sideMenuMinimizedWidth);
|
|
14
|
+
},
|
|
15
|
+
rootWithoutOverlay: function () {
|
|
16
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n left: ", ";\n z-index: -1;\n "], ["\n left: ", ";\n z-index: -1;\n "])), sideMenuStandardWidth);
|
|
17
|
+
},
|
|
18
|
+
rootWithShadow: function () {
|
|
19
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n box-shadow: ", ";\n clip-path: inset(0 -24px 0 0);\n border-right: none;\n "], ["\n box-shadow: ", ";\n clip-path: inset(0 -24px 0 0);\n border-right: none;\n "])), sideMenuBoxShadow);
|
|
20
|
+
},
|
|
11
21
|
};
|
|
12
22
|
export var jsStylesForSeparatedSubMenu = memoizeStyle(styles);
|
|
13
|
-
var templateObject_1, templateObject_2;
|
|
23
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -42,8 +42,8 @@ var SideMenuLogotype = forwardRef(function (_a, ref) {
|
|
|
42
42
|
var getStaticIconPath = function () {
|
|
43
43
|
return "https://s.kontur.ru/common-v2/icons-products/" + productName + "/" + productName + "-32.svg";
|
|
44
44
|
};
|
|
45
|
-
if (context.
|
|
46
|
-
return React.createElement("img", { className: jsStyles.
|
|
45
|
+
if (context.isMinimized || context.isBeingTransitioned) {
|
|
46
|
+
return React.createElement("img", { className: jsStyles.icon(), src: iconUrl || getStaticIconPath(), alt: productName });
|
|
47
47
|
}
|
|
48
48
|
var getWidget = function (withWidget, isTouchScreen, showWidget) {
|
|
49
49
|
if (withWidget !== undefined) {
|
|
@@ -54,7 +54,7 @@ var SideMenuLogotype = forwardRef(function (_a, ref) {
|
|
|
54
54
|
}
|
|
55
55
|
return showWidget;
|
|
56
56
|
};
|
|
57
|
-
return (React.createElement("div", { className: jsStyles.
|
|
57
|
+
return (React.createElement("div", { className: jsStyles.root(), ref: ref },
|
|
58
58
|
(context.isTablet || context.isMobile) && React.createElement(Burger, null),
|
|
59
59
|
React.createElement(Logotype, __assign({ ref: refLogotype, size: size, productLogo: productLogo, konturLogo: konturLogo, withWidget: getWidget(withWidget, context.isTouchScreen, context.showWidget) }, rest))));
|
|
60
60
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __makeTemplateObject } from "tslib";
|
|
2
2
|
import { css, memoizeStyle } from '@skbkontur/react-ui/lib/theming/Emotion';
|
|
3
3
|
var styles = {
|
|
4
|
-
|
|
4
|
+
icon: function () {
|
|
5
5
|
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 0 4px;\n "], ["\n padding: 0 4px;\n "])));
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
root: function () {
|
|
8
8
|
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n "], ["\n display: flex;\n "])));
|
|
9
9
|
},
|
|
10
10
|
};
|
package/src/internal/SubMenu.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
1
|
+
import React, { forwardRef, useContext } from 'react';
|
|
2
2
|
import { SeparatedSubMenu } from './SeparatedSubMenu';
|
|
3
3
|
import { InnerSubMenu } from './InnerSubMenu';
|
|
4
|
+
import { SideMenuContext } from '../SideMenuContext';
|
|
4
5
|
/**
|
|
5
6
|
* Подменю
|
|
6
7
|
*
|
|
7
8
|
* @visibleName InnerSubMenu
|
|
8
9
|
*/
|
|
9
10
|
var SubMenu = forwardRef(function (_a, ref) {
|
|
10
|
-
var children = _a.children, isOpened = _a.isOpened, isSubMenu = _a.isSubMenu,
|
|
11
|
-
|
|
11
|
+
var children = _a.children, isOpened = _a.isOpened, isSubMenu = _a.isSubMenu, isMinimized = _a.isMinimized, isSeparatedMenu = _a.isSeparatedMenu, generatedId = _a.generatedId, id = _a.id, href = _a.href, caption = _a.caption;
|
|
12
|
+
var context = useContext(SideMenuContext);
|
|
13
|
+
var shouldHideOverlayMenu = isMinimized && !context.separatedMenuWithoutOverlay;
|
|
14
|
+
if (!children || !isOpened || isSubMenu || shouldHideOverlayMenu) {
|
|
12
15
|
return null;
|
|
13
16
|
}
|
|
14
17
|
if (isSeparatedMenu) {
|
package/utils/scripts.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export declare const getAllParents: (id: string, flattedArrayOfAllElements: Flat
|
|
|
7
7
|
export declare const getChildrenIdArray: (childrenArray: FlattedArrayElementType[], id: string, isIdGenerated?: boolean) => string[];
|
|
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
|
-
export declare const
|
|
11
|
-
export declare const
|
|
10
|
+
export declare const isElementActive: (id: string | undefined, activeMenuItem: string | undefined | null) => boolean;
|
|
11
|
+
export declare const isTouchDevice: () => boolean;
|
|
12
12
|
export declare const getIconSize: (_isSubMenu?: boolean | undefined, _isBackButton?: boolean | undefined) => 24 | 16 | undefined;
|