@gravity-ui/page-constructor 1.6.0 → 1.7.0-alpha.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.
Files changed (83) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.css +6 -1
  3. package/build/cjs/blocks/ExtendedFeatures/ExtendedFeatures.js +26 -12
  4. package/build/cjs/components/RouterLink/RouterLink.d.ts +1 -0
  5. package/build/cjs/components/navigation/components/Header/Header.css +85 -0
  6. package/build/cjs/components/navigation/components/Header/Header.d.ts +28 -0
  7. package/build/cjs/components/navigation/components/Header/Header.js +81 -0
  8. package/build/cjs/components/navigation/components/Logo/Logo.css +18 -0
  9. package/build/cjs/components/navigation/components/Logo/Logo.d.ts +7 -0
  10. package/build/cjs/components/navigation/components/Logo/Logo.js +13 -0
  11. package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.css +58 -0
  12. package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.d.ts +13 -0
  13. package/build/cjs/components/navigation/components/MobileNavigation/MobileNavigation.js +45 -0
  14. package/build/cjs/components/navigation/components/Navigation/Navigation.css +43 -0
  15. package/build/cjs/components/navigation/components/Navigation/Navigation.d.ts +11 -0
  16. package/build/cjs/components/navigation/components/Navigation/Navigation.js +70 -0
  17. package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.css +40 -0
  18. package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.d.ts +12 -0
  19. package/build/cjs/components/navigation/components/NavigationItem/NavigationItem.js +47 -0
  20. package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.css +33 -0
  21. package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.d.ts +24 -0
  22. package/build/cjs/components/navigation/components/NavigationPopup/NavigationPopup.js +57 -0
  23. package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.css +20 -0
  24. package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.d.ts +7 -0
  25. package/build/cjs/components/navigation/components/SocialIcon/SocialIcon.js +10 -0
  26. package/build/cjs/containers/PageConstructor/PageConstructor.d.ts +2 -0
  27. package/build/cjs/containers/PageConstructor/PageConstructor.js +4 -2
  28. package/build/cjs/context/locationContext/locationContext.d.ts +1 -0
  29. package/build/cjs/icons/NavigationArrow.d.ts +2 -0
  30. package/build/cjs/icons/NavigationArrow.js +9 -0
  31. package/build/cjs/icons/NavigationClose.d.ts +2 -0
  32. package/build/cjs/icons/NavigationClose.js +9 -0
  33. package/build/cjs/icons/NavigationOpen.d.ts +2 -0
  34. package/build/cjs/icons/NavigationOpen.js +11 -0
  35. package/build/cjs/icons/index.d.ts +3 -0
  36. package/build/cjs/icons/index.js +3 -0
  37. package/build/cjs/models/constructor-items/blocks.d.ts +3 -1
  38. package/build/cjs/models/navigation.d.ts +59 -0
  39. package/build/cjs/models/navigation.js +10 -0
  40. package/build/cjs/text-transform/blocks.js +6 -1
  41. package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.css +6 -1
  42. package/build/esm/blocks/ExtendedFeatures/ExtendedFeatures.js +28 -14
  43. package/build/esm/components/RouterLink/RouterLink.d.ts +1 -0
  44. package/build/esm/components/navigation/components/Header/Header.css +85 -0
  45. package/build/esm/components/navigation/components/Header/Header.d.ts +29 -0
  46. package/build/esm/components/navigation/components/Header/Header.js +79 -0
  47. package/build/esm/components/navigation/components/Logo/Logo.css +18 -0
  48. package/build/esm/components/navigation/components/Logo/Logo.d.ts +8 -0
  49. package/build/esm/components/navigation/components/Logo/Logo.js +11 -0
  50. package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.css +58 -0
  51. package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.d.ts +14 -0
  52. package/build/esm/components/navigation/components/MobileNavigation/MobileNavigation.js +43 -0
  53. package/build/esm/components/navigation/components/Navigation/Navigation.css +43 -0
  54. package/build/esm/components/navigation/components/Navigation/Navigation.d.ts +12 -0
  55. package/build/esm/components/navigation/components/Navigation/Navigation.js +69 -0
  56. package/build/esm/components/navigation/components/NavigationItem/NavigationItem.css +40 -0
  57. package/build/esm/components/navigation/components/NavigationItem/NavigationItem.d.ts +13 -0
  58. package/build/esm/components/navigation/components/NavigationItem/NavigationItem.js +46 -0
  59. package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.css +33 -0
  60. package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.d.ts +25 -0
  61. package/build/esm/components/navigation/components/NavigationPopup/NavigationPopup.js +54 -0
  62. package/build/esm/components/navigation/components/SocialIcon/SocialIcon.css +20 -0
  63. package/build/esm/components/navigation/components/SocialIcon/SocialIcon.d.ts +8 -0
  64. package/build/esm/components/navigation/components/SocialIcon/SocialIcon.js +8 -0
  65. package/build/esm/containers/PageConstructor/PageConstructor.d.ts +2 -0
  66. package/build/esm/containers/PageConstructor/PageConstructor.js +4 -2
  67. package/build/esm/context/locationContext/locationContext.d.ts +1 -0
  68. package/build/esm/icons/NavigationArrow.d.ts +2 -0
  69. package/build/esm/icons/NavigationArrow.js +4 -0
  70. package/build/esm/icons/NavigationClose.d.ts +2 -0
  71. package/build/esm/icons/NavigationClose.js +4 -0
  72. package/build/esm/icons/NavigationOpen.d.ts +2 -0
  73. package/build/esm/icons/NavigationOpen.js +6 -0
  74. package/build/esm/icons/index.d.ts +3 -0
  75. package/build/esm/icons/index.js +3 -0
  76. package/build/esm/models/constructor-items/blocks.d.ts +3 -1
  77. package/build/esm/models/navigation.d.ts +59 -0
  78. package/build/esm/models/navigation.js +7 -0
  79. package/build/esm/text-transform/blocks.js +6 -1
  80. package/package.json +4 -1
  81. package/server/models/constructor-items/blocks.d.ts +3 -1
  82. package/server/text-transform/blocks.js +6 -1
  83. package/styles/mixins.scss +38 -0
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = (0, tslib_1.__importStar)(require("react"));
5
+ const bem_cn_lite_1 = (0, tslib_1.__importDefault)(require("bem-cn-lite"));
6
+ const index_1 = require("../../../index");
7
+ const utils_1 = require("../../../../utils");
8
+ const locationContext_1 = require("../../../../context/locationContext");
9
+ const navigation_1 = require("../../../../models/navigation");
10
+ const icons_1 = require("../../../../icons");
11
+ const SocialIcon_1 = (0, tslib_1.__importDefault)(require("../SocialIcon/SocialIcon"));
12
+ const b = (0, bem_cn_lite_1.default)('navigation-item');
13
+ const Content = ({ text, icon }) => (react_1.default.createElement(react_1.Fragment, null,
14
+ icon && react_1.default.createElement("img", { className: b('icon'), src: icon }),
15
+ react_1.default.createElement("span", { className: b('text') }, text)));
16
+ const NavigationDropdown = (_a) => {
17
+ var { text, icon, isOpened } = _a, props = (0, tslib_1.__rest)(_a, ["text", "icon", "isOpened"]);
18
+ return (react_1.default.createElement("span", Object.assign({}, props),
19
+ react_1.default.createElement(Content, { text: text, icon: icon }),
20
+ react_1.default.createElement(index_1.ToggleArrow, { className: b('dropdown'), size: 12, type: 'vertical', iconType: "navigation", open: isOpened })));
21
+ };
22
+ const NavigationLink = (props) => {
23
+ const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
24
+ const { url, text, icon, arrow, target } = props, rest = (0, tslib_1.__rest)(props, ["url", "text", "icon", "arrow", "target"]);
25
+ const linkExtraProps = (0, utils_1.getLinkProps)(url, hostname, target);
26
+ const content = (react_1.default.createElement(react_1.Fragment, null,
27
+ react_1.default.createElement(Content, { text: text, icon: icon }),
28
+ arrow && react_1.default.createElement(icons_1.NavigationArrow, { className: b('arrow') })));
29
+ return (linkExtraProps === null || linkExtraProps === void 0 ? void 0 : linkExtraProps.target) ? (react_1.default.createElement("a", Object.assign({ href: url, title: text }, rest, linkExtraProps), content)) : (react_1.default.createElement(index_1.RouterLink, { href: url, passHref: true },
30
+ react_1.default.createElement("a", Object.assign({}, rest), content)));
31
+ };
32
+ //todo: add types support form component in map
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ const NavigationItemsMap = {
35
+ [navigation_1.NavigationItemType.Button]: index_1.RouterLink,
36
+ [navigation_1.NavigationItemType.Social]: SocialIcon_1.default,
37
+ [navigation_1.NavigationItemType.Dropdown]: NavigationDropdown,
38
+ [navigation_1.NavigationItemType.Link]: NavigationLink,
39
+ };
40
+ const NavigationItem = (_a) => {
41
+ var { data, className } = _a, props = (0, tslib_1.__rest)(_a, ["data", "className"]);
42
+ const { type = navigation_1.NavigationItemType.Link } = data;
43
+ const Component = NavigationItemsMap[type];
44
+ const componentProps = (0, react_1.useMemo)(() => (Object.assign(Object.assign({ className: b({ type }, className) }, data), props)), [className, data, props, type]);
45
+ return react_1.default.createElement(Component, Object.assign({}, componentProps));
46
+ };
47
+ exports.default = NavigationItem;
@@ -0,0 +1,33 @@
1
+ /* use this for style redefinitions to awoid problems with
2
+ unpredictable css rules order in build */
3
+ .navigation-popup {
4
+ position: fixed;
5
+ top: calc(var(--header-height) - 16px);
6
+ padding-right: 4px;
7
+ padding-left: 4px;
8
+ transform: translateX(calc(calc(8px * 2) * -1));
9
+ z-index: 101;
10
+ display: flex;
11
+ flex-direction: column;
12
+ min-width: 220px;
13
+ padding: 16px;
14
+ border: 1px solid var(--yc-color-line-generic);
15
+ border-top-width: 0;
16
+ border-radius: calc(var(--pc-border-radius) / 2);
17
+ background: var(--yc-color-base-float);
18
+ box-shadow: 0 3px 10px var(--yc-color-sfx-shadow);
19
+ }
20
+ @media (max-width: 768px) {
21
+ .navigation-popup {
22
+ display: none;
23
+ }
24
+ }
25
+ .navigation-popup__link {
26
+ height: 36px;
27
+ padding: 8px 12px;
28
+ border-radius: 8px;
29
+ }
30
+ .navigation-popup__link:hover {
31
+ color: var(--yc-color-text-primary);
32
+ background-color: var(--yc-color-base-simple-hover);
33
+ }
@@ -0,0 +1,24 @@
1
+ import React, { RefObject } from 'react';
2
+ import { NavigationLinkItem } from '../../../../models/navigation';
3
+ export interface NavigationPopupProps {
4
+ items: NavigationLinkItem[];
5
+ onClose: () => void;
6
+ left?: number;
7
+ className?: string;
8
+ }
9
+ interface NavigationPopupState {
10
+ calculatedLeft?: number;
11
+ }
12
+ export default class NavigationPopup extends React.Component<NavigationPopupProps, NavigationPopupState> {
13
+ ref: RefObject<HTMLDivElement>;
14
+ state: {
15
+ calculatedLeft: number | undefined;
16
+ };
17
+ private calculateLeft;
18
+ componentDidMount(): void;
19
+ componentDidUpdate(prevProps: NavigationPopupProps): void;
20
+ componentWillUnmount(): void;
21
+ render(): JSX.Element | null;
22
+ private renderDefaultPopup;
23
+ }
24
+ export {};
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
5
+ const bem_cn_lite_1 = (0, tslib_1.__importDefault)(require("bem-cn-lite"));
6
+ const react_1 = (0, tslib_1.__importStar)(require("react"));
7
+ const uikit_1 = require("@gravity-ui/uikit");
8
+ const index_1 = require("../../../index");
9
+ const NavigationItem_1 = (0, tslib_1.__importDefault)(require("../NavigationItem/NavigationItem"));
10
+ const b = (0, bem_cn_lite_1.default)('navigation-popup');
11
+ class NavigationPopup extends react_1.default.Component {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.ref = (0, react_1.createRef)();
15
+ this.state = {
16
+ calculatedLeft: this.props.left,
17
+ };
18
+ this.calculateLeft = lodash_1.default.debounce(() => {
19
+ const { left } = this.props;
20
+ if (this.ref && this.ref.current && left) {
21
+ const right = left + this.ref.current.offsetWidth;
22
+ const docWidth = document.body.clientWidth;
23
+ const calculatedLeft = right > docWidth ? left - (right - docWidth) : left;
24
+ this.setState({ calculatedLeft });
25
+ }
26
+ else {
27
+ this.setState({ calculatedLeft: left });
28
+ }
29
+ }, 100);
30
+ }
31
+ componentDidMount() {
32
+ this.calculateLeft();
33
+ window.addEventListener('resize', this.calculateLeft);
34
+ }
35
+ componentDidUpdate(prevProps) {
36
+ if (prevProps.left !== this.props.left) {
37
+ this.calculateLeft();
38
+ }
39
+ }
40
+ componentWillUnmount() {
41
+ window.removeEventListener('resize', this.calculateLeft);
42
+ }
43
+ render() {
44
+ if (!document || !document.body) {
45
+ return null;
46
+ }
47
+ const { onClose } = this.props;
48
+ const { calculatedLeft } = this.state;
49
+ return (react_1.default.createElement(uikit_1.Portal, null,
50
+ react_1.default.createElement("div", { ref: this.ref, className: b(), style: { left: calculatedLeft } },
51
+ react_1.default.createElement(index_1.OutsideClick, { onOutsideClick: onClose }, this.renderDefaultPopup()))));
52
+ }
53
+ renderDefaultPopup() {
54
+ return (react_1.default.createElement(react_1.Fragment, null, this.props.items.map((item) => (react_1.default.createElement(NavigationItem_1.default, { key: item.text, className: b('link'), data: item })))));
55
+ }
56
+ }
57
+ exports.default = NavigationPopup;
@@ -0,0 +1,20 @@
1
+ /* use this for style redefinitions to awoid problems with
2
+ unpredictable css rules order in build */
3
+ .social-icon {
4
+ display: flex;
5
+ justify-content: center;
6
+ align-items: center;
7
+ width: 40px;
8
+ height: 40px;
9
+ margin-right: 8px;
10
+ color: var(--yc-color-base-background);
11
+ border-radius: 50%;
12
+ background-color: var(--yc-color-base-generic);
13
+ }
14
+ .social-icon:hover {
15
+ background-color: var(--yc-color-base-generic-hover);
16
+ }
17
+ .social-icon__icon {
18
+ width: 16px;
19
+ height: 16px;
20
+ }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { NavigationSocialItem } from '../../../../models/navigation';
3
+ export interface NavigationSocialItemProps extends NavigationSocialItem {
4
+ className?: string;
5
+ }
6
+ declare const SocialIcon: React.FC<NavigationSocialItemProps>;
7
+ export default SocialIcon;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = (0, tslib_1.__importDefault)(require("react"));
5
+ const bem_cn_lite_1 = (0, tslib_1.__importDefault)(require("bem-cn-lite"));
6
+ const index_1 = require("../../../index");
7
+ const b = (0, bem_cn_lite_1.default)('social-icon');
8
+ const SocialIcon = ({ icon, url, className }) => (react_1.default.createElement("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: b(null, className) },
9
+ react_1.default.createElement(index_1.Image, { className: b('icon'), src: icon })));
10
+ exports.default = SocialIcon;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ShouldRenderBlock, CustomConfig, PageContent, CustomItems } from '../../models';
3
3
  import { blockMap, subBlockMap } from '../../constructor-items';
4
+ import { NavigationData } from '../../models/navigation';
4
5
  import '@doc-tools/transform/dist/js/yfm';
5
6
  export declare type ItemMap = typeof blockMap & typeof subBlockMap & CustomItems;
6
7
  export interface PageConstructorProps {
@@ -8,6 +9,7 @@ export interface PageConstructorProps {
8
9
  shouldRenderBlock?: ShouldRenderBlock;
9
10
  custom?: CustomConfig;
10
11
  renderMenu?: () => React.ReactNode;
12
+ navigationData?: NavigationData;
11
13
  }
12
14
  export declare const Constructor: (props: PageConstructorProps) => JSX.Element;
13
15
  export declare const PageConstructor: (props: PageConstructorProps) => JSX.Element;
@@ -15,6 +15,7 @@ const ConstructorRow_1 = require("./components/ConstructorRow");
15
15
  const ConstructorFootnotes_1 = require("./components/ConstructorFootnotes");
16
16
  const ConstructorItem_1 = require("./components/ConstructorItem");
17
17
  const ConstructorBlocks_1 = require("./components/ConstructorBlocks");
18
+ const Header_1 = (0, tslib_1.__importDefault)(require("../../components/navigation/components/Header/Header"));
18
19
  require("@doc-tools/transform/dist/js/yfm");
19
20
  const b = (0, utils_1.block)('page-constructor');
20
21
  const Constructor = (props) => {
@@ -30,7 +31,7 @@ const Constructor = (props) => {
30
31
  });
31
32
  }, [props.custom]);
32
33
  const { themeValue: theme } = (0, react_1.useContext)(ThemeValueContext_1.ThemeValueContext);
33
- const { content: { blocks = [], background = {}, footnotes = [] } = {}, renderMenu, shouldRenderBlock, } = props;
34
+ const { content: { blocks = [], background = {}, footnotes = [] } = {}, renderMenu, shouldRenderBlock, navigationData, } = props;
34
35
  const hasFootnotes = footnotes.length > 0;
35
36
  const isHeaderBlock = (block) => headerBlockTypes.includes(block.type);
36
37
  const header = blocks === null || blocks === void 0 ? void 0 : blocks.find(isHeaderBlock);
@@ -39,7 +40,8 @@ const Constructor = (props) => {
39
40
  return (react_1.default.createElement(innerContext_1.InnerContext.Provider, { value: context },
40
41
  react_1.default.createElement("div", { className: b() },
41
42
  react_1.default.createElement("div", { className: b('wrapper') },
42
- react_1.default.createElement(BackgroundMedia_1.default, Object.assign({}, themedBackground, { className: b('background') })),
43
+ themedBackground && (react_1.default.createElement(BackgroundMedia_1.default, Object.assign({}, themedBackground, { className: b('background') }))),
44
+ (navigationData === null || navigationData === void 0 ? void 0 : navigationData.header) && (react_1.default.createElement(Header_1.default, { logo: navigationData === null || navigationData === void 0 ? void 0 : navigationData.logo, data: navigationData === null || navigationData === void 0 ? void 0 : navigationData.header })),
43
45
  renderMenu && renderMenu(),
44
46
  header && react_1.default.createElement(ConstructorItem_1.ConstructorHeader, { data: header }),
45
47
  react_1.default.createElement(grid_1.Grid, null,
@@ -16,5 +16,6 @@ export declare type LocationContextProps = {
16
16
  pathname?: string;
17
17
  hostname?: string;
18
18
  Link?: RouterLink;
19
+ asPath?: string;
19
20
  };
20
21
  export declare const LocationContext: React.Context<LocationContextProps>;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const NavigationArrow: React.FC<React.SVGProps<SVGSVGElement>>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavigationArrow = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = (0, tslib_1.__importDefault)(require("react"));
6
+ const svg_1 = require("../utils/svg");
7
+ const NavigationArrow = (props) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "9", height: "9", fill: "none", viewBox: "0 0 9 9" }, svg_1.a11yHiddenSvgProps, props),
8
+ react_1.default.createElement("path", { d: "M3 1H8M8 1V6M8 1L1 8", stroke: "currentColor", strokeOpacity: "0.7", strokeWidth: "1.2", strokeLinecap: "square" })));
9
+ exports.NavigationArrow = NavigationArrow;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const NavigationClose: React.FC<React.SVGProps<SVGSVGElement>>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavigationClose = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = (0, tslib_1.__importDefault)(require("react"));
6
+ const svg_1 = require("../utils/svg");
7
+ const NavigationClose = (props) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "36", height: "36", fill: "none" }, svg_1.a11yHiddenSvgProps, props),
8
+ react_1.default.createElement("path", { d: "M26 10 10 26m16 0L10 10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })));
9
+ exports.NavigationClose = NavigationClose;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const NavigationOpen: React.FC<React.SVGProps<SVGSVGElement>>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavigationOpen = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = (0, tslib_1.__importDefault)(require("react"));
6
+ const svg_1 = require("../utils/svg");
7
+ const NavigationOpen = (props) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "36", height: "36", fill: "none" }, svg_1.a11yHiddenSvgProps, props),
8
+ react_1.default.createElement("rect", { x: "8", y: "10", width: "20", height: "2", rx: "1", fill: "currentColor" }),
9
+ react_1.default.createElement("rect", { x: "8", y: "17", width: "20", height: "2", rx: "1", fill: "currentColor" }),
10
+ react_1.default.createElement("rect", { x: "8", y: "24", width: "20", height: "2", rx: "1", fill: "currentColor" })));
11
+ exports.NavigationOpen = NavigationOpen;
@@ -6,3 +6,6 @@ export * from './Github';
6
6
  export * from './NavigationChevron';
7
7
  export * from './PlayVideo';
8
8
  export * from './PreviewClose';
9
+ export * from './NavigationClose';
10
+ export * from './NavigationOpen';
11
+ export * from './NavigationArrow';
@@ -9,3 +9,6 @@ const tslib_1 = require("tslib");
9
9
  (0, tslib_1.__exportStar)(require("./NavigationChevron"), exports);
10
10
  (0, tslib_1.__exportStar)(require("./PlayVideo"), exports);
11
11
  (0, tslib_1.__exportStar)(require("./PreviewClose"), exports);
12
+ (0, tslib_1.__exportStar)(require("./NavigationClose"), exports);
13
+ (0, tslib_1.__exportStar)(require("./NavigationOpen"), exports);
14
+ (0, tslib_1.__exportStar)(require("./NavigationArrow"), exports);
@@ -118,8 +118,10 @@ export interface ExtendedFeaturesItem {
118
118
  title?: string;
119
119
  text?: string;
120
120
  label?: string;
121
- icon?: string;
121
+ icon?: ThemedImage;
122
+ /** @deprecated **/
122
123
  link?: LinkProps;
124
+ links?: LinkProps[];
123
125
  }
124
126
  export interface ExtendedFeaturesProps extends Animatable {
125
127
  items: ExtendedFeaturesItem[];
@@ -0,0 +1,59 @@
1
+ import { ButtonProps } from '../components/Button/Button';
2
+ export declare enum NavigationItemType {
3
+ Link = "link",
4
+ Dropdown = "dropdown",
5
+ Button = "button",
6
+ Social = "social"
7
+ }
8
+ export interface NavigationItemBase {
9
+ text: string;
10
+ icon?: string;
11
+ url?: string;
12
+ }
13
+ export interface NavigationLinkItem extends NavigationItemBase {
14
+ type: NavigationItemType.Link;
15
+ url: string;
16
+ arrow?: boolean;
17
+ target?: string;
18
+ }
19
+ export interface NavigationButtonItem extends ButtonProps {
20
+ type: NavigationItemType.Button;
21
+ url: string;
22
+ target?: string;
23
+ }
24
+ export interface NavigationDropdownItem extends NavigationItemBase {
25
+ type: NavigationItemType.Dropdown;
26
+ items: NavigationLinkItem[];
27
+ }
28
+ export interface NavigationSocialItem extends Omit<NavigationItemBase, 'text'> {
29
+ type: NavigationItemType.Social;
30
+ icon: string;
31
+ url: string;
32
+ }
33
+ export declare type NavigationItem = NavigationLinkItem | NavigationButtonItem | NavigationDropdownItem;
34
+ export interface NavigationLogo extends Omit<NavigationItemBase, 'text'> {
35
+ icon: string;
36
+ text?: string;
37
+ }
38
+ export interface HeaderData {
39
+ leftItems: NavigationItem[];
40
+ rightItems?: NavigationItem[];
41
+ }
42
+ export interface FooterColumn {
43
+ title: string;
44
+ links: NavigationItem[];
45
+ }
46
+ export interface FooterUnderline {
47
+ links?: NavigationItem[];
48
+ copyright?: string;
49
+ }
50
+ export interface FooterData {
51
+ columns: FooterColumn[];
52
+ social?: NavigationSocialItem[];
53
+ underline?: FooterUnderline;
54
+ }
55
+ export interface NavigationData {
56
+ logo: NavigationLogo;
57
+ header: HeaderData;
58
+ footer?: FooterData;
59
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavigationItemType = void 0;
4
+ var NavigationItemType;
5
+ (function (NavigationItemType) {
6
+ NavigationItemType["Link"] = "link";
7
+ NavigationItemType["Dropdown"] = "dropdown";
8
+ NavigationItemType["Button"] = "button";
9
+ NavigationItemType["Social"] = "social";
10
+ })(NavigationItemType = exports.NavigationItemType || (exports.NavigationItemType = {}));
@@ -155,7 +155,12 @@ const config = {
155
155
  {
156
156
  fields: ['items'],
157
157
  transformer: typografTransformer,
158
- parser: parseFeatures,
158
+ parser: (0, exports.createItemsParser)(['title']),
159
+ },
160
+ {
161
+ fields: ['items'],
162
+ transformer: yfmTransformer,
163
+ parser: (0, exports.createItemsParser)(['text', 'additionalInfo']),
159
164
  },
160
165
  ],
161
166
  [models_1.BlockType.PromoFeaturesBlock]: {
@@ -12,6 +12,8 @@ unpredictable css rules order in build */
12
12
  }
13
13
  .pc-ExtendedFeaturesBlock__item {
14
14
  margin-top: 32px;
15
+ }
16
+ .pc-ExtendedFeaturesBlock__item.col {
15
17
  padding-right: 32px;
16
18
  }
17
19
  .pc-ExtendedFeaturesBlock__item-title {
@@ -74,12 +76,15 @@ unpredictable css rules order in build */
74
76
  height: 32px;
75
77
  background-size: cover;
76
78
  display: block;
77
- margin-bottom: 8px;
79
+ margin-bottom: 12px;
78
80
  }
79
81
  @media (max-width: 577px) {
80
82
  .pc-ExtendedFeaturesBlock__item {
81
83
  margin-top: 32px;
82
84
  }
85
+ .pc-ExtendedFeaturesBlock__item.col {
86
+ padding-right: 8px;
87
+ }
83
88
  }
84
89
  @media (min-width: 769px) {
85
90
  .pc-ExtendedFeaturesBlock.pc-AnimateBlock .pc-ExtendedFeaturesBlock__item, .pc-AnimateBlock .pc-ExtendedFeaturesBlock .pc-ExtendedFeaturesBlock__item {
@@ -1,7 +1,11 @@
1
- import React from 'react';
2
- import { block } from '../../utils';
1
+ import React, { useContext } from 'react';
2
+ import { block, getThemedValue } from '../../utils';
3
3
  import { Row, Col } from '../../grid';
4
- import { Link, HTML, AnimateBlock, BlockHeader } from '../../components/';
4
+ import { AnimateBlock, BlockHeader, HTML } from '../../components/';
5
+ import { Content } from '../../sub-blocks';
6
+ import Image from '../../components/Image/Image';
7
+ import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
8
+ import { getMediaImage } from '../../components/Media/Image/utils';
5
9
  import './ExtendedFeatures.css';
6
10
  const b = block('ExtendedFeaturesBlock');
7
11
  const DEFAULT_SIZES = {
@@ -9,15 +13,25 @@ const DEFAULT_SIZES = {
9
13
  sm: 6,
10
14
  md: 4,
11
15
  };
12
- export const ExtendedFeaturesBlock = ({ title, description, items, colSizes = DEFAULT_SIZES, animated, }) => (React.createElement(AnimateBlock, { className: b(), animate: animated },
13
- React.createElement(BlockHeader, { title: title, description: description, className: b('header') }),
14
- React.createElement("div", { className: b('items') },
15
- React.createElement(Row, null, items.map(({ title: itemTitle, text, link, label, icon }) => (React.createElement(Col, { className: b('item'), key: text || itemTitle, sizes: colSizes },
16
- icon && React.createElement("img", { src: icon, className: b('icon') }),
17
- itemTitle && (React.createElement("h5", { className: b('item-title', { 'has-label': Boolean(label) }) },
18
- React.createElement(HTML, null, itemTitle),
19
- label && React.createElement("div", { className: b('item-label') }, label))),
20
- text && (React.createElement("div", { className: b('item-text') },
21
- React.createElement(HTML, null, text))),
22
- link && React.createElement(Link, Object.assign({ className: b('item-link') }, link)))))))));
16
+ export const ExtendedFeaturesBlock = ({ title, description, items, colSizes = DEFAULT_SIZES, animated, }) => {
17
+ const { themeValue: theme } = useContext(ThemeValueContext);
18
+ return (React.createElement(AnimateBlock, { className: b(), animate: animated },
19
+ React.createElement(BlockHeader, { title: title, description: description, className: b('header') }),
20
+ React.createElement("div", { className: b('items') },
21
+ React.createElement(Row, null, items.map(({ title: itemTitle, text, link, links, label, icon }) => {
22
+ const itemLinks = links || [];
23
+ const iconThemed = icon && getThemedValue(icon, theme);
24
+ const iconData = iconThemed && getMediaImage(iconThemed);
25
+ if (link) {
26
+ itemLinks.push(link);
27
+ }
28
+ return (React.createElement(Col, { className: b('item'), key: text || itemTitle, sizes: colSizes },
29
+ iconData && React.createElement(Image, Object.assign({}, iconData, { className: b('icon') })),
30
+ React.createElement("div", { className: b('container') },
31
+ itemTitle && (React.createElement("h5", { className: b('item-title') },
32
+ React.createElement(HTML, null, itemTitle),
33
+ label && (React.createElement("div", { className: b('item-label') }, label)))),
34
+ React.createElement(Content, { text: text, links: itemLinks, size: "s", colSizes: { all: 12, md: 12 } }))));
35
+ })))));
36
+ };
23
37
  export default ExtendedFeaturesBlock;
@@ -1,6 +1,7 @@
1
1
  import { WithChildren } from '../../models';
2
2
  export interface RouterLinkProps {
3
3
  href: string;
4
+ [key: string]: any;
4
5
  }
5
6
  declare const RouterLink: ({ href, children }: WithChildren<RouterLinkProps>) => JSX.Element;
6
7
  export default RouterLink;
@@ -0,0 +1,85 @@
1
+ /* use this for style redefinitions to awoid problems with
2
+ unpredictable css rules order in build */
3
+ .header {
4
+ position: sticky;
5
+ z-index: 98;
6
+ top: 0;
7
+ display: flex;
8
+ justify-content: center;
9
+ align-items: center;
10
+ height: var(--header-height);
11
+ background-color: var(--yc-color-base-background);
12
+ box-shadow: inset 0px -1px 0px var(--yc-color-line-generic);
13
+ }
14
+ .header__wrapper {
15
+ display: flex;
16
+ justify-content: space-between;
17
+ align-items: center;
18
+ height: var(--header-height);
19
+ }
20
+ @media (min-width: 769px) {
21
+ .header__mobile-menu-button {
22
+ display: none;
23
+ }
24
+ }
25
+ .header__navigation, .header__left, .header__right {
26
+ display: flex;
27
+ align-items: center;
28
+ }
29
+ .header__navigation {
30
+ position: relative;
31
+ flex: 1 0 0;
32
+ justify-content: flex-start;
33
+ margin-right: 20px;
34
+ }
35
+ @media (max-width: 768px) {
36
+ .header__navigation {
37
+ display: none;
38
+ }
39
+ }
40
+ .header__right {
41
+ flex: 0;
42
+ justify-content: flex-end;
43
+ }
44
+ .header__navigation-container {
45
+ display: flex;
46
+ overflow-x: hidden;
47
+ flex: 1 0 0;
48
+ justify-content: space-between;
49
+ align-items: center;
50
+ margin-right: 20px;
51
+ }
52
+ .header__buttons {
53
+ display: flex;
54
+ }
55
+ @media (max-width: 768px) {
56
+ .header__buttons {
57
+ display: none;
58
+ }
59
+ }
60
+ .header__buttons > *:not(:last-child) {
61
+ margin-right: 16px;
62
+ }
63
+ .header__button {
64
+ margin-top: 0;
65
+ }
66
+ .header__logo {
67
+ margin: 0 32px 0 0;
68
+ cursor: pointer;
69
+ }
70
+ @media (max-width: 768px) {
71
+ .header__navigation-container {
72
+ justify-content: flex-end;
73
+ }
74
+ .header__left {
75
+ flex: 1 0 0;
76
+ }
77
+ }
78
+ @media (max-width: 576px) {
79
+ .header__navigation-container {
80
+ margin-right: 12px;
81
+ }
82
+ .header__logo {
83
+ margin-right: 0;
84
+ }
85
+ }
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { HeaderData, NavigationLogo } from '../../../../models/navigation';
3
+ import './Header.css';
4
+ export interface HeaderProps {
5
+ logo: NavigationLogo;
6
+ data: HeaderData;
7
+ }
8
+ interface HeaderState {
9
+ isSidebarOpened: boolean;
10
+ activeItemIndex: number;
11
+ }
12
+ declare class Header extends React.Component<HeaderProps, HeaderState> {
13
+ ref: React.RefObject<unknown>;
14
+ state: {
15
+ isSidebarOpened: boolean;
16
+ activeItemIndex: number;
17
+ };
18
+ render(): JSX.Element;
19
+ private renderLeft;
20
+ private renderLogo;
21
+ private renderRight;
22
+ private renderRightItems;
23
+ private renderMobileMenuButton;
24
+ private renderMobileNavigation;
25
+ private onActiveItemChange;
26
+ private onSidebarOpenedChange;
27
+ private hideSidebar;
28
+ }
29
+ export default Header;