@gravity-ui/page-constructor 1.26.1 → 1.26.2-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 +34 -14
- package/README.md +7 -8
- package/build/cjs/blocks/Map/schema.d.ts +0 -12
- package/build/cjs/blocks/Share/Share.css +12 -11
- package/build/cjs/components/BlockHeader/BlockHeader.css +2 -2
- package/build/cjs/components/Button/Button.d.ts +1 -0
- package/build/cjs/components/Button/Button.js +1 -1
- package/build/cjs/components/Button/__tests__/Button.test.d.ts +1 -0
- package/build/cjs/components/Button/__tests__/Button.test.js +91 -0
- package/build/cjs/components/Button/utils.d.ts +1 -0
- package/build/cjs/components/Button/utils.js +2 -1
- 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 +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/ReactPlayer/utils.js +13 -12
- package/build/cjs/components/Title/Title.css +20 -5
- package/build/cjs/components/Title/Title.d.ts +1 -1
- package/build/cjs/components/Title/Title.js +4 -2
- package/build/cjs/models/constructor-items/common.d.ts +5 -5
- package/build/cjs/navigation/components/Navigation/Navigation.js +7 -6
- package/build/cjs/schema/validators/common.d.ts +0 -6
- package/build/cjs/schema/validators/common.js +0 -4
- package/build/cjs/sub-blocks/BannerCard/BannerCard.css +2 -1
- package/build/cjs/sub-blocks/Content/Content.css +6 -0
- package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +1 -0
- package/build/cjs/utils/blocks.d.ts +1 -1
- package/build/cjs/utils/blocks.js +2 -0
- package/build/esm/blocks/Map/schema.d.ts +0 -12
- package/build/esm/blocks/Share/Share.css +12 -11
- package/build/esm/components/BlockHeader/BlockHeader.css +2 -2
- package/build/esm/components/Button/Button.d.ts +1 -0
- package/build/esm/components/Button/Button.js +2 -2
- package/build/esm/components/Button/__tests__/Button.test.d.ts +1 -0
- package/build/esm/components/Button/__tests__/Button.test.js +88 -0
- package/build/esm/components/Button/utils.d.ts +1 -0
- package/build/esm/components/Button/utils.js +1 -0
- 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 +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/ReactPlayer/utils.js +13 -12
- package/build/esm/components/Title/Title.css +20 -5
- package/build/esm/components/Title/Title.d.ts +1 -1
- package/build/esm/components/Title/Title.js +4 -2
- package/build/esm/models/constructor-items/common.d.ts +5 -5
- package/build/esm/navigation/components/Navigation/Navigation.js +7 -6
- package/build/esm/schema/validators/common.d.ts +0 -6
- package/build/esm/schema/validators/common.js +0 -4
- package/build/esm/sub-blocks/BannerCard/BannerCard.css +2 -1
- package/build/esm/sub-blocks/Content/Content.css +6 -0
- package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +1 -0
- package/build/esm/utils/blocks.d.ts +1 -1
- package/build/esm/utils/blocks.js +2 -0
- package/package.json +7 -6
- package/server/models/constructor-items/common.d.ts +5 -5
- package/server/utils/blocks.d.ts +1 -1
- package/server/utils/blocks.js +2 -0
- package/styles/mixins.scss +9 -7
|
@@ -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,19 +1,20 @@
|
|
|
1
1
|
// the file serves to support live video with react-player@2.9
|
|
2
2
|
const LIVE_YUOTUBE_VIDEO_REGEX = /(?:youtu\.be\/live\/|youtube(?:-nocookie)?\.com\/(?:live\/))((\w|-){11})/;
|
|
3
3
|
const YOUTUBE_VIDEO_TEMPLATE = 'https://www.youtube.com/watch?v=';
|
|
4
|
+
const transformYoutubeUrl = (src) => {
|
|
5
|
+
var _a;
|
|
6
|
+
if (LIVE_YUOTUBE_VIDEO_REGEX.test(src)) {
|
|
7
|
+
const youtubeLiveId = (_a = src.match(LIVE_YUOTUBE_VIDEO_REGEX)) === null || _a === void 0 ? void 0 : _a[1];
|
|
8
|
+
if (!youtubeLiveId) {
|
|
9
|
+
return src;
|
|
10
|
+
}
|
|
11
|
+
return `${YOUTUBE_VIDEO_TEMPLATE}${youtubeLiveId}`;
|
|
12
|
+
}
|
|
13
|
+
return src;
|
|
14
|
+
};
|
|
4
15
|
export const checkYoutubeVideos = (src) => {
|
|
5
16
|
if (Array.isArray(src)) {
|
|
6
|
-
return src.map((videoUrl) =>
|
|
7
|
-
var _a;
|
|
8
|
-
if (LIVE_YUOTUBE_VIDEO_REGEX.test(videoUrl)) {
|
|
9
|
-
const youtubeLiveId = (_a = videoUrl.match(LIVE_YUOTUBE_VIDEO_REGEX)) === null || _a === void 0 ? void 0 : _a[1];
|
|
10
|
-
if (!youtubeLiveId) {
|
|
11
|
-
return videoUrl;
|
|
12
|
-
}
|
|
13
|
-
return `${YOUTUBE_VIDEO_TEMPLATE}${youtubeLiveId}`;
|
|
14
|
-
}
|
|
15
|
-
return videoUrl;
|
|
16
|
-
});
|
|
17
|
+
return src.map((videoUrl) => transformYoutubeUrl(videoUrl));
|
|
17
18
|
}
|
|
18
|
-
return src;
|
|
19
|
+
return transformYoutubeUrl(src);
|
|
19
20
|
};
|
|
@@ -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, .pc-title-block_size_xs {
|
|
2
2
|
margin: 0;
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -10,6 +10,12 @@ 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
|
+
}
|
|
13
19
|
.pc-title-block_size_s {
|
|
14
20
|
font-size: var(--yc-text-header-1-font-size);
|
|
15
21
|
line-height: var(--yc-text-header-1-line-height);
|
|
@@ -44,10 +50,13 @@ unpredictable css rules order in build */
|
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
.pc-title-block__arrow {
|
|
47
|
-
margin:
|
|
53
|
+
margin-top: 10px;
|
|
54
|
+
}
|
|
55
|
+
.pc-title-block__arrow_size_xs {
|
|
56
|
+
margin-top: 7px;
|
|
48
57
|
}
|
|
49
58
|
.pc-title-block__arrow_size_s {
|
|
50
|
-
margin:
|
|
59
|
+
margin-top: 5px;
|
|
51
60
|
}
|
|
52
61
|
.pc-title-block__link {
|
|
53
62
|
color: inherit;
|
|
@@ -62,7 +71,10 @@ unpredictable css rules order in build */
|
|
|
62
71
|
cursor: pointer;
|
|
63
72
|
}
|
|
64
73
|
.pc-title-block__link:hover .pc-title-block__arrow {
|
|
65
|
-
margin-left:
|
|
74
|
+
margin-left: 10px;
|
|
75
|
+
}
|
|
76
|
+
.pc-title-block__link:hover .pc-title-block__arrow_size_xs {
|
|
77
|
+
margin-left: 6px;
|
|
66
78
|
}
|
|
67
79
|
.pc-title-block__link:hover .pc-title-block__arrow_size_s {
|
|
68
80
|
margin-left: 8px;
|
|
@@ -90,7 +102,10 @@ unpredictable css rules order in build */
|
|
|
90
102
|
margin-top: 0;
|
|
91
103
|
}
|
|
92
104
|
@media (max-width: 577px) {
|
|
93
|
-
.pc-title-block_size_l {
|
|
105
|
+
.pc-title-block_size_l:not(.pc-title-block_reset-margin) {
|
|
94
106
|
margin-top: 48px;
|
|
95
107
|
}
|
|
108
|
+
.pc-title-block__arrow_size_m, .pc-title-block__arrow_size_l {
|
|
109
|
+
margin-top: 9px;
|
|
110
|
+
}
|
|
96
111
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TextSize, TitleProps } from '../../models';
|
|
2
2
|
import './Title.css';
|
|
3
|
-
export declare function getArrowSize(size: TextSize, isMobile: boolean): 16 | 20 | 24;
|
|
3
|
+
export declare function getArrowSize(size: TextSize, isMobile: boolean): 16 | 13 | 20 | 24 | 22 | 26 | 38;
|
|
4
4
|
export interface TitleFullProps extends TitleProps {
|
|
5
5
|
className?: string;
|
|
6
6
|
onClick?: () => void;
|
|
@@ -8,12 +8,14 @@ import './Title.css';
|
|
|
8
8
|
const b = block('title-block');
|
|
9
9
|
export function getArrowSize(size, isMobile) {
|
|
10
10
|
switch (size) {
|
|
11
|
+
case 'xs':
|
|
12
|
+
return 13;
|
|
11
13
|
case 's':
|
|
12
14
|
return 16;
|
|
13
15
|
case 'm':
|
|
14
|
-
return isMobile ?
|
|
16
|
+
return isMobile ? 22 : 24;
|
|
15
17
|
case 'l':
|
|
16
|
-
return isMobile ?
|
|
18
|
+
return isMobile ? 26 : 38;
|
|
17
19
|
default:
|
|
18
20
|
return 20;
|
|
19
21
|
}
|
|
@@ -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 = 's' | 'm' | 'l';
|
|
41
|
+
export type TextSize = 'xs' | '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,20 +130,22 @@ 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';
|
|
133
134
|
export interface ButtonProps extends AnalyticsEventsBase {
|
|
134
135
|
text: string;
|
|
135
136
|
url: string;
|
|
136
137
|
primary?: boolean;
|
|
137
138
|
size?: ButtonSize;
|
|
138
|
-
theme?:
|
|
139
|
+
theme?: ButtonTheme;
|
|
139
140
|
img?: ButtonImageProps | string;
|
|
140
141
|
metrikaGoals?: MetrikaGoal;
|
|
141
142
|
pixelEvents?: ButtonPixel;
|
|
142
143
|
target?: string;
|
|
143
144
|
}
|
|
145
|
+
export type ButtonImagePosition = 'left' | 'right';
|
|
144
146
|
export interface ButtonImageProps {
|
|
145
147
|
url: string;
|
|
146
|
-
position?:
|
|
148
|
+
position?: ButtonImagePosition;
|
|
147
149
|
alt?: string;
|
|
148
150
|
}
|
|
149
151
|
export interface PlayButtonProps extends ClassNameProps {
|
|
@@ -189,7 +191,6 @@ export interface MediaProps extends Animatable, Partial<MediaComponentDataLensPr
|
|
|
189
191
|
export type Coordinate = number[];
|
|
190
192
|
export interface MapBaseProps {
|
|
191
193
|
zoom?: number;
|
|
192
|
-
center?: Coordinate;
|
|
193
194
|
}
|
|
194
195
|
export interface GMapProps extends MapBaseProps {
|
|
195
196
|
address: string;
|
|
@@ -197,7 +198,6 @@ export interface GMapProps extends MapBaseProps {
|
|
|
197
198
|
export interface YMapProps extends MapBaseProps {
|
|
198
199
|
markers: YMapMarker[];
|
|
199
200
|
id: string;
|
|
200
|
-
center: Coordinate;
|
|
201
201
|
}
|
|
202
202
|
export interface YMapMarker {
|
|
203
203
|
address?: string;
|
|
@@ -7,6 +7,7 @@ import { ItemColumnName } from '../../constants';
|
|
|
7
7
|
import { NavigationListItem } from '../NavigationListItem/NavigationListItem';
|
|
8
8
|
import './Navigation.css';
|
|
9
9
|
const b = block('navigation');
|
|
10
|
+
const EVENT_HANDLE_DELAY = 100;
|
|
10
11
|
const Navigation = ({ className, onActiveItemChange, links, activeItemId, highlightActiveItem, }) => {
|
|
11
12
|
const { asPath, pathname } = useContext(LocationContext);
|
|
12
13
|
const itemRefs = useRef([]);
|
|
@@ -22,21 +23,21 @@ const Navigation = ({ className, onActiveItemChange, links, activeItemId, highli
|
|
|
22
23
|
}
|
|
23
24
|
}, []);
|
|
24
25
|
useEffect(() => {
|
|
25
|
-
const debouncedCalculateItemPositions = _.debounce(calculateItemPositions,
|
|
26
|
-
const
|
|
26
|
+
const debouncedCalculateItemPositions = _.debounce(calculateItemPositions, EVENT_HANDLE_DELAY);
|
|
27
|
+
const debouncedCalculateOnScroll = _.debounce(() => {
|
|
27
28
|
const curLeftScroll = window.pageXOffset;
|
|
28
29
|
if (curLeftScroll !== lastLeftScroll) {
|
|
29
30
|
setLastLeftScroll(window.pageXOffset);
|
|
30
31
|
calculateItemPositions();
|
|
31
32
|
}
|
|
32
|
-
},
|
|
33
|
+
}, EVENT_HANDLE_DELAY);
|
|
33
34
|
calculateItemPositions();
|
|
34
35
|
setLastLeftScroll(window.pageXOffset);
|
|
35
36
|
window.addEventListener('resize', debouncedCalculateItemPositions);
|
|
36
|
-
window.addEventListener('scroll',
|
|
37
|
+
window.addEventListener('scroll', debouncedCalculateOnScroll);
|
|
37
38
|
return () => {
|
|
38
|
-
window.removeEventListener(`resize`,
|
|
39
|
-
window.removeEventListener('scroll',
|
|
39
|
+
window.removeEventListener(`resize`, debouncedCalculateItemPositions);
|
|
40
|
+
window.removeEventListener('scroll', debouncedCalculateOnScroll);
|
|
40
41
|
};
|
|
41
42
|
}, [calculateItemPositions, itemRefs, lastLeftScroll]);
|
|
42
43
|
useEffect(() => {
|
|
@@ -70,9 +70,10 @@ unpredictable css rules order in build */
|
|
|
70
70
|
font-weight: var(--yc-text-accent-font-weight);
|
|
71
71
|
font-weight: normal;
|
|
72
72
|
}
|
|
73
|
-
.pc-banner-card__button {
|
|
73
|
+
.pc-banner-card__button.pc-banner-card__button {
|
|
74
74
|
margin-top: 28px;
|
|
75
75
|
}
|
|
76
|
+
|
|
76
77
|
.pc-banner-card__image {
|
|
77
78
|
border-top-right-radius: var(--pc-border-radius);
|
|
78
79
|
border-bottom-right-radius: var(--pc-border-radius);
|
|
@@ -31,6 +31,9 @@ unpredictable css rules order in build */
|
|
|
31
31
|
margin-top: 0;
|
|
32
32
|
margin-right: 12px;
|
|
33
33
|
}
|
|
34
|
+
.pc-content__button.pc-content__button:last-child {
|
|
35
|
+
margin-right: 0;
|
|
36
|
+
}
|
|
34
37
|
|
|
35
38
|
.pc-content__links {
|
|
36
39
|
display: flex;
|
|
@@ -41,6 +44,9 @@ unpredictable css rules order in build */
|
|
|
41
44
|
display: block;
|
|
42
45
|
margin-right: 32px;
|
|
43
46
|
}
|
|
47
|
+
.pc-content__link:last-child {
|
|
48
|
+
margin-right: 0;
|
|
49
|
+
}
|
|
44
50
|
.pc-content_centered.pc-content_centered {
|
|
45
51
|
margin: 0 auto;
|
|
46
52
|
text-align: center;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConstructorBlock } from '../models/constructor';
|
|
2
2
|
import { TextSize, CustomConfig, PCShareSocialNetwork } from '../models';
|
|
3
|
-
export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h4";
|
|
3
|
+
export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h4" | "h5";
|
|
4
4
|
export declare function getBlockKey(block: ConstructorBlock, index: number): string;
|
|
5
5
|
export declare const getCustomBlockTypes: ({ blocks, headers }?: CustomConfig) => string[];
|
|
6
6
|
export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomConfig) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.2-alpha.0",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"uuid": "^9.0.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"react": "^16.0.0 || ^17.0.0",
|
|
65
|
-
"@gravity-ui/uikit": "^
|
|
64
|
+
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
65
|
+
"@gravity-ui/uikit": "^4.1.0",
|
|
66
66
|
"@doc-tools/transform": "^2.6.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
@@ -73,19 +73,20 @@
|
|
|
73
73
|
"@gravity-ui/prettier-config": "^1.0.1",
|
|
74
74
|
"@gravity-ui/stylelint-config": "^1.0.0",
|
|
75
75
|
"@gravity-ui/tsconfig": "^1.0.0",
|
|
76
|
-
"@gravity-ui/uikit": "^
|
|
76
|
+
"@gravity-ui/uikit": "^4.1.0",
|
|
77
77
|
"@storybook/addon-actions": "^6.3.12",
|
|
78
78
|
"@storybook/addon-essentials": "^6.5.10",
|
|
79
79
|
"@storybook/addon-knobs": "^6.3.1",
|
|
80
80
|
"@storybook/addon-viewport": "^6.3.12",
|
|
81
81
|
"@storybook/preset-scss": "^1.0.3",
|
|
82
|
-
"@storybook/react": "^6.5.
|
|
82
|
+
"@storybook/react": "^6.5.16",
|
|
83
83
|
"@testing-library/jest-dom": "^5.16.5",
|
|
84
84
|
"@testing-library/react": "^13.4.0",
|
|
85
85
|
"@testing-library/user-event": "^14.4.3",
|
|
86
86
|
"@types/jest": "^29.2.4",
|
|
87
87
|
"@types/lodash": "^4.14.176",
|
|
88
|
-
"@types/react": "^
|
|
88
|
+
"@types/react": "^18.0.27",
|
|
89
|
+
"@types/react-dom": "^18.0.10",
|
|
89
90
|
"@types/react-slick": "^0.23.7",
|
|
90
91
|
"@types/react-transition-group": "^4.4.4",
|
|
91
92
|
"@types/sanitize-html": "^2.6.0",
|
|
@@ -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 = 's' | 'm' | 'l';
|
|
41
|
+
export type TextSize = 'xs' | '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,20 +130,22 @@ 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';
|
|
133
134
|
export interface ButtonProps extends AnalyticsEventsBase {
|
|
134
135
|
text: string;
|
|
135
136
|
url: string;
|
|
136
137
|
primary?: boolean;
|
|
137
138
|
size?: ButtonSize;
|
|
138
|
-
theme?:
|
|
139
|
+
theme?: ButtonTheme;
|
|
139
140
|
img?: ButtonImageProps | string;
|
|
140
141
|
metrikaGoals?: MetrikaGoal;
|
|
141
142
|
pixelEvents?: ButtonPixel;
|
|
142
143
|
target?: string;
|
|
143
144
|
}
|
|
145
|
+
export type ButtonImagePosition = 'left' | 'right';
|
|
144
146
|
export interface ButtonImageProps {
|
|
145
147
|
url: string;
|
|
146
|
-
position?:
|
|
148
|
+
position?: ButtonImagePosition;
|
|
147
149
|
alt?: string;
|
|
148
150
|
}
|
|
149
151
|
export interface PlayButtonProps extends ClassNameProps {
|
|
@@ -189,7 +191,6 @@ export interface MediaProps extends Animatable, Partial<MediaComponentDataLensPr
|
|
|
189
191
|
export type Coordinate = number[];
|
|
190
192
|
export interface MapBaseProps {
|
|
191
193
|
zoom?: number;
|
|
192
|
-
center?: Coordinate;
|
|
193
194
|
}
|
|
194
195
|
export interface GMapProps extends MapBaseProps {
|
|
195
196
|
address: string;
|
|
@@ -197,7 +198,6 @@ export interface GMapProps extends MapBaseProps {
|
|
|
197
198
|
export interface YMapProps extends MapBaseProps {
|
|
198
199
|
markers: YMapMarker[];
|
|
199
200
|
id: string;
|
|
200
|
-
center: Coordinate;
|
|
201
201
|
}
|
|
202
202
|
export interface YMapMarker {
|
|
203
203
|
address?: string;
|
package/server/utils/blocks.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConstructorBlock } from '../models/constructor';
|
|
2
2
|
import { TextSize, CustomConfig, PCShareSocialNetwork } from '../models';
|
|
3
|
-
export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h4";
|
|
3
|
+
export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h4" | "h5";
|
|
4
4
|
export declare function getBlockKey(block: ConstructorBlock, index: number): string;
|
|
5
5
|
export declare const getCustomBlockTypes: ({ blocks, headers }?: CustomConfig) => string[];
|
|
6
6
|
export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomConfig) => {
|
package/server/utils/blocks.js
CHANGED
package/styles/mixins.scss
CHANGED
|
@@ -141,15 +141,17 @@
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
@mixin label($size: m) {
|
|
144
|
-
@
|
|
144
|
+
@if $size == m {
|
|
145
|
+
@include text-size(body-1);
|
|
145
146
|
|
|
146
|
-
|
|
147
|
+
$label-height: 20px;
|
|
147
148
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
149
|
+
display: inline-block;
|
|
150
|
+
padding: 0 8px;
|
|
151
|
+
border-radius: 2px;
|
|
152
|
+
height: $label-height;
|
|
153
|
+
line-height: $label-height;
|
|
154
|
+
}
|
|
153
155
|
|
|
154
156
|
@if $size == s {
|
|
155
157
|
@include text-size(caption-2);
|