@gravity-ui/page-constructor 2.15.0 → 2.17.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/blocks/Slider/Slider.css +88 -0
- package/build/cjs/blocks/Slider/Slider.js +0 -2
- package/build/cjs/components/Map/YMap/YandexMap.js +1 -1
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +1 -1
- package/build/cjs/components/VideoBlock/VideoBlock.js +1 -1
- package/build/cjs/components/YFMWrapper/YFMWrapper.js +1 -1
- package/build/cjs/containers/Loadable/Loadable.js +1 -1
- 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/cjs/text-transform/blocks.js +2 -8
- package/build/cjs/text-transform/utils.d.ts +1 -1
- package/build/cjs/text-transform/utils.js +2 -2
- package/build/cjs/utils/scroll.js +1 -1
- package/build/esm/blocks/Slider/Slider.css +88 -0
- package/build/esm/blocks/Slider/Slider.d.ts +0 -1
- package/build/esm/blocks/Slider/Slider.js +0 -3
- package/build/esm/components/Map/YMap/YandexMap.js +1 -1
- package/build/esm/components/ReactPlayer/ReactPlayer.js +1 -1
- package/build/esm/components/VideoBlock/VideoBlock.js +1 -1
- package/build/esm/components/YFMWrapper/YFMWrapper.js +1 -1
- package/build/esm/containers/Loadable/Loadable.js +1 -1
- 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/build/esm/text-transform/blocks.js +2 -8
- package/build/esm/text-transform/utils.d.ts +1 -1
- package/build/esm/text-transform/utils.js +2 -2
- package/build/esm/utils/scroll.js +1 -1
- package/package.json +1 -1
- package/server/models/navigation.d.ts +2 -0
- package/server/text-transform/blocks.js +2 -8
- package/server/text-transform/utils.d.ts +1 -1
- package/server/text-transform/utils.js +2 -2
- package/server/utils/scroll.js +1 -1
- package/styles/variables.scss +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.17.0](https://github.com/gravity-ui/page-constructor/compare/v2.16.0...v2.17.0) (2023-05-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* drop rules overriding ([#303](https://github.com/gravity-ui/page-constructor/issues/303)) ([0c13398](https://github.com/gravity-ui/page-constructor/commit/0c1339885ce3b930ab9428b585aa6dd020b0d298))
|
|
9
|
+
|
|
10
|
+
## [2.16.0](https://github.com/gravity-ui/page-constructor/compare/v2.15.0...v2.16.0) (2023-05-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **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))
|
|
16
|
+
|
|
3
17
|
## [2.15.0](https://github.com/gravity-ui/page-constructor/compare/v2.14.0...v2.15.0) (2023-05-03)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -1,5 +1,93 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
|
+
.pc-slick-origin.slick-slider {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: block;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
-webkit-touch-callout: none;
|
|
8
|
+
user-select: none;
|
|
9
|
+
touch-action: pan-y;
|
|
10
|
+
-webkit-tap-highlight-color: transparent;
|
|
11
|
+
}
|
|
12
|
+
.pc-slick-origin.slick-slider .slick-track,
|
|
13
|
+
.pc-slick-origin.slick-slider .slick-list {
|
|
14
|
+
transform: translate3d(0, 0, 0);
|
|
15
|
+
}
|
|
16
|
+
.pc-slick-origin .slick-list {
|
|
17
|
+
position: relative;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
display: block;
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
}
|
|
23
|
+
.pc-slick-origin .slick-list:focus {
|
|
24
|
+
outline: none;
|
|
25
|
+
}
|
|
26
|
+
.pc-slick-origin .slick-list.dragging {
|
|
27
|
+
cursor: hand;
|
|
28
|
+
}
|
|
29
|
+
.pc-slick-origin .slick-track {
|
|
30
|
+
position: relative;
|
|
31
|
+
left: 0;
|
|
32
|
+
top: 0;
|
|
33
|
+
display: block;
|
|
34
|
+
margin-left: auto;
|
|
35
|
+
margin-right: auto;
|
|
36
|
+
}
|
|
37
|
+
.pc-slick-origin .slick-track::before, .pc-slick-origin .slick-track::after {
|
|
38
|
+
content: "";
|
|
39
|
+
display: table;
|
|
40
|
+
}
|
|
41
|
+
.pc-slick-origin .slick-track:after {
|
|
42
|
+
clear: both;
|
|
43
|
+
}
|
|
44
|
+
.slick-loading .pc-slick-origin .slick-track {
|
|
45
|
+
visibility: hidden;
|
|
46
|
+
}
|
|
47
|
+
.pc-slick-origin .slick-slide {
|
|
48
|
+
float: left;
|
|
49
|
+
height: 100%;
|
|
50
|
+
min-height: 1px;
|
|
51
|
+
display: none;
|
|
52
|
+
}
|
|
53
|
+
[dir=rtl] .pc-slick-origin .slick-slide {
|
|
54
|
+
float: right;
|
|
55
|
+
}
|
|
56
|
+
.pc-slick-origin .slick-slide img {
|
|
57
|
+
display: block;
|
|
58
|
+
}
|
|
59
|
+
.pc-slick-origin .slick-slide.slick-loading img {
|
|
60
|
+
display: none;
|
|
61
|
+
}
|
|
62
|
+
.pc-slick-origin .slick-slide.dragging img {
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
}
|
|
65
|
+
.slick-initialized .pc-slick-origin .slick-slide {
|
|
66
|
+
display: block;
|
|
67
|
+
}
|
|
68
|
+
.slick-loading .pc-slick-origin .slick-slide {
|
|
69
|
+
visibility: hidden;
|
|
70
|
+
}
|
|
71
|
+
.slick-vertical .pc-slick-origin .slick-slide {
|
|
72
|
+
display: block;
|
|
73
|
+
height: auto;
|
|
74
|
+
border: 1px solid transparent;
|
|
75
|
+
}
|
|
76
|
+
.pc-slick-origin.slick-initialized .slick-slide {
|
|
77
|
+
display: block;
|
|
78
|
+
}
|
|
79
|
+
.pc-slick-origin.slick-loading .slick-slide {
|
|
80
|
+
visibility: hidden;
|
|
81
|
+
}
|
|
82
|
+
.pc-slick-origin.slick-vertical .slick-slide {
|
|
83
|
+
display: block;
|
|
84
|
+
height: auto;
|
|
85
|
+
border: 1px solid transparent;
|
|
86
|
+
}
|
|
87
|
+
.pc-slick-origin .slick-arrow.slick-hidden {
|
|
88
|
+
display: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
3
91
|
.pc-SliderBlock .slick-list {
|
|
4
92
|
padding: 24px 0 20px;
|
|
5
93
|
margin: 0 -8px;
|
|
@@ -18,8 +18,6 @@ const models_1 = require("../../models");
|
|
|
18
18
|
const utils_1 = require("../../utils");
|
|
19
19
|
const Arrow_1 = tslib_1.__importDefault(require("./Arrow/Arrow"));
|
|
20
20
|
const utils_2 = require("./utils");
|
|
21
|
-
// Cause Slider.css should override slick.css
|
|
22
|
-
// eslint-disable-next-line import/order
|
|
23
21
|
const b = (0, utils_1.block)('SliderBlock');
|
|
24
22
|
const slick = (0, utils_1.block)('slick-origin');
|
|
25
23
|
const DOT_WIDTH = 8;
|
|
@@ -2,8 +2,8 @@
|
|
|
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 = tslib_1.__importDefault(require("lodash"));
|
|
6
5
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
7
|
const localeContext_1 = require("../../../context/localeContext/localeContext");
|
|
8
8
|
const mapsContext_1 = require("../../../context/mapsContext/mapsContext");
|
|
9
9
|
const mobileContext_1 = require("../../../context/mobileContext");
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ReactPlayerBlock = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
7
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
8
|
const react_player_1 = tslib_1.__importDefault(require("react-player"));
|
|
8
|
-
const uikit_1 = require("@gravity-ui/uikit");
|
|
9
9
|
const metrikaContext_1 = require("../../context/metrikaContext");
|
|
10
10
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
11
11
|
const videoContext_1 = require("../../context/videoContext");
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getHeight = exports.AUTOPLAY_ATTRIBUTES = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
7
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
7
8
|
const uuid_1 = require("uuid");
|
|
8
|
-
const uikit_1 = require("@gravity-ui/uikit");
|
|
9
9
|
const icons_1 = require("../../icons");
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const Image_1 = tslib_1.__importDefault(require("../Image/Image"));
|
|
@@ -1,9 +1,9 @@
|
|
|
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.__importDefault(require("react"));
|
|
5
4
|
/* we won't use 'pc' class prefix here to let you opportunity to define yfm styles
|
|
6
5
|
in your project via global 'yfm' class */
|
|
6
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
7
7
|
const bem_cn_lite_1 = tslib_1.__importDefault(require("bem-cn-lite"));
|
|
8
8
|
const snakecase_keys_1 = tslib_1.__importDefault(require("snakecase-keys"));
|
|
9
9
|
const components_1 = require("../../components");
|
|
@@ -2,8 +2,8 @@
|
|
|
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 bem_cn_lite_1 = tslib_1.__importDefault(require("bem-cn-lite"));
|
|
6
5
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
|
+
const bem_cn_lite_1 = tslib_1.__importDefault(require("bem-cn-lite"));
|
|
7
7
|
const ErrorWrapper_1 = tslib_1.__importDefault(require("../../components/ErrorWrapper/ErrorWrapper"));
|
|
8
8
|
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
9
9
|
const b = (0, bem_cn_lite_1.default)('loadable-block');
|
|
@@ -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
|
};
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformFootnotes = exports.transformBlocks = exports.typografTransformer = exports.yfmTransformer = exports.createItemsParser = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
/* eslint-disable no-param-reassign */
|
|
6
|
+
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
5
7
|
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
6
8
|
const models_1 = require("../models");
|
|
7
9
|
const utils_1 = require("./utils");
|
|
@@ -47,7 +49,6 @@ const parseItemsTitle = (transformer, items) => items.map((_a) => {
|
|
|
47
49
|
});
|
|
48
50
|
function parsePriceDetailedBlock(transformer, block) {
|
|
49
51
|
const { priceType } = block;
|
|
50
|
-
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
51
52
|
block.items = block.items.map((item) => {
|
|
52
53
|
const { description, items: details = [] } = item;
|
|
53
54
|
if (priceType === 'marked-list') {
|
|
@@ -65,27 +66,23 @@ function parsePriceDetailedBlock(transformer, block) {
|
|
|
65
66
|
item.description = transformer(description);
|
|
66
67
|
return item;
|
|
67
68
|
});
|
|
68
|
-
/* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
69
69
|
return block;
|
|
70
70
|
}
|
|
71
71
|
const parseContentLayout = (transformer, content) => {
|
|
72
72
|
if (content) {
|
|
73
73
|
const { text, additionalInfo } = content;
|
|
74
|
-
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
75
74
|
if (text) {
|
|
76
75
|
content.text = transformer(text);
|
|
77
76
|
}
|
|
78
77
|
if (additionalInfo) {
|
|
79
78
|
content.additionalInfo = transformer(additionalInfo);
|
|
80
79
|
}
|
|
81
|
-
/* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
82
80
|
}
|
|
83
81
|
return content;
|
|
84
82
|
};
|
|
85
83
|
function parseContentLayoutTitle(transformer, content) {
|
|
86
84
|
if (content === null || content === void 0 ? void 0 : content.title) {
|
|
87
85
|
const { title } = content;
|
|
88
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
89
86
|
content.title = title && parseTitle(transformer, title);
|
|
90
87
|
}
|
|
91
88
|
return content;
|
|
@@ -361,7 +358,6 @@ const config = {
|
|
|
361
358
|
function addRandomOrder(block) {
|
|
362
359
|
if (block) {
|
|
363
360
|
if ('randomOrder' in block && block.randomOrder && 'children' in block && block.children) {
|
|
364
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
365
361
|
block.children = lodash_1.default.shuffle(block.children);
|
|
366
362
|
}
|
|
367
363
|
}
|
|
@@ -376,7 +372,6 @@ function transformBlock(lang, blocksConfig, block) {
|
|
|
376
372
|
const transformer = transformerRaw.bind(null, lang);
|
|
377
373
|
if (fields) {
|
|
378
374
|
fields.forEach((field) => {
|
|
379
|
-
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
380
375
|
if (block[field]) {
|
|
381
376
|
if (parser) {
|
|
382
377
|
block[field] = parser(transformer, block[field]);
|
|
@@ -385,7 +380,6 @@ function transformBlock(lang, blocksConfig, block) {
|
|
|
385
380
|
block[field] = transformer(block[field]);
|
|
386
381
|
}
|
|
387
382
|
}
|
|
388
|
-
/* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
389
383
|
});
|
|
390
384
|
}
|
|
391
385
|
else if (parser) {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.typografEntity = exports.fullTransform = exports.transformMarkdown = exports.typografToText = exports.typografToHTML = exports.sanitizeHtml = exports.typograf = exports.sanitizeStripOptions = exports.typografConfig = exports.DEFAULT_ALLOWED_TAGS = exports.TransformType = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const transform_1 = tslib_1.__importDefault(require("@doc-tools/transform"));
|
|
5
6
|
const sanitize_html_1 = tslib_1.__importDefault(require("sanitize-html"));
|
|
6
7
|
const typograf_1 = tslib_1.__importDefault(require("typograf"));
|
|
7
|
-
const transform_1 = tslib_1.__importDefault(require("@doc-tools/transform"));
|
|
8
8
|
const configure_1 = require("../utils/configure");
|
|
9
9
|
var TransformType;
|
|
10
10
|
(function (TransformType) {
|
|
@@ -107,7 +107,7 @@ function typografEntity({ entity, fields, lang = configure_1.Lang.Ru, transformT
|
|
|
107
107
|
const transformer = transformTypeMap[transformType];
|
|
108
108
|
fields.forEach((fieldName) => {
|
|
109
109
|
if (entity[fieldName]) {
|
|
110
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
110
|
+
// eslint-disable-next-line no-param-reassign, no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
111
111
|
entity[fieldName] = transformer(entity[fieldName], lang);
|
|
112
112
|
}
|
|
113
113
|
});
|
|
@@ -22,7 +22,7 @@ function doSmoothScroll(element, startPosition, scrollOptions) {
|
|
|
22
22
|
exports.doSmoothScroll = doSmoothScroll;
|
|
23
23
|
function getChangeScrollFunction(direction, isReverse) {
|
|
24
24
|
return (element, scrollPosition, startPosition) => {
|
|
25
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
25
|
+
// eslint-disable-next-line no-param-reassign, no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
26
26
|
element[direction] = isReverse
|
|
27
27
|
? startPosition - scrollPosition
|
|
28
28
|
: startPosition + scrollPosition;
|
|
@@ -1,5 +1,93 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
|
+
.pc-slick-origin.slick-slider {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: block;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
-webkit-touch-callout: none;
|
|
8
|
+
user-select: none;
|
|
9
|
+
touch-action: pan-y;
|
|
10
|
+
-webkit-tap-highlight-color: transparent;
|
|
11
|
+
}
|
|
12
|
+
.pc-slick-origin.slick-slider .slick-track,
|
|
13
|
+
.pc-slick-origin.slick-slider .slick-list {
|
|
14
|
+
transform: translate3d(0, 0, 0);
|
|
15
|
+
}
|
|
16
|
+
.pc-slick-origin .slick-list {
|
|
17
|
+
position: relative;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
display: block;
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
}
|
|
23
|
+
.pc-slick-origin .slick-list:focus {
|
|
24
|
+
outline: none;
|
|
25
|
+
}
|
|
26
|
+
.pc-slick-origin .slick-list.dragging {
|
|
27
|
+
cursor: hand;
|
|
28
|
+
}
|
|
29
|
+
.pc-slick-origin .slick-track {
|
|
30
|
+
position: relative;
|
|
31
|
+
left: 0;
|
|
32
|
+
top: 0;
|
|
33
|
+
display: block;
|
|
34
|
+
margin-left: auto;
|
|
35
|
+
margin-right: auto;
|
|
36
|
+
}
|
|
37
|
+
.pc-slick-origin .slick-track::before, .pc-slick-origin .slick-track::after {
|
|
38
|
+
content: "";
|
|
39
|
+
display: table;
|
|
40
|
+
}
|
|
41
|
+
.pc-slick-origin .slick-track:after {
|
|
42
|
+
clear: both;
|
|
43
|
+
}
|
|
44
|
+
.slick-loading .pc-slick-origin .slick-track {
|
|
45
|
+
visibility: hidden;
|
|
46
|
+
}
|
|
47
|
+
.pc-slick-origin .slick-slide {
|
|
48
|
+
float: left;
|
|
49
|
+
height: 100%;
|
|
50
|
+
min-height: 1px;
|
|
51
|
+
display: none;
|
|
52
|
+
}
|
|
53
|
+
[dir=rtl] .pc-slick-origin .slick-slide {
|
|
54
|
+
float: right;
|
|
55
|
+
}
|
|
56
|
+
.pc-slick-origin .slick-slide img {
|
|
57
|
+
display: block;
|
|
58
|
+
}
|
|
59
|
+
.pc-slick-origin .slick-slide.slick-loading img {
|
|
60
|
+
display: none;
|
|
61
|
+
}
|
|
62
|
+
.pc-slick-origin .slick-slide.dragging img {
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
}
|
|
65
|
+
.slick-initialized .pc-slick-origin .slick-slide {
|
|
66
|
+
display: block;
|
|
67
|
+
}
|
|
68
|
+
.slick-loading .pc-slick-origin .slick-slide {
|
|
69
|
+
visibility: hidden;
|
|
70
|
+
}
|
|
71
|
+
.slick-vertical .pc-slick-origin .slick-slide {
|
|
72
|
+
display: block;
|
|
73
|
+
height: auto;
|
|
74
|
+
border: 1px solid transparent;
|
|
75
|
+
}
|
|
76
|
+
.pc-slick-origin.slick-initialized .slick-slide {
|
|
77
|
+
display: block;
|
|
78
|
+
}
|
|
79
|
+
.pc-slick-origin.slick-loading .slick-slide {
|
|
80
|
+
visibility: hidden;
|
|
81
|
+
}
|
|
82
|
+
.pc-slick-origin.slick-vertical .slick-slide {
|
|
83
|
+
display: block;
|
|
84
|
+
height: auto;
|
|
85
|
+
border: 1px solid transparent;
|
|
86
|
+
}
|
|
87
|
+
.pc-slick-origin .slick-arrow.slick-hidden {
|
|
88
|
+
display: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
3
91
|
.pc-SliderBlock .slick-list {
|
|
4
92
|
padding: 24px 0 20px;
|
|
5
93
|
margin: 0 -8px;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Settings } from 'react-slick';
|
|
2
2
|
import { ClassNameProps, Refable, SliderProps as SliderParams, WithChildren } from '../../models';
|
|
3
|
-
import './slick.css';
|
|
4
3
|
import './Slider.css';
|
|
5
4
|
export interface SliderProps extends Omit<SliderParams, 'children'>, Refable<HTMLDivElement>, ClassNameProps, Pick<Settings, 'lazyLoad'> {
|
|
6
5
|
type?: string;
|
|
@@ -14,9 +14,6 @@ import { SliderType, } from '../../models';
|
|
|
14
14
|
import { block } from '../../utils';
|
|
15
15
|
import Arrow from './Arrow/Arrow';
|
|
16
16
|
import { getSliderResponsiveParams, getSlidesCountByBreakpoint, getSlidesToShowCount, getSlidesToShowWithDefaults, } from './utils';
|
|
17
|
-
import './slick.css';
|
|
18
|
-
// Cause Slider.css should override slick.css
|
|
19
|
-
// eslint-disable-next-line import/order
|
|
20
17
|
import './Slider.css';
|
|
21
18
|
const b = block('SliderBlock');
|
|
22
19
|
const slick = block('slick-origin');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import _ from 'lodash';
|
|
3
2
|
import { Spin } from '@gravity-ui/uikit';
|
|
3
|
+
import _ from 'lodash';
|
|
4
4
|
import { LocaleContext } from '../../../context/localeContext/localeContext';
|
|
5
5
|
import { MapsContext } from '../../../context/mapsContext/mapsContext';
|
|
6
6
|
import { MobileContext } from '../../../context/mobileContext';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState, } from 'react';
|
|
2
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
2
3
|
import _ from 'lodash';
|
|
3
4
|
import ReactPlayer from 'react-player';
|
|
4
|
-
import { Icon } from '@gravity-ui/uikit';
|
|
5
5
|
import { MetrikaContext } from '../../context/metrikaContext';
|
|
6
6
|
import { MobileContext } from '../../context/mobileContext';
|
|
7
7
|
import { VideoContext } from '../../context/videoContext';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
2
3
|
import _ from 'lodash';
|
|
3
4
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
-
import { Icon } from '@gravity-ui/uikit';
|
|
5
5
|
import { PlayVideo } from '../../icons';
|
|
6
6
|
import { block, getPageSearchParams } from '../../utils';
|
|
7
7
|
import Image from '../Image/Image';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
/* we won't use 'pc' class prefix here to let you opportunity to define yfm styles
|
|
3
2
|
in your project via global 'yfm' class */
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import block from 'bem-cn-lite';
|
|
5
5
|
import toSnakeCase from 'snakecase-keys';
|
|
6
6
|
import { HTML } from '../../components';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import blockCn from 'bem-cn-lite';
|
|
3
2
|
import { Spin } from '@gravity-ui/uikit';
|
|
3
|
+
import blockCn from 'bem-cn-lite';
|
|
4
4
|
import ErrorWrapper from '../../components/ErrorWrapper/ErrorWrapper';
|
|
5
5
|
import i18n from './i18n';
|
|
6
6
|
import './Loadable.css';
|
|
@@ -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
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
+
/* eslint-disable no-param-reassign */
|
|
3
|
+
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
2
4
|
import _ from 'lodash';
|
|
3
5
|
import { BlockType, SubBlockType, } from '../models';
|
|
4
6
|
import { fullTransform, typografToHTML } from './utils';
|
|
@@ -43,7 +45,6 @@ const parseItemsTitle = (transformer, items) => items.map((_a) => {
|
|
|
43
45
|
});
|
|
44
46
|
function parsePriceDetailedBlock(transformer, block) {
|
|
45
47
|
const { priceType } = block;
|
|
46
|
-
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
47
48
|
block.items = block.items.map((item) => {
|
|
48
49
|
const { description, items: details = [] } = item;
|
|
49
50
|
if (priceType === 'marked-list') {
|
|
@@ -61,27 +62,23 @@ function parsePriceDetailedBlock(transformer, block) {
|
|
|
61
62
|
item.description = transformer(description);
|
|
62
63
|
return item;
|
|
63
64
|
});
|
|
64
|
-
/* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
65
65
|
return block;
|
|
66
66
|
}
|
|
67
67
|
const parseContentLayout = (transformer, content) => {
|
|
68
68
|
if (content) {
|
|
69
69
|
const { text, additionalInfo } = content;
|
|
70
|
-
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
71
70
|
if (text) {
|
|
72
71
|
content.text = transformer(text);
|
|
73
72
|
}
|
|
74
73
|
if (additionalInfo) {
|
|
75
74
|
content.additionalInfo = transformer(additionalInfo);
|
|
76
75
|
}
|
|
77
|
-
/* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
78
76
|
}
|
|
79
77
|
return content;
|
|
80
78
|
};
|
|
81
79
|
function parseContentLayoutTitle(transformer, content) {
|
|
82
80
|
if (content === null || content === void 0 ? void 0 : content.title) {
|
|
83
81
|
const { title } = content;
|
|
84
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
85
82
|
content.title = title && parseTitle(transformer, title);
|
|
86
83
|
}
|
|
87
84
|
return content;
|
|
@@ -355,7 +352,6 @@ const config = {
|
|
|
355
352
|
function addRandomOrder(block) {
|
|
356
353
|
if (block) {
|
|
357
354
|
if ('randomOrder' in block && block.randomOrder && 'children' in block && block.children) {
|
|
358
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
359
355
|
block.children = _.shuffle(block.children);
|
|
360
356
|
}
|
|
361
357
|
}
|
|
@@ -370,7 +366,6 @@ function transformBlock(lang, blocksConfig, block) {
|
|
|
370
366
|
const transformer = transformerRaw.bind(null, lang);
|
|
371
367
|
if (fields) {
|
|
372
368
|
fields.forEach((field) => {
|
|
373
|
-
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
374
369
|
if (block[field]) {
|
|
375
370
|
if (parser) {
|
|
376
371
|
block[field] = parser(transformer, block[field]);
|
|
@@ -379,7 +374,6 @@ function transformBlock(lang, blocksConfig, block) {
|
|
|
379
374
|
block[field] = transformer(block[field]);
|
|
380
375
|
}
|
|
381
376
|
}
|
|
382
|
-
/* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
383
377
|
});
|
|
384
378
|
}
|
|
385
379
|
else if (parser) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
|
+
import transformYFM from '@doc-tools/transform';
|
|
2
3
|
import sanitize from 'sanitize-html';
|
|
3
4
|
import Typograf from 'typograf';
|
|
4
|
-
import transformYFM from '@doc-tools/transform';
|
|
5
5
|
import { Lang } from '../utils/configure';
|
|
6
6
|
export var TransformType;
|
|
7
7
|
(function (TransformType) {
|
|
@@ -98,7 +98,7 @@ export function typografEntity({ entity, fields, lang = Lang.Ru, transformType =
|
|
|
98
98
|
const transformer = transformTypeMap[transformType];
|
|
99
99
|
fields.forEach((fieldName) => {
|
|
100
100
|
if (entity[fieldName]) {
|
|
101
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
101
|
+
// eslint-disable-next-line no-param-reassign, no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
102
102
|
entity[fieldName] = transformer(entity[fieldName], lang);
|
|
103
103
|
}
|
|
104
104
|
});
|
|
@@ -18,7 +18,7 @@ export function doSmoothScroll(element, startPosition, scrollOptions) {
|
|
|
18
18
|
}
|
|
19
19
|
function getChangeScrollFunction(direction, isReverse) {
|
|
20
20
|
return (element, scrollPosition, startPosition) => {
|
|
21
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
21
|
+
// eslint-disable-next-line no-param-reassign, no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
22
22
|
element[direction] = isReverse
|
|
23
23
|
? startPosition - scrollPosition
|
|
24
24
|
: startPosition + scrollPosition;
|
package/package.json
CHANGED
|
@@ -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;
|
|
@@ -15,6 +15,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.transformFootnotes = exports.transformBlocks = exports.typografTransformer = exports.yfmTransformer = exports.createItemsParser = void 0;
|
|
18
|
+
/* eslint-disable no-param-reassign */
|
|
19
|
+
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
18
20
|
const lodash_1 = __importDefault(require("lodash"));
|
|
19
21
|
const models_1 = require("../models");
|
|
20
22
|
const utils_1 = require("./utils");
|
|
@@ -60,7 +62,6 @@ const parseItemsTitle = (transformer, items) => items.map((_a) => {
|
|
|
60
62
|
});
|
|
61
63
|
function parsePriceDetailedBlock(transformer, block) {
|
|
62
64
|
const { priceType } = block;
|
|
63
|
-
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
64
65
|
block.items = block.items.map((item) => {
|
|
65
66
|
const { description, items: details = [] } = item;
|
|
66
67
|
if (priceType === 'marked-list') {
|
|
@@ -78,27 +79,23 @@ function parsePriceDetailedBlock(transformer, block) {
|
|
|
78
79
|
item.description = transformer(description);
|
|
79
80
|
return item;
|
|
80
81
|
});
|
|
81
|
-
/* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
82
82
|
return block;
|
|
83
83
|
}
|
|
84
84
|
const parseContentLayout = (transformer, content) => {
|
|
85
85
|
if (content) {
|
|
86
86
|
const { text, additionalInfo } = content;
|
|
87
|
-
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
88
87
|
if (text) {
|
|
89
88
|
content.text = transformer(text);
|
|
90
89
|
}
|
|
91
90
|
if (additionalInfo) {
|
|
92
91
|
content.additionalInfo = transformer(additionalInfo);
|
|
93
92
|
}
|
|
94
|
-
/* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
95
93
|
}
|
|
96
94
|
return content;
|
|
97
95
|
};
|
|
98
96
|
function parseContentLayoutTitle(transformer, content) {
|
|
99
97
|
if (content === null || content === void 0 ? void 0 : content.title) {
|
|
100
98
|
const { title } = content;
|
|
101
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
102
99
|
content.title = title && parseTitle(transformer, title);
|
|
103
100
|
}
|
|
104
101
|
return content;
|
|
@@ -374,7 +371,6 @@ const config = {
|
|
|
374
371
|
function addRandomOrder(block) {
|
|
375
372
|
if (block) {
|
|
376
373
|
if ('randomOrder' in block && block.randomOrder && 'children' in block && block.children) {
|
|
377
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
378
374
|
block.children = lodash_1.default.shuffle(block.children);
|
|
379
375
|
}
|
|
380
376
|
}
|
|
@@ -389,7 +385,6 @@ function transformBlock(lang, blocksConfig, block) {
|
|
|
389
385
|
const transformer = transformerRaw.bind(null, lang);
|
|
390
386
|
if (fields) {
|
|
391
387
|
fields.forEach((field) => {
|
|
392
|
-
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
393
388
|
if (block[field]) {
|
|
394
389
|
if (parser) {
|
|
395
390
|
block[field] = parser(transformer, block[field]);
|
|
@@ -398,7 +393,6 @@ function transformBlock(lang, blocksConfig, block) {
|
|
|
398
393
|
block[field] = transformer(block[field]);
|
|
399
394
|
}
|
|
400
395
|
}
|
|
401
|
-
/* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
402
396
|
});
|
|
403
397
|
}
|
|
404
398
|
else if (parser) {
|
|
@@ -15,9 +15,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.typografEntity = exports.fullTransform = exports.transformMarkdown = exports.typografToText = exports.typografToHTML = exports.sanitizeHtml = exports.typograf = exports.sanitizeStripOptions = exports.typografConfig = exports.DEFAULT_ALLOWED_TAGS = exports.TransformType = void 0;
|
|
18
|
+
const transform_1 = __importDefault(require("@doc-tools/transform"));
|
|
18
19
|
const sanitize_html_1 = __importDefault(require("sanitize-html"));
|
|
19
20
|
const typograf_1 = __importDefault(require("typograf"));
|
|
20
|
-
const transform_1 = __importDefault(require("@doc-tools/transform"));
|
|
21
21
|
const configure_1 = require("../utils/configure");
|
|
22
22
|
var TransformType;
|
|
23
23
|
(function (TransformType) {
|
|
@@ -120,7 +120,7 @@ function typografEntity({ entity, fields, lang = configure_1.Lang.Ru, transformT
|
|
|
120
120
|
const transformer = transformTypeMap[transformType];
|
|
121
121
|
fields.forEach((fieldName) => {
|
|
122
122
|
if (entity[fieldName]) {
|
|
123
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
123
|
+
// eslint-disable-next-line no-param-reassign, no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
124
124
|
entity[fieldName] = transformer(entity[fieldName], lang);
|
|
125
125
|
}
|
|
126
126
|
});
|
package/server/utils/scroll.js
CHANGED
|
@@ -22,7 +22,7 @@ function doSmoothScroll(element, startPosition, scrollOptions) {
|
|
|
22
22
|
exports.doSmoothScroll = doSmoothScroll;
|
|
23
23
|
function getChangeScrollFunction(direction, isReverse) {
|
|
24
24
|
return (element, scrollPosition, startPosition) => {
|
|
25
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
25
|
+
// eslint-disable-next-line no-param-reassign, no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
26
26
|
element[direction] = isReverse
|
|
27
27
|
? startPosition - scrollPosition
|
|
28
28
|
: startPosition + scrollPosition;
|