@gravity-ui/page-constructor 3.10.3 → 3.12.0
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/README.md +9 -11
- package/build/cjs/components/Media/Image/Image.js +3 -2
- package/build/cjs/editor/components/ControlPanel/ControlPanel.js +4 -1
- package/build/cjs/editor/components/DeviceEmulation/DeviceEmulation.d.ts +7 -0
- package/build/cjs/editor/components/DeviceEmulation/DeviceEmulation.js +10 -0
- package/build/cjs/editor/components/DeviceEmulation/DeviceEmulationMobile/DeviceEmulationMobile.css +33 -0
- package/build/cjs/editor/components/DeviceEmulation/DeviceEmulationMobile/DeviceEmulationMobile.d.ts +8 -0
- package/build/cjs/editor/components/DeviceEmulation/DeviceEmulationMobile/DeviceEmulationMobile.js +41 -0
- package/build/cjs/editor/components/DeviceEmulation/utils.d.ts +4 -0
- package/build/cjs/editor/components/DeviceEmulation/utils.js +7 -0
- package/build/cjs/editor/components/Layout/Layout.js +3 -1
- package/build/cjs/editor/containers/Editor/Editor.d.ts +1 -1
- package/build/cjs/editor/containers/Editor/Editor.js +34 -9
- package/build/cjs/editor/containers/Form/Form.js +2 -2
- package/build/cjs/editor/context.d.ts +9 -0
- package/build/cjs/editor/context.js +6 -0
- package/build/cjs/editor/icons/Tablet.d.ts +2 -0
- package/build/cjs/editor/icons/Tablet.js +9 -0
- package/build/cjs/editor/types/index.d.ts +14 -5
- package/build/cjs/editor/types/index.js +3 -1
- package/build/cjs/editor/utils/index.d.ts +2 -0
- package/build/cjs/editor/utils/index.js +4 -1
- package/build/cjs/editor/widget/constants.d.ts +4 -0
- package/build/cjs/editor/widget/constants.js +8 -0
- package/build/cjs/editor/widget/index.d.ts +21 -0
- package/build/cjs/editor/widget/index.js +76 -0
- package/build/cjs/editor/widget/utils.d.ts +1 -0
- package/build/cjs/editor/widget/utils.js +19 -0
- package/build/cjs/hooks/useHeightCalculator.js +1 -1
- package/build/cjs/models/navigation.d.ts +3 -2
- package/build/{esm/navigation/components/Header/Header.css → cjs/navigation/components/DesktopNavigation/DesktopNavigation.css} +28 -36
- package/build/cjs/navigation/components/DesktopNavigation/DesktopNavigation.d.ts +4 -0
- package/build/cjs/navigation/components/DesktopNavigation/DesktopNavigation.js +21 -0
- package/build/cjs/navigation/components/MobileMenuButton/MobileMenuButton.css +7 -0
- package/build/cjs/navigation/components/MobileMenuButton/MobileMenuButton.d.ts +3 -0
- package/build/cjs/navigation/components/MobileMenuButton/MobileMenuButton.js +15 -0
- package/build/cjs/navigation/components/MobileNavigation/MobileNavigation.css +10 -5
- package/build/cjs/navigation/components/MobileNavigation/MobileNavigation.d.ts +1 -10
- package/build/cjs/navigation/components/MobileNavigation/MobileNavigation.js +7 -30
- package/build/cjs/navigation/components/Navigation/Navigation.css +8 -13
- package/build/cjs/navigation/components/Navigation/Navigation.d.ts +4 -7
- package/build/cjs/navigation/components/Navigation/Navigation.js +37 -15
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.css +28 -0
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.d.ts +3 -9
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +15 -6
- package/build/cjs/navigation/components/NavigationItem/components/GithubButton/GithubButton.d.ts +1 -1
- package/build/cjs/navigation/components/NavigationItem/components/NavigationButton/NavigationButton.d.ts +1 -1
- package/build/cjs/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.d.ts +5 -4
- package/build/cjs/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js +12 -7
- package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.d.ts +1 -1
- package/build/cjs/navigation/components/NavigationList/NavigationList.d.ts +3 -0
- package/build/cjs/navigation/components/NavigationList/NavigationList.js +11 -0
- package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.d.ts +4 -13
- package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.js +6 -13
- package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.css +5 -4
- package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.d.ts +1 -8
- package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.js +6 -6
- package/build/cjs/navigation/containers/Layout/Layout.js +2 -2
- package/build/cjs/navigation/models.d.ts +63 -0
- package/build/cjs/navigation/{constants.js → models.js} +7 -1
- package/build/cjs/navigation/utils.d.ts +11 -1
- package/build/cjs/navigation/utils.js +19 -1
- package/build/esm/components/Media/Image/Image.js +3 -2
- package/build/esm/editor/components/ControlPanel/ControlPanel.js +6 -3
- package/build/esm/editor/components/DeviceEmulation/DeviceEmulation.d.ts +7 -0
- package/build/esm/editor/components/DeviceEmulation/DeviceEmulation.js +7 -0
- package/build/esm/editor/components/DeviceEmulation/DeviceEmulationMobile/DeviceEmulationMobile.css +33 -0
- package/build/esm/editor/components/DeviceEmulation/DeviceEmulationMobile/DeviceEmulationMobile.d.ts +9 -0
- package/build/esm/editor/components/DeviceEmulation/DeviceEmulationMobile/DeviceEmulationMobile.js +40 -0
- package/build/esm/editor/components/DeviceEmulation/utils.d.ts +4 -0
- package/build/esm/editor/components/DeviceEmulation/utils.js +3 -0
- package/build/esm/editor/components/Layout/Layout.js +3 -1
- package/build/esm/editor/containers/Editor/Editor.d.ts +1 -1
- package/build/esm/editor/containers/Editor/Editor.js +35 -10
- package/build/esm/editor/containers/Form/Form.js +2 -2
- package/build/esm/editor/context.d.ts +9 -0
- package/build/esm/editor/context.js +2 -0
- package/build/esm/editor/icons/Tablet.d.ts +2 -0
- package/build/esm/editor/icons/Tablet.js +4 -0
- package/build/esm/editor/types/index.d.ts +14 -5
- package/build/esm/editor/types/index.js +3 -1
- package/build/esm/editor/utils/index.d.ts +2 -0
- package/build/esm/editor/utils/index.js +2 -0
- package/build/esm/editor/widget/constants.d.ts +4 -0
- package/build/esm/editor/widget/constants.js +5 -0
- package/build/esm/editor/widget/index.d.ts +21 -0
- package/build/esm/editor/widget/index.js +71 -0
- package/build/esm/editor/widget/utils.d.ts +1 -0
- package/build/esm/editor/widget/utils.js +15 -0
- package/build/esm/hooks/useHeightCalculator.js +1 -1
- package/build/esm/models/navigation.d.ts +3 -2
- package/build/{cjs/navigation/components/Header/Header.css → esm/navigation/components/DesktopNavigation/DesktopNavigation.css} +28 -36
- package/build/esm/navigation/components/DesktopNavigation/DesktopNavigation.d.ts +5 -0
- package/build/esm/navigation/components/DesktopNavigation/DesktopNavigation.js +19 -0
- package/build/esm/navigation/components/MobileMenuButton/MobileMenuButton.css +7 -0
- package/build/esm/navigation/components/MobileMenuButton/MobileMenuButton.d.ts +4 -0
- package/build/esm/navigation/components/MobileMenuButton/MobileMenuButton.js +11 -0
- package/build/esm/navigation/components/MobileNavigation/MobileNavigation.css +10 -5
- package/build/esm/navigation/components/MobileNavigation/MobileNavigation.d.ts +1 -10
- package/build/esm/navigation/components/MobileNavigation/MobileNavigation.js +9 -31
- package/build/esm/navigation/components/Navigation/Navigation.css +8 -13
- package/build/esm/navigation/components/Navigation/Navigation.d.ts +4 -7
- package/build/esm/navigation/components/Navigation/Navigation.js +35 -15
- package/build/esm/navigation/components/NavigationItem/NavigationItem.css +28 -0
- package/build/esm/navigation/components/NavigationItem/NavigationItem.d.ts +4 -9
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +16 -6
- package/build/esm/navigation/components/NavigationItem/components/GithubButton/GithubButton.d.ts +1 -1
- package/build/esm/navigation/components/NavigationItem/components/NavigationButton/NavigationButton.d.ts +1 -1
- package/build/esm/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.d.ts +5 -4
- package/build/esm/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js +12 -7
- package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.d.ts +1 -1
- package/build/esm/navigation/components/NavigationList/NavigationList.d.ts +3 -0
- package/build/esm/navigation/components/NavigationList/NavigationList.js +7 -0
- package/build/esm/navigation/components/NavigationListItem/NavigationListItem.d.ts +4 -14
- package/build/esm/navigation/components/NavigationListItem/NavigationListItem.js +5 -10
- package/build/esm/navigation/components/NavigationPopup/NavigationPopup.css +5 -4
- package/build/esm/navigation/components/NavigationPopup/NavigationPopup.d.ts +1 -8
- package/build/esm/navigation/components/NavigationPopup/NavigationPopup.js +6 -6
- package/build/esm/navigation/containers/Layout/Layout.js +2 -2
- package/build/esm/navigation/models.d.ts +63 -0
- package/build/esm/navigation/{constants.js → models.js} +6 -0
- package/build/esm/navigation/utils.d.ts +11 -1
- package/build/esm/navigation/utils.js +17 -0
- package/package.json +39 -16
- package/server/models/navigation.d.ts +3 -2
- package/widget/index.js +1 -0
- package/CHANGELOG.md +0 -1469
- package/build/cjs/navigation/components/Header/Header.d.ts +0 -8
- package/build/cjs/navigation/components/Header/Header.js +0 -86
- package/build/cjs/navigation/components/NavigationDropdownItem/NavigationDropdownItem.d.ts +0 -11
- package/build/cjs/navigation/components/NavigationDropdownItem/NavigationDropdownItem.js +0 -15
- package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.css +0 -27
- package/build/cjs/navigation/constants.d.ts +0 -6
- package/build/esm/navigation/components/Header/Header.d.ts +0 -9
- package/build/esm/navigation/components/Header/Header.js +0 -82
- package/build/esm/navigation/components/NavigationDropdownItem/NavigationDropdownItem.d.ts +0 -11
- package/build/esm/navigation/components/NavigationDropdownItem/NavigationDropdownItem.js +0 -13
- package/build/esm/navigation/components/NavigationListItem/NavigationListItem.css +0 -27
- package/build/esm/navigation/constants.d.ts +0 -6
|
@@ -1,52 +1,39 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
|
-
.pc-
|
|
4
|
-
position: sticky;
|
|
5
|
-
z-index: 98;
|
|
6
|
-
top: 0;
|
|
7
|
-
display: flex;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
align-items: center;
|
|
10
|
-
height: var(--header-height);
|
|
11
|
-
background-color: var(--yc-color-base-background);
|
|
12
|
-
}
|
|
13
|
-
.pc-header_with-border {
|
|
14
|
-
box-shadow: inset 0 -1px 0 var(--yc-color-line-generic);
|
|
15
|
-
}
|
|
16
|
-
.pc-header__wrapper {
|
|
3
|
+
.pc-desktop-navigation__wrapper {
|
|
17
4
|
display: flex;
|
|
18
5
|
justify-content: space-between;
|
|
19
6
|
align-items: center;
|
|
20
7
|
height: var(--header-height);
|
|
21
8
|
}
|
|
22
9
|
@media (min-width: 769px) {
|
|
23
|
-
.pc-
|
|
10
|
+
.pc-desktop-navigation__mobile-menu-button.pc-desktop-navigation__mobile-menu-button {
|
|
24
11
|
display: none;
|
|
25
12
|
}
|
|
26
13
|
}
|
|
27
14
|
|
|
28
|
-
.pc-
|
|
15
|
+
.pc-desktop-navigation__navigation, .pc-desktop-navigation__left, .pc-desktop-navigation__right {
|
|
29
16
|
display: flex;
|
|
30
17
|
align-items: center;
|
|
31
18
|
}
|
|
32
|
-
.pc-
|
|
19
|
+
.pc-desktop-navigation__navigation.pc-desktop-navigation__navigation {
|
|
33
20
|
position: relative;
|
|
34
21
|
flex: 1 0 0;
|
|
35
22
|
justify-content: flex-start;
|
|
36
23
|
}
|
|
37
24
|
@media (max-width: 768px) {
|
|
38
|
-
.pc-
|
|
25
|
+
.pc-desktop-navigation__navigation.pc-desktop-navigation__navigation {
|
|
39
26
|
display: none;
|
|
40
27
|
}
|
|
41
28
|
}
|
|
42
29
|
|
|
43
|
-
.pc-
|
|
30
|
+
.pc-desktop-navigation__right {
|
|
44
31
|
flex: 0;
|
|
45
32
|
justify-content: flex-end;
|
|
46
33
|
font-size: var(--yc-text-body-2-font-size);
|
|
47
34
|
line-height: var(--yc-text-body-2-line-height);
|
|
48
35
|
}
|
|
49
|
-
.pc-
|
|
36
|
+
.pc-desktop-navigation__navigation-container {
|
|
50
37
|
display: flex;
|
|
51
38
|
overflow-x: hidden;
|
|
52
39
|
flex: 1 0 0;
|
|
@@ -54,7 +41,14 @@ unpredictable css rules order in build */
|
|
|
54
41
|
align-items: center;
|
|
55
42
|
margin-right: 32px;
|
|
56
43
|
}
|
|
57
|
-
.pc-
|
|
44
|
+
.pc-desktop-navigation__button {
|
|
45
|
+
margin-top: 0;
|
|
46
|
+
}
|
|
47
|
+
.pc-desktop-navigation__logo {
|
|
48
|
+
margin: 0 32px 0 0;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
.pc-desktop-navigation__buttons, .pc-desktop-navigation__links {
|
|
58
52
|
display: flex;
|
|
59
53
|
align-items: center;
|
|
60
54
|
margin: 0;
|
|
@@ -62,39 +56,37 @@ unpredictable css rules order in build */
|
|
|
62
56
|
list-style: none;
|
|
63
57
|
}
|
|
64
58
|
@media (max-width: 768px) {
|
|
65
|
-
.pc-
|
|
59
|
+
.pc-desktop-navigation__buttons {
|
|
66
60
|
display: none;
|
|
67
61
|
}
|
|
68
62
|
}
|
|
69
|
-
.pc-
|
|
63
|
+
.pc-desktop-navigation__buttons > *:not(:last-child) {
|
|
70
64
|
margin-right: 16px;
|
|
71
65
|
}
|
|
72
|
-
.pc-
|
|
66
|
+
.pc-desktop-navigation__links {
|
|
73
67
|
position: relative;
|
|
68
|
+
font-size: var(--yc-text-body-2-font-size);
|
|
69
|
+
line-height: var(--yc-text-body-2-line-height);
|
|
74
70
|
}
|
|
75
|
-
.pc-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
.pc-header__button {
|
|
79
|
-
margin-top: 0;
|
|
71
|
+
.pc-desktop-navigation__item {
|
|
72
|
+
position: relative;
|
|
80
73
|
}
|
|
81
|
-
.pc-
|
|
82
|
-
margin:
|
|
83
|
-
cursor: pointer;
|
|
74
|
+
.pc-desktop-navigation__item:not(:last-child) {
|
|
75
|
+
margin-right: 20px;
|
|
84
76
|
}
|
|
85
77
|
@media (max-width: 768px) {
|
|
86
|
-
.pc-
|
|
78
|
+
.pc-desktop-navigation__navigation-container {
|
|
87
79
|
justify-content: flex-end;
|
|
88
80
|
}
|
|
89
|
-
.pc-
|
|
81
|
+
.pc-desktop-navigation__left {
|
|
90
82
|
flex: 1 0 0;
|
|
91
83
|
}
|
|
92
84
|
}
|
|
93
85
|
@media (max-width: 576px) {
|
|
94
|
-
.pc-
|
|
86
|
+
.pc-desktop-navigation__navigation-container {
|
|
95
87
|
margin-right: 12px;
|
|
96
88
|
}
|
|
97
|
-
.pc-
|
|
89
|
+
.pc-desktop-navigation__logo {
|
|
98
90
|
margin-right: 0;
|
|
99
91
|
}
|
|
100
92
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const OverflowScroller_1 = tslib_1.__importDefault(require("../../../components/OverflowScroller/OverflowScroller"));
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
const models_1 = require("../../models");
|
|
8
|
+
const Logo_1 = tslib_1.__importDefault(require("../Logo/Logo"));
|
|
9
|
+
const MobileMenuButton_1 = require("../MobileMenuButton/MobileMenuButton");
|
|
10
|
+
const NavigationList_1 = require("../NavigationList/NavigationList");
|
|
11
|
+
const b = (0, utils_1.block)('desktop-navigation');
|
|
12
|
+
const DesktopNavigation = ({ logo, leftItemsWithIconSize, rightItemsWithIconSize, isSidebarOpened, onSidebarOpenedChange, onActiveItemChange, activeItemId, }) => (react_1.default.createElement("div", { className: b('wrapper') },
|
|
13
|
+
logo && (react_1.default.createElement("div", { className: b('left') },
|
|
14
|
+
react_1.default.createElement(Logo_1.default, Object.assign({}, logo, { className: b('logo') })))),
|
|
15
|
+
react_1.default.createElement("div", { className: b('navigation-container') },
|
|
16
|
+
react_1.default.createElement(OverflowScroller_1.default, { className: b('navigation'), onScrollStart: onActiveItemChange },
|
|
17
|
+
react_1.default.createElement(NavigationList_1.NavigationList, { items: leftItemsWithIconSize, onActiveItemChange: onActiveItemChange, className: b('links'), itemClassName: b('item'), column: models_1.ItemColumnName.Left, activeItemId: activeItemId, menuLayout: models_1.NavigationLayout.Desktop }))),
|
|
18
|
+
react_1.default.createElement("div", { className: b('right') },
|
|
19
|
+
react_1.default.createElement(MobileMenuButton_1.MobileMenuButton, { isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
|
|
20
|
+
rightItemsWithIconSize && (react_1.default.createElement(NavigationList_1.NavigationList, { onActiveItemChange: onActiveItemChange, column: models_1.ItemColumnName.Right, items: rightItemsWithIconSize, activeItemId: activeItemId, className: b('buttons'), itemClassName: b('item'), menuLayout: models_1.NavigationLayout.Desktop })))));
|
|
21
|
+
exports.default = DesktopNavigation;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileMenuButton = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const components_1 = require("../../../components");
|
|
7
|
+
const icons_1 = require("../../../icons");
|
|
8
|
+
const utils_1 = require("../../../utils");
|
|
9
|
+
const b = (0, utils_1.block)('mobile-menu-button');
|
|
10
|
+
const ICON_SIZE = 36;
|
|
11
|
+
const MobileMenuButton = ({ isSidebarOpened, onSidebarOpenedChange, }) => (react_1.default.createElement(components_1.Control, { className: b(), onClick: (e) => {
|
|
12
|
+
e.stopPropagation();
|
|
13
|
+
onSidebarOpenedChange(!isSidebarOpened);
|
|
14
|
+
}, size: "l", icon: isSidebarOpened ? icons_1.NavigationClose : icons_1.NavigationOpen, iconSize: ICON_SIZE }));
|
|
15
|
+
exports.MobileMenuButton = MobileMenuButton;
|
|
@@ -10,9 +10,16 @@ unpredictable css rules order in build */
|
|
|
10
10
|
border-bottom-left-radius: var(--pc-border-radius);
|
|
11
11
|
background-color: var(--yc-color-base-background);
|
|
12
12
|
box-shadow: 0 3px 10px var(--yc-color-sfx-shadow);
|
|
13
|
+
max-height: calc(100vh - 2 * var(--header-height));
|
|
14
|
+
overflow-y: scroll;
|
|
15
|
+
scrollbar-width: none;
|
|
16
|
+
-ms-overflow-style: none;
|
|
13
17
|
font-size: var(--yc-text-body-2-font-size);
|
|
14
18
|
line-height: var(--yc-text-body-2-line-height);
|
|
15
19
|
}
|
|
20
|
+
.pc-mobile-navigation::-webkit-scrollbar {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
16
23
|
@media (min-width: 769px) {
|
|
17
24
|
.pc-mobile-navigation {
|
|
18
25
|
display: none;
|
|
@@ -24,9 +31,6 @@ unpredictable css rules order in build */
|
|
|
24
31
|
.pc-mobile-navigation__button {
|
|
25
32
|
margin-top: 24px;
|
|
26
33
|
}
|
|
27
|
-
.pc-mobile-navigation__nav {
|
|
28
|
-
margin-bottom: 24px;
|
|
29
|
-
}
|
|
30
34
|
.pc-mobile-navigation__rows {
|
|
31
35
|
position: relative;
|
|
32
36
|
display: flex;
|
|
@@ -35,10 +39,11 @@ unpredictable css rules order in build */
|
|
|
35
39
|
margin: 0;
|
|
36
40
|
padding: 0;
|
|
37
41
|
list-style: none;
|
|
38
|
-
}
|
|
39
|
-
.pc-mobile-navigation__rows-item:not(:last-child) {
|
|
40
42
|
margin-bottom: 24px;
|
|
41
43
|
}
|
|
44
|
+
.pc-mobile-navigation__rows:last-child {
|
|
45
|
+
margin-bottom: 0;
|
|
46
|
+
}
|
|
42
47
|
.pc-mobile-navigation__dropdown-item:not(:last-child) {
|
|
43
48
|
margin-bottom: 16px;
|
|
44
49
|
}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface MobileNavigationProps {
|
|
4
|
-
className?: string;
|
|
5
|
-
isOpened?: boolean;
|
|
6
|
-
topItems?: NavigationItemModel[];
|
|
7
|
-
bottomItems?: NavigationItemModel[];
|
|
8
|
-
activeItemId?: string;
|
|
9
|
-
onClose: () => void;
|
|
10
|
-
onActiveItemChange: (id?: string) => void;
|
|
11
|
-
}
|
|
2
|
+
import { MobileNavigationProps } from '../../models';
|
|
12
3
|
declare const MobileNavigation: React.FC<MobileNavigationProps>;
|
|
13
4
|
export default MobileNavigation;
|
|
@@ -1,45 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const react_1 = tslib_1.
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
6
|
const Foldable_1 = tslib_1.__importDefault(require("../../../components/Foldable/Foldable"));
|
|
7
|
-
const models_1 = require("../../../models");
|
|
8
7
|
const utils_1 = require("../../../utils");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
const models_1 = require("../../models");
|
|
9
|
+
const NavigationList_1 = require("../NavigationList/NavigationList");
|
|
11
10
|
const b = (0, utils_1.block)('mobile-navigation');
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
return (react_1.default.createElement("div", { ref: ref, className: b('dropdown') },
|
|
15
|
-
react_1.default.createElement(NavigationItem_1.default, { data: data, onClick: onToggle, isOpened: isOpened }),
|
|
16
|
-
isOpened && (react_1.default.createElement(uikit_1.Popup, { anchorRef: ref, open: isOpened, className: b('popup') }, data.items.map((item) => (react_1.default.createElement(NavigationItem_1.default, { key: item.text, data: item, className: b('dropdown-item'), onClick: onItemClick })))))));
|
|
17
|
-
};
|
|
18
|
-
const MobileNavigationItem = ({ item, index, isOpened, activeItemId, onActiveItemChange, column, onClose, }) => {
|
|
19
|
-
const id = `${column}-${index}`;
|
|
20
|
-
const isActive = id === activeItemId && isOpened;
|
|
21
|
-
const toggleActive = (0, react_1.useCallback)((e) => {
|
|
22
|
-
e.stopPropagation();
|
|
23
|
-
if (onActiveItemChange) {
|
|
24
|
-
onActiveItemChange(isActive ? undefined : `${column}-${index}`);
|
|
25
|
-
}
|
|
26
|
-
}, [onActiveItemChange, isActive, column, index]);
|
|
27
|
-
const onItemClick = (0, react_1.useCallback)((e) => {
|
|
28
|
-
toggleActive(e);
|
|
29
|
-
onClose();
|
|
30
|
-
}, [toggleActive, onClose]);
|
|
31
|
-
return (react_1.default.createElement("li", { key: index, className: b('rows-item') }, item.type === models_1.NavigationItemType.Dropdown ? (react_1.default.createElement(MobileNavigationDropdown, { data: item, onToggle: toggleActive, isOpened: isActive, onItemClick: onItemClick })) : (react_1.default.createElement(NavigationItem_1.default, { data: item, onClick: onItemClick }))));
|
|
32
|
-
};
|
|
33
|
-
const MobileNavigation = (props) => {
|
|
11
|
+
const MobileNavigation = (_a) => {
|
|
12
|
+
var { isOpened, topItems, bottomItems } = _a, props = tslib_1.__rest(_a, ["isOpened", "topItems", "bottomItems"]);
|
|
34
13
|
if (typeof window === 'undefined') {
|
|
35
14
|
return null;
|
|
36
15
|
}
|
|
37
|
-
const { isOpened, topItems, bottomItems, activeItemId, onActiveItemChange, onClose } = props;
|
|
38
16
|
return (react_1.default.createElement(uikit_1.Portal, null,
|
|
39
17
|
react_1.default.createElement(Foldable_1.default, { key: topItems === null || topItems === void 0 ? void 0 : topItems.length, className: b(), isOpened: Boolean(isOpened) },
|
|
40
18
|
react_1.default.createElement("div", { className: b('wrapper') },
|
|
41
|
-
react_1.default.createElement(
|
|
42
|
-
|
|
43
|
-
react_1.default.createElement("ul", { className: b('rows') }, bottomItems === null || bottomItems === void 0 ? void 0 : bottomItems.map((item, index) => (react_1.default.createElement(MobileNavigationItem, { key: index, item: item, column: constants_1.ItemColumnName.Bottom, index: index, isOpened: isOpened, activeItemId: activeItemId, onClose: onClose, onActiveItemChange: onActiveItemChange }))))))));
|
|
19
|
+
topItems && (react_1.default.createElement(NavigationList_1.NavigationList, Object.assign({ className: b('rows'), items: topItems, column: models_1.ItemColumnName.Top, menuLayout: models_1.NavigationLayout.Mobile }, props))),
|
|
20
|
+
bottomItems && (react_1.default.createElement(NavigationList_1.NavigationList, Object.assign({ className: b('rows'), items: bottomItems, column: models_1.ItemColumnName.Bottom, menuLayout: models_1.NavigationLayout.Mobile }, props)))))));
|
|
44
21
|
};
|
|
45
22
|
exports.default = MobileNavigation;
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
3
|
.pc-navigation {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
.pc-navigation__links {
|
|
8
|
-
position: relative;
|
|
4
|
+
position: sticky;
|
|
5
|
+
z-index: 98;
|
|
6
|
+
top: 0;
|
|
9
7
|
display: flex;
|
|
8
|
+
justify-content: center;
|
|
10
9
|
align-items: center;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
list-style: none;
|
|
14
|
-
}
|
|
15
|
-
.pc-navigation__links-item {
|
|
16
|
-
position: relative;
|
|
10
|
+
height: var(--header-height);
|
|
11
|
+
background-color: var(--yc-color-base-background);
|
|
17
12
|
}
|
|
18
|
-
.pc-
|
|
19
|
-
|
|
13
|
+
.pc-navigation_with-border {
|
|
14
|
+
box-shadow: inset 0 -1px 0 var(--yc-color-line-generic);
|
|
20
15
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { HeaderData, ThemedNavigationLogoData } from '../../../models';
|
|
3
3
|
export interface NavigationProps {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
className?: string;
|
|
7
|
-
highlightActiveItem?: boolean;
|
|
8
|
-
onActiveItemChange: (id?: string) => void;
|
|
4
|
+
logo: ThemedNavigationLogoData;
|
|
5
|
+
data: HeaderData;
|
|
9
6
|
}
|
|
10
|
-
declare const Navigation: React.FC<NavigationProps>;
|
|
7
|
+
export declare const Navigation: React.FC<NavigationProps>;
|
|
11
8
|
export default Navigation;
|
|
@@ -1,23 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Navigation = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
-
const
|
|
6
|
-
const
|
|
6
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
|
+
const OutsideClick_1 = tslib_1.__importDefault(require("../../../components/OutsideClick/OutsideClick"));
|
|
8
|
+
const grid_1 = require("../../../grid");
|
|
7
9
|
const utils_1 = require("../../../utils");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
+
const utils_2 = require("../../utils");
|
|
11
|
+
const DesktopNavigation_1 = tslib_1.__importDefault(require("../DesktopNavigation/DesktopNavigation"));
|
|
12
|
+
const MobileNavigation_1 = tslib_1.__importDefault(require("../MobileNavigation/MobileNavigation"));
|
|
10
13
|
const b = (0, utils_1.block)('navigation');
|
|
11
|
-
const Navigation = ({
|
|
12
|
-
const {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const Navigation = ({ data, logo }) => {
|
|
15
|
+
const { leftItems, rightItems, iconSize = 20, withBorder = false } = data;
|
|
16
|
+
const [isSidebarOpened, setIsSidebarOpened] = (0, react_1.useState)(false);
|
|
17
|
+
const [activeItemId, setActiveItemId] = (0, react_1.useState)(undefined);
|
|
18
|
+
const [showBorder, setShowBorder] = (0, react_1.useState)(withBorder);
|
|
19
|
+
const getNavigationItem = (0, utils_2.getNavigationItemWithIconSize)(iconSize);
|
|
20
|
+
const leftItemsWithIconSize = (0, react_1.useMemo)(() => leftItems.map(getNavigationItem), [getNavigationItem, leftItems]);
|
|
21
|
+
const rightItemsWithIconSize = (0, react_1.useMemo)(() => rightItems === null || rightItems === void 0 ? void 0 : rightItems.map(getNavigationItem), [getNavigationItem, rightItems]);
|
|
22
|
+
const onActiveItemChange = (id) => {
|
|
23
|
+
setActiveItemId(id);
|
|
24
|
+
};
|
|
25
|
+
const onSidebarOpenedChange = (isOpen) => setIsSidebarOpened(isOpen);
|
|
16
26
|
(0, react_1.useEffect)(() => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
const showBorderOnScroll = () => {
|
|
28
|
+
if (!showBorder) {
|
|
29
|
+
setShowBorder(window.scrollY > 0);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const scrollHandler = lodash_1.default.debounce(showBorderOnScroll, 20);
|
|
33
|
+
window.addEventListener('scroll', scrollHandler, { passive: true });
|
|
34
|
+
return () => window.removeEventListener('scroll', scrollHandler);
|
|
35
|
+
});
|
|
36
|
+
return (react_1.default.createElement(grid_1.Grid, { className: b({ 'with-border': showBorder }) },
|
|
37
|
+
react_1.default.createElement(grid_1.Row, null,
|
|
38
|
+
react_1.default.createElement(grid_1.Col, null,
|
|
39
|
+
react_1.default.createElement("nav", null,
|
|
40
|
+
react_1.default.createElement(DesktopNavigation_1.default, { logo: logo, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange, leftItemsWithIconSize: leftItemsWithIconSize, rightItemsWithIconSize: rightItemsWithIconSize, isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
|
|
41
|
+
react_1.default.createElement(OutsideClick_1.default, { onOutsideClick: () => onSidebarOpenedChange(false) },
|
|
42
|
+
react_1.default.createElement(MobileNavigation_1.default, { topItems: leftItems, bottomItems: rightItems, isOpened: isSidebarOpened, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange })))))));
|
|
22
43
|
};
|
|
23
|
-
exports.
|
|
44
|
+
exports.Navigation = Navigation;
|
|
45
|
+
exports.default = exports.Navigation;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-navigation-item {
|
|
4
|
+
cursor: pointer;
|
|
5
|
+
outline: none;
|
|
6
|
+
color: inherit;
|
|
7
|
+
text-decoration: none;
|
|
8
|
+
}
|
|
9
|
+
.pc-navigation-item:last-child {
|
|
10
|
+
margin-bottom: 0;
|
|
11
|
+
}
|
|
12
|
+
.utilityfocus .pc-navigation-item:focus {
|
|
13
|
+
outline: 2px solid #ffdb4d;
|
|
14
|
+
}
|
|
15
|
+
.pc-navigation-item__content:hover, .pc-navigation-item__content:active {
|
|
16
|
+
color: var(--yc-color-text-link);
|
|
17
|
+
}
|
|
18
|
+
.pc-navigation-item_menu-layout_desktop {
|
|
19
|
+
height: var(--header-height);
|
|
20
|
+
line-height: var(--header-height);
|
|
21
|
+
margin-bottom: 0;
|
|
22
|
+
}
|
|
23
|
+
.pc-navigation-item_menu-layout_mobile {
|
|
24
|
+
margin-bottom: 24px;
|
|
25
|
+
}
|
|
26
|
+
.pc-navigation-item_menu-layout_dropdown {
|
|
27
|
+
margin-bottom: 0;
|
|
28
|
+
}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
data: NavigationItemData;
|
|
5
|
-
className?: string;
|
|
6
|
-
onClick?: MouseEventHandler;
|
|
7
|
-
isOpened?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const NavigationItem: React.ForwardRefExoticComponent<NavigationItemProps & React.RefAttributes<HTMLElement>>;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NavigationItemProps } from '../../models';
|
|
3
|
+
declare const NavigationItem: React.FC<NavigationItemProps>;
|
|
10
4
|
export default NavigationItem;
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
5
6
|
const blockIdContext_1 = require("../../../context/blockIdContext");
|
|
6
7
|
const models_1 = require("../../../models");
|
|
8
|
+
const utils_1 = require("../../../utils");
|
|
7
9
|
const SocialIcon_1 = tslib_1.__importDefault(require("../SocialIcon/SocialIcon"));
|
|
8
10
|
const GithubButton_1 = require("./components/GithubButton/GithubButton");
|
|
9
11
|
const NavigationButton_1 = require("./components/NavigationButton/NavigationButton");
|
|
10
12
|
const NavigationDropdown_1 = require("./components/NavigationDropdown/NavigationDropdown");
|
|
11
13
|
const NavigationLink_1 = require("./components/NavigationLink/NavigationLink");
|
|
14
|
+
const b = (0, utils_1.block)('navigation-item');
|
|
12
15
|
const ANALYTICS_ID = 'navigation';
|
|
13
16
|
//todo: add types support form component in map
|
|
14
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -19,13 +22,19 @@ const NavigationItemsMap = {
|
|
|
19
22
|
[models_1.NavigationItemType.Link]: NavigationLink_1.NavigationLink,
|
|
20
23
|
[models_1.NavigationItemType.GithubButton]: GithubButton_1.GithubButton,
|
|
21
24
|
};
|
|
22
|
-
const NavigationItem =
|
|
23
|
-
var { data, className } = _a, props = tslib_1.__rest(_a, ["data", "className"]);
|
|
25
|
+
const NavigationItem = (_a) => {
|
|
26
|
+
var { data, className, menuLayout } = _a, props = tslib_1.__rest(_a, ["data", "className", "menuLayout"]);
|
|
24
27
|
const { type = models_1.NavigationItemType.Link } = data;
|
|
25
28
|
const Component = NavigationItemsMap[type];
|
|
26
|
-
const componentProps = (0, react_1.useMemo)(() =>
|
|
29
|
+
const componentProps = (0, react_1.useMemo)(() => {
|
|
30
|
+
const componentProperties = Object.assign(Object.assign({}, data), props);
|
|
31
|
+
if (type !== models_1.NavigationItemType.Dropdown) {
|
|
32
|
+
return (0, lodash_1.omit)(componentProperties, 'hidePopup', 'isActive');
|
|
33
|
+
}
|
|
34
|
+
return componentProperties;
|
|
35
|
+
}, [data, props, type]);
|
|
27
36
|
return (react_1.default.createElement(blockIdContext_1.BlockIdContext.Provider, { value: ANALYTICS_ID },
|
|
28
|
-
react_1.default.createElement(
|
|
29
|
-
});
|
|
30
|
-
|
|
37
|
+
react_1.default.createElement("li", { className: b({ 'menu-layout': menuLayout }, className) },
|
|
38
|
+
react_1.default.createElement(Component, Object.assign({}, componentProps, { className: b('content') })))));
|
|
39
|
+
};
|
|
31
40
|
exports.default = NavigationItem;
|
package/build/cjs/navigation/components/NavigationItem/components/GithubButton/GithubButton.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NavigationGithubButton } from '../../../../../models';
|
|
2
|
-
import { NavigationItemProps } from '
|
|
2
|
+
import { NavigationItemProps } from '../../../../models';
|
|
3
3
|
type NavigationGithubButtonProps = NavigationItemProps & NavigationGithubButton;
|
|
4
4
|
export declare const GithubButton: ({ text, url, className, label, size, icon, }: NavigationGithubButtonProps) => JSX.Element;
|
|
5
5
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps } from '../../../../../models';
|
|
3
|
-
import { NavigationItemProps } from '
|
|
3
|
+
import { NavigationItemProps } from '../../../../models';
|
|
4
4
|
type NavigationButtonProps = Pick<NavigationItemProps, 'className'> & ButtonProps;
|
|
5
5
|
export declare const NavigationButton: React.FC<NavigationButtonProps>;
|
|
6
6
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare const NavigationDropdown:
|
|
1
|
+
import { NavigationDropdownItem } from '../../../../../models';
|
|
2
|
+
import { NavigationItemProps } from '../../../../models';
|
|
3
|
+
type NavigationDropdownProps = NavigationItemProps & NavigationDropdownItem;
|
|
4
|
+
export declare const NavigationDropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: NavigationDropdownProps) => JSX.Element;
|
|
5
|
+
export {};
|
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NavigationDropdown = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const react_1 = tslib_1.
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
const components_1 = require("../../../../../components");
|
|
7
7
|
const utils_1 = require("../../../../../components/Media/Image/utils");
|
|
8
8
|
const utils_2 = require("../../../../../utils");
|
|
9
|
+
const NavigationPopup_1 = tslib_1.__importDefault(require("../../../NavigationPopup/NavigationPopup"));
|
|
9
10
|
const ContentWrapper_1 = require("../ContentWrapper/ContentWrapper");
|
|
10
11
|
const b = (0, utils_2.block)('navigation-dropdown');
|
|
11
12
|
const TOGGLE_ARROW_SIZE = 12;
|
|
12
|
-
|
|
13
|
+
const NavigationDropdown = (_a) => {
|
|
14
|
+
var { text, icon, className, iconSize, hidePopup, items, isActive } = _a, props = tslib_1.__rest(_a, ["text", "icon", "className", "iconSize", "hidePopup", "items", "isActive"]);
|
|
13
15
|
const iconData = icon && (0, utils_1.getMediaImage)(icon);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
react_1.default.createElement(
|
|
17
|
-
})
|
|
18
|
-
|
|
16
|
+
const anchorRef = (0, react_1.useRef)(null);
|
|
17
|
+
return (react_1.default.createElement(react_1.Fragment, null,
|
|
18
|
+
react_1.default.createElement("span", Object.assign({ ref: anchorRef }, props, { className: b(null, className) }),
|
|
19
|
+
react_1.default.createElement(ContentWrapper_1.ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }),
|
|
20
|
+
react_1.default.createElement(components_1.ToggleArrow, { className: b('arrow'), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isActive })),
|
|
21
|
+
react_1.default.createElement(NavigationPopup_1.default, { open: isActive, onClose: hidePopup, items: items, anchorRef: anchorRef })));
|
|
22
|
+
};
|
|
23
|
+
exports.NavigationDropdown = NavigationDropdown;
|
package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NavigationLinkItem } from '../../../../../models';
|
|
3
|
-
import { NavigationItemProps } from '
|
|
3
|
+
import { NavigationItemProps } from '../../../../models';
|
|
4
4
|
type NavigationLinkProps = NavigationItemProps & NavigationLinkItem;
|
|
5
5
|
export declare const NavigationLink: React.FC<NavigationLinkProps>;
|
|
6
6
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NavigationList = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const NavigationListItem_1 = tslib_1.__importDefault(require("../NavigationListItem/NavigationListItem"));
|
|
7
|
+
const NavigationList = (_a) => {
|
|
8
|
+
var { className, itemClassName, items } = _a, props = tslib_1.__rest(_a, ["className", "itemClassName", "items"]);
|
|
9
|
+
return (react_1.default.createElement("ul", { className: className }, items.map((item, index) => (react_1.default.createElement(NavigationListItem_1.default, Object.assign({ key: index, index: index, data: item, className: itemClassName }, props))))));
|
|
10
|
+
};
|
|
11
|
+
exports.NavigationList = NavigationList;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
index: number;
|
|
6
|
-
column: ItemColumnName;
|
|
7
|
-
activeItemId?: string;
|
|
8
|
-
highlightActiveItem?: boolean;
|
|
9
|
-
hidePopup: () => void;
|
|
10
|
-
onActiveItemChange: (id?: string) => void;
|
|
11
|
-
} & ClassNameProps;
|
|
12
|
-
export declare const NavigationListItem: ({ item, className, index, activeItemId, highlightActiveItem, hidePopup, column, onActiveItemChange, }: NavigationListItemProps) => JSX.Element;
|
|
13
|
-
export {};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NavigationListItemProps } from '../../models';
|
|
3
|
+
declare const NavigationListItem: React.FC<NavigationListItemProps>;
|
|
4
|
+
export default NavigationListItem;
|