@gravity-ui/page-constructor 4.31.1 → 4.33.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/Header/Header.js +6 -2
- package/build/cjs/blocks/Tabs/Tabs.js +8 -1
- package/build/cjs/components/BackLink/BackLink.d.ts +3 -2
- package/build/cjs/components/BackLink/BackLink.js +2 -2
- package/build/cjs/components/Button/Button.d.ts +0 -1
- package/build/cjs/components/DefaultVideo/DefaultVideo.css +5 -0
- package/build/cjs/components/DefaultVideo/DefaultVideo.d.ts +11 -0
- package/build/cjs/components/DefaultVideo/DefaultVideo.js +60 -0
- package/build/cjs/components/FileLink/FileLink.js +2 -2
- package/build/cjs/components/FullscreenImage/FullscreenImage.d.ts +2 -1
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +2 -2
- package/build/cjs/components/Image/Image.js +2 -2
- package/build/cjs/components/Link/Link.js +4 -4
- package/build/cjs/components/Media/Video/Video.css +0 -5
- package/build/cjs/components/Media/Video/Video.js +3 -7
- package/build/cjs/components/Title/Title.d.ts +2 -1
- package/build/cjs/components/Title/Title.js +2 -2
- package/build/cjs/components/Title/TitleItem.css +3 -3
- package/build/cjs/models/constructor-items/blocks.d.ts +2 -0
- package/build/cjs/models/constructor-items/common.d.ts +5 -2
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +5 -2
- package/build/cjs/sub-blocks/Content/Content.js +12 -5
- package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +10 -10
- package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +1 -0
- package/build/cjs/sub-blocks/Quote/Quote.css +0 -2
- package/build/esm/blocks/Header/Header.js +6 -2
- package/build/esm/blocks/Tabs/Tabs.js +8 -1
- package/build/esm/components/BackLink/BackLink.d.ts +3 -2
- package/build/esm/components/BackLink/BackLink.js +2 -2
- package/build/esm/components/Button/Button.d.ts +0 -1
- package/build/esm/components/DefaultVideo/DefaultVideo.css +5 -0
- package/build/esm/components/DefaultVideo/DefaultVideo.d.ts +12 -0
- package/build/esm/components/DefaultVideo/DefaultVideo.js +57 -0
- package/build/esm/components/FileLink/FileLink.js +2 -2
- package/build/esm/components/FullscreenImage/FullscreenImage.d.ts +2 -1
- package/build/esm/components/FullscreenImage/FullscreenImage.js +2 -2
- package/build/esm/components/Image/Image.js +3 -2
- package/build/esm/components/Link/Link.js +4 -4
- package/build/esm/components/Media/Video/Video.css +0 -5
- package/build/esm/components/Media/Video/Video.js +3 -7
- package/build/esm/components/Title/Title.d.ts +2 -1
- package/build/esm/components/Title/Title.js +2 -2
- package/build/esm/components/Title/TitleItem.css +3 -3
- package/build/esm/models/constructor-items/blocks.d.ts +2 -0
- package/build/esm/models/constructor-items/common.d.ts +5 -2
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +5 -2
- package/build/esm/sub-blocks/Content/Content.js +12 -5
- package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +10 -10
- package/build/esm/sub-blocks/LayoutItem/utils.d.ts +1 -0
- package/build/esm/sub-blocks/Quote/Quote.css +0 -2
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +2 -0
- package/server/models/constructor-items/common.d.ts +5 -2
- package/widget/index.js +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { HTMLProps, ReactNode } from 'react';
|
|
2
2
|
import { ButtonSize } from '@gravity-ui/uikit';
|
|
3
3
|
import { Tabbable } from '../../models';
|
|
4
4
|
export type Theme = 'default' | 'special';
|
|
5
|
-
export interface BackLinkProps extends Tabbable {
|
|
5
|
+
export interface BackLinkProps<T = HTMLElement> extends Tabbable {
|
|
6
6
|
url: string;
|
|
7
7
|
title: ReactNode;
|
|
8
8
|
theme?: Theme;
|
|
@@ -10,5 +10,6 @@ export interface BackLinkProps extends Tabbable {
|
|
|
10
10
|
className?: string;
|
|
11
11
|
shouldHandleBackAction?: boolean;
|
|
12
12
|
onClick?: () => void;
|
|
13
|
+
extraProps?: HTMLProps<T>;
|
|
13
14
|
}
|
|
14
15
|
export default function BackLink(props: BackLinkProps): JSX.Element;
|
|
@@ -6,7 +6,7 @@ import { ArrowSidebar } from '../../icons';
|
|
|
6
6
|
import { DefaultEventNames } from '../../models';
|
|
7
7
|
export default function BackLink(props) {
|
|
8
8
|
const { history } = useContext(LocationContext);
|
|
9
|
-
const { url, title, theme = 'default', size = 'l', className, shouldHandleBackAction = false, onClick, tabIndex, } = props;
|
|
9
|
+
const { url, title, theme = 'default', size = 'l', className, shouldHandleBackAction = false, onClick, tabIndex, extraProps, } = props;
|
|
10
10
|
const handleAnalytics = useAnalytics(DefaultEventNames.ShareButton, url);
|
|
11
11
|
const backActionHandler = useCallback(async () => {
|
|
12
12
|
handleAnalytics();
|
|
@@ -23,7 +23,7 @@ export default function BackLink(props) {
|
|
|
23
23
|
history.push({ pathname: url });
|
|
24
24
|
}
|
|
25
25
|
}, [handleAnalytics, history, onClick, url]);
|
|
26
|
-
return (React.createElement(Button, { className: className, view: theme === 'special' ? 'flat-contrast' : 'flat-secondary', size: size, href: shouldHandleBackAction ? undefined : url, onClick: shouldHandleBackAction ? backActionHandler : undefined, tabIndex: tabIndex },
|
|
26
|
+
return (React.createElement(Button, { className: className, view: theme === 'special' ? 'flat-contrast' : 'flat-secondary', size: size, href: shouldHandleBackAction ? undefined : url, onClick: shouldHandleBackAction ? backActionHandler : undefined, tabIndex: tabIndex, extraProps: extraProps },
|
|
27
27
|
React.createElement(Icon, { data: ArrowSidebar, size: 24 }),
|
|
28
28
|
React.createElement("span", null, title)));
|
|
29
29
|
}
|
|
@@ -4,7 +4,6 @@ import './Button.css';
|
|
|
4
4
|
export interface ButtonProps extends Omit<ButtonParams, 'url'>, QAProps {
|
|
5
5
|
className?: string;
|
|
6
6
|
url?: string;
|
|
7
|
-
urlTitle?: string;
|
|
8
7
|
onClick?: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;
|
|
9
8
|
}
|
|
10
9
|
declare const Button: (props: ButtonProps) => JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MediaVideoProps } from '../../models';
|
|
3
|
+
import './DefaultVideo.css';
|
|
4
|
+
type DefaultVideoRefType = HTMLVideoElement | undefined;
|
|
5
|
+
interface DefaultVideoProps {
|
|
6
|
+
video: MediaVideoProps;
|
|
7
|
+
qa?: string;
|
|
8
|
+
customBarControlsClassName?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const DefaultVideo: React.ForwardRefExoticComponent<DefaultVideoProps & React.RefAttributes<DefaultVideoRefType>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { Fragment, useCallback, useImperativeHandle, useRef, useState } from 'react';
|
|
2
|
+
import { CustomControlsType, MediaVideoControlsType } from '../../models';
|
|
3
|
+
import { block } from '../../utils';
|
|
4
|
+
import { getVideoTypesWithPriority } from '../Media/Video/utils';
|
|
5
|
+
import CustomBarControls from '../ReactPlayer/CustomBarControls';
|
|
6
|
+
import './DefaultVideo.css';
|
|
7
|
+
const b = block('default-video');
|
|
8
|
+
export const DefaultVideo = React.forwardRef((props, ref) => {
|
|
9
|
+
const { video, qa, customBarControlsClassName } = props;
|
|
10
|
+
const { controls, customControlsOptions, muted: initiallyMuted } = video;
|
|
11
|
+
const { muteButtonShown, positioning, type: customControlsType, } = customControlsOptions || {};
|
|
12
|
+
const [isPaused, setIsPaused] = useState(false);
|
|
13
|
+
const [isMuted, setIsMuted] = useState(initiallyMuted);
|
|
14
|
+
const videoRef = useRef(null);
|
|
15
|
+
// one may not use this hook and work with `ref` variable only, but
|
|
16
|
+
// in this case one should support both function type and object type,
|
|
17
|
+
// according to ForwardedRef type.
|
|
18
|
+
// Currently used way with extra ref and useImperativeHandle is more
|
|
19
|
+
// convenient and allows us to work with object typed ref only,
|
|
20
|
+
// avoiding typeof ref === 'function' statements
|
|
21
|
+
useImperativeHandle(ref, () => {
|
|
22
|
+
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current)) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return videoRef.current;
|
|
26
|
+
}, [videoRef]);
|
|
27
|
+
const onPlayToggle = useCallback(() => {
|
|
28
|
+
setIsPaused((value) => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
if (value) {
|
|
31
|
+
(_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
(_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
|
|
35
|
+
}
|
|
36
|
+
return !value;
|
|
37
|
+
});
|
|
38
|
+
}, [videoRef]);
|
|
39
|
+
const onMuteToggle = useCallback(() => {
|
|
40
|
+
setIsMuted((value) => !value);
|
|
41
|
+
}, []);
|
|
42
|
+
const onClick = useCallback(() => {
|
|
43
|
+
if (customControlsType === CustomControlsType.WithPlayPauseButton) {
|
|
44
|
+
onPlayToggle();
|
|
45
|
+
}
|
|
46
|
+
}, [onPlayToggle, customControlsType]);
|
|
47
|
+
return (React.createElement(Fragment, null,
|
|
48
|
+
React.createElement("video", { disablePictureInPicture: true, playsInline: true,
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
51
|
+
pip: "false", className: b(), ref: videoRef, preload: "metadata", muted: isMuted, "aria-label": video.ariaLabel, onClick: onClick }, getVideoTypesWithPriority(video.src).map(({ src, type }, index) => (React.createElement("source", { key: index, src: src, type: type, "data-qa": qa })))),
|
|
52
|
+
controls === MediaVideoControlsType.Custom && (React.createElement(CustomBarControls, { className: customBarControlsClassName, type: customControlsType, isPaused: isPaused, onPlayClick: onPlayToggle, muteButtonShown: muteButtonShown, shown: true, positioning: positioning, mute: {
|
|
53
|
+
isMuted: Boolean(isMuted),
|
|
54
|
+
changeMute: onMuteToggle,
|
|
55
|
+
} }))));
|
|
56
|
+
});
|
|
57
|
+
DefaultVideo.displayName = 'DefaultVideo';
|
|
@@ -37,13 +37,13 @@ const LabelSizeMap = {
|
|
|
37
37
|
};
|
|
38
38
|
const FileLink = (props) => {
|
|
39
39
|
const { hostname } = useContext(LocationContext);
|
|
40
|
-
const { href, text, type = 'vertical', textSize = 'm', className, theme = 'default', onClick, tabIndex, urlTitle, } = props;
|
|
40
|
+
const { href, text, type = 'vertical', textSize = 'm', className, theme = 'default', onClick, tabIndex, urlTitle, extraProps, } = props;
|
|
41
41
|
const fileExt = getFileExt(href);
|
|
42
42
|
const labelTheme = (FileExtensionThemes[fileExt] || 'unknown');
|
|
43
43
|
const labelSize = LabelSizeMap[textSize];
|
|
44
44
|
return (React.createElement("div", { className: b({ ext: fileExt, type, size: textSize, theme }, className) },
|
|
45
45
|
React.createElement(Label, { className: b('file-label'), size: labelSize, theme: labelTheme }, fileExt),
|
|
46
46
|
React.createElement("div", { className: b('link') },
|
|
47
|
-
React.createElement("a", Object.assign({ href: href, onClick: onClick, tabIndex: tabIndex, title: urlTitle }, getLinkProps(href, hostname)), text))));
|
|
47
|
+
React.createElement("a", Object.assign({ href: href, onClick: onClick, tabIndex: tabIndex, title: urlTitle }, getLinkProps(href, hostname), extraProps), text))));
|
|
48
48
|
};
|
|
49
49
|
export default FileLink;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
1
|
+
import { CSSProperties, HTMLProps } from 'react';
|
|
2
2
|
import { ImageProps } from '../Image/Image';
|
|
3
3
|
import './FullscreenImage.css';
|
|
4
4
|
export interface FullscreenImageProps extends ImageProps {
|
|
5
5
|
imageClassName?: string;
|
|
6
6
|
modalImageClass?: string;
|
|
7
7
|
imageStyle?: CSSProperties;
|
|
8
|
+
extraProps?: HTMLProps<HTMLDivElement>;
|
|
8
9
|
}
|
|
9
10
|
declare const FullscreenImage: (props: FullscreenImageProps) => JSX.Element;
|
|
10
11
|
export default FullscreenImage;
|
|
@@ -9,11 +9,11 @@ const b = block('fullscreen-image');
|
|
|
9
9
|
const FULL_SCREEN_ICON_SIZE = 18;
|
|
10
10
|
const CLOSE_ICON_SIZE = 30;
|
|
11
11
|
const FullscreenImage = (props) => {
|
|
12
|
-
const { imageClassName, modalImageClass, imageStyle, alt = i18n('img-alt') } = props;
|
|
12
|
+
const { imageClassName, modalImageClass, imageStyle, alt = i18n('img-alt'), extraProps } = props;
|
|
13
13
|
const [isOpened, setIsOpened] = useState(false);
|
|
14
14
|
const openModal = () => setIsOpened(true);
|
|
15
15
|
const closeModal = () => setIsOpened(false);
|
|
16
|
-
return (React.createElement("div", { className: b() },
|
|
16
|
+
return (React.createElement("div", Object.assign({ className: b() }, extraProps),
|
|
17
17
|
React.createElement("div", { className: b('image-wrapper') },
|
|
18
18
|
React.createElement(Image, Object.assign({}, props, { alt: alt, className: b('image', imageClassName), onClick: openModal, style: imageStyle })),
|
|
19
19
|
React.createElement("button", { className: b('icon-wrapper'), onClick: openModal },
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
1
2
|
import React, { Fragment, useContext, useState } from 'react';
|
|
2
3
|
import { BREAKPOINTS } from '../../constants';
|
|
3
4
|
import { ProjectSettingsContext } from '../../context/projectSettingsContext';
|
|
@@ -12,7 +13,7 @@ const DeviceSpecificFragment = ({ disableWebp, src, breakpoint, qa, }) => (React
|
|
|
12
13
|
React.createElement("source", { srcSet: src, media: `(max-width: ${breakpoint}px)`, "data-qa": qa })));
|
|
13
14
|
const Image = (props) => {
|
|
14
15
|
const projectSettings = useContext(ProjectSettingsContext);
|
|
15
|
-
const { src: imageSrc, alt, disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName, qa
|
|
16
|
+
const { src: imageSrc, alt, disableCompress, tablet, desktop, mobile, style, className, onClick, containerClassName, qa } = props, rest = __rest(props, ["src", "alt", "disableCompress", "tablet", "desktop", "mobile", "style", "className", "onClick", "containerClassName", "qa"]);
|
|
16
17
|
const [imgLoadingError, setImgLoadingError] = useState(false);
|
|
17
18
|
const src = imageSrc || desktop;
|
|
18
19
|
if (!src) {
|
|
@@ -27,6 +28,6 @@ const Image = (props) => {
|
|
|
27
28
|
mobile && (React.createElement(DeviceSpecificFragment, { src: mobile, disableWebp: disableWebp, breakpoint: BREAKPOINTS.sm, qa: qaAttributes.mobileSource })),
|
|
28
29
|
tablet && (React.createElement(DeviceSpecificFragment, { src: tablet, disableWebp: disableWebp, breakpoint: BREAKPOINTS.md, qa: qaAttributes.tabletSource })),
|
|
29
30
|
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) })));
|
|
31
|
+
React.createElement(ImageBase, Object.assign({ className: className, alt: alt, src: src, style: style, onClick: onClick, onError: () => setImgLoadingError(true) }, rest))));
|
|
31
32
|
};
|
|
32
33
|
export default Image;
|
|
@@ -26,7 +26,7 @@ function getArrowSize(size) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
const LinkBlock = (props) => {
|
|
29
|
-
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, tabIndex, qa, urlTitle, } = props;
|
|
29
|
+
const { text, url, arrow, metrikaGoals, pixelEvents, analyticsEvents, theme = 'file-link', colorTheme = 'light', textSize = 'm', className, target, children, tabIndex, qa, urlTitle, extraProps, } = props;
|
|
30
30
|
const qaAttributes = getQaAttrubutes(qa, ['normal']);
|
|
31
31
|
const handleMetrika = useMetrika();
|
|
32
32
|
const handleAnalytics = useAnalytics(DefaultEventNames.Link, url);
|
|
@@ -41,14 +41,14 @@ const LinkBlock = (props) => {
|
|
|
41
41
|
const getLinkByType = () => {
|
|
42
42
|
switch (theme) {
|
|
43
43
|
case 'back':
|
|
44
|
-
return (React.createElement(BackLink, { title: children || text, url: href, onClick: onClick, tabIndex: tabIndex }));
|
|
44
|
+
return (React.createElement(BackLink, { title: children || text, url: href, onClick: onClick, tabIndex: tabIndex, extraProps: extraProps }));
|
|
45
45
|
case 'file-link':
|
|
46
46
|
case 'underline':
|
|
47
|
-
return (React.createElement(FileLink, { text: children || text, href: href, type: "horizontal", textSize: textSize, onClick: onClick, tabIndex: tabIndex }));
|
|
47
|
+
return (React.createElement(FileLink, { text: children || text, href: href, type: "horizontal", textSize: textSize, onClick: onClick, tabIndex: tabIndex, extraProps: extraProps }));
|
|
48
48
|
case 'normal': {
|
|
49
49
|
const linkProps = getLinkProps(url, hostname, target);
|
|
50
50
|
const content = children || text;
|
|
51
|
-
return (React.createElement("a", Object.assign({ className: b('link', { theme: colorTheme, 'has-arrow': arrow }), href: href, onClick: onClick, tabIndex: tabIndex, title: urlTitle }, linkProps, { "data-qa": qaAttributes.normal }), arrow ? (React.createElement(Fragment, null,
|
|
51
|
+
return (React.createElement("a", Object.assign({ className: b('link', { theme: colorTheme, 'has-arrow': arrow }), href: href, onClick: onClick, tabIndex: tabIndex, title: urlTitle }, linkProps, { "data-qa": qaAttributes.normal }, extraProps), arrow ? (React.createElement(Fragment, null,
|
|
52
52
|
React.createElement("span", { className: b('content') }, content),
|
|
53
53
|
WORD_JOINER_SYM,
|
|
54
54
|
React.createElement(Icon, { className: b('arrow'), data: Chevron, size: getArrowSize(textSize) }))) : (content)));
|
|
@@ -4,11 +4,6 @@ unpredictable css rules order in build */
|
|
|
4
4
|
position: relative;
|
|
5
5
|
overflow: hidden;
|
|
6
6
|
}
|
|
7
|
-
.pc-media-component-video__item {
|
|
8
|
-
width: 100%;
|
|
9
|
-
display: flex;
|
|
10
|
-
align-items: center;
|
|
11
|
-
}
|
|
12
7
|
.pc-media-component-video__react-player {
|
|
13
8
|
display: flex;
|
|
14
9
|
position: relative;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { MediaVideoType } from '../../../models';
|
|
3
3
|
import { block, getQaAttrubutes } from '../../../utils';
|
|
4
|
+
import { DefaultVideo } from '../../DefaultVideo/DefaultVideo';
|
|
4
5
|
import ReactPlayerBlock from '../../ReactPlayer/ReactPlayer';
|
|
5
|
-
import { getVideoTypesWithPriority } from './utils';
|
|
6
6
|
import './Video.css';
|
|
7
7
|
const b = block('media-component-video');
|
|
8
8
|
const Video = (props) => {
|
|
@@ -45,13 +45,9 @@ const Video = (props) => {
|
|
|
45
45
|
]);
|
|
46
46
|
const defaultVideoBlock = useMemo(() => {
|
|
47
47
|
return video.src.length && !hasVideoFallback ? (React.createElement("div", { className: b('wrap', videoClassName), style: { height }, "data-qa": qaAttributes.default },
|
|
48
|
-
React.createElement(
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
// eslint-disable-next-line react/no-unknown-property
|
|
51
|
-
pip: "false", className: b('item'), ref: ref, preload: "metadata", muted: true, "aria-label": video.ariaLabel }, getVideoTypesWithPriority(video.src).map(({ src, type }, index) => (React.createElement("source", { key: index, src: src, type: type, "data-qa": qaAttributes.source })))))) : null;
|
|
48
|
+
React.createElement(DefaultVideo, { ref: ref, video: video, qa: qaAttributes.source }))) : null;
|
|
52
49
|
}, [
|
|
53
|
-
video
|
|
54
|
-
video.ariaLabel,
|
|
50
|
+
video,
|
|
55
51
|
hasVideoFallback,
|
|
56
52
|
videoClassName,
|
|
57
53
|
height,
|
|
@@ -3,6 +3,7 @@ import { ClassNameProps, TitleProps as TitleParams } from '../../models';
|
|
|
3
3
|
import './Title.css';
|
|
4
4
|
export interface TitleProps extends TitleParams {
|
|
5
5
|
colSizes?: GridColumnSizesType;
|
|
6
|
+
id?: string;
|
|
6
7
|
}
|
|
7
|
-
declare const Title: ({ title, subtitle, className, colSizes, }: TitleProps & ClassNameProps) => JSX.Element | null;
|
|
8
|
+
declare const Title: ({ title, subtitle, className, colSizes, id, }: TitleProps & ClassNameProps) => JSX.Element | null;
|
|
8
9
|
export default Title;
|
|
@@ -6,12 +6,12 @@ import YFMWrapper from '../YFMWrapper/YFMWrapper';
|
|
|
6
6
|
import TitleItem from './TitleItem';
|
|
7
7
|
import './Title.css';
|
|
8
8
|
const b = block('title');
|
|
9
|
-
const Title = ({ title, subtitle, className, colSizes = { all: 12, sm: 8 }, }) => {
|
|
9
|
+
const Title = ({ title, subtitle, className, colSizes = { all: 12, sm: 8 }, id, }) => {
|
|
10
10
|
if (!title && !subtitle) {
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
const _a = !title || typeof title === 'string' ? { text: title } : title, { text } = _a, titleProps = __rest(_a, ["text"]);
|
|
14
|
-
return (React.createElement("div", { className: b(null, className) },
|
|
14
|
+
return (React.createElement("div", { className: b(null, className), id: id },
|
|
15
15
|
text && (React.createElement(Col, { reset: true, sizes: colSizes },
|
|
16
16
|
React.createElement(TitleItem, Object.assign({ text: text }, titleProps)))),
|
|
17
17
|
subtitle && (React.createElement(Col, { reset: true, sizes: colSizes },
|
|
@@ -50,13 +50,13 @@ unpredictable css rules order in build */
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
.pc-title-item__arrow {
|
|
53
|
-
margin-top:
|
|
53
|
+
margin-top: 9px;
|
|
54
54
|
}
|
|
55
55
|
.pc-title-item__arrow_size_xs {
|
|
56
|
-
margin-top:
|
|
56
|
+
margin-top: 6px;
|
|
57
57
|
}
|
|
58
58
|
.pc-title-item__arrow_size_s {
|
|
59
|
-
margin-top:
|
|
59
|
+
margin-top: 4px;
|
|
60
60
|
}
|
|
61
61
|
.pc-title-item__link {
|
|
62
62
|
color: inherit;
|
|
@@ -274,7 +274,9 @@ export interface ContentItemProps {
|
|
|
274
274
|
}
|
|
275
275
|
export interface ContentBlockProps {
|
|
276
276
|
title?: TitleItemBaseProps | string;
|
|
277
|
+
titleId?: string;
|
|
277
278
|
text?: string;
|
|
279
|
+
textId?: string;
|
|
278
280
|
additionalInfo?: string;
|
|
279
281
|
links?: LinkProps[];
|
|
280
282
|
buttons?: ButtonProps[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { CSSProperties, ReactNode } from 'react';
|
|
1
|
+
import React, { CSSProperties, HTMLProps, ReactNode } from 'react';
|
|
2
2
|
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils';
|
|
4
4
|
import { AnalyticsEventsBase, ClassNameProps, PixelEventType, QAProps } from '../common';
|
|
@@ -95,7 +95,7 @@ interface LoopProps {
|
|
|
95
95
|
start: number;
|
|
96
96
|
end?: number;
|
|
97
97
|
}
|
|
98
|
-
export interface ImageInfoProps {
|
|
98
|
+
export interface ImageInfoProps extends Pick<HTMLProps<HTMLImageElement>, 'aria-describedby'> {
|
|
99
99
|
alt?: string;
|
|
100
100
|
disableCompress?: boolean;
|
|
101
101
|
}
|
|
@@ -138,6 +138,7 @@ export interface LinkProps extends AnalyticsEventsBase, Stylable, Tabbable {
|
|
|
138
138
|
target?: string;
|
|
139
139
|
metrikaGoals?: MetrikaGoal;
|
|
140
140
|
pixelEvents?: ButtonPixel;
|
|
141
|
+
extraProps?: HTMLProps<HTMLAnchorElement>;
|
|
141
142
|
}
|
|
142
143
|
export interface FileLinkProps extends ClassNameProps, Tabbable {
|
|
143
144
|
href: string;
|
|
@@ -147,11 +148,13 @@ export interface FileLinkProps extends ClassNameProps, Tabbable {
|
|
|
147
148
|
theme?: ContentTheme;
|
|
148
149
|
urlTitle?: string;
|
|
149
150
|
onClick?: () => void;
|
|
151
|
+
extraProps?: HTMLProps<HTMLAnchorElement>;
|
|
150
152
|
}
|
|
151
153
|
export type ButtonTheme = ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
|
|
152
154
|
export interface ButtonProps extends AnalyticsEventsBase, Pick<UikitButtonProps, 'size' | 'width' | 'extraProps'> {
|
|
153
155
|
text: string;
|
|
154
156
|
url: string;
|
|
157
|
+
urlTitle?: string;
|
|
155
158
|
primary?: boolean;
|
|
156
159
|
theme?: ButtonTheme;
|
|
157
160
|
img?: ButtonImageProps | string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { useUniqId } from '@gravity-ui/uikit';
|
|
3
4
|
import { Content } from '../';
|
|
4
5
|
import CardBase from '../../components/CardBase/CardBase';
|
|
5
6
|
import Image from '../../components/Image/Image';
|
|
@@ -11,10 +12,12 @@ const b = block('basic-card');
|
|
|
11
12
|
const BasicCard = (props) => {
|
|
12
13
|
const { title, text, icon, additionalInfo, links, buttons, iconPosition = IconPosition.Top } = props, cardParams = __rest(props, ["title", "text", "icon", "additionalInfo", "links", "buttons", "iconPosition"]);
|
|
13
14
|
const iconProps = icon && getMediaImage(icon);
|
|
14
|
-
|
|
15
|
+
const titleId = useUniqId();
|
|
16
|
+
const descriptionId = useUniqId();
|
|
17
|
+
return (React.createElement(CardBase, Object.assign({ className: b() }, cardParams, { extraProps: { 'aria-describedby': descriptionId, 'aria-labelledby': titleId } }),
|
|
15
18
|
React.createElement(CardBase.Content, null,
|
|
16
19
|
React.createElement("div", { className: b('content', { ['icon-position']: iconPosition }) },
|
|
17
20
|
iconProps && (React.createElement(Image, Object.assign({}, iconProps, { className: b('icon', { ['icon-position']: iconPosition }) }))),
|
|
18
|
-
React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 }, size: "s", className: b({ ['content-layout']: iconPosition }) })))));
|
|
21
|
+
React.createElement(Content, { title: title, titleId: titleId, text: text, textId: descriptionId, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 }, size: "s", className: b({ ['content-layout']: iconPosition }) })))));
|
|
19
22
|
};
|
|
20
23
|
export default BasicCard;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useUniqId } from '@gravity-ui/uikit';
|
|
2
3
|
import { Button, Title, YFMWrapper } from '../../components';
|
|
3
4
|
import LinkBlock from '../../components/Link/Link';
|
|
4
5
|
import { Col } from '../../grid';
|
|
@@ -35,16 +36,18 @@ function getButtonSize(size) {
|
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
const Content = (props) => {
|
|
38
|
-
const { title, text, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, list, qa, } = props;
|
|
39
|
+
const { title, titleId: titleIdFromProps, text, textId, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, list, qa, } = props;
|
|
39
40
|
const qaAttributes = getQaAttrubutes(qa, ['links', 'link', 'buttons', 'button', 'list']);
|
|
40
41
|
const titleProps = !title || typeof title === 'string'
|
|
41
42
|
? { text: title, textSize: getTextSize(size) }
|
|
42
43
|
: title;
|
|
43
44
|
const hasTitle = Boolean(title);
|
|
45
|
+
const defaultTitleId = useUniqId();
|
|
46
|
+
const titleId = titleIdFromProps || defaultTitleId;
|
|
44
47
|
return (React.createElement(Col, { className: b({ size, centered, theme }, className), reset: true, sizes: colSizes, qa: qaAttributes.container },
|
|
45
|
-
title && React.createElement(Title, { className: b('title'), title: titleProps, colSizes: { all: 12 } }),
|
|
48
|
+
title && (React.createElement(Title, { className: b('title'), title: titleProps, colSizes: { all: 12 }, id: titleId })),
|
|
46
49
|
text && (React.createElement("div", { className: b('text', { ['without-title']: !hasTitle }) },
|
|
47
|
-
React.createElement(YFMWrapper, { content: text, modifiers: { constructor: true, [`constructor-size-${size}`]: true } }))),
|
|
50
|
+
React.createElement(YFMWrapper, { content: text, modifiers: { constructor: true, [`constructor-size-${size}`]: true }, id: textId }))),
|
|
48
51
|
(list === null || list === void 0 ? void 0 : list.length) ? React.createElement(ContentList, { list: list, size: size, qa: qaAttributes.list }) : null,
|
|
49
52
|
additionalInfo && (React.createElement("div", { className: b('notice') },
|
|
50
53
|
React.createElement(YFMWrapper, { content: additionalInfo, modifiers: {
|
|
@@ -52,7 +55,11 @@ const Content = (props) => {
|
|
|
52
55
|
'constructor-notice': true,
|
|
53
56
|
[`constructor-size-${size}`]: true,
|
|
54
57
|
} }))),
|
|
55
|
-
links && (React.createElement("div", { className: b('links'), "data-qa": qaAttributes.links }, links.map((link) => (React.createElement(LinkBlock, Object.assign({ className: b('link') }, link, { textSize: getLinkSize(size), key: link.url, qa: qaAttributes.link
|
|
56
|
-
|
|
58
|
+
links && (React.createElement("div", { className: b('links'), "data-qa": qaAttributes.links }, links.map((link) => (React.createElement(LinkBlock, Object.assign({ className: b('link') }, link, { textSize: getLinkSize(size), key: link.url, qa: qaAttributes.link, extraProps: {
|
|
59
|
+
'aria-describedby': link.urlTitle ? undefined : titleId,
|
|
60
|
+
} })))))),
|
|
61
|
+
buttons && (React.createElement("div", { className: b('buttons'), "data-qa": qaAttributes.buttons }, buttons.map((item) => (React.createElement(Button, Object.assign({ className: b('button') }, item, { key: item.url, size: getButtonSize(size), qa: qaAttributes.button, extraProps: {
|
|
62
|
+
'aria-describedby': item.urlTitle ? undefined : titleId,
|
|
63
|
+
} }))))))));
|
|
57
64
|
};
|
|
58
65
|
export default Content;
|
|
@@ -239,16 +239,6 @@ unpredictable css rules order in build */
|
|
|
239
239
|
font-weight: var(--g-text-body-font-weight);
|
|
240
240
|
margin: 20px 0;
|
|
241
241
|
}
|
|
242
|
-
.pc-hubspot-form .hs-richtext a:focus {
|
|
243
|
-
box-shadow: 0 0 0 2px var(--g-color-line-focus);
|
|
244
|
-
}
|
|
245
|
-
.pc-hubspot-form .hs-richtext a:focus:not(:focus-visible) {
|
|
246
|
-
box-shadow: none;
|
|
247
|
-
}
|
|
248
|
-
.pc-hubspot-form .hs-richtext a:focus {
|
|
249
|
-
outline: 0;
|
|
250
|
-
border-radius: var(--g-focus-border-radius);
|
|
251
|
-
}
|
|
252
242
|
.pc-hubspot-form .hs_error_rollup {
|
|
253
243
|
padding-left: 10px;
|
|
254
244
|
font-size: var(--g-text-body-1-font-size);
|
|
@@ -390,6 +380,16 @@ unpredictable css rules order in build */
|
|
|
390
380
|
.pc-hubspot-form_mobile .hs-button.primary {
|
|
391
381
|
width: 80%;
|
|
392
382
|
}
|
|
383
|
+
.pc-hubspot-form a:focus {
|
|
384
|
+
box-shadow: 0 0 0 2px var(--g-color-line-focus);
|
|
385
|
+
}
|
|
386
|
+
.pc-hubspot-form a:focus:not(:focus-visible) {
|
|
387
|
+
box-shadow: none;
|
|
388
|
+
}
|
|
389
|
+
.pc-hubspot-form a:focus {
|
|
390
|
+
outline: 0;
|
|
391
|
+
border-radius: var(--g-focus-border-radius);
|
|
392
|
+
}
|
|
393
393
|
.pc-hubspot-form_theme_dark {
|
|
394
394
|
--g-color-line-focus: var(--pc-color-line-focus-dark);
|
|
395
395
|
}
|
|
@@ -10,6 +10,7 @@ export declare const getLayoutItemLinks: (links: LayoutItemProps['content']['lin
|
|
|
10
10
|
target?: string | undefined;
|
|
11
11
|
metrikaGoals?: import("../../models").MetrikaGoal | undefined;
|
|
12
12
|
pixelEvents?: import("../../models").ButtonPixel | undefined;
|
|
13
|
+
extraProps?: import("react").HTMLProps<HTMLAnchorElement> | undefined;
|
|
13
14
|
analyticsEvents?: {
|
|
14
15
|
name: string;
|
|
15
16
|
type?: string | undefined;
|
|
@@ -62,7 +62,6 @@ unpredictable css rules order in build */
|
|
|
62
62
|
}
|
|
63
63
|
.pc-quote__content_quote-type_chevron::before {
|
|
64
64
|
position: absolute;
|
|
65
|
-
top: -1px;
|
|
66
65
|
left: -10px;
|
|
67
66
|
content: "«";
|
|
68
67
|
}
|
|
@@ -71,7 +70,6 @@ unpredictable css rules order in build */
|
|
|
71
70
|
}
|
|
72
71
|
.pc-quote__content_quote-type_english-double::before {
|
|
73
72
|
position: absolute;
|
|
74
|
-
top: -1px;
|
|
75
73
|
left: -8px;
|
|
76
74
|
content: "“";
|
|
77
75
|
}
|
package/package.json
CHANGED
|
@@ -274,7 +274,9 @@ export interface ContentItemProps {
|
|
|
274
274
|
}
|
|
275
275
|
export interface ContentBlockProps {
|
|
276
276
|
title?: TitleItemBaseProps | string;
|
|
277
|
+
titleId?: string;
|
|
277
278
|
text?: string;
|
|
279
|
+
textId?: string;
|
|
278
280
|
additionalInfo?: string;
|
|
279
281
|
links?: LinkProps[];
|
|
280
282
|
buttons?: ButtonProps[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { CSSProperties, ReactNode } from 'react';
|
|
1
|
+
import React, { CSSProperties, HTMLProps, ReactNode } from 'react';
|
|
2
2
|
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils';
|
|
4
4
|
import { AnalyticsEventsBase, ClassNameProps, PixelEventType, QAProps } from '../common';
|
|
@@ -95,7 +95,7 @@ interface LoopProps {
|
|
|
95
95
|
start: number;
|
|
96
96
|
end?: number;
|
|
97
97
|
}
|
|
98
|
-
export interface ImageInfoProps {
|
|
98
|
+
export interface ImageInfoProps extends Pick<HTMLProps<HTMLImageElement>, 'aria-describedby'> {
|
|
99
99
|
alt?: string;
|
|
100
100
|
disableCompress?: boolean;
|
|
101
101
|
}
|
|
@@ -138,6 +138,7 @@ export interface LinkProps extends AnalyticsEventsBase, Stylable, Tabbable {
|
|
|
138
138
|
target?: string;
|
|
139
139
|
metrikaGoals?: MetrikaGoal;
|
|
140
140
|
pixelEvents?: ButtonPixel;
|
|
141
|
+
extraProps?: HTMLProps<HTMLAnchorElement>;
|
|
141
142
|
}
|
|
142
143
|
export interface FileLinkProps extends ClassNameProps, Tabbable {
|
|
143
144
|
href: string;
|
|
@@ -147,11 +148,13 @@ export interface FileLinkProps extends ClassNameProps, Tabbable {
|
|
|
147
148
|
theme?: ContentTheme;
|
|
148
149
|
urlTitle?: string;
|
|
149
150
|
onClick?: () => void;
|
|
151
|
+
extraProps?: HTMLProps<HTMLAnchorElement>;
|
|
150
152
|
}
|
|
151
153
|
export type ButtonTheme = ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
|
|
152
154
|
export interface ButtonProps extends AnalyticsEventsBase, Pick<UikitButtonProps, 'size' | 'width' | 'extraProps'> {
|
|
153
155
|
text: string;
|
|
154
156
|
url: string;
|
|
157
|
+
urlTitle?: string;
|
|
155
158
|
primary?: boolean;
|
|
156
159
|
theme?: ButtonTheme;
|
|
157
160
|
img?: ButtonImageProps | string;
|