@gravity-ui/page-constructor 1.26.2-alpha.0 → 1.26.2
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 +17 -30
- package/README.md +8 -7
- package/build/cjs/blocks/Map/schema.d.ts +12 -0
- package/build/cjs/blocks/Share/Share.css +11 -12
- package/build/cjs/components/BlockHeader/BlockHeader.css +2 -2
- package/build/cjs/components/Button/Button.d.ts +0 -1
- package/build/cjs/components/Button/Button.js +1 -1
- package/build/cjs/components/Button/utils.d.ts +0 -1
- package/build/cjs/components/Button/utils.js +1 -2
- package/build/cjs/components/ButtonTabs/ButtonTabs.css +6 -6
- package/build/cjs/components/HTML/HTML.d.ts +1 -1
- package/build/cjs/components/Map/GoogleMap.js +5 -7
- package/build/cjs/components/Map/Map.css +0 -5
- package/build/cjs/components/Map/YMap/YMap.d.ts +2 -4
- package/build/cjs/components/Map/YMap/YMap.js +10 -18
- package/build/cjs/components/Map/YMap/YandexMap.js +9 -18
- package/build/cjs/components/Title/Title.css +5 -20
- package/build/cjs/components/Title/Title.d.ts +1 -1
- package/build/cjs/components/Title/Title.js +2 -4
- package/build/cjs/models/constructor-items/common.d.ts +5 -5
- package/build/cjs/navigation/components/Navigation/Navigation.js +6 -7
- package/build/cjs/schema/validators/common.d.ts +6 -0
- package/build/cjs/schema/validators/common.js +4 -0
- package/build/cjs/sub-blocks/BannerCard/BannerCard.css +1 -2
- package/build/cjs/sub-blocks/Content/Content.css +0 -6
- package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +0 -1
- package/build/cjs/utils/blocks.d.ts +1 -1
- package/build/cjs/utils/blocks.js +0 -2
- package/build/esm/blocks/Map/schema.d.ts +12 -0
- package/build/esm/blocks/Share/Share.css +11 -12
- package/build/esm/components/BlockHeader/BlockHeader.css +2 -2
- package/build/esm/components/Button/Button.d.ts +0 -1
- package/build/esm/components/Button/Button.js +2 -2
- package/build/esm/components/Button/utils.d.ts +0 -1
- package/build/esm/components/Button/utils.js +0 -1
- package/build/esm/components/ButtonTabs/ButtonTabs.css +6 -6
- package/build/esm/components/HTML/HTML.d.ts +1 -1
- package/build/esm/components/Map/GoogleMap.js +5 -7
- package/build/esm/components/Map/Map.css +0 -5
- package/build/esm/components/Map/YMap/YMap.d.ts +2 -4
- package/build/esm/components/Map/YMap/YMap.js +10 -18
- package/build/esm/components/Map/YMap/YandexMap.js +9 -18
- package/build/esm/components/Title/Title.css +5 -20
- package/build/esm/components/Title/Title.d.ts +1 -1
- package/build/esm/components/Title/Title.js +2 -4
- package/build/esm/models/constructor-items/common.d.ts +5 -5
- package/build/esm/navigation/components/Navigation/Navigation.js +6 -7
- package/build/esm/schema/validators/common.d.ts +6 -0
- package/build/esm/schema/validators/common.js +4 -0
- package/build/esm/sub-blocks/BannerCard/BannerCard.css +1 -2
- package/build/esm/sub-blocks/Content/Content.css +0 -6
- package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +0 -1
- package/build/esm/utils/blocks.d.ts +1 -1
- package/build/esm/utils/blocks.js +0 -2
- package/package.json +6 -7
- package/server/models/constructor-items/common.d.ts +5 -5
- package/server/utils/blocks.d.ts +1 -1
- package/server/utils/blocks.js +0 -2
- package/styles/mixins.scss +7 -9
- package/build/cjs/components/Button/__tests__/Button.test.d.ts +0 -1
- package/build/cjs/components/Button/__tests__/Button.test.js +0 -91
- package/build/esm/components/Button/__tests__/Button.test.d.ts +0 -1
- package/build/esm/components/Button/__tests__/Button.test.js +0 -88
package/CHANGELOG.md
CHANGED
|
@@ -1,59 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [
|
|
3
|
+
## [1.26.2](https://github.com/gravity-ui/page-constructor/compare/v1.26.1...v1.26.2) (2023-03-30)
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
###
|
|
6
|
+
### Bug Fixes
|
|
7
7
|
|
|
8
|
-
*
|
|
8
|
+
* **ReactPlayer:** transform youtube url for single video src ([#262](https://github.com/gravity-ui/page-constructor/issues/262)) ([#264](https://github.com/gravity-ui/page-constructor/issues/264)) ([94b6028](https://github.com/gravity-ui/page-constructor/commit/94b60283ebc8f48c2005571c251b0e0bc67fca08))
|
|
9
9
|
|
|
10
|
-
## [
|
|
10
|
+
## [1.26.1](https://github.com/gravity-ui/page-constructor/compare/v1.26.0...v1.26.1) (2023-03-29)
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
### Bug Fixes
|
|
14
14
|
|
|
15
|
-
*
|
|
15
|
+
* add readme about fixes major 1.x.x ([ebcd938](https://github.com/gravity-ui/page-constructor/commit/ebcd9388d3317b2ac8a1fdd97888ca905f66c08e))
|
|
16
16
|
|
|
17
|
-
## [2.1.0](https://github.com/gravity-ui/page-constructor/compare/v2.0.3...v2.1.0) (2023-03-27)
|
|
18
17
|
|
|
18
|
+
### chore
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* **Title:** add size xs ([#207](https://github.com/gravity-ui/page-constructor/issues/207)) ([1fd8cf7](https://github.com/gravity-ui/page-constructor/commit/1fd8cf7aeaf4a6a993a3ffcce576a41d61c3b66b))
|
|
20
|
+
* bump release ([d4fec6b](https://github.com/gravity-ui/page-constructor/commit/d4fec6b6f07b8cb3253979d473cc6503cd87dfdb))
|
|
21
|
+
* bump release ([095fa6c](https://github.com/gravity-ui/page-constructor/commit/095fa6cf8022f9bc2fa6ad555d8d960c16771b29))
|
|
23
22
|
|
|
24
|
-
## [
|
|
23
|
+
## [1.26.0](https://github.com/gravity-ui/page-constructor/compare/v1.25.2...v1.26.0) (2023-03-29)
|
|
25
24
|
|
|
26
25
|
|
|
27
|
-
###
|
|
28
|
-
|
|
29
|
-
* **Tabs:** wrap tabs on desktop ([#237](https://github.com/gravity-ui/page-constructor/issues/237)) ([68dd965](https://github.com/gravity-ui/page-constructor/commit/68dd965b8d5ad9439f8c59211232911695c30fd3))
|
|
26
|
+
### Features
|
|
30
27
|
|
|
31
|
-
|
|
28
|
+
* dropdown a ReactPlayer version ([#254](https://github.com/gravity-ui/page-constructor/issues/254)) ([#257](https://github.com/gravity-ui/page-constructor/issues/257)) ([4fffe1b](https://github.com/gravity-ui/page-constructor/commit/4fffe1b6c88f8bd3d8583606d4d2edf1ab18eafb))
|
|
32
29
|
|
|
33
30
|
|
|
34
31
|
### Bug Fixes
|
|
35
32
|
|
|
36
|
-
* add
|
|
33
|
+
* add tag untagged ([ce9efcf](https://github.com/gravity-ui/page-constructor/commit/ce9efcfc74eaad2cbcf3cf79494f577b0eda09b3))
|
|
34
|
+
* **package:** up version ([#241](https://github.com/gravity-ui/page-constructor/issues/241)) ([9b6d3f2](https://github.com/gravity-ui/page-constructor/commit/9b6d3f2ecace4e1e51c52a4c422aa44850bbefec))
|
|
35
|
+
* remove description and inputs ([000a85e](https://github.com/gravity-ui/page-constructor/commit/000a85ee6d1d9fedb0cef74d990be4065a750efb))
|
|
36
|
+
* try to release version ([6fc35f2](https://github.com/gravity-ui/page-constructor/commit/6fc35f2043097f883b9ad87bb348f73cc138be1e))
|
|
37
37
|
|
|
38
|
-
## [
|
|
38
|
+
## [1.25.3](https://github.com/gravity-ui/page-constructor/compare/v1.25.2...v1.25.3) (2023-03-27)
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
### Bug Fixes
|
|
42
42
|
|
|
43
|
-
*
|
|
44
|
-
* **Navigation:** fix issue with remaining event handler in effect ([#220](https://github.com/gravity-ui/page-constructor/issues/220)) ([d494523](https://github.com/gravity-ui/page-constructor/commit/d4945238ee52f7cca92ea4b092f0701ab4d99693))
|
|
45
|
-
|
|
46
|
-
## [2.0.0](https://github.com/gravity-ui/page-constructor/compare/v1.25.2...v2.0.0) (2023-03-23)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### ⚠ BREAKING CHANGES
|
|
50
|
-
|
|
51
|
-
* update uikit up to 4, update react up to 18([#134](https://github.com/gravity-ui/page-constructor/issues/134)) (#212)
|
|
52
|
-
|
|
53
|
-
### Features
|
|
54
|
-
|
|
55
|
-
* map-block changing the logic of zoom and center ([#219](https://github.com/gravity-ui/page-constructor/issues/219)) ([d332844](https://github.com/gravity-ui/page-constructor/commit/d33284425878cdbfacdf7813826d909e9ab696cb))
|
|
56
|
-
* update uikit up to 4, update react up to 18([#134](https://github.com/gravity-ui/page-constructor/issues/134)) ([#212](https://github.com/gravity-ui/page-constructor/issues/212)) ([377b1f5](https://github.com/gravity-ui/page-constructor/commit/377b1f59c25d08458082232075e2e7bcfe84fe5c))
|
|
43
|
+
* **Tabs:** wrap tabs on desktop ([#237](https://github.com/gravity-ui/page-constructor/issues/237)) ([ac7dd3d](https://github.com/gravity-ui/page-constructor/commit/ac7dd3d3573c6d633d39f88507e2bfeeb41b4f8c))
|
|
57
44
|
|
|
58
45
|
## [1.25.2](https://github.com/gravity-ui/page-constructor/compare/v1.25.1...v1.25.2) (2023-03-21)
|
|
59
46
|
|
package/README.md
CHANGED
|
@@ -306,13 +306,6 @@ In usual cases we use two types of commits:
|
|
|
306
306
|
1. fix: a commit of the type fix patches a bug in your codebase (this correlates with PATCH in Semantic Versioning).
|
|
307
307
|
2. feat: a commit of the type feat introduces a new feature to the codebase (this correlates with MINOR in Semantic Versioning).
|
|
308
308
|
3. BREAKING CHANGE: a commit that has a footer BREAKING CHANGE:, or appends a ! after the type/scope, introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type.
|
|
309
|
-
4. To set release package version manually you need to add `Release-As: <version>` to your commit message e.g.
|
|
310
|
-
|
|
311
|
-
```bash
|
|
312
|
-
git commit -m 'chore: bump release
|
|
313
|
-
|
|
314
|
-
Release-As: 1.2.3'
|
|
315
|
-
```
|
|
316
309
|
|
|
317
310
|
You can see all information [here](https://www.conventionalcommits.org/en/v1.0.0/).
|
|
318
311
|
|
|
@@ -323,3 +316,11 @@ When you receive the approval of your pull-request from the code owners and pass
|
|
|
323
316
|
3. Wait until robot creates a PR with a new version of the package and information about your changes in CHANGELOG.md. You can see the process on [the Actions tab](https://github.com/gravity-ui/page-constructor/actions).
|
|
324
317
|
4. Check your changes in CHANGELOG.md and approve robot's PR.
|
|
325
318
|
5. Squash and merge PR. You can see release process on [the Actions tab](https://github.com/gravity-ui/page-constructor/actions).
|
|
319
|
+
|
|
320
|
+
For now, we have two major version of package. If you want to have your changes in major one (1.x.x) for some reasons, e.g. you aren't ready for major 2.x.x. update, please do the following:
|
|
321
|
+
|
|
322
|
+
1. Create PR wit your changes as you usually do to the branch main.
|
|
323
|
+
2. Release package version in major 2.x.x.
|
|
324
|
+
3. Then you have to fetch a branch `version-1.x.x/fixes` - it is a branch with major 1.x.x and changes which were created after the release version 2.x.x.
|
|
325
|
+
4. Cherry-pick your commit from major 2.x.x to a branch which was released from the branch `version-1.x.x/fixes` and create a PR.
|
|
326
|
+
5. After that you have to follow regular flow above.
|
|
@@ -6,6 +6,12 @@ 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
|
+
};
|
|
9
15
|
address: {
|
|
10
16
|
type: string;
|
|
11
17
|
};
|
|
@@ -64,6 +70,12 @@ export declare const MapBlock: {
|
|
|
64
70
|
zoom: {
|
|
65
71
|
type: string;
|
|
66
72
|
};
|
|
73
|
+
center: {
|
|
74
|
+
type: string;
|
|
75
|
+
items: {
|
|
76
|
+
type: string;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
67
79
|
address: {
|
|
68
80
|
type: string;
|
|
69
81
|
};
|
|
@@ -17,47 +17,46 @@ unpredictable css rules order in build */
|
|
|
17
17
|
justify-content: center;
|
|
18
18
|
margin-top: 16px;
|
|
19
19
|
}
|
|
20
|
-
.pc-share-block__item
|
|
20
|
+
.pc-share-block__item {
|
|
21
21
|
display: flex;
|
|
22
22
|
justify-content: center;
|
|
23
23
|
width: 48px;
|
|
24
24
|
height: 48px;
|
|
25
25
|
border-radius: 100%;
|
|
26
26
|
}
|
|
27
|
-
.pc-share-
|
|
27
|
+
.pc-share-block__item_type_vk {
|
|
28
28
|
background-color: var(--yc-color-vk);
|
|
29
29
|
}
|
|
30
|
-
.pc-share-
|
|
30
|
+
.pc-share-block__item_type_facebook {
|
|
31
31
|
background-color: var(--yc-color-facebook);
|
|
32
32
|
}
|
|
33
|
-
.pc-share-
|
|
33
|
+
.pc-share-block__item_type_twitter {
|
|
34
34
|
background-color: var(--yc-color-twitter);
|
|
35
35
|
}
|
|
36
|
-
.pc-share-
|
|
36
|
+
.pc-share-block__item_type_telegram {
|
|
37
37
|
background-color: var(--yc-color-telegram);
|
|
38
38
|
}
|
|
39
|
-
.pc-share-
|
|
39
|
+
.pc-share-block__item_type_telegram {
|
|
40
40
|
background-color: var(--yc-color-telegram);
|
|
41
41
|
}
|
|
42
|
-
.pc-share-
|
|
42
|
+
.pc-share-block__item_type_linkedin {
|
|
43
43
|
background-color: var(--yc-color-linkedin);
|
|
44
44
|
}
|
|
45
|
-
.pc-share-block__item.pc-share-block__item
|
|
45
|
+
.pc-share-block__item.pc-share-block__item:before {
|
|
46
46
|
border-radius: 100%;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
.pc-share-block__item
|
|
49
|
+
.pc-share-block__item:hover:before {
|
|
50
50
|
/* stylelint-disable-next-line declaration-no-important */
|
|
51
51
|
background-color: var(--yc-color-base-generic) !important;
|
|
52
52
|
border-radius: 100%;
|
|
53
53
|
}
|
|
54
|
-
.pc-share-block__item
|
|
54
|
+
.pc-share-block__item + .pc-share-block__item {
|
|
55
55
|
margin-left: 12px;
|
|
56
56
|
}
|
|
57
|
-
.pc-share-block__item
|
|
57
|
+
.pc-share-block__item svg {
|
|
58
58
|
color: var(--yc-color-base-background);
|
|
59
59
|
}
|
|
60
|
-
|
|
61
60
|
@media (max-width: 577px) {
|
|
62
61
|
.pc-share-block__items {
|
|
63
62
|
flex-wrap: wrap;
|
|
@@ -7,10 +7,10 @@ unpredictable css rules order in build */
|
|
|
7
7
|
font-size: var(--yc-text-body-3-font-size);
|
|
8
8
|
line-height: var(--yc-text-body-3-line-height);
|
|
9
9
|
}
|
|
10
|
-
.pc-block-header__description_titleSize_s
|
|
10
|
+
.pc-block-header__description_titleSize_s {
|
|
11
11
|
margin-top: 8px;
|
|
12
12
|
}
|
|
13
|
-
.pc-block-header__description_titleSize_s .yfm
|
|
13
|
+
.pc-block-header__description_titleSize_s .yfm {
|
|
14
14
|
font-size: var(--yc-text-body-2-font-size);
|
|
15
15
|
line-height: var(--yc-text-body-2-line-height);
|
|
16
16
|
}
|
|
@@ -38,7 +38,7 @@ const Button = (props) => {
|
|
|
38
38
|
let icon;
|
|
39
39
|
let image = img && react_1.default.createElement("img", { className: b('image'), src: buttonImg.url, alt: buttonImg.alt });
|
|
40
40
|
if (theme === 'github') {
|
|
41
|
-
icon = react_1.default.createElement(uikit_1.Icon, { className: b('icon'), data: icons_1.Github, size: 24
|
|
41
|
+
icon = react_1.default.createElement(uikit_1.Icon, { className: b('icon'), data: icons_1.Github, size: 24 });
|
|
42
42
|
image = undefined;
|
|
43
43
|
}
|
|
44
44
|
const buttonTheme = theme === 'scale' ? 'accent' : theme;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ButtonSize, ButtonView } from '@gravity-ui/uikit';
|
|
2
|
-
export declare const ICON_QA = "button-icon";
|
|
3
2
|
export type OldButtonTheme = 'normal' | 'action' | 'flat' | 'light' | 'clear' | 'raised' | 'pseudo' | 'link' | 'accent' | 'websearch' | 'flat-special' | 'normal-special' | 'normal-dark' | 'pseudo-special';
|
|
4
3
|
export type OldButtonSize = 'xs' | 'ns' | 's' | 'm' | 'l' | 'n' | 'head' | 'promo';
|
|
5
4
|
export declare const toCommonView: (theme: OldButtonTheme) => ButtonView;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toCommonSize = exports.toCommonView =
|
|
4
|
-
exports.ICON_QA = 'button-icon';
|
|
3
|
+
exports.toCommonSize = exports.toCommonView = void 0;
|
|
5
4
|
const themeMap = {
|
|
6
5
|
normal: 'normal',
|
|
7
6
|
action: 'action',
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
|
-
.pc-button-tabs__item
|
|
3
|
+
.pc-button-tabs__item {
|
|
4
4
|
margin-right: 8px;
|
|
5
5
|
margin-bottom: 12px;
|
|
6
6
|
--yc-button-background-color: var(--pc-tab-item-background-color);
|
|
7
7
|
--yc-button-background-color-hover: var(--pc-tab-item-background-color-hover);
|
|
8
8
|
}
|
|
9
|
-
.pc-button-tabs__item
|
|
9
|
+
.pc-button-tabs__item, .pc-button-tabs__item:link, .pc-button-tabs__item:visited, .pc-button-tabs__item:active, .pc-button-tabs__item:focus {
|
|
10
10
|
color: var(--pc-tab-item-color);
|
|
11
11
|
}
|
|
12
|
-
.pc-button-tabs__item
|
|
12
|
+
.pc-button-tabs__item:hover {
|
|
13
13
|
color: var(--pc-tab-item-color);
|
|
14
14
|
}
|
|
15
|
-
.pc-button-
|
|
15
|
+
.pc-button-tabs__item_active {
|
|
16
16
|
pointer-events: none;
|
|
17
17
|
--yc-button-background-color: var(--pc-selected-tab-item-background-color);
|
|
18
18
|
--yc-button-background-color-hover: var(--pc-selected-tab-item-background-color-hover);
|
|
19
19
|
}
|
|
20
|
-
.pc-button-
|
|
20
|
+
.pc-button-tabs__item_active, .pc-button-tabs__item_active:link, .pc-button-tabs__item_active:visited, .pc-button-tabs__item_active:active, .pc-button-tabs__item_active:focus {
|
|
21
21
|
color: var(--pc-selected-tab-item-color);
|
|
22
22
|
}
|
|
23
|
-
.pc-button-
|
|
23
|
+
.pc-button-tabs__item_active:hover {
|
|
24
24
|
color: var(--pc-selected-tab-item-color);
|
|
25
25
|
}
|
|
@@ -7,7 +7,7 @@ export interface HTMLProps {
|
|
|
7
7
|
}
|
|
8
8
|
declare const HTML: ({ children, block, className }: WithChildren<HTMLProps>) => React.DetailedReactHTMLElement<{
|
|
9
9
|
dangerouslySetInnerHTML: {
|
|
10
|
-
__html: string
|
|
10
|
+
__html: string & (boolean | React.ReactChild | React.ReactFragment | React.ReactPortal | null);
|
|
11
11
|
};
|
|
12
12
|
className: string | undefined;
|
|
13
13
|
}, HTMLElement> | null;
|
|
@@ -8,20 +8,18 @@ const mapsContext_1 = require("../../context/mapsContext/mapsContext");
|
|
|
8
8
|
const localeContext_1 = require("../../context/localeContext/localeContext");
|
|
9
9
|
const mobileContext_1 = require("../../context/mobileContext");
|
|
10
10
|
const helpers_1 = require("./helpers");
|
|
11
|
-
const configure_1 = require("../../utils/configure");
|
|
12
11
|
const b = (0, utils_1.block)('map');
|
|
13
|
-
function getScriptSrc(
|
|
14
|
-
|
|
15
|
-
return `${scriptSrc}?key=${apiKey}&language=${lang}${zoom ? '&zoom=' + zoom : ''}&q=${encodeURI(address)}`;
|
|
12
|
+
function getScriptSrc(apiKey, scriptSrc, address, lang) {
|
|
13
|
+
return `${scriptSrc}?key=${apiKey}&language=${lang}&q=${encodeURI(address)}`;
|
|
16
14
|
}
|
|
17
15
|
const GoogleMap = (props) => {
|
|
18
|
-
const { address
|
|
16
|
+
const { address } = props;
|
|
19
17
|
const { apiKey, scriptSrc } = (0, react_1.useContext)(mapsContext_1.MapsContext);
|
|
20
|
-
const { lang =
|
|
18
|
+
const { lang = 'ru' } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
21
19
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
22
20
|
const [height, setHeight] = (0, react_1.useState)(undefined);
|
|
23
21
|
const ref = (0, react_1.useRef)(null);
|
|
24
|
-
const src = (0, react_1.useMemo)(() => getScriptSrc(
|
|
22
|
+
const src = (0, react_1.useMemo)(() => getScriptSrc(apiKey, scriptSrc, address, lang), [apiKey, scriptSrc, address, lang]);
|
|
25
23
|
(0, react_1.useEffect)(() => {
|
|
26
24
|
const updateSize = lodash_1.default.debounce(() => {
|
|
27
25
|
if (ref.current) {
|
|
@@ -7,13 +7,9 @@ unpredictable css rules order in build */
|
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
display: flex;
|
|
9
9
|
}
|
|
10
|
-
.pc-map_hidden {
|
|
11
|
-
opacity: 0;
|
|
12
|
-
}
|
|
13
10
|
.pc-map__spinner {
|
|
14
11
|
margin: 0 auto;
|
|
15
12
|
align-self: center;
|
|
16
|
-
position: absolute;
|
|
17
13
|
}
|
|
18
14
|
.pc-map__wrapper {
|
|
19
15
|
min-height: 300px;
|
|
@@ -21,5 +17,4 @@ unpredictable css rules order in build */
|
|
|
21
17
|
flex-direction: column;
|
|
22
18
|
align-items: center;
|
|
23
19
|
justify-content: center;
|
|
24
|
-
position: relative;
|
|
25
20
|
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type PlacemarksProps = Pick<YMapProps, 'zoom' | 'markers'>;
|
|
1
|
+
import { YMapMarker } from '../../../models';
|
|
3
2
|
export declare class YMap {
|
|
4
3
|
private ymap;
|
|
5
4
|
private mapRef;
|
|
6
5
|
private coords;
|
|
7
6
|
constructor(ymap: Ymaps.Map, mapRef: HTMLDivElement | null);
|
|
8
|
-
showPlacemarks(
|
|
7
|
+
showPlacemarks(markers: YMapMarker[]): Promise<void>;
|
|
9
8
|
findAddress(marker: YMapMarker): Promise<void>;
|
|
10
9
|
findCoordinate(marker: YMapMarker): void;
|
|
11
10
|
private drawPlaceMarkStyle;
|
|
12
11
|
private recalcZoomAndCenter;
|
|
13
12
|
private clearOldPlacemarks;
|
|
14
13
|
}
|
|
15
|
-
export {};
|
|
@@ -22,9 +22,9 @@ class YMap {
|
|
|
22
22
|
this.ymap = ymap;
|
|
23
23
|
this.mapRef = mapRef;
|
|
24
24
|
}
|
|
25
|
-
async showPlacemarks(
|
|
25
|
+
async showPlacemarks(markers) {
|
|
26
26
|
this.clearOldPlacemarks();
|
|
27
|
-
for (const marker of
|
|
27
|
+
for (const marker of markers) {
|
|
28
28
|
if (marker.address) {
|
|
29
29
|
await this.findAddress(marker);
|
|
30
30
|
}
|
|
@@ -32,7 +32,7 @@ class YMap {
|
|
|
32
32
|
this.findCoordinate(marker);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
this.recalcZoomAndCenter(
|
|
35
|
+
this.recalcZoomAndCenter();
|
|
36
36
|
}
|
|
37
37
|
async findAddress(marker) {
|
|
38
38
|
try {
|
|
@@ -52,7 +52,10 @@ class YMap {
|
|
|
52
52
|
this.ymap.geoObjects.add(geoObject);
|
|
53
53
|
}
|
|
54
54
|
drawPlaceMarkStyle(geoObject, marker) {
|
|
55
|
-
|
|
55
|
+
if (!marker.label) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const { iconColor, preset = DEFAULT_PLACEMARKS_PRESET } = marker.label;
|
|
56
59
|
let localIconColor = iconColor;
|
|
57
60
|
// You can set the preset option together with the iconColor option only if it not a 'Stretchy' preset
|
|
58
61
|
if (!preset.includes('Stretchy') && !iconColor) {
|
|
@@ -65,10 +68,9 @@ class YMap {
|
|
|
65
68
|
}
|
|
66
69
|
});
|
|
67
70
|
}
|
|
68
|
-
recalcZoomAndCenter(
|
|
71
|
+
recalcZoomAndCenter() {
|
|
69
72
|
var _a, _b;
|
|
70
73
|
const coordsLength = this.coords.length;
|
|
71
|
-
const { zoom = 0 } = props;
|
|
72
74
|
if (!coordsLength) {
|
|
73
75
|
return;
|
|
74
76
|
}
|
|
@@ -77,20 +79,10 @@ class YMap {
|
|
|
77
79
|
leftBottom = [Math.min(leftBottom[0], point[0]), Math.min(leftBottom[1], point[1])];
|
|
78
80
|
rightTop = [Math.max(rightTop[0], point[0]), Math.max(rightTop[1], point[1])];
|
|
79
81
|
});
|
|
80
|
-
|
|
81
|
-
zoom,
|
|
82
|
-
center: [],
|
|
83
|
-
};
|
|
84
|
-
if (zoom) {
|
|
85
|
-
// compute only the center
|
|
86
|
-
newMapParams.center = window.ymaps.util.bounds.getCenter([leftBottom, rightTop]);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
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 });
|
|
90
|
-
}
|
|
82
|
+
const 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 });
|
|
91
83
|
this.ymap.setCenter(newMapParams.center);
|
|
92
84
|
// Use default zoom for one placemark
|
|
93
|
-
if (coordsLength > 1
|
|
85
|
+
if (coordsLength > 1) {
|
|
94
86
|
this.ymap.setZoom(newMapParams.zoom);
|
|
95
87
|
}
|
|
96
88
|
}
|
|
@@ -16,12 +16,8 @@ const helpers_1 = require("../helpers");
|
|
|
16
16
|
const b = (0, utils_1.block)('map');
|
|
17
17
|
const DEFAULT_CONTAINER_ID = 'ymap';
|
|
18
18
|
const DEFAULT_ZOOM = 9;
|
|
19
|
-
// Center - is a required parameter for creating a new map
|
|
20
|
-
// We use this init center to create a map
|
|
21
|
-
// The real center of the map will be calculated later, using the coordinates of the markers
|
|
22
|
-
const INITIAL_CENTER = [0, 0];
|
|
23
19
|
const YandexMap = (props) => {
|
|
24
|
-
const { markers, zoom, id } = props;
|
|
20
|
+
const { markers, zoom, center, id } = props;
|
|
25
21
|
const { apiKey, scriptSrc, nonce } = (0, react_1.useContext)(mapsContext_1.MapsContext);
|
|
26
22
|
const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
|
|
27
23
|
const { lang = 'ru' } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
@@ -30,7 +26,6 @@ const YandexMap = (props) => {
|
|
|
30
26
|
const [height, setHeight] = (0, react_1.useState)(undefined);
|
|
31
27
|
const ref = (0, react_1.useRef)(null);
|
|
32
28
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
33
|
-
const [ready, setReady] = (0, react_1.useState)(false);
|
|
34
29
|
const [attemptsIndex, setAttemptsIndex] = (0, react_1.useState)(0);
|
|
35
30
|
const onTryAgain = (0, react_1.useCallback)(() => {
|
|
36
31
|
setAttemptsIndex(attemptsIndex + 1);
|
|
@@ -38,17 +33,20 @@ const YandexMap = (props) => {
|
|
|
38
33
|
(0, react_1.useEffect)(() => {
|
|
39
34
|
(async function () {
|
|
40
35
|
var _a;
|
|
36
|
+
if (!center) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
41
39
|
setLoading(true);
|
|
42
40
|
await YandexMapApiLoader_1.YMapsApiLoader.loadApi(apiKey, scriptSrc, lang, nonce);
|
|
43
41
|
(_a = window.ymaps) === null || _a === void 0 ? void 0 : _a.ready(() => {
|
|
44
42
|
setYmaps(new YMap_1.YMap(new window.ymaps.Map(containerId, {
|
|
45
|
-
center
|
|
43
|
+
center,
|
|
46
44
|
zoom: zoom || DEFAULT_ZOOM,
|
|
47
45
|
}, { autoFitToViewport: 'always' }), ref.current));
|
|
48
46
|
});
|
|
49
47
|
setLoading(false);
|
|
50
48
|
})();
|
|
51
|
-
}, [apiKey, lang, scriptSrc, containerId, zoom, nonce, attemptsIndex, setLoading]);
|
|
49
|
+
}, [apiKey, lang, scriptSrc, containerId, zoom, center, nonce, attemptsIndex, setLoading]);
|
|
52
50
|
(0, react_1.useEffect)(() => {
|
|
53
51
|
const updateSize = lodash_1.default.debounce(() => {
|
|
54
52
|
if (ref.current) {
|
|
@@ -63,19 +61,12 @@ const YandexMap = (props) => {
|
|
|
63
61
|
}, [markers, ymap, setYmaps, isMobile]);
|
|
64
62
|
(0, react_1.useEffect)(() => {
|
|
65
63
|
if (ymap) {
|
|
66
|
-
|
|
67
|
-
const showPlacemarks = async () => {
|
|
68
|
-
await ymap.showPlacemarks({ markers, zoom });
|
|
69
|
-
setReady(true);
|
|
70
|
-
};
|
|
71
|
-
showPlacemarks();
|
|
64
|
+
ymap.showPlacemarks(markers);
|
|
72
65
|
}
|
|
73
66
|
});
|
|
74
|
-
if (!
|
|
67
|
+
if (!center)
|
|
75
68
|
return null;
|
|
76
69
|
return (react_1.default.createElement(ErrorWrapper_1.default, { isError: YandexMapApiLoader_1.YMapsApiLoader.status === YandexMapApiLoader_1.MapApiStatus.Error, text: (0, i18n_1.default)('map-load-error'), buttonText: (0, i18n_1.default)('map-try-again'), handler: onTryAgain, className: b('wrapper') },
|
|
77
|
-
react_1.default.createElement("div", { className: b('
|
|
78
|
-
react_1.default.createElement("div", { id: containerId, className: b({ hidden: !ready }), ref: ref, style: { height } }),
|
|
79
|
-
loading ? react_1.default.createElement(uikit_1.Spin, { size: "xl", className: b('spinner') }) : null)));
|
|
70
|
+
react_1.default.createElement("div", { id: containerId, className: b(), ref: ref, style: { height } }, loading ? react_1.default.createElement(uikit_1.Spin, { size: "xl", className: b('spinner') }) : null)));
|
|
80
71
|
};
|
|
81
72
|
exports.default = YandexMap;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.pc-title-block_size_l, .pc-title-block_size_m, .pc-title-block_size_s
|
|
1
|
+
.pc-title-block_size_l, .pc-title-block_size_m, .pc-title-block_size_s {
|
|
2
2
|
margin: 0;
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -10,12 +10,6 @@ unpredictable css rules order in build */
|
|
|
10
10
|
.pc-title-block_justify_end {
|
|
11
11
|
text-align: right;
|
|
12
12
|
}
|
|
13
|
-
.pc-title-block_size_xs {
|
|
14
|
-
font-size: var(--yc-text-body-3-font-size);
|
|
15
|
-
line-height: var(--yc-text-body-3-line-height);
|
|
16
|
-
color: var(--pc-text-header-color);
|
|
17
|
-
font-weight: var(--yc-text-accent-font-weight);
|
|
18
|
-
}
|
|
19
13
|
.pc-title-block_size_s {
|
|
20
14
|
font-size: var(--yc-text-header-1-font-size);
|
|
21
15
|
line-height: var(--yc-text-header-1-line-height);
|
|
@@ -50,13 +44,10 @@ unpredictable css rules order in build */
|
|
|
50
44
|
}
|
|
51
45
|
}
|
|
52
46
|
.pc-title-block__arrow {
|
|
53
|
-
margin
|
|
54
|
-
}
|
|
55
|
-
.pc-title-block__arrow_size_xs {
|
|
56
|
-
margin-top: 7px;
|
|
47
|
+
margin: 8px 0 0 4px;
|
|
57
48
|
}
|
|
58
49
|
.pc-title-block__arrow_size_s {
|
|
59
|
-
margin
|
|
50
|
+
margin: 4px 0 0 4px;
|
|
60
51
|
}
|
|
61
52
|
.pc-title-block__link {
|
|
62
53
|
color: inherit;
|
|
@@ -71,10 +62,7 @@ unpredictable css rules order in build */
|
|
|
71
62
|
cursor: pointer;
|
|
72
63
|
}
|
|
73
64
|
.pc-title-block__link:hover .pc-title-block__arrow {
|
|
74
|
-
margin-left:
|
|
75
|
-
}
|
|
76
|
-
.pc-title-block__link:hover .pc-title-block__arrow_size_xs {
|
|
77
|
-
margin-left: 6px;
|
|
65
|
+
margin-left: 12px;
|
|
78
66
|
}
|
|
79
67
|
.pc-title-block__link:hover .pc-title-block__arrow_size_s {
|
|
80
68
|
margin-left: 8px;
|
|
@@ -102,10 +90,7 @@ unpredictable css rules order in build */
|
|
|
102
90
|
margin-top: 0;
|
|
103
91
|
}
|
|
104
92
|
@media (max-width: 577px) {
|
|
105
|
-
.pc-title-block_size_l
|
|
93
|
+
.pc-title-block_size_l {
|
|
106
94
|
margin-top: 48px;
|
|
107
95
|
}
|
|
108
|
-
.pc-title-block__arrow_size_m, .pc-title-block__arrow_size_l {
|
|
109
|
-
margin-top: 9px;
|
|
110
|
-
}
|
|
111
96
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextSize, TitleProps } from '../../models';
|
|
2
|
-
export declare function getArrowSize(size: TextSize, isMobile: boolean): 16 |
|
|
2
|
+
export declare function getArrowSize(size: TextSize, isMobile: boolean): 16 | 20 | 24;
|
|
3
3
|
export interface TitleFullProps extends TitleProps {
|
|
4
4
|
className?: string;
|
|
5
5
|
onClick?: () => void;
|
|
@@ -11,14 +11,12 @@ const mobileContext_1 = require("../../context/mobileContext");
|
|
|
11
11
|
const b = (0, utils_1.block)('title-block');
|
|
12
12
|
function getArrowSize(size, isMobile) {
|
|
13
13
|
switch (size) {
|
|
14
|
-
case 'xs':
|
|
15
|
-
return 13;
|
|
16
14
|
case 's':
|
|
17
15
|
return 16;
|
|
18
16
|
case 'm':
|
|
19
|
-
return isMobile ?
|
|
17
|
+
return isMobile ? 20 : 24;
|
|
20
18
|
case 'l':
|
|
21
|
-
return isMobile ?
|
|
19
|
+
return isMobile ? 20 : 24;
|
|
22
20
|
default:
|
|
23
21
|
return 20;
|
|
24
22
|
}
|
|
@@ -38,7 +38,7 @@ export declare enum MediaVideoControlsType {
|
|
|
38
38
|
Custom = "custom"
|
|
39
39
|
}
|
|
40
40
|
export type TextTheme = 'light' | 'dark';
|
|
41
|
-
export type TextSize = '
|
|
41
|
+
export type TextSize = 's' | 'm' | 'l';
|
|
42
42
|
export type DividerSize = '0' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';
|
|
43
43
|
export type HeaderWidth = 's' | 'm' | 'l';
|
|
44
44
|
export type HeaderImageSize = 's' | 'm';
|
|
@@ -130,22 +130,20 @@ export interface FileLinkProps extends ClassNameProps {
|
|
|
130
130
|
theme?: ContentTheme;
|
|
131
131
|
onClick?: () => void;
|
|
132
132
|
}
|
|
133
|
-
export type ButtonTheme = ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
|
|
134
133
|
export interface ButtonProps extends AnalyticsEventsBase {
|
|
135
134
|
text: string;
|
|
136
135
|
url: string;
|
|
137
136
|
primary?: boolean;
|
|
138
137
|
size?: ButtonSize;
|
|
139
|
-
theme?:
|
|
138
|
+
theme?: ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
|
|
140
139
|
img?: ButtonImageProps | string;
|
|
141
140
|
metrikaGoals?: MetrikaGoal;
|
|
142
141
|
pixelEvents?: ButtonPixel;
|
|
143
142
|
target?: string;
|
|
144
143
|
}
|
|
145
|
-
export type ButtonImagePosition = 'left' | 'right';
|
|
146
144
|
export interface ButtonImageProps {
|
|
147
145
|
url: string;
|
|
148
|
-
position?:
|
|
146
|
+
position?: 'left' | 'right';
|
|
149
147
|
alt?: string;
|
|
150
148
|
}
|
|
151
149
|
export interface PlayButtonProps extends ClassNameProps {
|
|
@@ -191,6 +189,7 @@ export interface MediaProps extends Animatable, Partial<MediaComponentDataLensPr
|
|
|
191
189
|
export type Coordinate = number[];
|
|
192
190
|
export interface MapBaseProps {
|
|
193
191
|
zoom?: number;
|
|
192
|
+
center?: Coordinate;
|
|
194
193
|
}
|
|
195
194
|
export interface GMapProps extends MapBaseProps {
|
|
196
195
|
address: string;
|
|
@@ -198,6 +197,7 @@ export interface GMapProps extends MapBaseProps {
|
|
|
198
197
|
export interface YMapProps extends MapBaseProps {
|
|
199
198
|
markers: YMapMarker[];
|
|
200
199
|
id: string;
|
|
200
|
+
center: Coordinate;
|
|
201
201
|
}
|
|
202
202
|
export interface YMapMarker {
|
|
203
203
|
address?: string;
|