@gravity-ui/page-constructor 4.34.1 → 4.36.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/blocks/Table/Table.css +1 -1
- package/build/cjs/blocks/Tabs/Tabs.css +3 -33
- package/build/cjs/blocks/Tabs/Tabs.js +21 -18
- package/build/cjs/blocks/Tabs/TabsTextContent/TabsTextContent.css +20 -0
- package/build/cjs/blocks/Tabs/TabsTextContent/TabsTextContent.d.ts +10 -0
- package/build/cjs/blocks/Tabs/TabsTextContent/TabsTextContent.js +17 -0
- package/build/cjs/components/Control/Control.d.ts +2 -0
- package/build/cjs/components/Control/Control.js +5 -3
- package/build/cjs/components/Image/Image.d.ts +2 -1
- package/build/cjs/components/Image/Image.js +2 -2
- package/build/cjs/components/ImageBase/ImageBase.d.ts +2 -1
- package/build/cjs/components/Media/Image/Image.d.ts +1 -0
- package/build/cjs/components/Media/Image/Image.js +2 -2
- package/build/cjs/components/Media/Media.js +4 -3
- package/build/cjs/components/Table/Table.css +0 -1
- package/build/cjs/components/VideoBlock/VideoBlock.d.ts +1 -0
- package/build/cjs/components/VideoBlock/VideoBlock.js +2 -2
- package/build/esm/blocks/Table/Table.css +1 -1
- package/build/esm/blocks/Tabs/Tabs.css +3 -33
- package/build/esm/blocks/Tabs/Tabs.js +22 -19
- package/build/esm/blocks/Tabs/TabsTextContent/TabsTextContent.css +20 -0
- package/build/esm/blocks/Tabs/TabsTextContent/TabsTextContent.d.ts +11 -0
- package/build/esm/blocks/Tabs/TabsTextContent/TabsTextContent.js +13 -0
- package/build/esm/components/Control/Control.d.ts +2 -0
- package/build/esm/components/Control/Control.js +4 -3
- package/build/esm/components/Image/Image.d.ts +2 -1
- package/build/esm/components/Image/Image.js +3 -3
- package/build/esm/components/ImageBase/ImageBase.d.ts +2 -1
- package/build/esm/components/Media/Image/Image.d.ts +1 -0
- package/build/esm/components/Media/Image/Image.js +2 -2
- package/build/esm/components/Media/Media.js +4 -3
- package/build/esm/components/Table/Table.css +0 -1
- package/build/esm/components/VideoBlock/VideoBlock.d.ts +1 -0
- package/build/esm/components/VideoBlock/VideoBlock.js +2 -2
- package/package.json +1 -1
- package/widget/index.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Fragment, useContext, useState } from 'react';
|
|
1
|
+
import React, { Fragment, useContext, useState, } from 'react';
|
|
2
2
|
import { BREAKPOINTS } from '../../constants';
|
|
3
3
|
import { ProjectSettingsContext } from '../../context/projectSettingsContext';
|
|
4
4
|
import { getQaAttrubutes } from '../../utils';
|
|
@@ -12,7 +12,7 @@ const DeviceSpecificFragment = ({ disableWebp, src, breakpoint, qa, }) => (React
|
|
|
12
12
|
React.createElement("source", { srcSet: src, media: `(max-width: ${breakpoint}px)`, "data-qa": qa })));
|
|
13
13
|
const Image = (props) => {
|
|
14
14
|
const projectSettings = useContext(ProjectSettingsContext);
|
|
15
|
-
const { src: imageSrc, alt, disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName, qa, } = props;
|
|
15
|
+
const { src: imageSrc, alt, disableCompress, tablet, desktop, mobile, style, className, onClick, onLoad, containerClassName, qa, } = props;
|
|
16
16
|
const [imgLoadingError, setImgLoadingError] = useState(false);
|
|
17
17
|
const src = imageSrc || desktop;
|
|
18
18
|
if (!src) {
|
|
@@ -27,6 +27,6 @@ const Image = (props) => {
|
|
|
27
27
|
mobile && (React.createElement(DeviceSpecificFragment, { src: mobile, disableWebp: disableWebp, breakpoint: BREAKPOINTS.sm, qa: qaAttributes.mobileSource })),
|
|
28
28
|
tablet && (React.createElement(DeviceSpecificFragment, { src: tablet, disableWebp: disableWebp, breakpoint: BREAKPOINTS.md, qa: qaAttributes.tabletSource })),
|
|
29
29
|
src && !disableWebp && (React.createElement("source", { srcSet: checkWebP(src), type: "image/webp", "data-qa": qaAttributes.desktopSourceCompressed })),
|
|
30
|
-
React.createElement(ImageBase, { className: className, alt: alt, src: src, style: style, onClick: onClick, onError: () => setImgLoadingError(true) })));
|
|
30
|
+
React.createElement(ImageBase, { className: className, alt: alt, src: src, style: style, onClick: onClick, onError: () => setImgLoadingError(true), onLoad: onLoad })));
|
|
31
31
|
};
|
|
32
32
|
export default Image;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { CSSProperties, MouseEventHandler } from 'react';
|
|
1
|
+
import { CSSProperties, MouseEventHandler, ReactEventHandler } from 'react';
|
|
2
2
|
import { ImageObjectProps } from '../../models';
|
|
3
3
|
export interface ImageBaseProps extends Partial<ImageObjectProps> {
|
|
4
4
|
style?: CSSProperties;
|
|
5
5
|
className?: string;
|
|
6
6
|
onClick?: MouseEventHandler;
|
|
7
|
+
onLoad?: ReactEventHandler<HTMLDivElement>;
|
|
7
8
|
onError?: () => void;
|
|
8
9
|
}
|
|
9
10
|
export declare const ImageBase: (props: ImageBaseProps) => JSX.Element;
|
|
@@ -12,7 +12,7 @@ import './Image.css';
|
|
|
12
12
|
const b = block('media-component-image');
|
|
13
13
|
export const defaultAnimatedDivQa = 'animated-div';
|
|
14
14
|
const Image = (props) => {
|
|
15
|
-
const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video, fullscreen, qa, } = props;
|
|
15
|
+
const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video, fullscreen, qa, handleImageLoad, } = props;
|
|
16
16
|
const qaAttributes = getQaAttrubutes(qa, 'fullscreen-image', 'animate', 'background-image', 'image-view', 'slider-block');
|
|
17
17
|
const [scrollY, setScrollY] = useState(0);
|
|
18
18
|
const [{ springScrollY }, springSetScrollY] = useSpring(() => ({
|
|
@@ -46,7 +46,7 @@ const Image = (props) => {
|
|
|
46
46
|
};
|
|
47
47
|
const imageOnly = (oneImage) => {
|
|
48
48
|
const imageData = getMediaImage(oneImage);
|
|
49
|
-
return (React.createElement(ImageView, Object.assign({}, imageData, { className: imageClass, style: { height }, qa: qaAttributes.imageView })));
|
|
49
|
+
return (React.createElement(ImageView, Object.assign({}, imageData, { className: imageClass, style: { height }, qa: qaAttributes.imageView, onLoad: handleImageLoad })));
|
|
50
50
|
};
|
|
51
51
|
const imageSlider = (imageArray) => {
|
|
52
52
|
const fullscreenItem = fullscreen === undefined || fullscreen;
|
|
@@ -8,13 +8,13 @@ import Video from './Video/Video';
|
|
|
8
8
|
import './Media.css';
|
|
9
9
|
const b = block('Media');
|
|
10
10
|
export const Media = (props) => {
|
|
11
|
-
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, qa, ratio, autoplay, } = props;
|
|
11
|
+
const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, qa, ratio, autoplay, handleImageLoad, } = props;
|
|
12
12
|
const [hasVideoFallback, setHasVideoFallback] = useState(false);
|
|
13
13
|
const qaAttributes = getQaAttrubutes(qa, 'video');
|
|
14
14
|
const content = useMemo(() => {
|
|
15
15
|
let result = [];
|
|
16
16
|
if (image) {
|
|
17
|
-
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullscreen, qa: qaAttributes.image }));
|
|
17
|
+
result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullscreen, qa: qaAttributes.image, handleImageLoad: handleImageLoad }));
|
|
18
18
|
}
|
|
19
19
|
if (video) {
|
|
20
20
|
const videoProps = {
|
|
@@ -40,7 +40,7 @@ export const Media = (props) => {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
if (youtube) {
|
|
43
|
-
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: fullscreen, analyticsEvents: analyticsEvents, autoplay: autoplay }));
|
|
43
|
+
result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: fullscreen, analyticsEvents: analyticsEvents, autoplay: autoplay, handleImageLoad: handleImageLoad }));
|
|
44
44
|
}
|
|
45
45
|
if (dataLens) {
|
|
46
46
|
result = React.createElement(DataLens, { dataLens: dataLens });
|
|
@@ -69,6 +69,7 @@ export const Media = (props) => {
|
|
|
69
69
|
ratio,
|
|
70
70
|
youtubeClassName,
|
|
71
71
|
autoplay,
|
|
72
|
+
handleImageLoad,
|
|
72
73
|
]);
|
|
73
74
|
return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color }, "data-qa": qa }, content));
|
|
74
75
|
};
|
|
@@ -17,6 +17,7 @@ export interface VideoBlockProps extends AnalyticsEventsBase {
|
|
|
17
17
|
height?: number;
|
|
18
18
|
fullscreen?: boolean;
|
|
19
19
|
autoplay?: boolean;
|
|
20
|
+
handleImageLoad?: () => void;
|
|
20
21
|
}
|
|
21
22
|
declare const VideoBlock: (props: VideoBlockProps) => JSX.Element | null;
|
|
22
23
|
export default VideoBlock;
|
|
@@ -37,7 +37,7 @@ export function getHeight(width) {
|
|
|
37
37
|
return (width / 16) * 9;
|
|
38
38
|
}
|
|
39
39
|
const VideoBlock = (props) => {
|
|
40
|
-
const { stream, record, attributes, className, id, previewImg, playButton, height, fullscreen, analyticsEvents, autoplay, } = props;
|
|
40
|
+
const { stream, record, attributes, className, id, previewImg, playButton, height, fullscreen, analyticsEvents, autoplay, handleImageLoad, } = props;
|
|
41
41
|
const handleAnalytics = useAnalytics(DefaultEventNames.VideoPreview);
|
|
42
42
|
const src = getVideoSrc(stream, record);
|
|
43
43
|
const ref = useRef(null);
|
|
@@ -91,7 +91,7 @@ const VideoBlock = (props) => {
|
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
93
|
return (React.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && !fullscreen && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
|
|
94
|
-
React.createElement(Image, { src: previewImg, className: b('image'), containerClassName: b('image-wrapper') }),
|
|
94
|
+
React.createElement(Image, { src: previewImg, className: b('image'), containerClassName: b('image-wrapper'), onLoad: handleImageLoad }),
|
|
95
95
|
playButton || (React.createElement("button", { title: "Play", className: b('button') },
|
|
96
96
|
React.createElement(Icon, { className: b('icon'), data: PlayVideo, size: 24 })))))));
|
|
97
97
|
};
|