@gravity-ui/page-constructor 5.21.0 → 5.22.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/build/cjs/components/ButtonTabs/ButtonTabs.js +3 -2
- package/build/cjs/constructor-items.d.ts +4 -4
- package/build/cjs/models/navigation.d.ts +8 -0
- package/build/cjs/navigation/components/DesktopNavigation/DesktopNavigation.css +42 -3
- package/build/cjs/navigation/components/DesktopNavigation/DesktopNavigation.d.ts +1 -1
- package/build/cjs/navigation/components/DesktopNavigation/DesktopNavigation.js +7 -2
- package/build/cjs/navigation/components/Logo/Logo.d.ts +1 -1
- package/build/cjs/navigation/components/Logo/Logo.js +3 -1
- package/build/cjs/navigation/components/MobileNavigation/MobileNavigation.d.ts +1 -1
- package/build/cjs/navigation/components/MobileNavigation/MobileNavigation.js +3 -1
- package/build/cjs/navigation/components/Navigation/Navigation.d.ts +2 -2
- package/build/cjs/navigation/components/Navigation/Navigation.js +5 -24
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.d.ts +1 -1
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +3 -1
- package/build/cjs/navigation/components/NavigationItem/hooks/useNavigationItemMap.d.ts +5 -5
- package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.d.ts +1 -1
- package/build/cjs/navigation/components/NavigationListItem/NavigationListItem.js +3 -1
- package/build/cjs/navigation/components/Standalone/index.d.ts +2 -2
- package/build/cjs/navigation/containers/Layout/Layout.js +2 -1
- package/build/cjs/navigation/hooks/index.d.ts +2 -0
- package/build/cjs/navigation/hooks/index.js +10 -0
- package/build/cjs/navigation/hooks/useActiveNavItem.d.ts +26 -0
- package/build/cjs/navigation/hooks/useActiveNavItem.js +15 -0
- package/build/cjs/navigation/hooks/useShowBorder.d.ts +2 -0
- package/build/cjs/navigation/hooks/useShowBorder.js +21 -0
- package/build/cjs/navigation/index.d.ts +14 -0
- package/build/cjs/navigation/index.js +16 -4
- package/build/cjs/navigation/models.d.ts +1 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.css +34 -1
- package/build/esm/components/ButtonTabs/ButtonTabs.js +3 -2
- package/build/esm/constructor-items.d.ts +4 -4
- package/build/esm/models/navigation.d.ts +8 -0
- package/build/esm/navigation/components/DesktopNavigation/DesktopNavigation.css +42 -3
- package/build/esm/navigation/components/DesktopNavigation/DesktopNavigation.d.ts +1 -1
- package/build/esm/navigation/components/DesktopNavigation/DesktopNavigation.js +4 -1
- package/build/esm/navigation/components/Logo/Logo.d.ts +1 -1
- package/build/esm/navigation/components/Logo/Logo.js +1 -1
- package/build/esm/navigation/components/MobileNavigation/MobileNavigation.d.ts +1 -1
- package/build/esm/navigation/components/MobileNavigation/MobileNavigation.js +1 -1
- package/build/esm/navigation/components/Navigation/Navigation.d.ts +2 -2
- package/build/esm/navigation/components/Navigation/Navigation.js +6 -25
- package/build/esm/navigation/components/NavigationItem/NavigationItem.d.ts +1 -1
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +1 -1
- package/build/esm/navigation/components/NavigationItem/hooks/useNavigationItemMap.d.ts +5 -5
- package/build/esm/navigation/components/NavigationListItem/NavigationListItem.d.ts +1 -1
- package/build/esm/navigation/components/NavigationListItem/NavigationListItem.js +1 -1
- package/build/esm/navigation/components/Standalone/index.d.ts +2 -2
- package/build/esm/navigation/containers/Layout/Layout.js +2 -1
- package/build/esm/navigation/hooks/index.d.ts +2 -0
- package/build/esm/navigation/hooks/index.js +2 -0
- package/build/esm/navigation/hooks/useActiveNavItem.d.ts +26 -0
- package/build/esm/navigation/hooks/useActiveNavItem.js +13 -0
- package/build/esm/navigation/hooks/useShowBorder.d.ts +2 -0
- package/build/esm/navigation/hooks/useShowBorder.js +19 -0
- package/build/esm/navigation/index.d.ts +14 -0
- package/build/esm/navigation/index.js +14 -0
- package/build/esm/navigation/models.d.ts +1 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.css +34 -1
- package/package.json +1 -1
- package/server/models/navigation.d.ts +8 -0
- package/widget/index.js +1 -1
|
@@ -17,10 +17,11 @@ const ButtonTabs = ({ className, items, activeTab, onSelectTab, tabSize = 'l', q
|
|
|
17
17
|
onSelectTab(tabId, e);
|
|
18
18
|
}
|
|
19
19
|
}, [onSelectTab]);
|
|
20
|
-
return (react_1.default.createElement("div", { className: b(null, className), "data-qa": qa }, items.map(({ id, title }) => {
|
|
20
|
+
return (react_1.default.createElement("div", { className: b(null, className), role: "tablist", "data-qa": qa }, items.map(({ id, title }) => {
|
|
21
21
|
const isActive = id === activeTabId;
|
|
22
22
|
return (react_1.default.createElement(index_1.Button, { text: title, className: b('item', { active: isActive }), key: title, size: tabSize, onClick: handleClick(id), extraProps: {
|
|
23
|
-
'
|
|
23
|
+
role: 'tab',
|
|
24
|
+
'aria-selected': isActive,
|
|
24
25
|
} }));
|
|
25
26
|
})));
|
|
26
27
|
};
|
|
@@ -34,9 +34,9 @@ export declare const subBlockMap: {
|
|
|
34
34
|
"image-card": (props: import("./models").ImageCardProps) => JSX.Element;
|
|
35
35
|
};
|
|
36
36
|
export declare const navItemMap: {
|
|
37
|
-
button: import("react").FC<Pick<import("./navigation
|
|
37
|
+
button: import("react").FC<Pick<import("./navigation").NavigationItemProps, "className"> & import("./models").ButtonProps>;
|
|
38
38
|
social: import("react").FC<import("./navigation/components/SocialIcon/SocialIcon").NavigationSocialItemOwnProps>;
|
|
39
|
-
dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("./navigation
|
|
40
|
-
link: import("react").FC<import("./navigation
|
|
41
|
-
"github-button": ({ text, url, className, label, size, icon, urlTitle, }: import("./navigation
|
|
39
|
+
dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("./navigation").NavigationItemProps & import("./models").NavigationDropdownItem) => JSX.Element;
|
|
40
|
+
link: import("react").FC<import("./navigation").NavigationItemProps & import("./models").NavigationLinkItem>;
|
|
41
|
+
"github-button": ({ text, url, className, label, size, icon, urlTitle, }: import("./navigation").NavigationItemProps & import("./models").NavigationGithubButton) => JSX.Element;
|
|
42
42
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ThemeSupporting } from '../utils';
|
|
2
3
|
import { ButtonProps, ImageProps } from './constructor-items';
|
|
3
4
|
export declare enum NavigationItemType {
|
|
@@ -69,6 +70,12 @@ export type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<Navi
|
|
|
69
70
|
export interface HeaderData {
|
|
70
71
|
leftItems: NavigationItemModel[];
|
|
71
72
|
rightItems?: NavigationItemModel[];
|
|
73
|
+
/**
|
|
74
|
+
* Items for the navigation header on mobile devices.
|
|
75
|
+
* They are located to the right of the Logo and to the left of the MobileMenuButton.
|
|
76
|
+
* @type {NavigationItemModel[]}
|
|
77
|
+
*/
|
|
78
|
+
customMobileHeaderItems?: NavigationItemModel[];
|
|
72
79
|
iconSize?: number;
|
|
73
80
|
withBorder?: boolean;
|
|
74
81
|
withBorderOnScroll?: boolean;
|
|
@@ -90,4 +97,5 @@ export interface NavigationData {
|
|
|
90
97
|
logo: ThemedNavigationLogoData;
|
|
91
98
|
header: HeaderData;
|
|
92
99
|
footer?: FooterData;
|
|
100
|
+
renderNavigation?: () => React.ReactNode;
|
|
93
101
|
}
|
|
@@ -27,18 +27,43 @@ unpredictable css rules order in build */
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
.pc-desktop-navigation__mobile-navigation.pc-desktop-navigation__mobile-navigation {
|
|
31
|
+
justify-content: flex-end;
|
|
32
|
+
}
|
|
33
|
+
@media (min-width: 769px) {
|
|
34
|
+
.pc-desktop-navigation__mobile-navigation.pc-desktop-navigation__mobile-navigation {
|
|
35
|
+
display: none;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.pc-desktop-navigation__mobile-navigation-container {
|
|
40
|
+
padding-right: 8px;
|
|
41
|
+
}
|
|
42
|
+
.pc-desktop-navigation__mobile-navigation-container:has(.pc-overflow-scroller__arrow) .pc-desktop-navigation__mobile-navigation {
|
|
43
|
+
justify-content: flex-start;
|
|
44
|
+
}
|
|
45
|
+
.pc-desktop-navigation__mobile-navigation-container:has(.pc-overflow-scroller__arrow_type_right) {
|
|
46
|
+
padding-right: 16px;
|
|
47
|
+
}
|
|
30
48
|
.pc-desktop-navigation__right {
|
|
31
|
-
flex: 0;
|
|
32
49
|
justify-content: flex-end;
|
|
33
50
|
font-size: var(--g-text-body-2-font-size);
|
|
34
51
|
line-height: var(--g-text-body-2-line-height);
|
|
35
52
|
}
|
|
36
|
-
|
|
53
|
+
@media (max-width: 768px) {
|
|
54
|
+
.pc-desktop-navigation__right {
|
|
55
|
+
flex: 3 0 0;
|
|
56
|
+
max-width: 50%;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
.pc-desktop-navigation__navigation-container, .pc-desktop-navigation__mobile-navigation-container {
|
|
37
60
|
display: flex;
|
|
38
61
|
overflow-x: hidden;
|
|
39
62
|
flex: 1 0 0;
|
|
40
63
|
justify-content: space-between;
|
|
41
64
|
align-items: center;
|
|
65
|
+
}
|
|
66
|
+
.pc-desktop-navigation__navigation-container {
|
|
42
67
|
margin-right: 32px;
|
|
43
68
|
}
|
|
44
69
|
.pc-desktop-navigation__button {
|
|
@@ -48,7 +73,7 @@ unpredictable css rules order in build */
|
|
|
48
73
|
margin: 0 32px 0 0;
|
|
49
74
|
cursor: pointer;
|
|
50
75
|
}
|
|
51
|
-
.pc-desktop-navigation__buttons, .pc-desktop-
|
|
76
|
+
.pc-desktop-navigation__links, .pc-desktop-navigation__buttons, .pc-desktop-navigation__mobile-buttons {
|
|
52
77
|
display: flex;
|
|
53
78
|
align-items: center;
|
|
54
79
|
margin: 0;
|
|
@@ -63,6 +88,14 @@ unpredictable css rules order in build */
|
|
|
63
88
|
.pc-desktop-navigation__buttons > *:not(:last-child) {
|
|
64
89
|
margin-right: 16px;
|
|
65
90
|
}
|
|
91
|
+
@media (min-width: 769px) {
|
|
92
|
+
.pc-desktop-navigation__mobile-buttons {
|
|
93
|
+
display: none;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
.pc-desktop-navigation__mobile-buttons .pc-desktop-navigation__item:not(:last-child) {
|
|
97
|
+
margin-right: 0;
|
|
98
|
+
}
|
|
66
99
|
.pc-desktop-navigation__links {
|
|
67
100
|
position: relative;
|
|
68
101
|
font-size: var(--g-text-body-2-font-size);
|
|
@@ -78,6 +111,12 @@ unpredictable css rules order in build */
|
|
|
78
111
|
.pc-desktop-navigation__navigation-container {
|
|
79
112
|
justify-content: flex-end;
|
|
80
113
|
}
|
|
114
|
+
.pc-desktop-navigation__navigation-container, .pc-desktop-navigation__mobile-navigation-container {
|
|
115
|
+
justify-content: flex-end;
|
|
116
|
+
}
|
|
117
|
+
.pc-desktop-navigation__navigation-container {
|
|
118
|
+
flex: 0 0 0;
|
|
119
|
+
}
|
|
81
120
|
.pc-desktop-navigation__left {
|
|
82
121
|
flex: 1 0 0;
|
|
83
122
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DesktopNavigation = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
6
|
const OverflowScroller_1 = tslib_1.__importDefault(require("../../../components/OverflowScroller/OverflowScroller"));
|
|
@@ -9,13 +10,17 @@ const Logo_1 = tslib_1.__importDefault(require("../Logo/Logo"));
|
|
|
9
10
|
const MobileMenuButton_1 = require("../MobileMenuButton/MobileMenuButton");
|
|
10
11
|
const NavigationList_1 = require("../NavigationList/NavigationList");
|
|
11
12
|
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
|
+
const DesktopNavigation = ({ logo, leftItemsWithIconSize, rightItemsWithIconSize, customMobileHeaderItems, isSidebarOpened, onSidebarOpenedChange, onActiveItemChange, activeItemId, }) => (react_1.default.createElement("div", { className: b('wrapper') },
|
|
13
14
|
logo && (react_1.default.createElement("div", { className: b('left') },
|
|
14
15
|
react_1.default.createElement(Logo_1.default, Object.assign({}, logo, { className: b('logo') })))),
|
|
15
16
|
react_1.default.createElement("div", { className: b('navigation-container') },
|
|
16
17
|
react_1.default.createElement(OverflowScroller_1.default, { className: b('navigation'), onScrollStart: onActiveItemChange },
|
|
17
18
|
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
19
|
react_1.default.createElement("div", { className: b('right') },
|
|
20
|
+
customMobileHeaderItems && (react_1.default.createElement("div", { className: b('mobile-navigation-container') },
|
|
21
|
+
react_1.default.createElement(OverflowScroller_1.default, { className: b('mobile-navigation'), onScrollStart: onActiveItemChange, arrowSize: 18 },
|
|
22
|
+
react_1.default.createElement(NavigationList_1.NavigationList, { items: customMobileHeaderItems, onActiveItemChange: onActiveItemChange, className: b('mobile-buttons'), itemClassName: b('item'), column: models_1.ItemColumnName.Left, activeItemId: activeItemId, menuLayout: models_1.NavigationLayout.Dropdown })))),
|
|
19
23
|
react_1.default.createElement(MobileMenuButton_1.MobileMenuButton, { isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
|
|
20
24
|
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.
|
|
25
|
+
exports.DesktopNavigation = DesktopNavigation;
|
|
26
|
+
exports.default = exports.DesktopNavigation;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logo = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
6
|
const components_1 = require("../../../components");
|
|
@@ -27,4 +28,5 @@ const Logo = (_a) => {
|
|
|
27
28
|
react_1.default.createElement("span", { className: b('text') }, textData)));
|
|
28
29
|
return (react_1.default.createElement(RouterLink_1.default, { href: url, passHref: true }, Link ? (react_1.default.createElement("span", { className: b(null, props.className) }, content)) : (react_1.default.createElement("a", Object.assign({ className: b(null, props.className), href: url, title: urlTitle }, linkExtraProps), content))));
|
|
29
30
|
};
|
|
30
|
-
exports.
|
|
31
|
+
exports.Logo = Logo;
|
|
32
|
+
exports.default = exports.Logo;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileNavigation = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
@@ -22,4 +23,5 @@ const MobileNavigation = (_a) => {
|
|
|
22
23
|
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))),
|
|
23
24
|
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)))))));
|
|
24
25
|
};
|
|
25
|
-
exports.
|
|
26
|
+
exports.MobileNavigation = MobileNavigation;
|
|
27
|
+
exports.default = exports.MobileNavigation;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ClassNameProps, HeaderData, ThemedNavigationLogoData } from '../../../models';
|
|
3
|
-
export interface
|
|
3
|
+
export interface NavigationComponentProps extends ClassNameProps {
|
|
4
4
|
logo: ThemedNavigationLogoData;
|
|
5
5
|
data: HeaderData;
|
|
6
6
|
}
|
|
7
|
-
export declare const Navigation: React.FC<
|
|
7
|
+
export declare const Navigation: React.FC<NavigationComponentProps>;
|
|
8
8
|
export default Navigation;
|
|
@@ -3,43 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Navigation = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
-
const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
|
|
7
6
|
const OutsideClick_1 = tslib_1.__importDefault(require("../../../components/OutsideClick/OutsideClick"));
|
|
8
7
|
const grid_1 = require("../../../grid");
|
|
9
8
|
const utils_1 = require("../../../utils");
|
|
10
|
-
const
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
11
10
|
const DesktopNavigation_1 = tslib_1.__importDefault(require("../DesktopNavigation/DesktopNavigation"));
|
|
12
11
|
const MobileNavigation_1 = tslib_1.__importDefault(require("../MobileNavigation/MobileNavigation"));
|
|
13
12
|
const b = (0, utils_1.block)('navigation');
|
|
14
13
|
const Navigation = ({ data, logo, className }) => {
|
|
15
|
-
const { leftItems, rightItems, iconSize = 20, withBorder = false, withBorderOnScroll = true, } = data;
|
|
14
|
+
const { leftItems, rightItems, customMobileHeaderItems, iconSize = 20, withBorder = false, withBorderOnScroll = true, } = data;
|
|
16
15
|
const [isSidebarOpened, setIsSidebarOpened] = (0, react_1.useState)(false);
|
|
17
|
-
const [
|
|
18
|
-
const
|
|
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
|
-
};
|
|
16
|
+
const [showBorder] = (0, hooks_1.useShowBorder)(withBorder, withBorderOnScroll);
|
|
17
|
+
const { activeItemId, leftItemsWithIconSize, rightItemsWithIconSize, onActiveItemChange } = (0, hooks_1.useActiveNavItem)(iconSize, leftItems, rightItems);
|
|
25
18
|
const onSidebarOpenedChange = (isOpen) => setIsSidebarOpened(isOpen);
|
|
26
|
-
(0, react_1.useEffect)(() => {
|
|
27
|
-
if (!withBorderOnScroll)
|
|
28
|
-
return () => { };
|
|
29
|
-
const showBorderOnScroll = () => {
|
|
30
|
-
if (!withBorder) {
|
|
31
|
-
setShowBorder(window.scrollY > 0);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const scrollHandler = (0, debounce_1.default)(showBorderOnScroll, 20);
|
|
35
|
-
window.addEventListener('scroll', scrollHandler, { passive: true });
|
|
36
|
-
return () => window.removeEventListener('scroll', scrollHandler);
|
|
37
|
-
});
|
|
38
19
|
return (react_1.default.createElement(grid_1.Grid, { className: b({ 'with-border': showBorder }, className) },
|
|
39
20
|
react_1.default.createElement(grid_1.Row, null,
|
|
40
21
|
react_1.default.createElement(grid_1.Col, null,
|
|
41
22
|
react_1.default.createElement("nav", null,
|
|
42
|
-
react_1.default.createElement(DesktopNavigation_1.default, { logo: logo, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange, leftItemsWithIconSize: leftItemsWithIconSize, rightItemsWithIconSize: rightItemsWithIconSize, isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
|
|
23
|
+
react_1.default.createElement(DesktopNavigation_1.default, { logo: logo, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange, leftItemsWithIconSize: leftItemsWithIconSize, rightItemsWithIconSize: rightItemsWithIconSize, customMobileHeaderItems: customMobileHeaderItems, isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
|
|
43
24
|
react_1.default.createElement(OutsideClick_1.default, { onOutsideClick: () => onSidebarOpenedChange(false) },
|
|
44
25
|
react_1.default.createElement(MobileNavigation_1.default, { topItems: leftItemsWithIconSize, bottomItems: rightItemsWithIconSize, isOpened: isSidebarOpened, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange })))))));
|
|
45
26
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NavigationItem = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
6
|
const omit_1 = tslib_1.__importDefault(require("lodash/omit"));
|
|
@@ -28,4 +29,5 @@ const NavigationItem = (_a) => {
|
|
|
28
29
|
react_1.default.createElement("li", { className: b({ 'menu-layout': menuLayout }, className) },
|
|
29
30
|
react_1.default.createElement(Component, Object.assign({}, componentProps, { className: b('content', { type }) })))));
|
|
30
31
|
};
|
|
31
|
-
exports.
|
|
32
|
+
exports.NavigationItem = NavigationItem;
|
|
33
|
+
exports.default = exports.NavigationItem;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const useNavigationItemMap: () => {
|
|
2
|
-
button: import("react").FC<Pick<import("
|
|
3
|
-
social: import("react").FC<import("
|
|
4
|
-
dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("
|
|
5
|
-
link: import("react").FC<import("
|
|
6
|
-
"github-button": ({ text, url, className, label, size, icon, urlTitle, }: import("
|
|
2
|
+
button: import("react").FC<Pick<import("../../..").NavigationItemProps, "className"> & import("../../../..").ButtonProps>;
|
|
3
|
+
social: import("react").FC<import("../../..").NavigationSocialItemOwnProps>;
|
|
4
|
+
dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("../../..").NavigationItemProps & import("../../../..").NavigationDropdownItem) => JSX.Element;
|
|
5
|
+
link: import("react").FC<import("../../..").NavigationItemProps & import("../../../..").NavigationLinkItem>;
|
|
6
|
+
"github-button": ({ text, url, className, label, size, icon, urlTitle, }: import("../../..").NavigationItemProps & import("../../../..").NavigationGithubButton) => JSX.Element;
|
|
7
7
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NavigationListItem = void 0;
|
|
3
4
|
const tslib_1 = require("tslib");
|
|
4
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
6
|
const utils_1 = require("../../utils");
|
|
@@ -16,4 +17,5 @@ const NavigationListItem = (_a) => {
|
|
|
16
17
|
});
|
|
17
18
|
return (react_1.default.createElement(NavigationItem_1.default, Object.assign({ isActive: isActive, onClick: onClick, hidePopup: onActiveItemChange }, props)));
|
|
18
19
|
};
|
|
19
|
-
exports.
|
|
20
|
+
exports.NavigationListItem = NavigationListItem;
|
|
21
|
+
exports.default = exports.NavigationListItem;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const Standalone: (props:
|
|
1
|
+
import { NavigationComponentProps } from './../../components/Navigation/Navigation';
|
|
2
|
+
declare const Standalone: (props: NavigationComponentProps) => JSX.Element;
|
|
3
3
|
export default Standalone;
|
|
@@ -6,6 +6,7 @@ const utils_1 = require("../../../utils");
|
|
|
6
6
|
const Navigation_1 = tslib_1.__importDefault(require("../../components/Navigation/Navigation"));
|
|
7
7
|
const b = (0, utils_1.block)('layout');
|
|
8
8
|
const Layout = ({ children, navigation }) => (react_1.default.createElement("div", { className: b() },
|
|
9
|
-
navigation &&
|
|
9
|
+
navigation &&
|
|
10
|
+
(navigation.renderNavigation ? (navigation.renderNavigation()) : (react_1.default.createElement(Navigation_1.default, { data: navigation.header, logo: navigation.logo, className: b('navigation') }))),
|
|
10
11
|
react_1.default.createElement("main", { className: b('content') }, children)));
|
|
11
12
|
exports.default = Layout;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useShowBorder = exports.useActiveNavItem = void 0;
|
|
7
|
+
var useActiveNavItem_1 = require("./useActiveNavItem");
|
|
8
|
+
Object.defineProperty(exports, "useActiveNavItem", { enumerable: true, get: function () { return __importDefault(useActiveNavItem_1).default; } });
|
|
9
|
+
var useShowBorder_1 = require("./useShowBorder");
|
|
10
|
+
Object.defineProperty(exports, "useShowBorder", { enumerable: true, get: function () { return __importDefault(useShowBorder_1).default; } });
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NavigationItemModel } from '../../models';
|
|
2
|
+
declare const useActiveNavItem: (iconSize: number, leftItems: NavigationItemModel[], rightItems?: NavigationItemModel[]) => {
|
|
3
|
+
activeItemId: string | undefined;
|
|
4
|
+
leftItemsWithIconSize: (import("../../models").NavigationButtonItem | import("../../models").NavigationDropdownItem | {
|
|
5
|
+
type: import("../../models").NavigationItemType.Link;
|
|
6
|
+
url: string;
|
|
7
|
+
urlTitle?: string | undefined;
|
|
8
|
+
arrow?: boolean | undefined;
|
|
9
|
+
target?: string | undefined;
|
|
10
|
+
text: string;
|
|
11
|
+
icon?: import("../../models").ImageProps | undefined;
|
|
12
|
+
iconSize?: number | undefined;
|
|
13
|
+
})[];
|
|
14
|
+
rightItemsWithIconSize: (import("../../models").NavigationButtonItem | import("../../models").NavigationDropdownItem | {
|
|
15
|
+
type: import("../../models").NavigationItemType.Link;
|
|
16
|
+
url: string;
|
|
17
|
+
urlTitle?: string | undefined;
|
|
18
|
+
arrow?: boolean | undefined;
|
|
19
|
+
target?: string | undefined;
|
|
20
|
+
text: string;
|
|
21
|
+
icon?: import("../../models").ImageProps | undefined;
|
|
22
|
+
iconSize?: number | undefined;
|
|
23
|
+
})[] | undefined;
|
|
24
|
+
onActiveItemChange: (id?: string) => void;
|
|
25
|
+
};
|
|
26
|
+
export default useActiveNavItem;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const useActiveNavItem = (iconSize, leftItems, rightItems) => {
|
|
6
|
+
const [activeItemId, setActiveItemId] = (0, react_1.useState)(undefined);
|
|
7
|
+
const getNavigationItem = (0, utils_1.getNavigationItemWithIconSize)(iconSize);
|
|
8
|
+
const leftItemsWithIconSize = (0, react_1.useMemo)(() => leftItems.map(getNavigationItem), [getNavigationItem, leftItems]);
|
|
9
|
+
const rightItemsWithIconSize = (0, react_1.useMemo)(() => rightItems === null || rightItems === void 0 ? void 0 : rightItems.map(getNavigationItem), [getNavigationItem, rightItems]);
|
|
10
|
+
const onActiveItemChange = (id) => {
|
|
11
|
+
setActiveItemId(id);
|
|
12
|
+
};
|
|
13
|
+
return { activeItemId, leftItemsWithIconSize, rightItemsWithIconSize, onActiveItemChange };
|
|
14
|
+
};
|
|
15
|
+
exports.default = useActiveNavItem;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const useShowBorder = (withBorder, withBorderOnScroll) => {
|
|
6
|
+
const [showBorder, setShowBorder] = (0, react_1.useState)(withBorder);
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
8
|
+
if (!withBorderOnScroll)
|
|
9
|
+
return () => { };
|
|
10
|
+
const showBorderOnScroll = () => {
|
|
11
|
+
if (!withBorder) {
|
|
12
|
+
setShowBorder(window.scrollY > 0);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const scrollHandler = (0, lodash_1.debounce)(showBorderOnScroll, 20);
|
|
16
|
+
window.addEventListener('scroll', scrollHandler, { passive: true });
|
|
17
|
+
return () => window.removeEventListener('scroll', scrollHandler);
|
|
18
|
+
});
|
|
19
|
+
return [showBorder];
|
|
20
|
+
};
|
|
21
|
+
exports.default = useShowBorder;
|
|
@@ -1 +1,15 @@
|
|
|
1
|
+
export * from './components/Navigation/Navigation';
|
|
2
|
+
export * from './components/DesktopNavigation/DesktopNavigation';
|
|
3
|
+
export * from './components/MobileNavigation/MobileNavigation';
|
|
4
|
+
export * from './components/MobileMenuButton/MobileMenuButton';
|
|
5
|
+
export * from './components/NavigationList/NavigationList';
|
|
6
|
+
export * from './components/NavigationListItem/NavigationListItem';
|
|
7
|
+
export * from './components/NavigationItem/';
|
|
8
|
+
export * from './components/NavigationItem/NavigationItem';
|
|
9
|
+
export * from './components/NavigationPopup/NavigationPopup';
|
|
10
|
+
export * from './components/SocialIcon/SocialIcon';
|
|
11
|
+
export * from './components/Logo/Logo';
|
|
12
|
+
export * from './hooks';
|
|
13
|
+
export * from './models';
|
|
14
|
+
export * from './utils';
|
|
1
15
|
export { default as Navigation } from './components/Standalone';
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.Navigation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
tslib_1.__exportStar(require("./components/Navigation/Navigation"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./components/DesktopNavigation/DesktopNavigation"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./components/MobileNavigation/MobileNavigation"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./components/MobileMenuButton/MobileMenuButton"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./components/NavigationList/NavigationList"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./components/NavigationListItem/NavigationListItem"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./components/NavigationItem/"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./components/NavigationItem/NavigationItem"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./components/NavigationPopup/NavigationPopup"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./components/SocialIcon/SocialIcon"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./components/Logo/Logo"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./hooks"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./models"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./utils"), exports);
|
|
7
19
|
var Standalone_1 = require("./components/Standalone");
|
|
8
|
-
Object.defineProperty(exports, "Navigation", { enumerable: true, get: function () { return __importDefault(Standalone_1).default; } });
|
|
20
|
+
Object.defineProperty(exports, "Navigation", { enumerable: true, get: function () { return tslib_1.__importDefault(Standalone_1).default; } });
|
|
@@ -44,6 +44,7 @@ export interface DesktopNavigationProps extends MobileMenuButtonProps, ActiveIte
|
|
|
44
44
|
logo: ThemedNavigationLogoData;
|
|
45
45
|
leftItemsWithIconSize: NavigationItemModel[];
|
|
46
46
|
rightItemsWithIconSize?: NavigationItemModel[];
|
|
47
|
+
customMobileHeaderItems?: NavigationItemModel[];
|
|
47
48
|
}
|
|
48
49
|
export interface MobileNavigationProps extends ClassNameProps, ActiveItemProps {
|
|
49
50
|
isOpened?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.pc-image-card_border_shadow {
|
|
1
|
+
a.pc-image-card_border_shadow, .pc-image-card_border_shadow {
|
|
2
2
|
box-shadow: 0px 4px 24px var(--pc-color-sfx-shadow), 0px 2px 8px var(--pc-color-sfx-shadow);
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -58,4 +58,37 @@ unpredictable css rules order in build */
|
|
|
58
58
|
}
|
|
59
59
|
.pc-image-card_with-content.pc-image-card_direction_reverse .pc-image-card__content {
|
|
60
60
|
padding-bottom: 24px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
a.pc-image-card {
|
|
64
|
+
color: inherit;
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
min-height: 248px;
|
|
67
|
+
height: 100%;
|
|
68
|
+
overflow-x: hidden;
|
|
69
|
+
border-radius: var(--pc-border-radius);
|
|
70
|
+
background-color: var(--g-color-base-float);
|
|
71
|
+
transition: box-shadow 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
|
|
72
|
+
}
|
|
73
|
+
a.pc-image-card:hover, a.pc-image-card:active {
|
|
74
|
+
--pc-text-header-color: inherit;
|
|
75
|
+
color: inherit;
|
|
76
|
+
}
|
|
77
|
+
a.pc-image-card_border_line {
|
|
78
|
+
border: 1px solid var(--g-color-line-generic);
|
|
79
|
+
}
|
|
80
|
+
a.pc-image-card_border_line, a.pc-image-card_border_none {
|
|
81
|
+
transition: transform 0.3s ease-out;
|
|
82
|
+
}
|
|
83
|
+
a.pc-image-card_border_line:hover, a.pc-image-card_border_none:hover {
|
|
84
|
+
transform: translateY(-8px);
|
|
85
|
+
}
|
|
86
|
+
a.pc-image-card_border_shadow {
|
|
87
|
+
transition: transform 0.3s ease-out;
|
|
88
|
+
}
|
|
89
|
+
a.pc-image-card_border_shadow:hover {
|
|
90
|
+
transform: translateY(-8px);
|
|
91
|
+
}
|
|
92
|
+
a.pc-image-card_border_shadow:hover {
|
|
93
|
+
background-color: var(--pc-color-base-float-hover);
|
|
61
94
|
}
|
|
@@ -15,10 +15,11 @@ const ButtonTabs = ({ className, items, activeTab, onSelectTab, tabSize = 'l', q
|
|
|
15
15
|
onSelectTab(tabId, e);
|
|
16
16
|
}
|
|
17
17
|
}, [onSelectTab]);
|
|
18
|
-
return (React.createElement("div", { className: b(null, className), "data-qa": qa }, items.map(({ id, title }) => {
|
|
18
|
+
return (React.createElement("div", { className: b(null, className), role: "tablist", "data-qa": qa }, items.map(({ id, title }) => {
|
|
19
19
|
const isActive = id === activeTabId;
|
|
20
20
|
return (React.createElement(Button, { text: title, className: b('item', { active: isActive }), key: title, size: tabSize, onClick: handleClick(id), extraProps: {
|
|
21
|
-
'
|
|
21
|
+
role: 'tab',
|
|
22
|
+
'aria-selected': isActive,
|
|
22
23
|
} }));
|
|
23
24
|
})));
|
|
24
25
|
};
|
|
@@ -34,9 +34,9 @@ export declare const subBlockMap: {
|
|
|
34
34
|
"image-card": (props: import("./models").ImageCardProps) => JSX.Element;
|
|
35
35
|
};
|
|
36
36
|
export declare const navItemMap: {
|
|
37
|
-
button: import("react").FC<Pick<import("./navigation
|
|
37
|
+
button: import("react").FC<Pick<import("./navigation").NavigationItemProps, "className"> & import("./models").ButtonProps>;
|
|
38
38
|
social: import("react").FC<import("./navigation/components/SocialIcon/SocialIcon").NavigationSocialItemOwnProps>;
|
|
39
|
-
dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("./navigation
|
|
40
|
-
link: import("react").FC<import("./navigation
|
|
41
|
-
"github-button": ({ text, url, className, label, size, icon, urlTitle, }: import("./navigation
|
|
39
|
+
dropdown: ({ text, icon, className, iconSize, hidePopup, items, isActive, ...props }: import("./navigation").NavigationItemProps & import("./models").NavigationDropdownItem) => JSX.Element;
|
|
40
|
+
link: import("react").FC<import("./navigation").NavigationItemProps & import("./models").NavigationLinkItem>;
|
|
41
|
+
"github-button": ({ text, url, className, label, size, icon, urlTitle, }: import("./navigation").NavigationItemProps & import("./models").NavigationGithubButton) => JSX.Element;
|
|
42
42
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ThemeSupporting } from '../utils';
|
|
2
3
|
import { ButtonProps, ImageProps } from './constructor-items';
|
|
3
4
|
export declare enum NavigationItemType {
|
|
@@ -69,6 +70,12 @@ export type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<Navi
|
|
|
69
70
|
export interface HeaderData {
|
|
70
71
|
leftItems: NavigationItemModel[];
|
|
71
72
|
rightItems?: NavigationItemModel[];
|
|
73
|
+
/**
|
|
74
|
+
* Items for the navigation header on mobile devices.
|
|
75
|
+
* They are located to the right of the Logo and to the left of the MobileMenuButton.
|
|
76
|
+
* @type {NavigationItemModel[]}
|
|
77
|
+
*/
|
|
78
|
+
customMobileHeaderItems?: NavigationItemModel[];
|
|
72
79
|
iconSize?: number;
|
|
73
80
|
withBorder?: boolean;
|
|
74
81
|
withBorderOnScroll?: boolean;
|
|
@@ -90,4 +97,5 @@ export interface NavigationData {
|
|
|
90
97
|
logo: ThemedNavigationLogoData;
|
|
91
98
|
header: HeaderData;
|
|
92
99
|
footer?: FooterData;
|
|
100
|
+
renderNavigation?: () => React.ReactNode;
|
|
93
101
|
}
|