@gravity-ui/page-constructor 1.18.0 → 1.19.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/README.md +8 -0
- package/build/cjs/blocks/Map/Map.d.ts +3 -0
- package/build/cjs/blocks/Map/Map.js +15 -0
- package/build/cjs/blocks/Map/schema.d.ts +370 -0
- package/build/cjs/blocks/Map/schema.js +18 -0
- package/build/cjs/blocks/Media/Media.js +5 -27
- package/build/cjs/blocks/Media/schema.d.ts +265 -9
- package/build/cjs/blocks/Media/schema.js +18 -17
- package/build/cjs/blocks/index.d.ts +1 -0
- package/build/cjs/blocks/index.js +3 -1
- package/build/cjs/components/Map/GoogleMap.d.ts +4 -0
- package/build/cjs/components/Map/GoogleMap.js +42 -0
- package/build/cjs/components/Map/Map.css +20 -0
- package/build/cjs/components/Map/Map.d.ts +3 -0
- package/build/cjs/components/Map/Map.js +21 -0
- package/build/cjs/components/Map/YMap/YMap.d.ts +13 -0
- package/build/cjs/components/Map/YMap/YMap.js +97 -0
- package/build/cjs/components/Map/YMap/YandexMap.d.ts +4 -0
- package/build/cjs/components/Map/YMap/YandexMap.js +72 -0
- package/build/cjs/components/Map/YMap/YandexMapApiLoader.d.ts +11 -0
- package/build/cjs/components/Map/YMap/YandexMapApiLoader.js +37 -0
- package/build/cjs/components/Map/YMap/i18n/en.json +4 -0
- package/build/cjs/components/Map/YMap/i18n/index.d.ts +2 -0
- package/build/cjs/components/Map/YMap/i18n/index.js +8 -0
- package/build/cjs/components/Map/YMap/i18n/ru.json +4 -0
- package/build/cjs/components/Map/helpers.d.ts +1 -0
- package/build/cjs/components/Map/helpers.js +7 -0
- package/build/cjs/{blocks/Media/Media.css → components/MediaBase/MediaBase.css} +15 -14
- package/build/cjs/components/MediaBase/MediaBase.d.ts +13 -0
- package/build/cjs/components/MediaBase/MediaBase.js +39 -0
- package/build/cjs/{blocks/Media/MediaContent.css → components/MediaBase/MediaBaseContent.css} +2 -2
- package/build/cjs/{blocks/Media/MediaContent.js → components/MediaBase/MediaBaseContent.js} +1 -1
- package/build/cjs/constructor-items.d.ts +1 -0
- package/build/cjs/constructor-items.js +1 -0
- package/build/cjs/containers/PageConstructor/Provider.d.ts +2 -0
- package/build/cjs/containers/PageConstructor/Provider.js +3 -1
- package/build/cjs/context/mapsContext/mapsContext.d.ts +22 -0
- package/build/cjs/context/mapsContext/mapsContext.js +20 -0
- package/build/cjs/context/mapsContext/mapsProvider.d.ts +10 -0
- package/build/cjs/context/mapsContext/mapsProvider.js +15 -0
- package/build/cjs/context/mapsContext/useMap.d.ts +2 -0
- package/build/cjs/context/mapsContext/useMap.js +11 -0
- package/build/cjs/internal-typings/global.d.ts +36 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +18 -9
- package/build/cjs/models/constructor-items/blocks.js +1 -0
- package/build/cjs/models/constructor-items/common.d.ts +25 -0
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.js +1 -3
- package/build/cjs/navigation/components/NavigationItem/components/GithubStars/GithubStars.css +4 -0
- package/build/cjs/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.css +6 -0
- package/build/cjs/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js +3 -3
- package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.css +4 -0
- package/build/cjs/navigation/components/NavigationItem/mixins.css +0 -0
- package/build/cjs/schema/index.js +1 -1
- package/build/cjs/schema/validators/blocks.d.ts +1 -0
- package/build/cjs/schema/validators/blocks.js +1 -0
- package/build/cjs/schema/validators/common.d.ts +91 -0
- package/build/cjs/schema/validators/common.js +46 -1
- package/build/cjs/utils/blocks.d.ts +1 -1
- package/build/cjs/utils/common.d.ts +6 -0
- package/build/cjs/utils/common.js +24 -0
- package/build/cjs/utils/index.d.ts +1 -0
- package/build/cjs/utils/index.js +1 -0
- package/build/esm/blocks/Map/Map.d.ts +3 -0
- package/build/esm/blocks/Map/Map.js +11 -0
- package/build/esm/blocks/Map/schema.d.ts +370 -0
- package/build/esm/blocks/Map/schema.js +15 -0
- package/build/esm/blocks/Media/Media.d.ts +0 -1
- package/build/esm/blocks/Media/Media.js +7 -31
- package/build/esm/blocks/Media/schema.d.ts +265 -9
- package/build/esm/blocks/Media/schema.js +17 -16
- package/build/esm/blocks/index.d.ts +1 -0
- package/build/esm/blocks/index.js +1 -0
- package/build/esm/components/Map/GoogleMap.d.ts +4 -0
- package/build/esm/components/Map/GoogleMap.js +39 -0
- package/build/esm/components/Map/Map.css +20 -0
- package/build/esm/components/Map/Map.d.ts +4 -0
- package/build/esm/components/Map/Map.js +17 -0
- package/build/esm/components/Map/YMap/YMap.d.ts +13 -0
- package/build/esm/components/Map/YMap/YMap.js +93 -0
- package/build/esm/components/Map/YMap/YandexMap.d.ts +4 -0
- package/build/esm/components/Map/YMap/YandexMap.js +69 -0
- package/build/esm/components/Map/YMap/YandexMapApiLoader.d.ts +11 -0
- package/build/esm/components/Map/YMap/YandexMapApiLoader.js +33 -0
- package/build/esm/components/Map/YMap/i18n/en.json +4 -0
- package/build/esm/components/Map/YMap/i18n/index.d.ts +2 -0
- package/build/esm/components/Map/YMap/i18n/index.js +5 -0
- package/build/esm/components/Map/YMap/i18n/ru.json +4 -0
- package/build/esm/components/Map/helpers.d.ts +1 -0
- package/build/esm/components/Map/helpers.js +3 -0
- package/build/esm/{blocks/Media/Media.css → components/MediaBase/MediaBase.css} +15 -14
- package/build/esm/components/MediaBase/MediaBase.d.ts +14 -0
- package/build/esm/components/MediaBase/MediaBase.js +36 -0
- package/build/esm/{blocks/Media/MediaContent.css → components/MediaBase/MediaBaseContent.css} +2 -2
- package/build/esm/{blocks/Media/MediaContent.d.ts → components/MediaBase/MediaBaseContent.d.ts} +1 -1
- package/build/esm/{blocks/Media/MediaContent.js → components/MediaBase/MediaBaseContent.js} +2 -2
- package/build/esm/constructor-items.d.ts +1 -0
- package/build/esm/constructor-items.js +2 -1
- package/build/esm/containers/PageConstructor/Provider.d.ts +2 -0
- package/build/esm/containers/PageConstructor/Provider.js +3 -1
- package/build/esm/context/mapsContext/mapsContext.d.ts +22 -0
- package/build/esm/context/mapsContext/mapsContext.js +16 -0
- package/build/esm/context/mapsContext/mapsProvider.d.ts +10 -0
- package/build/esm/context/mapsContext/mapsProvider.js +10 -0
- package/build/esm/context/mapsContext/useMap.d.ts +2 -0
- package/build/esm/context/mapsContext/useMap.js +6 -0
- package/build/esm/internal-typings/global.d.ts +36 -0
- package/build/esm/models/constructor-items/blocks.d.ts +18 -9
- package/build/esm/models/constructor-items/blocks.js +1 -0
- package/build/esm/models/constructor-items/common.d.ts +25 -0
- package/build/esm/navigation/components/NavigationItem/NavigationItem.d.ts +0 -1
- package/build/esm/navigation/components/NavigationItem/NavigationItem.js +1 -4
- package/build/esm/navigation/components/NavigationItem/components/GithubStars/GithubStars.css +4 -0
- package/build/esm/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.css +6 -0
- package/build/esm/navigation/components/NavigationItem/components/NavigationDropdown/NavigationDropdown.js +3 -3
- package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.css +4 -0
- package/build/esm/navigation/components/NavigationItem/mixins.css +0 -0
- package/build/esm/schema/index.js +2 -2
- package/build/esm/schema/validators/blocks.d.ts +1 -0
- package/build/esm/schema/validators/blocks.js +1 -0
- package/build/esm/schema/validators/common.d.ts +91 -0
- package/build/esm/schema/validators/common.js +45 -0
- package/build/esm/utils/blocks.d.ts +1 -1
- package/build/esm/utils/common.d.ts +6 -0
- package/build/esm/utils/common.js +20 -0
- package/build/esm/utils/index.d.ts +1 -0
- package/build/esm/utils/index.js +1 -0
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +18 -9
- package/server/models/constructor-items/blocks.js +1 -0
- package/server/models/constructor-items/common.d.ts +25 -0
- package/server/utils/blocks.d.ts +1 -1
- package/server/utils/common.d.ts +6 -0
- package/server/utils/common.js +24 -0
- package/server/utils/index.d.ts +1 -0
- package/server/utils/index.js +1 -0
- package/build/cjs/navigation/components/NavigationItem/NavigationItem.css +0 -6
- package/build/esm/navigation/components/NavigationItem/NavigationItem.css +0 -6
- /package/build/cjs/{blocks/Media/MediaContent.d.ts → components/MediaBase/MediaBaseContent.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getMapHeight(width: number, isMobile: boolean): number;
|
|
@@ -1,50 +1,51 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
|
-
.pc-media-
|
|
3
|
+
.pc-media-base__card img {
|
|
4
4
|
width: 100%;
|
|
5
5
|
}
|
|
6
|
-
.pc-media-
|
|
7
|
-
.pc-media-
|
|
8
|
-
.pc-media-
|
|
6
|
+
.pc-media-base__card img,
|
|
7
|
+
.pc-media-base__card video,
|
|
8
|
+
.pc-media-base__card iframe,
|
|
9
|
+
.pc-media-base__card .pc-map {
|
|
9
10
|
border-radius: var(--pc-border-radius);
|
|
10
11
|
}
|
|
11
|
-
.pc-media-
|
|
12
|
+
.pc-media-base__card_shadow {
|
|
12
13
|
box-shadow: 0 2px 8px var(--pc-color-sfx-shadow), 0 4px 24px var(--pc-color-sfx-shadow);
|
|
13
14
|
overflow-x: hidden;
|
|
14
15
|
border-radius: var(--pc-border-radius);
|
|
15
16
|
}
|
|
16
|
-
.pc-media-
|
|
17
|
+
.pc-media-base__row_reverse {
|
|
17
18
|
flex-direction: row-reverse;
|
|
18
19
|
}
|
|
19
|
-
.pc-media-
|
|
20
|
+
.pc-media-base__row_reverse .pc-media-base__content > * {
|
|
20
21
|
margin-right: 0;
|
|
21
22
|
margin-left: 64px;
|
|
22
23
|
}
|
|
23
|
-
.pc-media-
|
|
24
|
+
.pc-media-base__header {
|
|
24
25
|
margin-bottom: 24px;
|
|
25
26
|
}
|
|
26
27
|
@media (max-width: 769px) {
|
|
27
|
-
.pc-media-
|
|
28
|
+
.pc-media-base__row_reverse {
|
|
28
29
|
flex-direction: row;
|
|
29
30
|
}
|
|
30
|
-
.pc-media-
|
|
31
|
+
.pc-media-base__row_reverse .pc-media-base__content > * {
|
|
31
32
|
margin-left: 0;
|
|
32
33
|
}
|
|
33
|
-
.pc-media-
|
|
34
|
+
.pc-media-base__row_mobile-reverse {
|
|
34
35
|
flex-direction: column-reverse;
|
|
35
36
|
}
|
|
36
|
-
.pc-media-
|
|
37
|
+
.pc-media-base__row_mobile-reverse .pc-media-base__content > * {
|
|
37
38
|
margin-top: 32px;
|
|
38
39
|
padding-bottom: 0;
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
@media (min-width: 769px) {
|
|
42
|
-
.pc-media-
|
|
43
|
+
.pc-media-base.pc-AnimateBlock .pc-media-base__card, .pc-AnimateBlock .pc-media-base .pc-media-base__card {
|
|
43
44
|
position: relative;
|
|
44
45
|
top: 100px;
|
|
45
46
|
opacity: 0;
|
|
46
47
|
}
|
|
47
|
-
.pc-media-
|
|
48
|
+
.pc-media-base.pc-AnimateBlock.animate .pc-media-base__card, .pc-AnimateBlock .pc-media-base.animate .pc-media-base__card {
|
|
48
49
|
top: 0;
|
|
49
50
|
opacity: 1;
|
|
50
51
|
transition: top 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import { MediaBaseBlockProps } from '../../models';
|
|
3
|
+
import './MediaBase.css';
|
|
4
|
+
interface MediaBaseProps extends MediaBaseBlockProps {
|
|
5
|
+
children: ReactElement;
|
|
6
|
+
onScroll?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const MediaBase: {
|
|
9
|
+
(props: MediaBaseProps): JSX.Element;
|
|
10
|
+
Card: React.FC<{
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
export default MediaBase;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { block } from '../../utils';
|
|
4
|
+
import { Grid, Row, Col, GridColumnSize } from '../../grid';
|
|
5
|
+
import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
|
|
6
|
+
import BlockHeader from '../../components/BlockHeader/BlockHeader';
|
|
7
|
+
import MediaContent from './MediaBaseContent';
|
|
8
|
+
import './MediaBase.css';
|
|
9
|
+
const b = block('media-base');
|
|
10
|
+
const Card = () => null;
|
|
11
|
+
export const MediaBase = (props) => {
|
|
12
|
+
const { children, largeMedia, direction = 'content-media', mobileDirection = 'content-media', animated, mediaOnly, disableShadow = false, onScroll } = props, mediaContentProps = __rest(props, ["children", "largeMedia", "direction", "mobileDirection", "animated", "mediaOnly", "disableShadow", "onScroll"]);
|
|
13
|
+
const { title, description } = mediaContentProps;
|
|
14
|
+
const mediaSizes = useMemo(() => {
|
|
15
|
+
return mediaOnly
|
|
16
|
+
? { [GridColumnSize.All]: 12 }
|
|
17
|
+
: { [GridColumnSize.Md]: largeMedia ? 8 : 6, [GridColumnSize.All]: 12 };
|
|
18
|
+
}, [mediaOnly, largeMedia]);
|
|
19
|
+
const contentSizes = useMemo(() => {
|
|
20
|
+
return { [GridColumnSize.Md]: largeMedia ? 4 : 6, [GridColumnSize.All]: 12 };
|
|
21
|
+
}, [largeMedia]);
|
|
22
|
+
const mediaContent = !mediaOnly && React.createElement(MediaContent, Object.assign({}, mediaContentProps));
|
|
23
|
+
const card = children.type === Card ? children === null || children === void 0 ? void 0 : children.props.children : null;
|
|
24
|
+
return (React.createElement(AnimateBlock, { className: b(), onScroll: onScroll, animate: animated },
|
|
25
|
+
mediaOnly && (React.createElement(BlockHeader, { className: b('header'), title: title, description: description })),
|
|
26
|
+
React.createElement(Grid, null,
|
|
27
|
+
React.createElement(Row, { className: b('row', {
|
|
28
|
+
reverse: direction === 'media-content',
|
|
29
|
+
'mobile-reverse': mobileDirection === 'media-content',
|
|
30
|
+
}) },
|
|
31
|
+
React.createElement(Col, { className: b('content'), sizes: contentSizes }, mediaContent),
|
|
32
|
+
card ? (React.createElement(Col, { sizes: mediaSizes },
|
|
33
|
+
React.createElement("div", { className: b('card', { shadow: !disableShadow }) }, card))) : null))));
|
|
34
|
+
};
|
|
35
|
+
MediaBase.Card = Card;
|
|
36
|
+
export default MediaBase;
|
package/build/esm/{blocks/Media/MediaContent.css → components/MediaBase/MediaBaseContent.css}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
.pc-media-content {
|
|
1
|
+
.pc-media-base-content {
|
|
2
2
|
margin-right: 64px;
|
|
3
3
|
height: 100%;
|
|
4
4
|
align-items: center;
|
|
5
5
|
display: flex;
|
|
6
6
|
}
|
|
7
7
|
@media (max-width: 769px) {
|
|
8
|
-
.pc-media-content {
|
|
8
|
+
.pc-media-base-content {
|
|
9
9
|
margin-right: 0;
|
|
10
10
|
padding-bottom: 32px;
|
|
11
11
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { block } from '../../utils';
|
|
3
3
|
import { Content } from '../../sub-blocks';
|
|
4
|
-
import './
|
|
5
|
-
const b = block('media-content');
|
|
4
|
+
import './MediaBaseContent.css';
|
|
5
|
+
const b = block('media-base-content');
|
|
6
6
|
const MediaContent = (props) => {
|
|
7
7
|
const { title, description, button, links, buttons = [], additionalInfo, size = 'l' } = props;
|
|
8
8
|
const allButtons = button ? [Object.assign(Object.assign({}, button), { size: 'xl' }), ...buttons] : buttons;
|
|
@@ -19,6 +19,7 @@ export declare const blockMap: {
|
|
|
19
19
|
"card-layout-block": ({ title, description, animated, colSizes, children, }: import("./blocks/CardLayout/CardLayout").CardLayoutBlockProps) => JSX.Element;
|
|
20
20
|
"content-layout-block": (props: import("./models").ContentLayoutBlockProps) => JSX.Element;
|
|
21
21
|
"share-block": ({ items, title }: import("./models").ShareBlockProps) => JSX.Element;
|
|
22
|
+
"map-block": ({ map, ...props }: import("./models").MapBlockProps) => JSX.Element;
|
|
22
23
|
};
|
|
23
24
|
export declare const subBlockMap: {
|
|
24
25
|
divider: ({ size, border }: import("./models").DividerProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BlockType, SubBlockType } from './models';
|
|
2
2
|
import { Partner, PriceDetailed, MediaCard, NewsCard, TutorialCard, CardWithImage, LayoutItem, BackgroundCard, Content, Quote, Divider, BannerCard, BasicCard, } from './sub-blocks';
|
|
3
|
-
import { BannerBlock, CompaniesBlock, SimpleBlock, MediaBlock, PreviewBlock, InfoBlock, SecurityBlock, SliderBlock, ExtendedFeaturesBlock, PromoFeaturesBlock, QuestionsBlock, TableBlock, TabsBlock, LinkTableBlock, HeaderBlock, IconsBlock, HeaderSliderBlock, CardLayoutBlock, ContentLayoutBlock, ShareBlock, } from './blocks';
|
|
3
|
+
import { BannerBlock, CompaniesBlock, SimpleBlock, MediaBlock, MapBlock, PreviewBlock, InfoBlock, SecurityBlock, SliderBlock, ExtendedFeaturesBlock, PromoFeaturesBlock, QuestionsBlock, TableBlock, TabsBlock, LinkTableBlock, HeaderBlock, IconsBlock, HeaderSliderBlock, CardLayoutBlock, ContentLayoutBlock, ShareBlock, } from './blocks';
|
|
4
4
|
export const blockMap = {
|
|
5
5
|
[BlockType.SliderBlock]: SliderBlock,
|
|
6
6
|
[BlockType.SimpleBlock]: SimpleBlock,
|
|
@@ -22,6 +22,7 @@ export const blockMap = {
|
|
|
22
22
|
[BlockType.CardLayoutBlock]: CardLayoutBlock,
|
|
23
23
|
[BlockType.ContentLayoutBlock]: ContentLayoutBlock,
|
|
24
24
|
[BlockType.ShareBlock]: ShareBlock,
|
|
25
|
+
[BlockType.MapBlock]: MapBlock,
|
|
25
26
|
};
|
|
26
27
|
export const subBlockMap = {
|
|
27
28
|
[SubBlockType.Divider]: Divider,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MetrikaContextProps } from '../../context/metrikaContext';
|
|
2
|
+
import { MapsContextType } from '../../context/mapsContext/mapsContext';
|
|
2
3
|
import { ProjectSettingsContextProps } from '../../context/projectSettingsContext';
|
|
3
4
|
import { SSRContextProps } from '../../context/ssrContext';
|
|
4
5
|
import { LocaleContextProps } from '../../context/localeContext';
|
|
@@ -12,6 +13,7 @@ export interface PageConstructorProviderProps {
|
|
|
12
13
|
metrika?: MetrikaContextProps;
|
|
13
14
|
ssrConfig?: SSRContextProps;
|
|
14
15
|
theme?: ConstructorTheme;
|
|
16
|
+
mapsContext?: MapsContextType;
|
|
15
17
|
projectSettings?: ProjectSettingsContextProps;
|
|
16
18
|
}
|
|
17
19
|
export declare const PageConstructorProvider: (props: WithChildren<PageConstructorProviderProps>) => JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { Fragment } from 'react';
|
|
2
2
|
import { MetrikaContext } from '../../context/metrikaContext';
|
|
3
3
|
import { MobileContext } from '../../context/mobileContext';
|
|
4
|
+
import { MapsContext, initialMapValue } from '../../context/mapsContext/mapsContext';
|
|
4
5
|
import { ProjectSettingsContext, } from '../../context/projectSettingsContext';
|
|
5
6
|
import { SSRContext } from '../../context/ssrContext';
|
|
6
7
|
import { LocaleContext } from '../../context/localeContext';
|
|
@@ -8,7 +9,7 @@ import { LocationContext } from '../../context/locationContext';
|
|
|
8
9
|
import { ThemeValueContext } from '../../context/theme/ThemeValueContext';
|
|
9
10
|
import { DEFAULT_THEME } from '../../components/constants';
|
|
10
11
|
export const PageConstructorProvider = (props) => {
|
|
11
|
-
const { isMobile, locale = {}, location = {}, metrika = {}, ssrConfig = {}, projectSettings = {}, theme = DEFAULT_THEME, children, } = props;
|
|
12
|
+
const { isMobile, mapsContext = initialMapValue, locale = {}, location = {}, metrika = {}, ssrConfig = {}, projectSettings = {}, theme = DEFAULT_THEME, children, } = props;
|
|
12
13
|
/* eslint-disable react/jsx-key */
|
|
13
14
|
const context = [
|
|
14
15
|
React.createElement(ThemeValueContext.Provider, { value: { themeValue: theme } }),
|
|
@@ -16,6 +17,7 @@ export const PageConstructorProvider = (props) => {
|
|
|
16
17
|
React.createElement(LocaleContext.Provider, { value: locale }),
|
|
17
18
|
React.createElement(LocationContext.Provider, { value: location }),
|
|
18
19
|
React.createElement(MobileContext.Provider, { value: Boolean(isMobile) }),
|
|
20
|
+
React.createElement(MapsContext.Provider, { value: mapsContext }),
|
|
19
21
|
React.createElement(MetrikaContext.Provider, { value: metrika }),
|
|
20
22
|
React.createElement(SSRContext.Provider, { value: { isServer: ssrConfig === null || ssrConfig === void 0 ? void 0 : ssrConfig.isServer } }),
|
|
21
23
|
].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare enum MapType {
|
|
3
|
+
Yandex = "yandex",
|
|
4
|
+
Google = "google"
|
|
5
|
+
}
|
|
6
|
+
export declare const Maplangs: {
|
|
7
|
+
ru: string;
|
|
8
|
+
en: string;
|
|
9
|
+
};
|
|
10
|
+
export interface MapsContextType {
|
|
11
|
+
apiKey: string;
|
|
12
|
+
type: MapType;
|
|
13
|
+
scriptSrc: string;
|
|
14
|
+
nonce?: string;
|
|
15
|
+
setKey?: (newKey: string) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const initialMapValue: {
|
|
18
|
+
apiKey: string;
|
|
19
|
+
scriptSrc: string;
|
|
20
|
+
type: MapType;
|
|
21
|
+
};
|
|
22
|
+
export declare const MapsContext: React.Context<MapsContextType>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export var MapType;
|
|
3
|
+
(function (MapType) {
|
|
4
|
+
MapType["Yandex"] = "yandex";
|
|
5
|
+
MapType["Google"] = "google";
|
|
6
|
+
})(MapType || (MapType = {}));
|
|
7
|
+
export const Maplangs = {
|
|
8
|
+
ru: 'ru_RU',
|
|
9
|
+
en: 'en_US',
|
|
10
|
+
};
|
|
11
|
+
export const initialMapValue = {
|
|
12
|
+
apiKey: '',
|
|
13
|
+
scriptSrc: '',
|
|
14
|
+
type: MapType.Yandex,
|
|
15
|
+
};
|
|
16
|
+
export const MapsContext = React.createContext(initialMapValue);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { MapType } from './mapsContext';
|
|
3
|
+
interface MapProviderProps {
|
|
4
|
+
type: MapType;
|
|
5
|
+
scriptSrc: string;
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const gmapApiKeyIdInLS = "gmap-api-key";
|
|
9
|
+
export declare const MapProvider: React.FC<PropsWithChildren<MapProviderProps>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { MapsContext, MapType } from './mapsContext';
|
|
3
|
+
export const gmapApiKeyIdInLS = 'gmap-api-key';
|
|
4
|
+
export const MapProvider = ({ type = MapType.Yandex, scriptSrc, apiKey, children, }) => {
|
|
5
|
+
const initialKeyValue = type === MapType.Google
|
|
6
|
+
? apiKey || localStorage.getItem(gmapApiKeyIdInLS) || ''
|
|
7
|
+
: apiKey || '';
|
|
8
|
+
const [currentApiKey, setKey] = useState(initialKeyValue);
|
|
9
|
+
return (React.createElement(MapsContext.Provider, { value: { apiKey: currentApiKey, setKey, scriptSrc, type } }, children));
|
|
10
|
+
};
|
|
@@ -25,6 +25,42 @@ interface Window {
|
|
|
25
25
|
create: (args: CreateFormProps) => unknown;
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
+
ymaps: Ymaps;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare namespace Ymaps {
|
|
32
|
+
export function ready(): Promise;
|
|
33
|
+
|
|
34
|
+
class Promise {
|
|
35
|
+
then(onFulfilled?: Function, onRejected?: Function, onProgress?: Function): Promise;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class Map {
|
|
39
|
+
setCenter: (center: number[]) => void;
|
|
40
|
+
setZoom: (zoom: number) => void;
|
|
41
|
+
geoObjects: {
|
|
42
|
+
add: (object) => void;
|
|
43
|
+
removeAll: () => void;
|
|
44
|
+
get: () => void;
|
|
45
|
+
};
|
|
46
|
+
constructor(element: string, state: MapState);
|
|
47
|
+
destroy(): Promise;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export class GeoObject {
|
|
51
|
+
properties: {
|
|
52
|
+
set: (objectName: string, value: string) => void;
|
|
53
|
+
};
|
|
54
|
+
options: {
|
|
55
|
+
set: (objectName: string, value: string) => void;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export class MapState {
|
|
60
|
+
center: number[];
|
|
61
|
+
controls: string[];
|
|
62
|
+
zoom: number;
|
|
63
|
+
}
|
|
28
64
|
}
|
|
29
65
|
|
|
30
66
|
declare module '*.md';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, Justify, LinkProps, LinkTheme, MediaDirection, MediaProps, PreviewItemProps, PreviewRatioMediaContent, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleProps, LegendTableMarkerType, AnchorProps, TitleBaseProps, Animatable, BlockHeaderProps, ImageDeviceProps } from './common';
|
|
2
|
+
import { BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, Justify, LinkProps, LinkTheme, MediaDirection, MediaProps, MapProps, PreviewItemProps, PreviewRatioMediaContent, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleProps, LegendTableMarkerType, AnchorProps, TitleBaseProps, Animatable, BlockHeaderProps, ImageDeviceProps } from './common';
|
|
3
3
|
import { ThemeSupporting } from '../../utils';
|
|
4
4
|
import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
|
|
5
5
|
import { BannerCardProps, SubBlock } from './sub-blocks';
|
|
@@ -25,7 +25,8 @@ export declare enum BlockType {
|
|
|
25
25
|
IconsBlock = "icons-block",
|
|
26
26
|
CardLayoutBlock = "card-layout-block",
|
|
27
27
|
ContentLayoutBlock = "content-layout-block",
|
|
28
|
-
ShareBlock = "share-block"
|
|
28
|
+
ShareBlock = "share-block",
|
|
29
|
+
MapBlock = "map-block"
|
|
29
30
|
}
|
|
30
31
|
export declare const BlockTypes: BlockType[];
|
|
31
32
|
export declare const HeaderBlockTypes: BlockType[];
|
|
@@ -155,6 +156,13 @@ export interface CompaniesBlockProps extends Animatable {
|
|
|
155
156
|
title: string;
|
|
156
157
|
images: ThemeSupporting<ImageDeviceProps>;
|
|
157
158
|
}
|
|
159
|
+
export interface MediaBaseBlockProps extends Animatable, MediaContentProps {
|
|
160
|
+
direction?: MediaDirection;
|
|
161
|
+
mobileDirection?: MediaDirection;
|
|
162
|
+
largeMedia?: boolean;
|
|
163
|
+
mediaOnly?: boolean;
|
|
164
|
+
disableShadow?: boolean;
|
|
165
|
+
}
|
|
158
166
|
export interface MediaContentProps {
|
|
159
167
|
title: string;
|
|
160
168
|
description?: string;
|
|
@@ -164,13 +172,11 @@ export interface MediaContentProps {
|
|
|
164
172
|
buttons?: ButtonProps[];
|
|
165
173
|
size?: ContentSize;
|
|
166
174
|
}
|
|
167
|
-
export interface MediaBlockProps extends
|
|
175
|
+
export interface MediaBlockProps extends MediaBaseBlockProps {
|
|
168
176
|
media: ThemeSupporting<MediaProps>;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
mediaOnly?: boolean;
|
|
173
|
-
disableShadow?: boolean;
|
|
177
|
+
}
|
|
178
|
+
export interface MapBlockProps extends MediaBaseBlockProps {
|
|
179
|
+
map: MapProps;
|
|
174
180
|
}
|
|
175
181
|
export interface PreviewBlockProps extends Animatable {
|
|
176
182
|
title: string;
|
|
@@ -317,6 +323,9 @@ export type CompaniesBlockModel = {
|
|
|
317
323
|
export type MediaBlockModel = {
|
|
318
324
|
type: BlockType.MediaBlock;
|
|
319
325
|
} & MediaBlockProps;
|
|
326
|
+
export type MapBlockModel = {
|
|
327
|
+
type: BlockType.MapBlock;
|
|
328
|
+
} & MapBlockProps;
|
|
320
329
|
export type PreviewBlockModel = {
|
|
321
330
|
type: BlockType.PreviewBlock;
|
|
322
331
|
} & PreviewBlockProps;
|
|
@@ -353,6 +362,6 @@ export type ContentLayoutBlockModel = {
|
|
|
353
362
|
export type ShareBLockModel = {
|
|
354
363
|
type: BlockType.ShareBlock;
|
|
355
364
|
} & ShareBlockProps;
|
|
356
|
-
type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | SimpleBlockModel | LinkTableBlockModel | HeaderBlockModel | PreviewBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel;
|
|
365
|
+
type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | SimpleBlockModel | LinkTableBlockModel | HeaderBlockModel | PreviewBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel;
|
|
357
366
|
export type Block = BlockModels & BlockBaseProps;
|
|
358
367
|
export {};
|
|
@@ -22,6 +22,7 @@ export var BlockType;
|
|
|
22
22
|
BlockType["CardLayoutBlock"] = "card-layout-block";
|
|
23
23
|
BlockType["ContentLayoutBlock"] = "content-layout-block";
|
|
24
24
|
BlockType["ShareBlock"] = "share-block";
|
|
25
|
+
BlockType["MapBlock"] = "map-block";
|
|
25
26
|
})(BlockType || (BlockType = {}));
|
|
26
27
|
export const BlockTypes = Object.values(BlockType);
|
|
27
28
|
export const HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];
|
|
@@ -186,6 +186,31 @@ export interface MediaComponentDataLensProps {
|
|
|
186
186
|
export interface MediaProps extends Animatable, Partial<MediaComponentDataLensProps>, Partial<MediaComponentYoutubeProps>, Partial<MediaComponentImageProps>, Partial<MediaComponentVideoProps> {
|
|
187
187
|
color?: string;
|
|
188
188
|
}
|
|
189
|
+
export type Coordinate = number[];
|
|
190
|
+
export interface MapBaseProps {
|
|
191
|
+
zoom?: number;
|
|
192
|
+
center?: Coordinate;
|
|
193
|
+
}
|
|
194
|
+
export interface GMapProps extends MapBaseProps {
|
|
195
|
+
address: string;
|
|
196
|
+
}
|
|
197
|
+
export interface YMapProps extends MapBaseProps {
|
|
198
|
+
markers: YMapMarker[];
|
|
199
|
+
id: string;
|
|
200
|
+
center: Coordinate;
|
|
201
|
+
}
|
|
202
|
+
export interface YMapMarker {
|
|
203
|
+
address?: string;
|
|
204
|
+
coordinate?: Coordinate;
|
|
205
|
+
label?: YMapMarkerLabel;
|
|
206
|
+
}
|
|
207
|
+
export interface YMapMarkerLabel {
|
|
208
|
+
iconCaption?: string;
|
|
209
|
+
iconContent?: string;
|
|
210
|
+
iconColor?: string;
|
|
211
|
+
preset?: string;
|
|
212
|
+
}
|
|
213
|
+
export type MapProps = GMapProps | YMapProps;
|
|
189
214
|
export type ThemedMediaProps = ThemeSupporting<MediaProps>;
|
|
190
215
|
export interface NewMetrikaGoal {
|
|
191
216
|
name: string;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
|
-
import { block } from '../../../utils';
|
|
4
3
|
import { NavigationItemType } from '../../../models';
|
|
5
4
|
import SocialIcon from '../SocialIcon/SocialIcon';
|
|
6
5
|
import { NavigationButton } from './components/NavigationButton/NavigationButton';
|
|
7
6
|
import { NavigationDropdown } from './components/NavigationDropdown/NavigationDropdown';
|
|
8
7
|
import { NavigationLink } from './components/NavigationLink/NavigationLink';
|
|
9
8
|
import { GithubStars } from './components/GithubStars/GithubStars';
|
|
10
|
-
import './NavigationItem.css';
|
|
11
|
-
const b = block('navigation-item');
|
|
12
9
|
//todo: add types support form component in map
|
|
13
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
11
|
const NavigationItemsMap = {
|
|
@@ -22,7 +19,7 @@ const NavigationItem = (_a) => {
|
|
|
22
19
|
var { data, className } = _a, props = __rest(_a, ["data", "className"]);
|
|
23
20
|
const { type = NavigationItemType.Link } = data;
|
|
24
21
|
const Component = NavigationItemsMap[type];
|
|
25
|
-
const componentProps = useMemo(() => (Object.assign(Object.assign({ className
|
|
22
|
+
const componentProps = useMemo(() => (Object.assign(Object.assign({ className }, data), props)), [className, data, props]);
|
|
26
23
|
return React.createElement(Component, Object.assign({}, componentProps));
|
|
27
24
|
};
|
|
28
25
|
export default NavigationItem;
|
|
@@ -8,9 +8,9 @@ import './NavigationDropdown.css';
|
|
|
8
8
|
const b = block('navigation-dropdown');
|
|
9
9
|
const TOGGLE_ARROW_SIZE = 12;
|
|
10
10
|
export const NavigationDropdown = (_a) => {
|
|
11
|
-
var { text, icon, isOpened } = _a, props = __rest(_a, ["text", "icon", "isOpened"]);
|
|
11
|
+
var { text, icon, isOpened, className } = _a, props = __rest(_a, ["text", "icon", "isOpened", "className"]);
|
|
12
12
|
const iconData = icon && getMediaImage(icon);
|
|
13
|
-
return (React.createElement("span", Object.assign({}, props),
|
|
13
|
+
return (React.createElement("span", Object.assign({}, props, { className: b(null, className) }),
|
|
14
14
|
React.createElement(ContentWrapper, { text: text, icon: iconData }),
|
|
15
|
-
React.createElement(ToggleArrow, { className: b(), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isOpened })));
|
|
15
|
+
React.createElement(ToggleArrow, { className: b('arrow'), size: TOGGLE_ARROW_SIZE, type: 'vertical', iconType: "navigation", open: isOpened })));
|
|
16
16
|
};
|
package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.css
CHANGED
|
@@ -5,6 +5,10 @@ unpredictable css rules order in build */
|
|
|
5
5
|
color: inherit;
|
|
6
6
|
text-decoration: none;
|
|
7
7
|
outline: none;
|
|
8
|
+
position: relative;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
white-space: nowrap;
|
|
8
12
|
}
|
|
9
13
|
.utilityfocus .pc-navigation-link:focus {
|
|
10
14
|
outline: 2px solid #ffdb4d;
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { validators } from './validators';
|
|
2
|
-
import { TabsBlock, BannerCard, SliderBlock, ExtendedFeaturesBlock, HeaderBlock, BannerBlock, CompaniesBlock, MediaBlock, InfoBlock, QuestionsBlock, SecurityBlock, TableBlock, SimpleBlock, LinkTableBlock, PromoFeaturesBlock, PreviewBlock, ContentLayoutBlock, HeaderSliderBlock, IconsBlock, CardLayoutBlock, ShareBlock, } from './validators/blocks';
|
|
2
|
+
import { TabsBlock, BannerCard, SliderBlock, ExtendedFeaturesBlock, HeaderBlock, BannerBlock, CompaniesBlock, MediaBlock, InfoBlock, QuestionsBlock, SecurityBlock, TableBlock, SimpleBlock, LinkTableBlock, PromoFeaturesBlock, PreviewBlock, ContentLayoutBlock, HeaderSliderBlock, IconsBlock, CardLayoutBlock, ShareBlock, MapBlock, } from './validators/blocks';
|
|
3
3
|
import { PartnerBlock, MediaCardBlock, TutorialCard, BackgroundCard, NewsCard, CardWithImage, PriceDetailedBlock, Quote, Divider, BasicCard, } from './validators/sub-blocks';
|
|
4
4
|
import { AnimatableProps, BackgroundProps, MenuProps, withTheme } from './validators/common';
|
|
5
5
|
import { filteredItem } from './validators/utils';
|
|
@@ -9,7 +9,7 @@ export const getBlocksCases = (blocks) => {
|
|
|
9
9
|
};
|
|
10
10
|
export function generateDefaultSchema(config) {
|
|
11
11
|
const { cards = {}, blocks = {}, extensions = {} } = config !== null && config !== void 0 ? config : {};
|
|
12
|
-
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({}, Divider), ExtendedFeaturesBlock), PromoFeaturesBlock), SliderBlock), QuestionsBlock), HeaderBlock), BannerBlock), CompaniesBlock), MediaBlock), InfoBlock), SecurityBlock), TableBlock), TabsBlock), SimpleBlock), LinkTableBlock), PreviewBlock), HeaderSliderBlock), IconsBlock), CardLayoutBlock), ContentLayoutBlock), ShareBlock);
|
|
12
|
+
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({}, Divider), ExtendedFeaturesBlock), PromoFeaturesBlock), SliderBlock), QuestionsBlock), HeaderBlock), BannerBlock), CompaniesBlock), MediaBlock), MapBlock), InfoBlock), SecurityBlock), TableBlock), TabsBlock), SimpleBlock), LinkTableBlock), PreviewBlock), HeaderSliderBlock), IconsBlock), CardLayoutBlock), ContentLayoutBlock), ShareBlock);
|
|
13
13
|
const cardValidators = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, PartnerBlock), MediaCardBlock), BannerCard), PriceDetailedBlock), TutorialCard), BackgroundCard), NewsCard), CardWithImage), Quote), BasicCard);
|
|
14
14
|
const constructorBlockSchemaNames = [
|
|
15
15
|
'divider',
|
|
@@ -6,6 +6,7 @@ export * from '../../blocks/Simple/schema';
|
|
|
6
6
|
export * from '../../blocks/Header/schema';
|
|
7
7
|
export * from '../../blocks/Info/schema';
|
|
8
8
|
export * from '../../blocks/Media/schema';
|
|
9
|
+
export * from '../../blocks/Map/schema';
|
|
9
10
|
export * from '../../blocks/Questions/schema';
|
|
10
11
|
export * from '../../blocks/Security/schema';
|
|
11
12
|
export * from '../../blocks/Slider/schema';
|
|
@@ -6,6 +6,7 @@ export * from '../../blocks/Simple/schema';
|
|
|
6
6
|
export * from '../../blocks/Header/schema';
|
|
7
7
|
export * from '../../blocks/Info/schema';
|
|
8
8
|
export * from '../../blocks/Media/schema';
|
|
9
|
+
export * from '../../blocks/Map/schema';
|
|
9
10
|
export * from '../../blocks/Questions/schema';
|
|
10
11
|
export * from '../../blocks/Security/schema';
|
|
11
12
|
export * from '../../blocks/Slider/schema';
|