@doyourjob/gravity-ui-page-constructor 5.31.97 → 5.31.100
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/SliderNew/Slider.d.ts +5 -4
- package/build/cjs/blocks/SliderNew/Slider.js +9 -10
- package/build/cjs/blocks/SliderNew/useSlider.d.ts +4 -5
- package/build/cjs/blocks/SliderNew/useSlider.js +6 -5
- package/build/cjs/blocks/SliderNew/useSliderPagination.d.ts +1 -1
- package/build/cjs/components/BackgroundImage/BackgroundImage.css +4 -0
- package/build/cjs/components/BackgroundImage/BackgroundImage.js +5 -2
- package/build/cjs/components/CardBase/CardBase.d.ts +1 -0
- package/build/cjs/components/CardBase/CardBase.js +13 -6
- package/build/cjs/models/constructor-items/common.d.ts +1 -0
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +5 -1
- package/build/cjs/schema/constants.d.ts +178 -26
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.css +7 -0
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +8 -4
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +55 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +1 -1
- package/build/cjs/sub-blocks/Card/Card.css +3 -0
- package/build/cjs/sub-blocks/Card/Card.js +2 -2
- package/build/cjs/sub-blocks/Card/schema.d.ts +3 -0
- package/build/cjs/sub-blocks/Card/schema.js +3 -0
- package/build/cjs/sub-blocks/EventPersonCard/EventPersonCard.css +11 -0
- package/build/cjs/sub-blocks/EventPersonCard/EventPersonCard.js +5 -4
- package/build/cjs/sub-blocks/EventPersonCard/schema.d.ts +60 -13
- package/build/cjs/sub-blocks/EventPersonCard/schema.js +1 -1
- package/build/cjs/sub-blocks/ImageCard/ImageCard.css +10 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.js +8 -4
- package/build/cjs/sub-blocks/ImageCard/schema.d.ts +60 -13
- package/build/cjs/sub-blocks/ImageCard/schema.js +1 -1
- package/build/esm/blocks/SliderNew/Slider.d.ts +5 -4
- package/build/esm/blocks/SliderNew/Slider.js +9 -10
- package/build/esm/blocks/SliderNew/useSlider.d.ts +4 -5
- package/build/esm/blocks/SliderNew/useSlider.js +6 -5
- package/build/esm/blocks/SliderNew/useSliderPagination.d.ts +1 -1
- package/build/esm/components/BackgroundImage/BackgroundImage.css +4 -0
- package/build/esm/components/BackgroundImage/BackgroundImage.js +5 -2
- package/build/esm/components/CardBase/CardBase.d.ts +1 -0
- package/build/esm/components/CardBase/CardBase.js +13 -6
- package/build/esm/models/constructor-items/common.d.ts +1 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +5 -1
- package/build/esm/schema/constants.d.ts +178 -26
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.css +7 -0
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +6 -2
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +55 -0
- package/build/esm/sub-blocks/BackgroundCard/schema.js +1 -1
- package/build/esm/sub-blocks/Card/Card.css +3 -0
- package/build/esm/sub-blocks/Card/Card.js +2 -2
- package/build/esm/sub-blocks/Card/schema.d.ts +3 -0
- package/build/esm/sub-blocks/Card/schema.js +3 -0
- package/build/esm/sub-blocks/EventPersonCard/EventPersonCard.css +11 -0
- package/build/esm/sub-blocks/EventPersonCard/EventPersonCard.js +5 -4
- package/build/esm/sub-blocks/EventPersonCard/schema.d.ts +60 -13
- package/build/esm/sub-blocks/EventPersonCard/schema.js +2 -2
- package/build/esm/sub-blocks/ImageCard/ImageCard.css +10 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.js +8 -4
- package/build/esm/sub-blocks/ImageCard/schema.d.ts +60 -13
- package/build/esm/sub-blocks/ImageCard/schema.js +2 -2
- package/package.json +3 -2
- package/schema/index.js +1 -1
- package/server/models/constructor-items/common.d.ts +1 -0
- package/server/models/constructor-items/sub-blocks.d.ts +5 -1
- package/widget/index.js +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import 'swiper/css';
|
|
3
|
+
import 'swiper/css/autoplay';
|
|
4
|
+
import 'swiper/css/pagination';
|
|
5
|
+
import type { SwiperProps } from 'swiper/react';
|
|
3
6
|
import { ClassNameProps, Refable, SliderProps as SliderParams } from '../../models';
|
|
4
|
-
|
|
5
|
-
export type { Swiper, SwiperOptions } from 'swiper';
|
|
6
|
-
export interface SliderNewProps extends Omit<SliderParams, 'children'>, Partial<Pick<SwiperReact, 'onSlideChange' | 'onSlideChangeTransitionStart' | 'onSlideChangeTransitionEnd' | 'onActiveIndexChange' | 'onBreakpoint'>>, Refable<HTMLDivElement>, ClassNameProps {
|
|
7
|
+
export interface SliderNewProps extends Omit<SliderParams, 'children'>, Partial<Pick<SwiperProps, 'onSlideChange' | 'onSlideChangeTransitionStart' | 'onSlideChangeTransitionEnd' | 'onActiveIndexChange' | 'onBreakpoint'>>, Refable<HTMLDivElement>, ClassNameProps {
|
|
7
8
|
type?: string;
|
|
8
9
|
anchorId?: string;
|
|
9
10
|
dotsClassName?: string;
|
|
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SliderNewBlock = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
|
|
6
|
+
require("swiper/css");
|
|
7
|
+
require("swiper/css/autoplay");
|
|
8
|
+
require("swiper/css/pagination");
|
|
9
|
+
const modules_1 = require("swiper/modules");
|
|
7
10
|
const react_1 = require("swiper/react");
|
|
8
11
|
const Anchor_1 = tslib_1.__importDefault(require("../../components/Anchor/Anchor"));
|
|
9
12
|
const AnimateBlock_1 = tslib_1.__importDefault(require("../../components/AnimateBlock/AnimateBlock"));
|
|
@@ -14,12 +17,9 @@ const Arrow_1 = tslib_1.__importDefault(require("./Arrow/Arrow"));
|
|
|
14
17
|
const i18n_1 = require("./i18n");
|
|
15
18
|
const useSlider_1 = require("./useSlider");
|
|
16
19
|
const useSliderPagination_1 = require("./useSliderPagination");
|
|
17
|
-
require("swiper/swiper-bundle.css");
|
|
18
20
|
const b = (0, utils_1.block)('slider-new-block');
|
|
19
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
20
|
-
swiper_1.default.use([swiper_1.Autoplay, swiper_1.A11y, swiper_1.Pagination]);
|
|
21
21
|
const SliderNewBlock = ({ animated, title, description, type, anchorId, arrows = true, adaptive, autoplay: autoplayMs, infinite = false, dots = true, initialSlide = 0, className, dotsClassName, disclaimer, children, blockClassName, arrowSize, slidesToShow, onSlideChange, onSlideChangeTransitionStart, onSlideChangeTransitionEnd, onActiveIndexChange, onBreakpoint, }) => {
|
|
22
|
-
const { autoplay, isLocked, childrenCount, breakpoints, onSwiper,
|
|
22
|
+
const { autoplay, isLocked, childrenCount, breakpoints, onSwiper, handleSwiperInit, onPrev, onNext, setIsLocked, } = (0, useSlider_1.useSlider)({
|
|
23
23
|
slidesToShow,
|
|
24
24
|
children,
|
|
25
25
|
type,
|
|
@@ -46,14 +46,13 @@ const SliderNewBlock = ({ animated, title, description, type, anchorId, arrows =
|
|
|
46
46
|
anchorId && React.createElement(Anchor_1.default, { id: anchorId }),
|
|
47
47
|
React.createElement(Title_1.default, { title: title, subtitle: description, className: b('header', { 'no-description': !description }) }),
|
|
48
48
|
React.createElement(AnimateBlock_1.default, { className: b('animate-slides'), animate: animated },
|
|
49
|
-
React.createElement(react_1.Swiper, Object.assign({ className: b('slider', className), onSwiper: onSwiper, speed: 700, autoplay: autoplay, loop: infinite, autoHeight: adaptive, initialSlide: initialSlide, noSwiping: false, slidesOffsetBefore: 24, slidesOffsetAfter: 24, breakpoints: breakpoints, onSlideChange: onSlideChange, onSlideChangeTransitionStart: onSlideChangeTransitionStart, onSlideChangeTransitionEnd: onSlideChangeTransitionEnd, onActiveIndexChange: onActiveIndexChange, onBreakpoint: onBreakpoint, onLock: () => setIsLocked(true), onUnlock: () => setIsLocked(false),
|
|
49
|
+
React.createElement(react_1.Swiper, Object.assign({ modules: [modules_1.Autoplay, modules_1.A11y, modules_1.Pagination], className: b('slider', className), onSwiper: onSwiper, speed: 700, autoplay: autoplay, loop: infinite, autoHeight: adaptive, initialSlide: initialSlide, noSwiping: false, slidesOffsetBefore: 24, slidesOffsetAfter: 24, breakpoints: breakpoints, onSlideChange: onSlideChange, onSlideChangeTransitionStart: onSlideChangeTransitionStart, onSlideChangeTransitionEnd: onSlideChangeTransitionEnd, onActiveIndexChange: onActiveIndexChange, onBreakpoint: onBreakpoint, onLock: () => setIsLocked(true), onUnlock: () => setIsLocked(false), onInit: handleSwiperInit, watchSlidesProgress: true, watchOverflow: true, a11y: {
|
|
50
50
|
slideLabelMessage: '',
|
|
51
51
|
paginationBulletMessage: (0, i18n_1.i18n)('dot-label', { index: '{{index}}' }),
|
|
52
52
|
} }, paginationProps), React.Children.map(children, (elem, index) => (React.createElement(react_1.SwiperSlide, { className: b('slide'), key: index }, ({ isVisible }) => (React.createElement("div", { className: b('slide-item'), "aria-hidden": !isA11yControlHidden && !isVisible }, elem)))))),
|
|
53
|
-
arrows && !isLocked && (React.createElement(
|
|
54
|
-
React.createElement(
|
|
55
|
-
|
|
56
|
-
React.createElement(Arrow_1.default, { className: b('arrow', { next: true }), type: "right", transparent: type === models_1.SliderType.HeaderCard, onClick: onNext, size: arrowSize, extraProps: { tabIndex: controlTabIndex } })))),
|
|
53
|
+
arrows && !isLocked && (React.createElement("div", { "aria-hidden": isA11yControlHidden },
|
|
54
|
+
React.createElement(Arrow_1.default, { className: b('arrow', { prev: true }), type: "left", transparent: type === models_1.SliderType.HeaderCard, onClick: onPrev, size: arrowSize, extraProps: { tabIndex: controlTabIndex } }),
|
|
55
|
+
React.createElement(Arrow_1.default, { className: b('arrow', { next: true }), type: "right", transparent: type === models_1.SliderType.HeaderCard, onClick: onNext, size: arrowSize, extraProps: { tabIndex: controlTabIndex } }))),
|
|
57
56
|
React.createElement("div", { className: b('footer') }, disclaimer ? (React.createElement("div", { className: b('disclaimer', { size: (disclaimer === null || disclaimer === void 0 ? void 0 : disclaimer.size) || 'm' }) }, disclaimer === null || disclaimer === void 0 ? void 0 : disclaimer.text)) : null))));
|
|
58
57
|
};
|
|
59
58
|
exports.SliderNewBlock = SliderNewBlock;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { Swiper } from 'swiper';
|
|
3
2
|
import { SlidesToShow } from '../../models';
|
|
4
3
|
type UseSliderProps = React.PropsWithChildren<{
|
|
5
4
|
autoplayMs?: number;
|
|
@@ -7,12 +6,12 @@ type UseSliderProps = React.PropsWithChildren<{
|
|
|
7
6
|
slidesToShow?: SlidesToShow;
|
|
8
7
|
}>;
|
|
9
8
|
export declare const useSlider: ({ children, autoplayMs, type, ...props }: UseSliderProps) => {
|
|
10
|
-
slider:
|
|
11
|
-
onSwiper: React.Dispatch<
|
|
9
|
+
slider: any;
|
|
10
|
+
onSwiper: React.Dispatch<any>;
|
|
12
11
|
onNext: () => void;
|
|
13
12
|
onPrev: () => void;
|
|
14
|
-
|
|
15
|
-
breakpoints: Record<number, import("swiper").SwiperOptions>;
|
|
13
|
+
handleSwiperInit: (swiper: Swiper) => void;
|
|
14
|
+
breakpoints: Record<number, import("swiper/types/swiper-options").SwiperOptions>;
|
|
16
15
|
childrenCount: number;
|
|
17
16
|
isLocked: boolean;
|
|
18
17
|
setIsLocked: React.Dispatch<React.SetStateAction<boolean>>;
|
|
@@ -39,11 +39,12 @@ const useSlider = (_a) => {
|
|
|
39
39
|
}
|
|
40
40
|
slider.slidePrev();
|
|
41
41
|
};
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
const handleSwiperInit = (swiper) => {
|
|
43
|
+
setSlider(swiper);
|
|
44
|
+
setTimeout(() => swiper.update(), 100);
|
|
45
|
+
};
|
|
45
46
|
React.useEffect(() => {
|
|
46
|
-
if (!slider) {
|
|
47
|
+
if (!slider || !slider.autoplay) {
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
if (autoplayEnabled) {
|
|
@@ -58,7 +59,7 @@ const useSlider = (_a) => {
|
|
|
58
59
|
onSwiper: setSlider,
|
|
59
60
|
onNext: handleNext,
|
|
60
61
|
onPrev: handlePrev,
|
|
61
|
-
|
|
62
|
+
handleSwiperInit,
|
|
62
63
|
breakpoints,
|
|
63
64
|
childrenCount,
|
|
64
65
|
isLocked,
|
|
@@ -5,13 +5,16 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
7
|
const Image_1 = tslib_1.__importDefault(require("../Image/Image"));
|
|
8
|
+
const utils_2 = require("../Media/Image/utils");
|
|
8
9
|
exports.qaIdByDefault = 'background-image';
|
|
9
10
|
const b = (0, utils_1.block)('storage-background-image');
|
|
10
11
|
const BackgroundImage = (props) => {
|
|
11
|
-
const { children, src, desktop, className, imageClassName, style, hide, qa } = props;
|
|
12
|
+
const { children, src, desktop, className, hoverImage, imageClassName, style, hide, qa } = props;
|
|
12
13
|
const qaAttributes = (0, utils_1.getQaAttrubutes)(qa || exports.qaIdByDefault);
|
|
13
14
|
return (react_1.default.createElement("div", { className: b(null, className), style: style, "data-qa": qa || exports.qaIdByDefault },
|
|
14
|
-
(src || desktop) && !hide && (react_1.default.createElement(
|
|
15
|
+
(src || desktop) && !hide && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
16
|
+
react_1.default.createElement(Image_1.default, Object.assign({}, props, { className: b('img', imageClassName), qa: qaAttributes.image })),
|
|
17
|
+
hoverImage && (react_1.default.createElement(Image_1.default, Object.assign({}, (0, utils_2.getMediaImage)(hoverImage || ''), { className: b('img', { hover: true }, imageClassName), qa: qaAttributes.image }))))),
|
|
15
18
|
children && react_1.default.createElement("div", { className: b('container') }, children)));
|
|
16
19
|
};
|
|
17
20
|
exports.default = BackgroundImage;
|
|
@@ -14,6 +14,7 @@ export type CardBasePropsType = PropsWithChildren<CardBaseProps>;
|
|
|
14
14
|
export interface CardHeaderBaseProps {
|
|
15
15
|
className?: string;
|
|
16
16
|
image?: ImageProps | null;
|
|
17
|
+
hoverImage?: ImageProps | null;
|
|
17
18
|
imageExtraProps?: React.HTMLAttributes<HTMLImageElement>;
|
|
18
19
|
}
|
|
19
20
|
export interface CardFooterBaseProps {
|
|
@@ -8,6 +8,7 @@ const hooks_1 = require("../../hooks");
|
|
|
8
8
|
const models_1 = require("../../models");
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
const BackgroundImage_1 = tslib_1.__importDefault(require("../BackgroundImage/BackgroundImage"));
|
|
11
|
+
const utils_2 = require("../Media/Image/utils");
|
|
11
12
|
const RouterLink_1 = tslib_1.__importDefault(require("../RouterLink/RouterLink"));
|
|
12
13
|
const b = (0, utils_1.block)('card-base-block');
|
|
13
14
|
const Header = () => null;
|
|
@@ -17,13 +18,14 @@ const Layout = (props) => {
|
|
|
17
18
|
const { className, bodyClassName, analyticsEvents, contentClassName, children, url, target, border = 'shadow', urlTitle, qa, extraProps = {}, } = props;
|
|
18
19
|
const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.CardBase, url);
|
|
19
20
|
const qaAttributes = (0, react_1.useMemo)(() => (0, utils_1.getQaAttrubutes)(qa, 'header', 'footer', 'body', 'content'), [qa]);
|
|
20
|
-
const { header, content, footer, image, imageExtraProps, headerClass, footerClass } = (0, react_1.useMemo)(() => {
|
|
21
|
-
let _header, _content, _footer, _image, _imageExtraProps, _headerClass, _footerClass;
|
|
21
|
+
const { header, content, footer, image, hoverImage, imageExtraProps, headerClass, footerClass } = (0, react_1.useMemo)(() => {
|
|
22
|
+
let _header, _content, _footer, _image, _hoverImage, _imageExtraProps, _headerClass, _footerClass;
|
|
22
23
|
function handleChild(child) {
|
|
23
24
|
switch (child.type) {
|
|
24
25
|
case Header:
|
|
25
26
|
_header = child.props.children;
|
|
26
27
|
_image = child.props.image;
|
|
28
|
+
_hoverImage = child.props.hoverImage;
|
|
27
29
|
_imageExtraProps = child.props.imageExtraProps;
|
|
28
30
|
_headerClass = child.props.className;
|
|
29
31
|
break;
|
|
@@ -46,27 +48,32 @@ const Layout = (props) => {
|
|
|
46
48
|
content: _content,
|
|
47
49
|
footer: _footer,
|
|
48
50
|
image: _image,
|
|
51
|
+
hoverImage: _hoverImage,
|
|
49
52
|
imageExtraProps: _imageExtraProps,
|
|
50
53
|
headerClass: _headerClass,
|
|
51
54
|
footerClass: _footerClass,
|
|
52
55
|
};
|
|
53
56
|
}, [children]);
|
|
54
57
|
const cardContent = (0, react_1.useMemo)(() => (react_1.default.createElement(react_1.Fragment, null,
|
|
55
|
-
(header || image) && (react_1.default.createElement(BackgroundImage_1.default, Object.assign({ className: b('header', headerClass) }, (
|
|
58
|
+
(header || image) && (react_1.default.createElement(BackgroundImage_1.default, Object.assign({ className: b('header', headerClass) }, (0, utils_2.getMediaImage)(image || ''), { hoverImage: hoverImage, extraProps: imageExtraProps, qa: qaAttributes.header }),
|
|
56
59
|
react_1.default.createElement("div", { className: b('header-content') }, header))),
|
|
57
60
|
react_1.default.createElement("div", { className: b('body', bodyClassName), "data-qa": qaAttributes.body },
|
|
58
61
|
react_1.default.createElement("div", { className: b('content', contentClassName), "data-qa": qaAttributes.content }, content),
|
|
59
62
|
footer && (react_1.default.createElement("div", { className: b('footer', footerClass), "data-qa": qaAttributes.footer }, footer))))), [
|
|
60
63
|
header,
|
|
61
|
-
content,
|
|
62
64
|
image,
|
|
63
|
-
imageExtraProps,
|
|
64
65
|
headerClass,
|
|
66
|
+
hoverImage,
|
|
67
|
+
imageExtraProps,
|
|
68
|
+
qaAttributes.header,
|
|
69
|
+
qaAttributes.body,
|
|
70
|
+
qaAttributes.content,
|
|
71
|
+
qaAttributes.footer,
|
|
65
72
|
bodyClassName,
|
|
66
73
|
contentClassName,
|
|
74
|
+
content,
|
|
67
75
|
footer,
|
|
68
76
|
footerClass,
|
|
69
|
-
qaAttributes,
|
|
70
77
|
]);
|
|
71
78
|
const fullClassName = (0, react_1.useMemo)(() => b({ border }, className), [border, className]);
|
|
72
79
|
const onClick = (0, react_1.useCallback)(() => {
|
|
@@ -113,6 +113,7 @@ export interface ImageDeviceProps extends ImageInfoProps {
|
|
|
113
113
|
export type ImageProps = string | ImageObjectProps | ImageDeviceProps;
|
|
114
114
|
export type ThemedImage = ThemeSupporting<ImageProps>;
|
|
115
115
|
export interface BackgroundImageProps extends React.HTMLProps<HTMLDivElement>, Partial<ImageDeviceProps>, Partial<ImageObjectProps>, QAProps {
|
|
116
|
+
hoverImage?: ImageProps;
|
|
116
117
|
style?: CSSProperties;
|
|
117
118
|
imageClassName?: string;
|
|
118
119
|
hide?: boolean;
|
|
@@ -104,6 +104,7 @@ export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase,
|
|
|
104
104
|
urlTitle?: string;
|
|
105
105
|
target?: string;
|
|
106
106
|
background?: ThemeSupporting<ImageObjectProps>;
|
|
107
|
+
hoverBackground?: ThemeSupporting<ImageObjectProps>;
|
|
107
108
|
backgroundPosition?: 'left' | 'right' | 'center' | 'top' | 'bottom';
|
|
108
109
|
paddingBottom?: 's' | 'm' | 'l' | 'xl';
|
|
109
110
|
backgroundColor?: string;
|
|
@@ -119,8 +120,9 @@ export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, Card
|
|
|
119
120
|
}
|
|
120
121
|
export interface CardProps extends CardBaseProps, Pick<ContentBlockProps, 'summary' | 'text'> {
|
|
121
122
|
header: {
|
|
122
|
-
image: string;
|
|
123
123
|
title: string;
|
|
124
|
+
image: string;
|
|
125
|
+
hoverImage?: string;
|
|
124
126
|
};
|
|
125
127
|
service?: ServiceLabelProps;
|
|
126
128
|
label?: TagProps;
|
|
@@ -173,6 +175,7 @@ export interface LayoutItemProps extends ClassNameProps, CardLayoutProps, Analyt
|
|
|
173
175
|
}
|
|
174
176
|
export interface ImageCardProps extends CardBaseProps, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'controlPosition'> {
|
|
175
177
|
image: ThemeSupporting<ImageProps>;
|
|
178
|
+
hoverImage: ThemeSupporting<ImageProps>;
|
|
176
179
|
enableImageBorderRadius?: boolean;
|
|
177
180
|
margins?: ImageCardMargins;
|
|
178
181
|
direction?: ImageCardDirection;
|
|
@@ -249,6 +252,7 @@ export interface CaseStudyCardProps {
|
|
|
249
252
|
}
|
|
250
253
|
export interface EventPersonCardProps {
|
|
251
254
|
image: ThemeSupporting<ImageProps>;
|
|
255
|
+
hoverImage?: ThemeSupporting<ImageProps>;
|
|
252
256
|
title?: TitleItemBaseProps | string;
|
|
253
257
|
subtitle?: string;
|
|
254
258
|
text?: string;
|
|
@@ -465,30 +465,77 @@ export declare const cardSchemas: {
|
|
|
465
465
|
enum: string[];
|
|
466
466
|
};
|
|
467
467
|
image: {
|
|
468
|
-
oneOf: ({
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
468
|
+
oneOf: (({
|
|
469
|
+
oneOf: ({
|
|
470
|
+
type: string;
|
|
471
|
+
properties: {
|
|
472
|
+
when: {
|
|
473
|
+
type: string;
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
} | {
|
|
477
|
+
type: string;
|
|
478
|
+
pattern: string;
|
|
479
|
+
optionName: string;
|
|
480
|
+
items?: undefined;
|
|
481
|
+
} | {
|
|
482
|
+
type: string;
|
|
483
|
+
items: {
|
|
472
484
|
type: string;
|
|
485
|
+
properties: {
|
|
486
|
+
when: {
|
|
487
|
+
type: string;
|
|
488
|
+
};
|
|
489
|
+
};
|
|
473
490
|
};
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
491
|
+
optionName: string;
|
|
492
|
+
pattern?: undefined;
|
|
493
|
+
})[];
|
|
494
|
+
} & {
|
|
478
495
|
optionName: string;
|
|
479
|
-
|
|
480
|
-
} | {
|
|
496
|
+
}) | {
|
|
481
497
|
type: string;
|
|
482
|
-
|
|
498
|
+
additionalProperties: boolean;
|
|
499
|
+
required: import("../models").Theme[];
|
|
500
|
+
properties: {};
|
|
501
|
+
optionName: string;
|
|
502
|
+
})[];
|
|
503
|
+
};
|
|
504
|
+
hoverImage: {
|
|
505
|
+
oneOf: (({
|
|
506
|
+
oneOf: ({
|
|
483
507
|
type: string;
|
|
484
508
|
properties: {
|
|
485
509
|
when: {
|
|
486
510
|
type: string;
|
|
487
511
|
};
|
|
488
512
|
};
|
|
489
|
-
}
|
|
513
|
+
} | {
|
|
514
|
+
type: string;
|
|
515
|
+
pattern: string;
|
|
516
|
+
optionName: string;
|
|
517
|
+
items?: undefined;
|
|
518
|
+
} | {
|
|
519
|
+
type: string;
|
|
520
|
+
items: {
|
|
521
|
+
type: string;
|
|
522
|
+
properties: {
|
|
523
|
+
when: {
|
|
524
|
+
type: string;
|
|
525
|
+
};
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
optionName: string;
|
|
529
|
+
pattern?: undefined;
|
|
530
|
+
})[];
|
|
531
|
+
} & {
|
|
532
|
+
optionName: string;
|
|
533
|
+
}) | {
|
|
534
|
+
type: string;
|
|
535
|
+
additionalProperties: boolean;
|
|
536
|
+
required: import("../models").Theme[];
|
|
537
|
+
properties: {};
|
|
490
538
|
optionName: string;
|
|
491
|
-
pattern?: undefined;
|
|
492
539
|
})[];
|
|
493
540
|
};
|
|
494
541
|
type: {};
|
|
@@ -583,6 +630,9 @@ export declare const cardSchemas: {
|
|
|
583
630
|
image: {
|
|
584
631
|
type: string;
|
|
585
632
|
};
|
|
633
|
+
hoverImage: {
|
|
634
|
+
type: string;
|
|
635
|
+
};
|
|
586
636
|
title: {
|
|
587
637
|
type: string;
|
|
588
638
|
};
|
|
@@ -1200,30 +1250,77 @@ export declare const cardSchemas: {
|
|
|
1200
1250
|
required: string[];
|
|
1201
1251
|
properties: {
|
|
1202
1252
|
image: {
|
|
1203
|
-
oneOf: ({
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1253
|
+
oneOf: (({
|
|
1254
|
+
oneOf: ({
|
|
1255
|
+
type: string;
|
|
1256
|
+
properties: {
|
|
1257
|
+
when: {
|
|
1258
|
+
type: string;
|
|
1259
|
+
};
|
|
1260
|
+
};
|
|
1261
|
+
} | {
|
|
1262
|
+
type: string;
|
|
1263
|
+
pattern: string;
|
|
1264
|
+
optionName: string;
|
|
1265
|
+
items?: undefined;
|
|
1266
|
+
} | {
|
|
1267
|
+
type: string;
|
|
1268
|
+
items: {
|
|
1207
1269
|
type: string;
|
|
1270
|
+
properties: {
|
|
1271
|
+
when: {
|
|
1272
|
+
type: string;
|
|
1273
|
+
};
|
|
1274
|
+
};
|
|
1208
1275
|
};
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1276
|
+
optionName: string;
|
|
1277
|
+
pattern?: undefined;
|
|
1278
|
+
})[];
|
|
1279
|
+
} & {
|
|
1213
1280
|
optionName: string;
|
|
1214
|
-
|
|
1215
|
-
} | {
|
|
1281
|
+
}) | {
|
|
1216
1282
|
type: string;
|
|
1217
|
-
|
|
1283
|
+
additionalProperties: boolean;
|
|
1284
|
+
required: import("../models").Theme[];
|
|
1285
|
+
properties: {};
|
|
1286
|
+
optionName: string;
|
|
1287
|
+
})[];
|
|
1288
|
+
};
|
|
1289
|
+
hoverImage: {
|
|
1290
|
+
oneOf: (({
|
|
1291
|
+
oneOf: ({
|
|
1218
1292
|
type: string;
|
|
1219
1293
|
properties: {
|
|
1220
1294
|
when: {
|
|
1221
1295
|
type: string;
|
|
1222
1296
|
};
|
|
1223
1297
|
};
|
|
1224
|
-
}
|
|
1298
|
+
} | {
|
|
1299
|
+
type: string;
|
|
1300
|
+
pattern: string;
|
|
1301
|
+
optionName: string;
|
|
1302
|
+
items?: undefined;
|
|
1303
|
+
} | {
|
|
1304
|
+
type: string;
|
|
1305
|
+
items: {
|
|
1306
|
+
type: string;
|
|
1307
|
+
properties: {
|
|
1308
|
+
when: {
|
|
1309
|
+
type: string;
|
|
1310
|
+
};
|
|
1311
|
+
};
|
|
1312
|
+
};
|
|
1313
|
+
optionName: string;
|
|
1314
|
+
pattern?: undefined;
|
|
1315
|
+
})[];
|
|
1316
|
+
} & {
|
|
1317
|
+
optionName: string;
|
|
1318
|
+
}) | {
|
|
1319
|
+
type: string;
|
|
1320
|
+
additionalProperties: boolean;
|
|
1321
|
+
required: import("../models").Theme[];
|
|
1322
|
+
properties: {};
|
|
1225
1323
|
optionName: string;
|
|
1226
|
-
pattern?: undefined;
|
|
1227
1324
|
})[];
|
|
1228
1325
|
};
|
|
1229
1326
|
direction: {
|
|
@@ -2332,6 +2429,61 @@ export declare const cardSchemas: {
|
|
|
2332
2429
|
optionName: string;
|
|
2333
2430
|
})[];
|
|
2334
2431
|
};
|
|
2432
|
+
hoverBackground: {
|
|
2433
|
+
oneOf: (({
|
|
2434
|
+
required: string[];
|
|
2435
|
+
type: string;
|
|
2436
|
+
additionalProperties: boolean;
|
|
2437
|
+
properties: {
|
|
2438
|
+
src: {
|
|
2439
|
+
type: string;
|
|
2440
|
+
pattern: string;
|
|
2441
|
+
};
|
|
2442
|
+
style: {
|
|
2443
|
+
type: string;
|
|
2444
|
+
additionalProperties: boolean;
|
|
2445
|
+
required: never[];
|
|
2446
|
+
properties: {
|
|
2447
|
+
backgroundColor: {
|
|
2448
|
+
type: string;
|
|
2449
|
+
};
|
|
2450
|
+
height: {
|
|
2451
|
+
type: string[];
|
|
2452
|
+
};
|
|
2453
|
+
width: {
|
|
2454
|
+
type: string[];
|
|
2455
|
+
};
|
|
2456
|
+
color: {
|
|
2457
|
+
type: string;
|
|
2458
|
+
};
|
|
2459
|
+
};
|
|
2460
|
+
};
|
|
2461
|
+
alt: {
|
|
2462
|
+
type: string;
|
|
2463
|
+
contentType: string;
|
|
2464
|
+
};
|
|
2465
|
+
disableCompress: {
|
|
2466
|
+
type: string;
|
|
2467
|
+
};
|
|
2468
|
+
loading: {
|
|
2469
|
+
type: string;
|
|
2470
|
+
enum: string[];
|
|
2471
|
+
};
|
|
2472
|
+
fetchPriority: {
|
|
2473
|
+
type: string;
|
|
2474
|
+
enum: string[];
|
|
2475
|
+
};
|
|
2476
|
+
};
|
|
2477
|
+
} & {
|
|
2478
|
+
optionName: string;
|
|
2479
|
+
}) | {
|
|
2480
|
+
type: string;
|
|
2481
|
+
additionalProperties: boolean;
|
|
2482
|
+
required: import("../models").Theme[];
|
|
2483
|
+
properties: {};
|
|
2484
|
+
optionName: string;
|
|
2485
|
+
})[];
|
|
2486
|
+
};
|
|
2335
2487
|
backgroundColor: {
|
|
2336
2488
|
type: string;
|
|
2337
2489
|
};
|
|
@@ -58,6 +58,13 @@ unpredictable css rules order in build */
|
|
|
58
58
|
.pc-background-card__image img {
|
|
59
59
|
object-fit: cover;
|
|
60
60
|
}
|
|
61
|
+
.pc-background-card__image_hover {
|
|
62
|
+
opacity: 0;
|
|
63
|
+
transition: opacity 0.5s ease;
|
|
64
|
+
}
|
|
65
|
+
.pc-background-card:hover .pc-background-card__image_hover {
|
|
66
|
+
opacity: 1;
|
|
67
|
+
}
|
|
61
68
|
|
|
62
69
|
a.pc-background-card_theme_light {
|
|
63
70
|
background-color: var(--pc-color-base-silver);
|
|
@@ -4,24 +4,28 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
6
|
const components_1 = require("../../components/");
|
|
7
|
+
const utils_1 = require("../../components/Media/Image/utils");
|
|
7
8
|
const theme_1 = require("../../context/theme");
|
|
8
|
-
const
|
|
9
|
+
const utils_2 = require("../../utils");
|
|
9
10
|
const Content_1 = tslib_1.__importDefault(require("../Content/Content"));
|
|
10
|
-
const b = (0,
|
|
11
|
+
const b = (0, utils_2.block)('background-card');
|
|
11
12
|
const BackgroundCard = (props) => {
|
|
12
|
-
const { url, target, title, summary, text, border, background, backgroundPosition = 'left', paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, urlTitle, controlPosition = 'content', list, label, } = props;
|
|
13
|
+
const { url, target, title, summary, text, border, background, hoverBackground, backgroundPosition = 'left', paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, urlTitle, controlPosition = 'content', list, label, } = props;
|
|
13
14
|
const titleId = (0, uikit_1.useUniqId)();
|
|
14
15
|
const theme = (0, theme_1.useTheme)();
|
|
15
16
|
const hasBackgroundColor = backgroundColor || cardTheme !== 'default';
|
|
16
17
|
const borderType = hasBackgroundColor ? 'none' : border;
|
|
17
18
|
const areControlsInFooter = !paddingBottom && controlPosition === 'footer';
|
|
19
|
+
const backgroundProps = (0, utils_1.getMediaImage)((0, utils_2.getThemedValue)(background, theme) || '');
|
|
20
|
+
const hoverBackgroundProps = (0, utils_1.getMediaImage)((0, utils_2.getThemedValue)(hoverBackground, theme) || '');
|
|
18
21
|
return (react_1.default.createElement(components_1.CardBase, { className: b({
|
|
19
22
|
padding: paddingBottom,
|
|
20
23
|
theme: cardTheme,
|
|
21
24
|
bgPosition: backgroundPosition,
|
|
22
25
|
}), contentClassName: b('content'), url: url, target: target, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle },
|
|
23
26
|
react_1.default.createElement(components_1.CardBase.Content, null,
|
|
24
|
-
react_1.default.createElement(components_1.BackgroundImage, Object.assign({ className: b('image') },
|
|
27
|
+
react_1.default.createElement(components_1.BackgroundImage, Object.assign({ className: b('image') }, backgroundProps, { style: { backgroundColor } })),
|
|
28
|
+
hoverBackground && (react_1.default.createElement(components_1.BackgroundImage, Object.assign({ className: b('image', { hover: true }) }, hoverBackgroundProps, { style: { backgroundColor } }))),
|
|
25
29
|
label && react_1.default.createElement(components_1.Tag, Object.assign({}, label)),
|
|
26
30
|
react_1.default.createElement(Content_1.default, { className: b('data'), titleId: titleId, title: title, summary: summary, text: text, additionalInfo: additionalInfo, size: "s", theme: cardTheme, links: links, buttons: buttons, list: list, colSizes: { all: 12, md: 12 }, controlPosition: areControlsInFooter ? 'bottom' : 'default' }))));
|
|
27
31
|
};
|
|
@@ -68,6 +68,61 @@ export declare const BackgroundCard: {
|
|
|
68
68
|
optionName: string;
|
|
69
69
|
})[];
|
|
70
70
|
};
|
|
71
|
+
hoverBackground: {
|
|
72
|
+
oneOf: (({
|
|
73
|
+
required: string[];
|
|
74
|
+
type: string;
|
|
75
|
+
additionalProperties: boolean;
|
|
76
|
+
properties: {
|
|
77
|
+
src: {
|
|
78
|
+
type: string;
|
|
79
|
+
pattern: string;
|
|
80
|
+
};
|
|
81
|
+
style: {
|
|
82
|
+
type: string;
|
|
83
|
+
additionalProperties: boolean;
|
|
84
|
+
required: never[];
|
|
85
|
+
properties: {
|
|
86
|
+
backgroundColor: {
|
|
87
|
+
type: string;
|
|
88
|
+
};
|
|
89
|
+
height: {
|
|
90
|
+
type: string[];
|
|
91
|
+
};
|
|
92
|
+
width: {
|
|
93
|
+
type: string[];
|
|
94
|
+
};
|
|
95
|
+
color: {
|
|
96
|
+
type: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
alt: {
|
|
101
|
+
type: string;
|
|
102
|
+
contentType: string;
|
|
103
|
+
};
|
|
104
|
+
disableCompress: {
|
|
105
|
+
type: string;
|
|
106
|
+
};
|
|
107
|
+
loading: {
|
|
108
|
+
type: string;
|
|
109
|
+
enum: string[];
|
|
110
|
+
};
|
|
111
|
+
fetchPriority: {
|
|
112
|
+
type: string;
|
|
113
|
+
enum: string[];
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
} & {
|
|
117
|
+
optionName: string;
|
|
118
|
+
}) | {
|
|
119
|
+
type: string;
|
|
120
|
+
additionalProperties: boolean;
|
|
121
|
+
required: import("../..").Theme[];
|
|
122
|
+
properties: {};
|
|
123
|
+
optionName: string;
|
|
124
|
+
})[];
|
|
125
|
+
};
|
|
71
126
|
backgroundColor: {
|
|
72
127
|
type: string;
|
|
73
128
|
};
|
|
@@ -19,7 +19,7 @@ exports.BackgroundCard = {
|
|
|
19
19
|
}, target: {
|
|
20
20
|
type: 'string',
|
|
21
21
|
enum: ['_blank', '_parent', '_top', '_self'],
|
|
22
|
-
}, background: (0, common_1.withTheme)(schema_1.ImageObjectProps), backgroundColor: {
|
|
22
|
+
}, background: (0, common_1.withTheme)(schema_1.ImageObjectProps), hoverBackground: (0, common_1.withTheme)(schema_1.ImageObjectProps), backgroundColor: {
|
|
23
23
|
type: 'string',
|
|
24
24
|
}, backgroundPosition: {
|
|
25
25
|
type: 'string',
|
|
@@ -10,6 +10,9 @@ unpredictable css rules order in build */
|
|
|
10
10
|
.pc-card__header p {
|
|
11
11
|
margin: 0;
|
|
12
12
|
}
|
|
13
|
+
.pc-card:hover .pc-storage-background-image__img_hover {
|
|
14
|
+
opacity: 1;
|
|
15
|
+
}
|
|
13
16
|
.pc-card__title {
|
|
14
17
|
font-size: var(--g-text-header-1-font-size, var(--pc-text-header-1-font-size));
|
|
15
18
|
line-height: var(--g-text-header-1-line-height, var(--pc-text-header-1-line-height));
|