@gravity-ui/page-constructor 2.15.0-alpha → 2.16.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/CHANGELOG.md +14 -0
- package/build/cjs/models/navigation.d.ts +2 -0
- package/build/cjs/navigation/components/Header/Header.js +12 -3
- package/build/cjs/navigation/components/NavigationDropdownItem/NavigationDropdownItem.js +2 -2
- package/build/cjs/navigation/components/NavigationItem/components/ContentWrapper/ContentWrapper.css +1 -3
- package/build/cjs/navigation/components/NavigationItem/components/ContentWrapper/ContentWrapper.d.ts +5 -2
- package/build/cjs/navigation/components/NavigationItem/components/ContentWrapper/ContentWrapper.js +6 -3
- package/build/cjs/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js +2 -2
- package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js +2 -2
- package/build/cjs/navigation/schema.d.ts +3 -0
- package/build/cjs/navigation/schema.js +6 -0
- package/build/cjs/schema/index.d.ts +3 -0
- package/build/esm/models/navigation.d.ts +2 -0
- package/build/esm/navigation/components/Header/Header.js +13 -4
- package/build/esm/navigation/components/NavigationDropdownItem/NavigationDropdownItem.js +2 -2
- package/build/esm/navigation/components/NavigationItem/components/ContentWrapper/ContentWrapper.css +1 -3
- package/build/esm/navigation/components/NavigationItem/components/ContentWrapper/ContentWrapper.d.ts +5 -2
- package/build/esm/navigation/components/NavigationItem/components/ContentWrapper/ContentWrapper.js +7 -4
- package/build/esm/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js +2 -2
- package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js +2 -2
- package/build/esm/navigation/schema.d.ts +3 -0
- package/build/esm/navigation/schema.js +6 -0
- package/build/esm/schema/index.d.ts +3 -0
- package/package.json +1 -4
- package/server/models/navigation.d.ts +2 -0
- package/styles/variables.scss +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.16.0](https://github.com/gravity-ui/page-constructor/compare/v2.15.0...v2.16.0) (2023-05-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **Navigation:** add iconSize for navigation icons, update margin between icon and text ([#329](https://github.com/gravity-ui/page-constructor/issues/329)) ([1427740](https://github.com/gravity-ui/page-constructor/commit/14277404cfe199847ae0d1834eb433ba1efd919a))
|
|
9
|
+
|
|
10
|
+
## [2.15.0](https://github.com/gravity-ui/page-constructor/compare/v2.14.0...v2.15.0) (2023-05-03)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **OverflowScroller:** customize arrow ([#326](https://github.com/gravity-ui/page-constructor/issues/326)) ([edd3dbe](https://github.com/gravity-ui/page-constructor/commit/edd3dbe2b9dfe93a83b21261f4ab8a836e05359a))
|
|
16
|
+
|
|
3
17
|
## [2.14.0](https://github.com/gravity-ui/page-constructor/compare/v2.13.1...v2.14.0) (2023-05-02)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -11,6 +11,7 @@ export interface NavigationItemBase {
|
|
|
11
11
|
text: string;
|
|
12
12
|
icon?: ImageProps;
|
|
13
13
|
url?: string;
|
|
14
|
+
iconSize?: number;
|
|
14
15
|
}
|
|
15
16
|
export declare enum NavigationGithubButtonIcon {
|
|
16
17
|
heart = "octicon-heart",
|
|
@@ -61,6 +62,7 @@ export type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<Navi
|
|
|
61
62
|
export interface HeaderData {
|
|
62
63
|
leftItems: NavigationItemModel[];
|
|
63
64
|
rightItems?: NavigationItemModel[];
|
|
65
|
+
iconSize?: number;
|
|
64
66
|
}
|
|
65
67
|
export interface FooterColumn {
|
|
66
68
|
title: string;
|
|
@@ -25,10 +25,19 @@ const MobileMenuButton = ({ isSidebarOpened, onSidebarOpenedChange, }) => {
|
|
|
25
25
|
onSidebarOpenedChange(!isSidebarOpened);
|
|
26
26
|
}, size: "l" }, iconProps)));
|
|
27
27
|
};
|
|
28
|
+
const iconSizeKey = 'iconSize';
|
|
28
29
|
const Header = ({ data, logo }) => {
|
|
29
|
-
const { leftItems, rightItems } = data;
|
|
30
|
+
const { leftItems, rightItems, iconSize = 20 } = data;
|
|
30
31
|
const [isSidebarOpened, setIsSidebarOpened] = (0, react_1.useState)(false);
|
|
31
32
|
const [activeItemId, setactiveItemId] = (0, react_1.useState)(undefined);
|
|
33
|
+
const getNavigationItemWithIconSize = (0, react_1.useCallback)((item) => {
|
|
34
|
+
if (!(iconSizeKey in item)) {
|
|
35
|
+
return Object.assign(Object.assign({}, item), { iconSize });
|
|
36
|
+
}
|
|
37
|
+
return item;
|
|
38
|
+
}, [iconSize]);
|
|
39
|
+
const leftItemsWithIconSize = (0, react_1.useMemo)(() => leftItems.map(getNavigationItemWithIconSize), [getNavigationItemWithIconSize, leftItems]);
|
|
40
|
+
const rightItemsWithIconSize = (0, react_1.useMemo)(() => rightItems === null || rightItems === void 0 ? void 0 : rightItems.map(getNavigationItemWithIconSize), [getNavigationItemWithIconSize, rightItems]);
|
|
32
41
|
const onActiveItemChange = (0, react_1.useCallback)((id) => {
|
|
33
42
|
setactiveItemId(id);
|
|
34
43
|
}, []);
|
|
@@ -48,10 +57,10 @@ const Header = ({ data, logo }) => {
|
|
|
48
57
|
logo && (react_1.default.createElement("div", { className: b('left') },
|
|
49
58
|
react_1.default.createElement(Logo_1.default, Object.assign({}, logo, { className: b('logo') })))),
|
|
50
59
|
react_1.default.createElement("div", { className: b('navigation-container') },
|
|
51
|
-
react_1.default.createElement(Navigation_1.default, { className: b('navigation'), links:
|
|
60
|
+
react_1.default.createElement(Navigation_1.default, { className: b('navigation'), links: leftItemsWithIconSize, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange })),
|
|
52
61
|
react_1.default.createElement("div", { className: b('right') },
|
|
53
62
|
react_1.default.createElement(MobileMenuButton, { isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
|
|
54
|
-
|
|
63
|
+
rightItemsWithIconSize && (react_1.default.createElement("ul", { className: b('buttons') }, rightItemsWithIconSize.map((button, index) => (react_1.default.createElement(NavigationListItem_1.NavigationListItem, { key: index, className: b('buttons-item'), item: button, index: index, activeItemId: activeItemId, hidePopup: hidePopup, column: constants_1.ItemColumnName.Right, onActiveItemChange: onActiveItemChange })))))),
|
|
55
64
|
react_1.default.createElement(OutsideClick_1.default, { onOutsideClick: () => onSidebarOpenedChange(false) },
|
|
56
65
|
react_1.default.createElement(MobileNavigation_1.default, { topItems: leftItems, bottomItems: rightItems, isOpened: isSidebarOpened, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange, onClose: hideSidebar })))))));
|
|
57
66
|
};
|
|
@@ -7,9 +7,9 @@ const NavigationItem_1 = tslib_1.__importDefault(require("../NavigationItem/Navi
|
|
|
7
7
|
const NavigationPopup_1 = tslib_1.__importDefault(require("../NavigationPopup/NavigationPopup"));
|
|
8
8
|
const NavigationDropdown = ({ className, data, isActive, hidePopup, onClick, }) => {
|
|
9
9
|
const anchorRef = (0, react_1.useRef)(null);
|
|
10
|
-
const { text, icon, items } = data, popupProps = tslib_1.__rest(data, ["text", "icon", "items"]);
|
|
10
|
+
const { text, icon, items, iconSize } = data, popupProps = tslib_1.__rest(data, ["text", "icon", "items", "iconSize"]);
|
|
11
11
|
return (react_1.default.createElement(react_1.Fragment, null,
|
|
12
|
-
react_1.default.createElement(NavigationItem_1.default, { className: className, ref: anchorRef, onClick: onClick, isOpened: isActive, data: { text, type: models_1.NavigationItemType.Dropdown, icon } }),
|
|
12
|
+
react_1.default.createElement(NavigationItem_1.default, { className: className, ref: anchorRef, onClick: onClick, isOpened: isActive, data: { text, type: models_1.NavigationItemType.Dropdown, icon, iconSize } }),
|
|
13
13
|
react_1.default.createElement(NavigationPopup_1.default, Object.assign({ open: isActive, onClose: hidePopup, items: items, anchorRef: anchorRef }, popupProps))));
|
|
14
14
|
};
|
|
15
15
|
exports.default = NavigationDropdown;
|
package/build/cjs/navigation/components/NavigationItem/components/ContentWrapper/ContentWrapper.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ImageProps } from '../../../../../models';
|
|
3
|
-
|
|
3
|
+
interface ContentWrapperProps {
|
|
4
4
|
text: string;
|
|
5
5
|
icon?: ImageProps;
|
|
6
|
-
|
|
6
|
+
iconSize?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const ContentWrapper: React.FC<ContentWrapperProps>;
|
|
9
|
+
export {};
|
package/build/cjs/navigation/components/NavigationItem/components/ContentWrapper/ContentWrapper.js
CHANGED
|
@@ -6,7 +6,10 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
|
6
6
|
const components_1 = require("../../../../../components");
|
|
7
7
|
const utils_1 = require("../../../../../utils");
|
|
8
8
|
const b = (0, utils_1.block)('content-wrapper');
|
|
9
|
-
const ContentWrapper = ({ text, icon }) =>
|
|
10
|
-
|
|
11
|
-
react_1.default.createElement(
|
|
9
|
+
const ContentWrapper = ({ text, icon, iconSize }) => {
|
|
10
|
+
const iconSizeStyle = (0, react_1.useMemo)(() => (iconSize ? { height: `${iconSize}px`, width: `${iconSize}px` } : {}), [iconSize]);
|
|
11
|
+
return (react_1.default.createElement(react_1.Fragment, null,
|
|
12
|
+
icon && typeof icon !== 'string' && (react_1.default.createElement(components_1.Image, Object.assign({ className: b('icon') }, icon, { style: iconSizeStyle }))),
|
|
13
|
+
react_1.default.createElement("span", { className: b('text') }, text)));
|
|
14
|
+
};
|
|
12
15
|
exports.ContentWrapper = ContentWrapper;
|
|
@@ -10,10 +10,10 @@ const ContentWrapper_1 = require("../ContentWrapper/ContentWrapper");
|
|
|
10
10
|
const b = (0, utils_2.block)('navigation-dropdown');
|
|
11
11
|
const TOGGLE_ARROW_SIZE = 12;
|
|
12
12
|
exports.NavigationDropdown = react_1.default.forwardRef((_a, ref) => {
|
|
13
|
-
var { text, icon, isOpened, className } = _a, props = tslib_1.__rest(_a, ["text", "icon", "isOpened", "className"]);
|
|
13
|
+
var { text, icon, isOpened, className, iconSize } = _a, props = tslib_1.__rest(_a, ["text", "icon", "isOpened", "className", "iconSize"]);
|
|
14
14
|
const iconData = icon && (0, utils_1.getMediaImage)(icon);
|
|
15
15
|
return (react_1.default.createElement("span", Object.assign({ ref: ref }, props, { className: b(null, className) }),
|
|
16
|
-
react_1.default.createElement(ContentWrapper_1.ContentWrapper, { text: text, icon: iconData }),
|
|
16
|
+
react_1.default.createElement(ContentWrapper_1.ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }),
|
|
17
17
|
react_1.default.createElement(components_1.ToggleArrow, { className: b('arrow'), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isOpened })));
|
|
18
18
|
});
|
|
19
19
|
exports.NavigationDropdown.displayName = 'NavigationDropdown';
|
package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js
CHANGED
|
@@ -12,12 +12,12 @@ const ContentWrapper_1 = require("../ContentWrapper/ContentWrapper");
|
|
|
12
12
|
const b = (0, utils_2.block)('navigation-link');
|
|
13
13
|
const NavigationLink = (props) => {
|
|
14
14
|
const { hostname, Link } = (0, react_1.useContext)(locationContext_1.LocationContext);
|
|
15
|
-
const { url, text, icon, arrow, target, className } = props, rest = tslib_1.__rest(props, ["url", "text", "icon", "arrow", "target", "className"]);
|
|
15
|
+
const { url, text, icon, arrow, target, className, iconSize } = props, rest = tslib_1.__rest(props, ["url", "text", "icon", "arrow", "target", "className", "iconSize"]);
|
|
16
16
|
const linkExtraProps = (0, utils_2.getLinkProps)(url, hostname, target);
|
|
17
17
|
const iconData = icon && (0, utils_1.getMediaImage)(icon);
|
|
18
18
|
const classes = b(null, className);
|
|
19
19
|
const content = (react_1.default.createElement(react_1.Fragment, null,
|
|
20
|
-
react_1.default.createElement(ContentWrapper_1.ContentWrapper, { text: text, icon: iconData }),
|
|
20
|
+
react_1.default.createElement(ContentWrapper_1.ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }),
|
|
21
21
|
arrow && react_1.default.createElement(icons_1.NavigationArrow, { className: b('arrow') })));
|
|
22
22
|
if ((linkExtraProps === null || linkExtraProps === void 0 ? void 0 : linkExtraProps.target) || !Link) {
|
|
23
23
|
return (react_1.default.createElement("a", Object.assign({ href: url, title: text, className: classes }, rest, linkExtraProps), content));
|
|
@@ -36,6 +36,9 @@ const NavigationItemBaseProps = {
|
|
|
36
36
|
type: 'string',
|
|
37
37
|
pattern: schema_1.urlPattern,
|
|
38
38
|
},
|
|
39
|
+
iconSize: {
|
|
40
|
+
type: 'number',
|
|
41
|
+
},
|
|
39
42
|
};
|
|
40
43
|
const NavigationItemBaseLinkProps = (0, lodash_1.omit)(NavigationItemBaseProps, ['url']);
|
|
41
44
|
const NavigationLinkItemProps = {
|
|
@@ -76,5 +79,8 @@ exports.NavigationHeaderProps = {
|
|
|
76
79
|
properties: {
|
|
77
80
|
leftItems: NavigationItemProps,
|
|
78
81
|
rightItems: NavigationItemProps,
|
|
82
|
+
iconSize: {
|
|
83
|
+
type: 'number',
|
|
84
|
+
},
|
|
79
85
|
},
|
|
80
86
|
};
|
|
@@ -11,6 +11,7 @@ export interface NavigationItemBase {
|
|
|
11
11
|
text: string;
|
|
12
12
|
icon?: ImageProps;
|
|
13
13
|
url?: string;
|
|
14
|
+
iconSize?: number;
|
|
14
15
|
}
|
|
15
16
|
export declare enum NavigationGithubButtonIcon {
|
|
16
17
|
heart = "octicon-heart",
|
|
@@ -61,6 +62,7 @@ export type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<Navi
|
|
|
61
62
|
export interface HeaderData {
|
|
62
63
|
leftItems: NavigationItemModel[];
|
|
63
64
|
rightItems?: NavigationItemModel[];
|
|
65
|
+
iconSize?: number;
|
|
64
66
|
}
|
|
65
67
|
export interface FooterColumn {
|
|
66
68
|
title: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import Control from '../../../components/Control/Control';
|
|
3
3
|
import OutsideClick from '../../../components/OutsideClick/OutsideClick';
|
|
4
4
|
import { Col, Grid, Row } from '../../../grid';
|
|
@@ -22,10 +22,19 @@ const MobileMenuButton = ({ isSidebarOpened, onSidebarOpenedChange, }) => {
|
|
|
22
22
|
onSidebarOpenedChange(!isSidebarOpened);
|
|
23
23
|
}, size: "l" }, iconProps)));
|
|
24
24
|
};
|
|
25
|
+
const iconSizeKey = 'iconSize';
|
|
25
26
|
export const Header = ({ data, logo }) => {
|
|
26
|
-
const { leftItems, rightItems } = data;
|
|
27
|
+
const { leftItems, rightItems, iconSize = 20 } = data;
|
|
27
28
|
const [isSidebarOpened, setIsSidebarOpened] = useState(false);
|
|
28
29
|
const [activeItemId, setactiveItemId] = useState(undefined);
|
|
30
|
+
const getNavigationItemWithIconSize = useCallback((item) => {
|
|
31
|
+
if (!(iconSizeKey in item)) {
|
|
32
|
+
return Object.assign(Object.assign({}, item), { iconSize });
|
|
33
|
+
}
|
|
34
|
+
return item;
|
|
35
|
+
}, [iconSize]);
|
|
36
|
+
const leftItemsWithIconSize = useMemo(() => leftItems.map(getNavigationItemWithIconSize), [getNavigationItemWithIconSize, leftItems]);
|
|
37
|
+
const rightItemsWithIconSize = useMemo(() => rightItems === null || rightItems === void 0 ? void 0 : rightItems.map(getNavigationItemWithIconSize), [getNavigationItemWithIconSize, rightItems]);
|
|
29
38
|
const onActiveItemChange = useCallback((id) => {
|
|
30
39
|
setactiveItemId(id);
|
|
31
40
|
}, []);
|
|
@@ -45,10 +54,10 @@ export const Header = ({ data, logo }) => {
|
|
|
45
54
|
logo && (React.createElement("div", { className: b('left') },
|
|
46
55
|
React.createElement(Logo, Object.assign({}, logo, { className: b('logo') })))),
|
|
47
56
|
React.createElement("div", { className: b('navigation-container') },
|
|
48
|
-
React.createElement(Navigation, { className: b('navigation'), links:
|
|
57
|
+
React.createElement(Navigation, { className: b('navigation'), links: leftItemsWithIconSize, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange })),
|
|
49
58
|
React.createElement("div", { className: b('right') },
|
|
50
59
|
React.createElement(MobileMenuButton, { isSidebarOpened: isSidebarOpened, onSidebarOpenedChange: onSidebarOpenedChange }),
|
|
51
|
-
|
|
60
|
+
rightItemsWithIconSize && (React.createElement("ul", { className: b('buttons') }, rightItemsWithIconSize.map((button, index) => (React.createElement(NavigationListItem, { key: index, className: b('buttons-item'), item: button, index: index, activeItemId: activeItemId, hidePopup: hidePopup, column: ItemColumnName.Right, onActiveItemChange: onActiveItemChange })))))),
|
|
52
61
|
React.createElement(OutsideClick, { onOutsideClick: () => onSidebarOpenedChange(false) },
|
|
53
62
|
React.createElement(MobileNavigation, { topItems: leftItems, bottomItems: rightItems, isOpened: isSidebarOpened, activeItemId: activeItemId, onActiveItemChange: onActiveItemChange, onClose: hideSidebar })))))));
|
|
54
63
|
};
|
|
@@ -5,9 +5,9 @@ import NavigationItem from '../NavigationItem/NavigationItem';
|
|
|
5
5
|
import NavigationPopup from '../NavigationPopup/NavigationPopup';
|
|
6
6
|
const NavigationDropdown = ({ className, data, isActive, hidePopup, onClick, }) => {
|
|
7
7
|
const anchorRef = useRef(null);
|
|
8
|
-
const { text, icon, items } = data, popupProps = __rest(data, ["text", "icon", "items"]);
|
|
8
|
+
const { text, icon, items, iconSize } = data, popupProps = __rest(data, ["text", "icon", "items", "iconSize"]);
|
|
9
9
|
return (React.createElement(Fragment, null,
|
|
10
|
-
React.createElement(NavigationItem, { className: className, ref: anchorRef, onClick: onClick, isOpened: isActive, data: { text, type: NavigationItemType.Dropdown, icon } }),
|
|
10
|
+
React.createElement(NavigationItem, { className: className, ref: anchorRef, onClick: onClick, isOpened: isActive, data: { text, type: NavigationItemType.Dropdown, icon, iconSize } }),
|
|
11
11
|
React.createElement(NavigationPopup, Object.assign({ open: isActive, onClose: hidePopup, items: items, anchorRef: anchorRef }, popupProps))));
|
|
12
12
|
};
|
|
13
13
|
export default NavigationDropdown;
|
package/build/esm/navigation/components/NavigationItem/components/ContentWrapper/ContentWrapper.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ImageProps } from '../../../../../models';
|
|
3
3
|
import './ContentWrapper.css';
|
|
4
|
-
|
|
4
|
+
interface ContentWrapperProps {
|
|
5
5
|
text: string;
|
|
6
6
|
icon?: ImageProps;
|
|
7
|
-
|
|
7
|
+
iconSize?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const ContentWrapper: React.FC<ContentWrapperProps>;
|
|
10
|
+
export {};
|
package/build/esm/navigation/components/NavigationItem/components/ContentWrapper/ContentWrapper.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import React, { Fragment } from 'react';
|
|
1
|
+
import React, { Fragment, useMemo } from 'react';
|
|
2
2
|
import { Image } from '../../../../../components';
|
|
3
3
|
import { block } from '../../../../../utils';
|
|
4
4
|
import './ContentWrapper.css';
|
|
5
5
|
const b = block('content-wrapper');
|
|
6
|
-
export const ContentWrapper = ({ text, icon }) =>
|
|
7
|
-
|
|
8
|
-
React.createElement(
|
|
6
|
+
export const ContentWrapper = ({ text, icon, iconSize }) => {
|
|
7
|
+
const iconSizeStyle = useMemo(() => (iconSize ? { height: `${iconSize}px`, width: `${iconSize}px` } : {}), [iconSize]);
|
|
8
|
+
return (React.createElement(Fragment, null,
|
|
9
|
+
icon && typeof icon !== 'string' && (React.createElement(Image, Object.assign({ className: b('icon') }, icon, { style: iconSizeStyle }))),
|
|
10
|
+
React.createElement("span", { className: b('text') }, text)));
|
|
11
|
+
};
|
|
@@ -8,10 +8,10 @@ import './NavigationDropdown.css';
|
|
|
8
8
|
const b = block('navigation-dropdown');
|
|
9
9
|
const TOGGLE_ARROW_SIZE = 12;
|
|
10
10
|
export const NavigationDropdown = React.forwardRef((_a, ref) => {
|
|
11
|
-
var { text, icon, isOpened, className } = _a, props = __rest(_a, ["text", "icon", "isOpened", "className"]);
|
|
11
|
+
var { text, icon, isOpened, className, iconSize } = _a, props = __rest(_a, ["text", "icon", "isOpened", "className", "iconSize"]);
|
|
12
12
|
const iconData = icon && getMediaImage(icon);
|
|
13
13
|
return (React.createElement("span", Object.assign({ ref: ref }, props, { className: b(null, className) }),
|
|
14
|
-
React.createElement(ContentWrapper, { text: text, icon: iconData }),
|
|
14
|
+
React.createElement(ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }),
|
|
15
15
|
React.createElement(ToggleArrow, { className: b('arrow'), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isOpened })));
|
|
16
16
|
});
|
|
17
17
|
NavigationDropdown.displayName = 'NavigationDropdown';
|
package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js
CHANGED
|
@@ -10,12 +10,12 @@ import './NavigationLink.css';
|
|
|
10
10
|
const b = block('navigation-link');
|
|
11
11
|
export const NavigationLink = (props) => {
|
|
12
12
|
const { hostname, Link } = useContext(LocationContext);
|
|
13
|
-
const { url, text, icon, arrow, target, className } = props, rest = __rest(props, ["url", "text", "icon", "arrow", "target", "className"]);
|
|
13
|
+
const { url, text, icon, arrow, target, className, iconSize } = props, rest = __rest(props, ["url", "text", "icon", "arrow", "target", "className", "iconSize"]);
|
|
14
14
|
const linkExtraProps = getLinkProps(url, hostname, target);
|
|
15
15
|
const iconData = icon && getMediaImage(icon);
|
|
16
16
|
const classes = b(null, className);
|
|
17
17
|
const content = (React.createElement(Fragment, null,
|
|
18
|
-
React.createElement(ContentWrapper, { text: text, icon: iconData }),
|
|
18
|
+
React.createElement(ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }),
|
|
19
19
|
arrow && React.createElement(NavigationArrow, { className: b('arrow') })));
|
|
20
20
|
if ((linkExtraProps === null || linkExtraProps === void 0 ? void 0 : linkExtraProps.target) || !Link) {
|
|
21
21
|
return (React.createElement("a", Object.assign({ href: url, title: text, className: classes }, rest, linkExtraProps), content));
|
|
@@ -33,6 +33,9 @@ const NavigationItemBaseProps = {
|
|
|
33
33
|
type: 'string',
|
|
34
34
|
pattern: urlPattern,
|
|
35
35
|
},
|
|
36
|
+
iconSize: {
|
|
37
|
+
type: 'number',
|
|
38
|
+
},
|
|
36
39
|
};
|
|
37
40
|
const NavigationItemBaseLinkProps = omit(NavigationItemBaseProps, ['url']);
|
|
38
41
|
const NavigationLinkItemProps = {
|
|
@@ -73,5 +76,8 @@ export const NavigationHeaderProps = {
|
|
|
73
76
|
properties: {
|
|
74
77
|
leftItems: NavigationItemProps,
|
|
75
78
|
rightItems: NavigationItemProps,
|
|
79
|
+
iconSize: {
|
|
80
|
+
type: 'number',
|
|
81
|
+
},
|
|
76
82
|
},
|
|
77
83
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -138,8 +138,5 @@
|
|
|
138
138
|
"*.{json,yaml,yml,md}": [
|
|
139
139
|
"prettier --write"
|
|
140
140
|
]
|
|
141
|
-
},
|
|
142
|
-
"publishConfig": {
|
|
143
|
-
"tag": "alpha"
|
|
144
141
|
}
|
|
145
142
|
}
|
|
@@ -11,6 +11,7 @@ export interface NavigationItemBase {
|
|
|
11
11
|
text: string;
|
|
12
12
|
icon?: ImageProps;
|
|
13
13
|
url?: string;
|
|
14
|
+
iconSize?: number;
|
|
14
15
|
}
|
|
15
16
|
export declare enum NavigationGithubButtonIcon {
|
|
16
17
|
heart = "octicon-heart",
|
|
@@ -61,6 +62,7 @@ export type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<Navi
|
|
|
61
62
|
export interface HeaderData {
|
|
62
63
|
leftItems: NavigationItemModel[];
|
|
63
64
|
rightItems?: NavigationItemModel[];
|
|
65
|
+
iconSize?: number;
|
|
64
66
|
}
|
|
65
67
|
export interface FooterColumn {
|
|
66
68
|
title: string;
|