@gravity-ui/page-constructor 1.26.0-alpha.1 → 2.0.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.
- package/CHANGELOG.md +12 -0
- package/build/cjs/blocks/Icons/Icons.js +1 -1
- package/build/cjs/blocks/Map/schema.d.ts +0 -12
- package/build/cjs/blocks/Share/Share.js +1 -2
- package/build/cjs/components/BackLink/BackLink.js +1 -2
- package/build/cjs/components/Button/Button.js +1 -2
- package/build/cjs/components/FileLink/FileLink.js +1 -2
- package/build/cjs/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +1 -2
- package/build/cjs/components/Link/Link.js +1 -2
- package/build/cjs/components/Map/GoogleMap.js +7 -5
- package/build/cjs/components/Map/Map.css +5 -0
- package/build/cjs/components/Map/YMap/YMap.d.ts +4 -2
- package/build/cjs/components/Map/YMap/YMap.js +18 -10
- package/build/cjs/components/Map/YMap/YandexMap.js +18 -9
- package/build/cjs/components/Title/Title.js +1 -2
- package/build/cjs/components/index.d.ts +0 -1
- package/build/cjs/components/index.js +1 -3
- package/build/cjs/constructor-items.d.ts +0 -1
- package/build/cjs/constructor-items.js +0 -1
- package/build/cjs/models/constructor-items/common.d.ts +0 -79
- package/build/cjs/models/constructor-items/common.js +1 -14
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +2 -6
- package/build/cjs/models/constructor-items/sub-blocks.js +0 -1
- package/build/cjs/navigation/components/NavigationItem/components/GithubButton/GithubButton.js +1 -2
- package/build/cjs/navigation/components/SocialIcon/SocialIcon.js +1 -1
- package/build/cjs/schema/index.js +1 -3
- package/build/cjs/schema/validators/common.d.ts +0 -6
- package/build/cjs/schema/validators/common.js +0 -4
- package/build/cjs/schema/validators/sub-blocks.d.ts +0 -1
- package/build/cjs/schema/validators/sub-blocks.js +0 -1
- package/build/cjs/sub-blocks/Quote/Quote.js +1 -1
- package/build/cjs/sub-blocks/index.d.ts +0 -1
- package/build/cjs/sub-blocks/index.js +1 -3
- package/build/cjs/text-transform/blocks.js +0 -27
- package/build/esm/blocks/Icons/Icons.js +2 -2
- package/build/esm/blocks/Map/schema.d.ts +0 -12
- package/build/esm/blocks/Share/Share.js +1 -2
- package/build/esm/components/BackLink/BackLink.js +1 -2
- package/build/esm/components/Button/Button.js +1 -2
- package/build/esm/components/FileLink/FileLink.js +1 -2
- package/build/esm/components/HeaderBreadcrumbs/HeaderBreadcrumbs.js +1 -2
- package/build/esm/components/Link/Link.js +1 -2
- package/build/esm/components/Map/GoogleMap.js +7 -5
- package/build/esm/components/Map/Map.css +5 -0
- package/build/esm/components/Map/YMap/YMap.d.ts +4 -2
- package/build/esm/components/Map/YMap/YMap.js +18 -10
- package/build/esm/components/Map/YMap/YandexMap.js +18 -9
- package/build/esm/components/Title/Title.js +1 -2
- package/build/esm/components/index.d.ts +0 -1
- package/build/esm/components/index.js +0 -1
- package/build/esm/constructor-items.d.ts +0 -1
- package/build/esm/constructor-items.js +1 -2
- package/build/esm/models/constructor-items/common.d.ts +0 -79
- package/build/esm/models/constructor-items/common.js +0 -13
- package/build/esm/models/constructor-items/sub-blocks.d.ts +2 -6
- package/build/esm/models/constructor-items/sub-blocks.js +0 -1
- package/build/esm/navigation/components/NavigationItem/components/GithubButton/GithubButton.js +1 -2
- package/build/esm/navigation/components/SocialIcon/SocialIcon.js +2 -2
- package/build/esm/schema/index.js +2 -4
- package/build/esm/schema/validators/common.d.ts +0 -6
- package/build/esm/schema/validators/common.js +0 -4
- package/build/esm/schema/validators/sub-blocks.d.ts +0 -1
- package/build/esm/schema/validators/sub-blocks.js +0 -1
- package/build/esm/sub-blocks/Quote/Quote.js +2 -2
- package/build/esm/sub-blocks/index.d.ts +0 -1
- package/build/esm/sub-blocks/index.js +0 -1
- package/build/esm/text-transform/blocks.js +0 -27
- package/package.json +10 -6
- package/server/models/constructor-items/common.d.ts +0 -79
- package/server/models/constructor-items/common.js +1 -14
- package/server/models/constructor-items/sub-blocks.d.ts +2 -6
- package/server/models/constructor-items/sub-blocks.js +0 -1
- package/server/text-transform/blocks.js +0 -27
- package/build/cjs/components/LinkBase/LinkBase.d.ts +0 -3
- package/build/cjs/components/LinkBase/LinkBase.js +0 -18
- package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.css +0 -35
- package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.d.ts +0 -12
- package/build/cjs/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +0 -60
- package/build/cjs/sub-blocks/PriceDetailed/PriceDescription/PriceDescription.css +0 -62
- package/build/cjs/sub-blocks/PriceDetailed/PriceDescription/PriceDescription.d.ts +0 -10
- package/build/cjs/sub-blocks/PriceDetailed/PriceDescription/PriceDescription.js +0 -54
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetailed.d.ts +0 -3
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetailed.js +0 -22
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetails/Details/List.css +0 -11
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetails/Details/List.d.ts +0 -7
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetails/Details/List.js +0 -15
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetails/Details/Settings.css +0 -20
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetails/Details/Settings.d.ts +0 -8
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetails/Details/Settings.js +0 -15
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetails/PriceDetails.css +0 -43
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetails/PriceDetails.d.ts +0 -11
- package/build/cjs/sub-blocks/PriceDetailed/PriceDetails/PriceDetails.js +0 -56
- package/build/cjs/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.css +0 -9
- package/build/cjs/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.d.ts +0 -10
- package/build/cjs/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.js +0 -15
- package/build/cjs/sub-blocks/PriceDetailed/schema.d.ts +0 -93
- package/build/cjs/sub-blocks/PriceDetailed/schema.js +0 -155
- package/build/esm/components/LinkBase/LinkBase.d.ts +0 -3
- package/build/esm/components/LinkBase/LinkBase.js +0 -16
- package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.css +0 -35
- package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.d.ts +0 -13
- package/build/esm/sub-blocks/PriceDetailed/CombinedPriceDetailed/CombinedPriceDetailed.js +0 -58
- package/build/esm/sub-blocks/PriceDetailed/PriceDescription/PriceDescription.css +0 -62
- package/build/esm/sub-blocks/PriceDetailed/PriceDescription/PriceDescription.d.ts +0 -11
- package/build/esm/sub-blocks/PriceDetailed/PriceDescription/PriceDescription.js +0 -52
- package/build/esm/sub-blocks/PriceDetailed/PriceDetailed.d.ts +0 -3
- package/build/esm/sub-blocks/PriceDetailed/PriceDetailed.js +0 -19
- package/build/esm/sub-blocks/PriceDetailed/PriceDetails/Details/List.css +0 -11
- package/build/esm/sub-blocks/PriceDetailed/PriceDetails/Details/List.d.ts +0 -8
- package/build/esm/sub-blocks/PriceDetailed/PriceDetails/Details/List.js +0 -13
- package/build/esm/sub-blocks/PriceDetailed/PriceDetails/Details/Settings.css +0 -20
- package/build/esm/sub-blocks/PriceDetailed/PriceDetails/Details/Settings.d.ts +0 -9
- package/build/esm/sub-blocks/PriceDetailed/PriceDetails/Details/Settings.js +0 -13
- package/build/esm/sub-blocks/PriceDetailed/PriceDetails/PriceDetails.css +0 -43
- package/build/esm/sub-blocks/PriceDetailed/PriceDetails/PriceDetails.d.ts +0 -12
- package/build/esm/sub-blocks/PriceDetailed/PriceDetails/PriceDetails.js +0 -54
- package/build/esm/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.css +0 -9
- package/build/esm/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.d.ts +0 -11
- package/build/esm/sub-blocks/PriceDetailed/SeparatePriceDetailed/SeparatePriceDetailed.js +0 -13
- package/build/esm/sub-blocks/PriceDetailed/schema.d.ts +0 -93
- package/build/esm/sub-blocks/PriceDetailed/schema.js +0 -152
|
@@ -8,7 +8,7 @@ const utils_2 = require("../../../components/Media/Image/utils");
|
|
|
8
8
|
const b = (0, utils_1.block)('social-icon');
|
|
9
9
|
const SocialIcon = ({ icon, url, className }) => {
|
|
10
10
|
const iconData = (0, utils_2.getMediaImage)(icon);
|
|
11
|
-
return (react_1.default.createElement(
|
|
11
|
+
return (react_1.default.createElement("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: b(null, className) },
|
|
12
12
|
react_1.default.createElement(components_1.Image, Object.assign({ className: b('icon') }, iconData))));
|
|
13
13
|
};
|
|
14
14
|
exports.default = SocialIcon;
|
|
@@ -15,7 +15,7 @@ exports.getBlocksCases = getBlocksCases;
|
|
|
15
15
|
function generateDefaultSchema(config) {
|
|
16
16
|
const { cards = {}, blocks = {}, extensions = {} } = config !== null && config !== void 0 ? config : {};
|
|
17
17
|
const blockValidators = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sub_blocks_1.Divider), blocks_1.ExtendedFeaturesBlock), blocks_1.PromoFeaturesBlock), blocks_1.SliderBlock), blocks_1.QuestionsBlock), blocks_1.HeaderBlock), blocks_1.BannerBlock), blocks_1.CompaniesBlock), blocks_1.MediaBlock), blocks_1.MapBlock), blocks_1.InfoBlock), blocks_1.SecurityBlock), blocks_1.TableBlock), blocks_1.TabsBlock), blocks_1.SimpleBlock), blocks_1.LinkTableBlock), blocks_1.PreviewBlock), blocks_1.HeaderSliderBlock), blocks_1.IconsBlock), blocks_1.CardLayoutBlock), blocks_1.ContentLayoutBlock), blocks_1.ShareBlock);
|
|
18
|
-
const cardValidators = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
18
|
+
const cardValidators = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, sub_blocks_1.PartnerBlock), sub_blocks_1.MediaCardBlock), blocks_1.BannerCard), sub_blocks_1.TutorialCard), sub_blocks_1.BackgroundCard), sub_blocks_1.NewsCard), sub_blocks_1.CardWithImage), sub_blocks_1.Quote), sub_blocks_1.BasicCard);
|
|
19
19
|
const constructorBlockSchemaNames = [
|
|
20
20
|
'divider',
|
|
21
21
|
'quote',
|
|
@@ -37,7 +37,6 @@ function generateDefaultSchema(config) {
|
|
|
37
37
|
'simple-block',
|
|
38
38
|
'link-table-block',
|
|
39
39
|
'preview-block',
|
|
40
|
-
'price-detailed',
|
|
41
40
|
'header-slider-block',
|
|
42
41
|
'cards-with-image-block',
|
|
43
42
|
'icons-block',
|
|
@@ -49,7 +48,6 @@ function generateDefaultSchema(config) {
|
|
|
49
48
|
'partner',
|
|
50
49
|
'media-card',
|
|
51
50
|
'banner-card',
|
|
52
|
-
'price-detailed',
|
|
53
51
|
'tutoral-card',
|
|
54
52
|
'background-card',
|
|
55
53
|
'news-card',
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("../../sub-blocks/PriceDetailed/schema"), exports);
|
|
5
4
|
tslib_1.__exportStar(require("../../sub-blocks/BackgroundCard/schema"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("../../sub-blocks/Content/schema"), exports);
|
|
7
6
|
tslib_1.__exportStar(require("../../sub-blocks/MediaCard/schema"), exports);
|
|
@@ -19,7 +19,7 @@ const Quote = (props) => {
|
|
|
19
19
|
const handleButtonClick = (0, react_1.useCallback)(() => handleAnalytics(), [handleAnalytics]);
|
|
20
20
|
const renderFooter = Boolean(author || url) && (react_1.default.createElement("div", { className: b('author-wrapper') },
|
|
21
21
|
author && (react_1.default.createElement(components_1.Author, { className: b('author', { theme: textTheme }), author: author, type: models_1.AuthorType.Line })),
|
|
22
|
-
url && buttonText && (react_1.default.createElement(uikit_1.Button, { view: "outlined", size: "xl", href: url,
|
|
22
|
+
url && buttonText && (react_1.default.createElement(uikit_1.Button, { view: "outlined", size: "xl", href: url, className: b('link-button', { theme: textTheme }), onClick: handleButtonClick }, buttonText))));
|
|
23
23
|
return (react_1.default.createElement("div", { className: b({ theme: textTheme, border }), style: color ? { backgroundColor: color } : {} },
|
|
24
24
|
react_1.default.createElement("div", { key: text, className: b('content-wrapper') },
|
|
25
25
|
react_1.default.createElement("div", null,
|
|
@@ -2,7 +2,6 @@ export { default as Divider } from './Divider/Divider';
|
|
|
2
2
|
export { default as Quote } from './Quote/Quote';
|
|
3
3
|
export { default as NewsCard } from './NewsCard/NewsCard';
|
|
4
4
|
export { default as Partner } from './Partner/Partner';
|
|
5
|
-
export { default as PriceDetailed } from './PriceDetailed/PriceDetailed';
|
|
6
5
|
export { default as MediaCard } from './MediaCard/MediaCard';
|
|
7
6
|
export { default as BannerCard } from './BannerCard/BannerCard';
|
|
8
7
|
export { default as TutorialCard } from './TutorialCard/TutorialCard';
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.HubspotForm = exports.Content = exports.BasicCard = exports.BackgroundCard = exports.LayoutItem = exports.CardWithImage = exports.TutorialCard = exports.BannerCard = exports.MediaCard = exports.
|
|
6
|
+
exports.HubspotForm = exports.Content = exports.BasicCard = exports.BackgroundCard = exports.LayoutItem = exports.CardWithImage = exports.TutorialCard = exports.BannerCard = exports.MediaCard = exports.Partner = exports.NewsCard = exports.Quote = exports.Divider = void 0;
|
|
7
7
|
var Divider_1 = require("./Divider/Divider");
|
|
8
8
|
Object.defineProperty(exports, "Divider", { enumerable: true, get: function () { return __importDefault(Divider_1).default; } });
|
|
9
9
|
var Quote_1 = require("./Quote/Quote");
|
|
@@ -12,8 +12,6 @@ var NewsCard_1 = require("./NewsCard/NewsCard");
|
|
|
12
12
|
Object.defineProperty(exports, "NewsCard", { enumerable: true, get: function () { return __importDefault(NewsCard_1).default; } });
|
|
13
13
|
var Partner_1 = require("./Partner/Partner");
|
|
14
14
|
Object.defineProperty(exports, "Partner", { enumerable: true, get: function () { return __importDefault(Partner_1).default; } });
|
|
15
|
-
var PriceDetailed_1 = require("./PriceDetailed/PriceDetailed");
|
|
16
|
-
Object.defineProperty(exports, "PriceDetailed", { enumerable: true, get: function () { return __importDefault(PriceDetailed_1).default; } });
|
|
17
15
|
var MediaCard_1 = require("./MediaCard/MediaCard");
|
|
18
16
|
Object.defineProperty(exports, "MediaCard", { enumerable: true, get: function () { return __importDefault(MediaCard_1).default; } });
|
|
19
17
|
var BannerCard_1 = require("./BannerCard/BannerCard");
|
|
@@ -45,27 +45,6 @@ const parseItemsTitle = (transformer, items) => items.map((_a) => {
|
|
|
45
45
|
var { title } = _a, rest = tslib_1.__rest(_a, ["title"]);
|
|
46
46
|
return (Object.assign({ title: title && parseTitle(transformer, title) }, rest));
|
|
47
47
|
});
|
|
48
|
-
function parsePriceDetailedBlock(transformer, block) {
|
|
49
|
-
const { priceType } = block;
|
|
50
|
-
block.items = block.items.map((item) => {
|
|
51
|
-
const { description, items: details = [] } = item;
|
|
52
|
-
if (priceType === 'marked-list') {
|
|
53
|
-
item.items = details.map((detail) => {
|
|
54
|
-
detail.text = detail.text && transformer(detail.text);
|
|
55
|
-
return detail;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
item.items = details.map((detail) => {
|
|
60
|
-
detail.description = detail.description && transformer(detail.description);
|
|
61
|
-
return detail;
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
item.description = transformer(description);
|
|
65
|
-
return item;
|
|
66
|
-
});
|
|
67
|
-
return block;
|
|
68
|
-
}
|
|
69
48
|
const parseContentLayout = (transformer, content) => {
|
|
70
49
|
if (content) {
|
|
71
50
|
const { text, additionalInfo } = content;
|
|
@@ -279,12 +258,6 @@ const config = {
|
|
|
279
258
|
transformer: yfmTransformer,
|
|
280
259
|
},
|
|
281
260
|
],
|
|
282
|
-
[models_1.SubBlockType.PriceDetailed]: [
|
|
283
|
-
{
|
|
284
|
-
transformer: yfmTransformer,
|
|
285
|
-
parser: parsePriceDetailedBlock,
|
|
286
|
-
},
|
|
287
|
-
],
|
|
288
261
|
[models_1.BlockType.HeaderBlock]: [
|
|
289
262
|
{
|
|
290
263
|
fields: ['description'],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import { block, getLinkProps } from '../../utils';
|
|
3
|
-
import { BlockHeader, Image
|
|
3
|
+
import { BlockHeader, Image } from '../../components';
|
|
4
4
|
import { LocationContext } from '../../context/locationContext';
|
|
5
5
|
import './Icons.css';
|
|
6
6
|
const b = block('icons-block');
|
|
@@ -8,7 +8,7 @@ const Icons = ({ title, size = 's', items }) => {
|
|
|
8
8
|
const { hostname } = useContext(LocationContext);
|
|
9
9
|
return (React.createElement("div", { className: b({ size }) },
|
|
10
10
|
title && React.createElement(BlockHeader, { className: b('header'), title: title, colSizes: { all: 12 } }),
|
|
11
|
-
items.map((item) => (React.createElement(
|
|
11
|
+
items.map((item) => (React.createElement("a", Object.assign({ className: b('item'), key: item.url, href: item.url }, getLinkProps(item.url, hostname)),
|
|
12
12
|
React.createElement(Image, { className: b('image'), src: item.src }),
|
|
13
13
|
React.createElement("p", { className: b('text') }, item.text))))));
|
|
14
14
|
};
|
|
@@ -6,12 +6,6 @@ export declare const Map: {
|
|
|
6
6
|
zoom: {
|
|
7
7
|
type: string;
|
|
8
8
|
};
|
|
9
|
-
center: {
|
|
10
|
-
type: string;
|
|
11
|
-
items: {
|
|
12
|
-
type: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
9
|
address: {
|
|
16
10
|
type: string;
|
|
17
11
|
};
|
|
@@ -70,12 +64,6 @@ export declare const MapBlock: {
|
|
|
70
64
|
zoom: {
|
|
71
65
|
type: string;
|
|
72
66
|
};
|
|
73
|
-
center: {
|
|
74
|
-
type: string;
|
|
75
|
-
items: {
|
|
76
|
-
type: string;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
67
|
address: {
|
|
80
68
|
type: string;
|
|
81
69
|
};
|
|
@@ -10,7 +10,6 @@ import { Twitter } from '../../icons/Twitter';
|
|
|
10
10
|
import { Linkedin } from '../../icons/Linkedin';
|
|
11
11
|
import { Vk } from '../../icons/Vk';
|
|
12
12
|
import { Telegram } from '../../icons/Telegram';
|
|
13
|
-
import { RouterLink } from '../../components';
|
|
14
13
|
import './Share.css';
|
|
15
14
|
const icons = {
|
|
16
15
|
facebook: Facebook,
|
|
@@ -30,7 +29,7 @@ const Share = ({ items, title }) => {
|
|
|
30
29
|
const url = getAbsolutePath(hostname, pathname);
|
|
31
30
|
const socialUrl = getShareLink(url, type);
|
|
32
31
|
const icon = icons[type];
|
|
33
|
-
return (React.createElement(Button, { key: type, view: "flat", size: "l", target: "_blank", href: socialUrl,
|
|
32
|
+
return (React.createElement(Button, { key: type, view: "flat", size: "l", target: "_blank", href: socialUrl, className: b('item', { type: type.toLowerCase() }), onClick: handleButtonClick }, icon && React.createElement(Icon, { data: icon, size: 24, className: b('icon', { type }) })));
|
|
34
33
|
}))));
|
|
35
34
|
};
|
|
36
35
|
export default Share;
|
|
@@ -4,7 +4,6 @@ import { ArrowSidebar } from '../../icons';
|
|
|
4
4
|
import { LocationContext } from '../../context/locationContext';
|
|
5
5
|
import { useAnalytics } from '../../hooks';
|
|
6
6
|
import { DefaultEventNames } from '../../models';
|
|
7
|
-
import RouterLink from '../RouterLink/RouterLink';
|
|
8
7
|
export default function BackLink(props) {
|
|
9
8
|
const { history } = useContext(LocationContext);
|
|
10
9
|
const { url, title, theme = 'default', size = 'l', className, shouldHandleBackAction = false, onClick, } = props;
|
|
@@ -24,7 +23,7 @@ export default function BackLink(props) {
|
|
|
24
23
|
history.push({ pathname: url });
|
|
25
24
|
}
|
|
26
25
|
}, [handleAnalytics, history, onClick, url]);
|
|
27
|
-
return (React.createElement(Button, {
|
|
26
|
+
return (React.createElement(Button, { className: className, view: theme === 'special' ? 'flat-contrast' : 'flat-secondary', size: size, href: shouldHandleBackAction ? undefined : url, onClick: shouldHandleBackAction ? backActionHandler : undefined },
|
|
28
27
|
React.createElement(Icon, { data: ArrowSidebar, size: 24 }),
|
|
29
28
|
React.createElement("span", null, title)));
|
|
30
29
|
}
|
|
@@ -8,7 +8,6 @@ import { LocaleContext } from '../../context/localeContext/localeContext';
|
|
|
8
8
|
import { useMetrika } from '../../hooks/useMetrika';
|
|
9
9
|
import { useAnalytics } from '../../hooks';
|
|
10
10
|
import { Github } from '../../icons';
|
|
11
|
-
import RouterLink from '../RouterLink/RouterLink';
|
|
12
11
|
import './Button.css';
|
|
13
12
|
const b = block('button-block');
|
|
14
13
|
const Button = (props) => {
|
|
@@ -42,7 +41,7 @@ const Button = (props) => {
|
|
|
42
41
|
image = undefined;
|
|
43
42
|
}
|
|
44
43
|
const buttonTheme = theme === 'scale' ? 'accent' : theme;
|
|
45
|
-
return (React.createElement(CommonButton, Object.assign({ className: buttonClass, view: toCommonView(buttonTheme), size: toCommonSize(size), href: url ? setUrlTld(url, tld) : undefined
|
|
44
|
+
return (React.createElement(CommonButton, Object.assign({ className: buttonClass, view: toCommonView(buttonTheme), size: toCommonSize(size), href: url ? setUrlTld(url, tld) : undefined }, buttonProps),
|
|
46
45
|
icon && buttonImg.position === 'left' ? icon : null,
|
|
47
46
|
React.createElement("span", { className: b('content') },
|
|
48
47
|
image && buttonImg.position === 'left' ? image : null,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { block, getLinkProps } from '../../utils';
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import { LocationContext } from '../../context/locationContext';
|
|
4
|
-
import LinkBase from '../LinkBase/LinkBase';
|
|
5
4
|
import './FileLink.css';
|
|
6
5
|
const b = block('file-link');
|
|
7
6
|
const FIGMA_URL = 'https://www.figma.com';
|
|
@@ -28,6 +27,6 @@ const FileLink = (props) => {
|
|
|
28
27
|
return (React.createElement("div", { className: b({ ext: fileExt, type, size: textSize, theme }, className) },
|
|
29
28
|
Object.values(FileExtension).includes(fileExt) && (React.createElement("div", { className: b('file-label') }, fileExt)),
|
|
30
29
|
React.createElement("div", { className: b('link') },
|
|
31
|
-
React.createElement(
|
|
30
|
+
React.createElement("a", Object.assign({ href: href }, getLinkProps(href, hostname), { onClick: onClick }), text))));
|
|
32
31
|
};
|
|
33
32
|
export default FileLink;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { block } from '../../utils';
|
|
3
3
|
import { useMetrika } from '../../hooks/useMetrika';
|
|
4
|
-
import LinkBase from '../LinkBase/LinkBase';
|
|
5
4
|
import './HeaderBreadcrumbs.css';
|
|
6
5
|
const b = block('header-breadcrumbs');
|
|
7
6
|
export default function HeaderBreadcrumbs(props) {
|
|
@@ -11,5 +10,5 @@ export default function HeaderBreadcrumbs(props) {
|
|
|
11
10
|
handleMetrika({ metrikaGoals, pixelEvents });
|
|
12
11
|
};
|
|
13
12
|
return (React.createElement("div", { className: b({ theme }, className) }, items.map((item) => (React.createElement("div", { className: b('item'), key: item.url },
|
|
14
|
-
React.createElement(
|
|
13
|
+
React.createElement("a", { href: item.url, className: b('text'), onClick: onClick }, item.text))))));
|
|
15
14
|
}
|
|
@@ -3,7 +3,6 @@ import { Icon } from '@gravity-ui/uikit';
|
|
|
3
3
|
import { block, getLinkProps, setUrlTld } from '../../utils';
|
|
4
4
|
import { DefaultEventNames } from '../../models';
|
|
5
5
|
import { Chevron } from '../../icons';
|
|
6
|
-
import LinkBase from '../LinkBase/LinkBase';
|
|
7
6
|
import FileLink from '../FileLink/FileLink';
|
|
8
7
|
import BackLink from '../BackLink/BackLink';
|
|
9
8
|
import { LocaleContext } from '../../context/localeContext/localeContext';
|
|
@@ -47,7 +46,7 @@ const LinkBlock = (props) => {
|
|
|
47
46
|
case 'normal': {
|
|
48
47
|
const linkProps = getLinkProps(url, hostname, target);
|
|
49
48
|
const content = children || text;
|
|
50
|
-
return (React.createElement(
|
|
49
|
+
return (React.createElement("a", Object.assign({ className: b('link', { theme: colorTheme, 'has-arrow': arrow }), href: href, onClick: onClick }, linkProps), arrow ? (React.createElement(Fragment, null,
|
|
51
50
|
React.createElement("span", { className: b('content') }, content),
|
|
52
51
|
WORD_JOINER_SYM,
|
|
53
52
|
React.createElement(Icon, { className: b('arrow'), data: Chevron, size: getArrowSize(textSize) }))) : (content)));
|
|
@@ -5,18 +5,20 @@ import { MapsContext } from '../../context/mapsContext/mapsContext';
|
|
|
5
5
|
import { LocaleContext } from '../../context/localeContext/localeContext';
|
|
6
6
|
import { MobileContext } from '../../context/mobileContext';
|
|
7
7
|
import { getMapHeight } from './helpers';
|
|
8
|
+
import { Lang } from '../../utils/configure';
|
|
8
9
|
const b = block('map');
|
|
9
|
-
function getScriptSrc(
|
|
10
|
-
|
|
10
|
+
function getScriptSrc(params) {
|
|
11
|
+
const { apiKey, scriptSrc, address, lang, zoom } = params;
|
|
12
|
+
return `${scriptSrc}?key=${apiKey}&language=${lang}${zoom ? '&zoom=' + zoom : ''}&q=${encodeURI(address)}`;
|
|
11
13
|
}
|
|
12
14
|
const GoogleMap = (props) => {
|
|
13
|
-
const { address } = props;
|
|
15
|
+
const { address, zoom } = props;
|
|
14
16
|
const { apiKey, scriptSrc } = useContext(MapsContext);
|
|
15
|
-
const { lang =
|
|
17
|
+
const { lang = Lang.Ru } = useContext(LocaleContext);
|
|
16
18
|
const isMobile = useContext(MobileContext);
|
|
17
19
|
const [height, setHeight] = useState(undefined);
|
|
18
20
|
const ref = useRef(null);
|
|
19
|
-
const src = useMemo(() => getScriptSrc(apiKey, scriptSrc, address, lang), [apiKey, scriptSrc, address, lang]);
|
|
21
|
+
const src = useMemo(() => getScriptSrc({ apiKey, scriptSrc, address, lang, zoom }), [apiKey, scriptSrc, address, lang, zoom]);
|
|
20
22
|
useEffect(() => {
|
|
21
23
|
const updateSize = _.debounce(() => {
|
|
22
24
|
if (ref.current) {
|
|
@@ -7,9 +7,13 @@ unpredictable css rules order in build */
|
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
display: flex;
|
|
9
9
|
}
|
|
10
|
+
.pc-map_hidden {
|
|
11
|
+
opacity: 0;
|
|
12
|
+
}
|
|
10
13
|
.pc-map__spinner {
|
|
11
14
|
margin: 0 auto;
|
|
12
15
|
align-self: center;
|
|
16
|
+
position: absolute;
|
|
13
17
|
}
|
|
14
18
|
.pc-map__wrapper {
|
|
15
19
|
min-height: 300px;
|
|
@@ -17,4 +21,5 @@ unpredictable css rules order in build */
|
|
|
17
21
|
flex-direction: column;
|
|
18
22
|
align-items: center;
|
|
19
23
|
justify-content: center;
|
|
24
|
+
position: relative;
|
|
20
25
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { YMapMarker } from '../../../models';
|
|
1
|
+
import { YMapProps, YMapMarker } from '../../../models';
|
|
2
|
+
type PlacemarksProps = Pick<YMapProps, 'zoom' | 'markers'>;
|
|
2
3
|
export declare class YMap {
|
|
3
4
|
private ymap;
|
|
4
5
|
private mapRef;
|
|
5
6
|
private coords;
|
|
6
7
|
constructor(ymap: Ymaps.Map, mapRef: HTMLDivElement | null);
|
|
7
|
-
showPlacemarks(
|
|
8
|
+
showPlacemarks(props: PlacemarksProps): Promise<void>;
|
|
8
9
|
findAddress(marker: YMapMarker): Promise<void>;
|
|
9
10
|
findCoordinate(marker: YMapMarker): void;
|
|
10
11
|
private drawPlaceMarkStyle;
|
|
11
12
|
private recalcZoomAndCenter;
|
|
12
13
|
private clearOldPlacemarks;
|
|
13
14
|
}
|
|
15
|
+
export {};
|
|
@@ -19,9 +19,9 @@ export class YMap {
|
|
|
19
19
|
this.ymap = ymap;
|
|
20
20
|
this.mapRef = mapRef;
|
|
21
21
|
}
|
|
22
|
-
async showPlacemarks(
|
|
22
|
+
async showPlacemarks(props) {
|
|
23
23
|
this.clearOldPlacemarks();
|
|
24
|
-
for (const marker of markers) {
|
|
24
|
+
for (const marker of props.markers) {
|
|
25
25
|
if (marker.address) {
|
|
26
26
|
await this.findAddress(marker);
|
|
27
27
|
}
|
|
@@ -29,7 +29,7 @@ export class YMap {
|
|
|
29
29
|
this.findCoordinate(marker);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
this.recalcZoomAndCenter();
|
|
32
|
+
this.recalcZoomAndCenter(props);
|
|
33
33
|
}
|
|
34
34
|
async findAddress(marker) {
|
|
35
35
|
try {
|
|
@@ -49,10 +49,7 @@ export class YMap {
|
|
|
49
49
|
this.ymap.geoObjects.add(geoObject);
|
|
50
50
|
}
|
|
51
51
|
drawPlaceMarkStyle(geoObject, marker) {
|
|
52
|
-
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const { iconColor, preset = DEFAULT_PLACEMARKS_PRESET } = marker.label;
|
|
52
|
+
const { iconColor, preset = DEFAULT_PLACEMARKS_PRESET } = marker.label || {};
|
|
56
53
|
let localIconColor = iconColor;
|
|
57
54
|
// You can set the preset option together with the iconColor option only if it not a 'Stretchy' preset
|
|
58
55
|
if (!preset.includes('Stretchy') && !iconColor) {
|
|
@@ -65,9 +62,10 @@ export class YMap {
|
|
|
65
62
|
}
|
|
66
63
|
});
|
|
67
64
|
}
|
|
68
|
-
recalcZoomAndCenter() {
|
|
65
|
+
recalcZoomAndCenter(props) {
|
|
69
66
|
var _a, _b;
|
|
70
67
|
const coordsLength = this.coords.length;
|
|
68
|
+
const { zoom = 0 } = props;
|
|
71
69
|
if (!coordsLength) {
|
|
72
70
|
return;
|
|
73
71
|
}
|
|
@@ -76,10 +74,20 @@ export class YMap {
|
|
|
76
74
|
leftBottom = [Math.min(leftBottom[0], point[0]), Math.min(leftBottom[1], point[1])];
|
|
77
75
|
rightTop = [Math.max(rightTop[0], point[0]), Math.max(rightTop[1], point[1])];
|
|
78
76
|
});
|
|
79
|
-
|
|
77
|
+
let newMapParams = {
|
|
78
|
+
zoom,
|
|
79
|
+
center: [],
|
|
80
|
+
};
|
|
81
|
+
if (zoom) {
|
|
82
|
+
// compute only the center
|
|
83
|
+
newMapParams.center = window.ymaps.util.bounds.getCenter([leftBottom, rightTop]);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
newMapParams = window.ymaps.util.bounds.getCenterAndZoom([leftBottom, rightTop], [(_a = this.mapRef) === null || _a === void 0 ? void 0 : _a.clientWidth, (_b = this.mapRef) === null || _b === void 0 ? void 0 : _b.clientHeight], undefined, { margin: DEFAULT_MAP_CONTROL_BUTTON_HEIGHT });
|
|
87
|
+
}
|
|
80
88
|
this.ymap.setCenter(newMapParams.center);
|
|
81
89
|
// Use default zoom for one placemark
|
|
82
|
-
if (coordsLength > 1) {
|
|
90
|
+
if (coordsLength > 1 && !zoom) {
|
|
83
91
|
this.ymap.setZoom(newMapParams.zoom);
|
|
84
92
|
}
|
|
85
93
|
}
|
|
@@ -13,8 +13,12 @@ import { getMapHeight } from '../helpers';
|
|
|
13
13
|
const b = block('map');
|
|
14
14
|
const DEFAULT_CONTAINER_ID = 'ymap';
|
|
15
15
|
const DEFAULT_ZOOM = 9;
|
|
16
|
+
// Center - is a required parameter for creating a new map
|
|
17
|
+
// We use this init center to create a map
|
|
18
|
+
// The real center of the map will be calculated later, using the coordinates of the markers
|
|
19
|
+
const INITIAL_CENTER = [0, 0];
|
|
16
20
|
const YandexMap = (props) => {
|
|
17
|
-
const { markers, zoom,
|
|
21
|
+
const { markers, zoom, id } = props;
|
|
18
22
|
const { apiKey, scriptSrc, nonce } = useContext(MapsContext);
|
|
19
23
|
const isMobile = useContext(MobileContext);
|
|
20
24
|
const { lang = 'ru' } = useContext(LocaleContext);
|
|
@@ -23,6 +27,7 @@ const YandexMap = (props) => {
|
|
|
23
27
|
const [height, setHeight] = useState(undefined);
|
|
24
28
|
const ref = useRef(null);
|
|
25
29
|
const [loading, setLoading] = useState(false);
|
|
30
|
+
const [ready, setReady] = useState(false);
|
|
26
31
|
const [attemptsIndex, setAttemptsIndex] = useState(0);
|
|
27
32
|
const onTryAgain = useCallback(() => {
|
|
28
33
|
setAttemptsIndex(attemptsIndex + 1);
|
|
@@ -30,20 +35,17 @@ const YandexMap = (props) => {
|
|
|
30
35
|
useEffect(() => {
|
|
31
36
|
(async function () {
|
|
32
37
|
var _a;
|
|
33
|
-
if (!center) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
38
|
setLoading(true);
|
|
37
39
|
await YMapsApiLoader.loadApi(apiKey, scriptSrc, lang, nonce);
|
|
38
40
|
(_a = window.ymaps) === null || _a === void 0 ? void 0 : _a.ready(() => {
|
|
39
41
|
setYmaps(new YMap(new window.ymaps.Map(containerId, {
|
|
40
|
-
center,
|
|
42
|
+
center: INITIAL_CENTER,
|
|
41
43
|
zoom: zoom || DEFAULT_ZOOM,
|
|
42
44
|
}, { autoFitToViewport: 'always' }), ref.current));
|
|
43
45
|
});
|
|
44
46
|
setLoading(false);
|
|
45
47
|
})();
|
|
46
|
-
}, [apiKey, lang, scriptSrc, containerId, zoom,
|
|
48
|
+
}, [apiKey, lang, scriptSrc, containerId, zoom, nonce, attemptsIndex, setLoading]);
|
|
47
49
|
useEffect(() => {
|
|
48
50
|
const updateSize = _.debounce(() => {
|
|
49
51
|
if (ref.current) {
|
|
@@ -58,12 +60,19 @@ const YandexMap = (props) => {
|
|
|
58
60
|
}, [markers, ymap, setYmaps, isMobile]);
|
|
59
61
|
useEffect(() => {
|
|
60
62
|
if (ymap) {
|
|
61
|
-
|
|
63
|
+
// show with computed center and placemarks
|
|
64
|
+
const showPlacemarks = async () => {
|
|
65
|
+
await ymap.showPlacemarks({ markers, zoom });
|
|
66
|
+
setReady(true);
|
|
67
|
+
};
|
|
68
|
+
showPlacemarks();
|
|
62
69
|
}
|
|
63
70
|
});
|
|
64
|
-
if (!
|
|
71
|
+
if (!markers)
|
|
65
72
|
return null;
|
|
66
73
|
return (React.createElement(ErrorWrapper, { isError: YMapsApiLoader.status === MapApiStatus.Error, text: i18n('map-load-error'), buttonText: i18n('map-try-again'), handler: onTryAgain, className: b('wrapper') },
|
|
67
|
-
React.createElement("div", {
|
|
74
|
+
React.createElement("div", { className: b('wrapper') },
|
|
75
|
+
React.createElement("div", { id: containerId, className: b({ hidden: !ready }), ref: ref, style: { height } }),
|
|
76
|
+
loading ? React.createElement(Spin, { size: "xl", className: b('spinner') }) : null)));
|
|
68
77
|
};
|
|
69
78
|
export default YandexMap;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Fragment, useContext } from 'react';
|
|
2
2
|
import { block, getHeaderTag, getLinkProps } from '../../utils';
|
|
3
3
|
import Anchor from '../Anchor/Anchor';
|
|
4
|
-
import LinkBase from '../LinkBase/LinkBase';
|
|
5
4
|
import { ToggleArrow, HTML } from '../';
|
|
6
5
|
import { LocationContext } from '../../context/locationContext';
|
|
7
6
|
import { MobileContext } from '../../context/mobileContext';
|
|
@@ -37,7 +36,7 @@ const Title = (props) => {
|
|
|
37
36
|
content = textMarkup;
|
|
38
37
|
}
|
|
39
38
|
else if (url) {
|
|
40
|
-
content = (React.createElement(
|
|
39
|
+
content = (React.createElement("a", Object.assign({ className: b('link'), href: url }, getLinkProps(url, hostname), { onClick: onClick }), insideClickableContent));
|
|
41
40
|
}
|
|
42
41
|
else if (onClick) {
|
|
43
42
|
content = (React.createElement("span", { className: b('link'), onClick: onClick }, insideClickableContent));
|
|
@@ -17,7 +17,6 @@ export { default as HeaderBreadcrumbs } from './HeaderBreadcrumbs/HeaderBreadcru
|
|
|
17
17
|
export { default as HeightCalculator } from './HeightCalculator/HeightCalculator';
|
|
18
18
|
export { default as Image } from './Image/Image';
|
|
19
19
|
export { default as Link } from './Link/Link';
|
|
20
|
-
export { default as LinkBase } from './LinkBase/LinkBase';
|
|
21
20
|
export { default as Links } from './Link/Links';
|
|
22
21
|
export { default as Media } from './Media/Media';
|
|
23
22
|
export { default as OutsideClick } from './OutsideClick/OutsideClick';
|
|
@@ -17,7 +17,6 @@ export { default as HeaderBreadcrumbs } from './HeaderBreadcrumbs/HeaderBreadcru
|
|
|
17
17
|
export { default as HeightCalculator } from './HeightCalculator/HeightCalculator';
|
|
18
18
|
export { default as Image } from './Image/Image';
|
|
19
19
|
export { default as Link } from './Link/Link';
|
|
20
|
-
export { default as LinkBase } from './LinkBase/LinkBase';
|
|
21
20
|
export { default as Links } from './Link/Links';
|
|
22
21
|
export { default as Media } from './Media/Media';
|
|
23
22
|
export { default as OutsideClick } from './OutsideClick/OutsideClick';
|
|
@@ -32,7 +32,6 @@ export declare const subBlockMap: {
|
|
|
32
32
|
* @deprecated Will be removed, use basic card instead
|
|
33
33
|
*/
|
|
34
34
|
partner: ({ text, logo, url, border }: import("./models").PartnerProps) => JSX.Element;
|
|
35
|
-
"price-detailed": (props: import("./models").PriceDetailedProps) => JSX.Element;
|
|
36
35
|
"media-card": ({ border, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
|
|
37
36
|
"banner-card": (props: import("./models").BannerCardProps) => JSX.Element;
|
|
38
37
|
"news-card": (props: import("./models").NewsCardProps) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockType, SubBlockType } from './models';
|
|
2
|
-
import { Partner,
|
|
2
|
+
import { Partner, MediaCard, NewsCard, TutorialCard, CardWithImage, LayoutItem, BackgroundCard, Content, Quote, Divider, BannerCard, BasicCard, } from './sub-blocks';
|
|
3
3
|
import { BannerBlock, CompaniesBlock, SimpleBlock, MediaBlock, MapBlock, PreviewBlock, InfoBlock, SecurityBlock, SliderBlock, ExtendedFeaturesBlock, PromoFeaturesBlock, QuestionsBlock, TableBlock, TabsBlock, LinkTableBlock, HeaderBlock, IconsBlock, HeaderSliderBlock, CardLayoutBlock, ContentLayoutBlock, ShareBlock, FilterBlock, } from './blocks';
|
|
4
4
|
export const blockMap = {
|
|
5
5
|
[BlockType.SliderBlock]: SliderBlock,
|
|
@@ -35,7 +35,6 @@ export const subBlockMap = {
|
|
|
35
35
|
* @deprecated Will be removed, use basic card instead
|
|
36
36
|
*/
|
|
37
37
|
[SubBlockType.Partner]: Partner,
|
|
38
|
-
[SubBlockType.PriceDetailed]: PriceDetailed,
|
|
39
38
|
[SubBlockType.MediaCard]: MediaCard,
|
|
40
39
|
[SubBlockType.BannerCard]: BannerCard,
|
|
41
40
|
[SubBlockType.NewsCard]: NewsCard,
|