@gravity-ui/page-constructor 5.12.0 → 5.13.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/ContentLayout/schema.d.ts +4 -0
- package/build/cjs/blocks/Form/schema.d.ts +4 -0
- package/build/cjs/blocks/Info/schema.d.ts +8 -0
- package/build/cjs/blocks/Map/schema.d.ts +4 -0
- package/build/cjs/blocks/Media/schema.d.ts +8 -0
- package/build/cjs/blocks/Questions/schema.d.ts +4 -0
- package/build/cjs/blocks/Tabs/schema.d.ts +4 -0
- package/build/cjs/components/IconWrapper/IconWrapper.css +4 -2
- package/build/cjs/components/IconWrapper/IconWrapper.d.ts +2 -2
- package/build/cjs/components/IconWrapper/IconWrapper.js +3 -3
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -0
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +3 -3
- package/build/cjs/schema/constants.d.ts +4 -0
- package/build/cjs/schema/validators/common.d.ts +6 -0
- package/build/cjs/schema/validators/common.js +8 -1
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.css +3 -6
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +2 -5
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +2 -2
- package/build/cjs/sub-blocks/BasicCard/BasicCard.css +4 -4
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +3 -6
- package/build/cjs/sub-blocks/BasicCard/schema.js +2 -2
- package/build/cjs/sub-blocks/Content/Content.css +11 -0
- package/build/cjs/sub-blocks/Content/Content.js +2 -2
- package/build/cjs/sub-blocks/Content/schema.d.ts +8 -0
- package/build/cjs/sub-blocks/Content/schema.js +4 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.css +2 -0
- package/build/cjs/sub-blocks/ImageCard/ImageCard.js +4 -2
- package/build/cjs/sub-blocks/ImageCard/schema.d.ts +4 -0
- package/build/cjs/sub-blocks/ImageCard/schema.js +2 -2
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.css +3 -2
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +4 -6
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +4 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.js +1 -4
- package/build/esm/blocks/ContentLayout/schema.d.ts +4 -0
- package/build/esm/blocks/Form/schema.d.ts +4 -0
- package/build/esm/blocks/Info/schema.d.ts +8 -0
- package/build/esm/blocks/Map/schema.d.ts +4 -0
- package/build/esm/blocks/Media/schema.d.ts +8 -0
- package/build/esm/blocks/Questions/schema.d.ts +4 -0
- package/build/esm/blocks/Tabs/schema.d.ts +4 -0
- package/build/esm/components/IconWrapper/IconWrapper.css +4 -2
- package/build/esm/components/IconWrapper/IconWrapper.d.ts +2 -2
- package/build/esm/components/IconWrapper/IconWrapper.js +3 -3
- package/build/esm/constructor-items.d.ts +1 -1
- package/build/esm/models/constructor-items/blocks.d.ts +1 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +3 -3
- package/build/esm/schema/constants.d.ts +4 -0
- package/build/esm/schema/validators/common.d.ts +6 -0
- package/build/esm/schema/validators/common.js +6 -0
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.css +3 -6
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +3 -6
- package/build/esm/sub-blocks/BackgroundCard/schema.js +3 -3
- package/build/esm/sub-blocks/BasicCard/BasicCard.css +4 -4
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +4 -7
- package/build/esm/sub-blocks/BasicCard/schema.js +3 -3
- package/build/esm/sub-blocks/Content/Content.css +11 -0
- package/build/esm/sub-blocks/Content/Content.js +2 -2
- package/build/esm/sub-blocks/Content/schema.d.ts +8 -0
- package/build/esm/sub-blocks/Content/schema.js +4 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.css +2 -0
- package/build/esm/sub-blocks/ImageCard/ImageCard.js +4 -2
- package/build/esm/sub-blocks/ImageCard/schema.d.ts +4 -0
- package/build/esm/sub-blocks/ImageCard/schema.js +3 -3
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.css +3 -2
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +5 -7
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +4 -0
- package/build/esm/sub-blocks/LayoutItem/schema.js +2 -5
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +1 -0
- package/server/models/constructor-items/sub-blocks.d.ts +3 -3
- package/widget/index.js +1 -1
|
@@ -538,6 +538,10 @@ export declare const MediaBlockBaseProps: {
|
|
|
538
538
|
};
|
|
539
539
|
};
|
|
540
540
|
};
|
|
541
|
+
controlPosition: {
|
|
542
|
+
type: string;
|
|
543
|
+
enum: string[];
|
|
544
|
+
};
|
|
541
545
|
animated: {
|
|
542
546
|
type: string;
|
|
543
547
|
};
|
|
@@ -1139,6 +1143,10 @@ export declare const MediaBlock: {
|
|
|
1139
1143
|
};
|
|
1140
1144
|
};
|
|
1141
1145
|
};
|
|
1146
|
+
controlPosition: {
|
|
1147
|
+
type: string;
|
|
1148
|
+
enum: string[];
|
|
1149
|
+
};
|
|
1142
1150
|
animated: {
|
|
1143
1151
|
type: string;
|
|
1144
1152
|
};
|
|
@@ -22,6 +22,8 @@ unpredictable css rules order in build */
|
|
|
22
22
|
width: 22px;
|
|
23
23
|
margin: 1px 12px 1px 0px;
|
|
24
24
|
}
|
|
25
|
-
.pc-icon-
|
|
26
|
-
|
|
25
|
+
.pc-icon-wrapper__content {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
flex: 1 0 auto;
|
|
27
29
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { IconWrapperProps } from '../../models';
|
|
2
|
+
import type { ClassNameProps, IconWrapperProps } from '../../models';
|
|
3
3
|
import './IconWrapper.css';
|
|
4
|
-
declare const IconWrapper: (props: PropsWithChildren<IconWrapperProps>) => JSX.Element;
|
|
4
|
+
declare const IconWrapper: (props: PropsWithChildren<IconWrapperProps> & ClassNameProps) => JSX.Element;
|
|
5
5
|
export default IconWrapper;
|
|
@@ -5,14 +5,14 @@ import { getMediaImage } from '../Media/Image/utils';
|
|
|
5
5
|
import './IconWrapper.css';
|
|
6
6
|
const b = block('icon-wrapper');
|
|
7
7
|
const IconWrapper = (props) => {
|
|
8
|
-
const { icon, children } = props;
|
|
8
|
+
const { icon, children, className } = props;
|
|
9
9
|
if (!icon) {
|
|
10
10
|
return React.createElement(Fragment, null, children);
|
|
11
11
|
}
|
|
12
12
|
const iconProps = getMediaImage(icon.value);
|
|
13
13
|
const iconPosition = icon === null || icon === void 0 ? void 0 : icon.position;
|
|
14
|
-
return (React.createElement("div", { className: b({ ['icon-position']: iconPosition }) },
|
|
14
|
+
return (React.createElement("div", { className: b({ ['icon-position']: iconPosition }, className) },
|
|
15
15
|
iconProps && (React.createElement(Image, Object.assign({}, iconProps, { containerClassName: b('icon-container'), className: b('icon', { ['icon-position']: iconPosition }) }))),
|
|
16
|
-
React.createElement("div", { className: b(
|
|
16
|
+
React.createElement("div", { className: b('content') }, children)));
|
|
17
17
|
};
|
|
18
18
|
export default IconWrapper;
|
|
@@ -24,7 +24,7 @@ export declare const subBlockMap: {
|
|
|
24
24
|
"price-detailed": (props: import("./models").PriceDetailedProps) => JSX.Element;
|
|
25
25
|
"media-card": ({ border, analyticsEvents, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
|
|
26
26
|
"banner-card": (props: import("./models").BannerCardProps) => JSX.Element;
|
|
27
|
-
"layout-item": ({ content: { links,
|
|
27
|
+
"layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition, }: import("./models").LayoutItemProps) => JSX.Element;
|
|
28
28
|
"background-card": (props: import("./models").BackgroundCardProps) => JSX.Element;
|
|
29
29
|
"basic-card": (props: import("./models").BasicCardProps) => JSX.Element;
|
|
30
30
|
content: (props: import("./sub-blocks/Content/Content").ContentProps) => JSX.Element;
|
|
@@ -96,14 +96,14 @@ export interface QuoteProps extends Themable, CardBaseProps {
|
|
|
96
96
|
quoteType?: QuoteType;
|
|
97
97
|
button?: ButtonProps;
|
|
98
98
|
}
|
|
99
|
-
export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
|
|
99
|
+
export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'controlPosition'> {
|
|
100
100
|
url?: string;
|
|
101
101
|
urlTitle?: string;
|
|
102
102
|
background?: ThemeSupporting<ImageObjectProps>;
|
|
103
103
|
paddingBottom?: 's' | 'm' | 'l' | 'xl';
|
|
104
104
|
backgroundColor?: string;
|
|
105
105
|
}
|
|
106
|
-
export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
|
|
106
|
+
export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme' | 'controlPosition'> {
|
|
107
107
|
url: string;
|
|
108
108
|
urlTitle?: string;
|
|
109
109
|
icon?: ImageProps;
|
|
@@ -141,7 +141,7 @@ export interface LayoutItemProps extends ClassNameProps, CardLayoutProps, Analyt
|
|
|
141
141
|
fullscreen?: boolean;
|
|
142
142
|
icon?: PositionedIcon;
|
|
143
143
|
}
|
|
144
|
-
export interface ImageCardProps extends CardBaseProps, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
|
|
144
|
+
export interface ImageCardProps extends CardBaseProps, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'controlPosition'> {
|
|
145
145
|
image: ImageProps;
|
|
146
146
|
enableImageBorderRadius?: boolean;
|
|
147
147
|
margins?: ImageCardMargins;
|
|
@@ -29,6 +29,12 @@ export declare const BaseProps: {
|
|
|
29
29
|
type: string;
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
+
export declare const CardLayoutProps: {
|
|
33
|
+
controlPosition: {
|
|
34
|
+
type: string;
|
|
35
|
+
enum: string[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
32
38
|
export declare const containerSizesObject: {
|
|
33
39
|
type: string;
|
|
34
40
|
additionalProperties: boolean;
|
|
@@ -32,6 +32,12 @@ export const BaseProps = {
|
|
|
32
32
|
type: 'string',
|
|
33
33
|
},
|
|
34
34
|
};
|
|
35
|
+
export const CardLayoutProps = {
|
|
36
|
+
controlPosition: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
enum: ['content', 'footer'],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
35
41
|
export const containerSizesObject = {
|
|
36
42
|
type: 'object',
|
|
37
43
|
additionalProperties: false,
|
|
@@ -26,6 +26,9 @@ unpredictable css rules order in build */
|
|
|
26
26
|
cursor: default;
|
|
27
27
|
border: none;
|
|
28
28
|
}
|
|
29
|
+
.pc-background-card__content {
|
|
30
|
+
display: flex;
|
|
31
|
+
}
|
|
29
32
|
.pc-background-card__image {
|
|
30
33
|
position: absolute;
|
|
31
34
|
top: 0;
|
|
@@ -37,12 +40,6 @@ unpredictable css rules order in build */
|
|
|
37
40
|
object-fit: cover;
|
|
38
41
|
object-position: left;
|
|
39
42
|
}
|
|
40
|
-
.pc-background-card__footer {
|
|
41
|
-
margin-top: 0px;
|
|
42
|
-
}
|
|
43
|
-
.pc-background-card__links, .pc-background-card__buttons {
|
|
44
|
-
margin-top: 16px;
|
|
45
|
-
}
|
|
46
43
|
|
|
47
44
|
a.pc-background-card_theme_light {
|
|
48
45
|
background-color: var(--pc-color-base-silver);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useUniqId } from '@gravity-ui/uikit';
|
|
3
|
-
import { BackgroundImage,
|
|
3
|
+
import { BackgroundImage, CardBase } from '../../components/';
|
|
4
4
|
import { useTheme } from '../../context/theme';
|
|
5
5
|
import { block, getThemedValue } from '../../utils';
|
|
6
6
|
import Content from '../Content/Content';
|
|
@@ -13,12 +13,9 @@ const BackgroundCard = (props) => {
|
|
|
13
13
|
const hasBackgroundColor = backgroundColor || cardTheme !== 'default';
|
|
14
14
|
const borderType = hasBackgroundColor ? 'none' : border;
|
|
15
15
|
const areControlsInFooter = !paddingBottom && controlPosition === 'footer';
|
|
16
|
-
return (React.createElement(CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), url: url, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle },
|
|
16
|
+
return (React.createElement(CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), contentClassName: b('content'), url: url, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle },
|
|
17
17
|
React.createElement(CardBase.Content, null,
|
|
18
18
|
React.createElement(BackgroundImage, Object.assign({ className: b('image') }, getThemedValue(background, theme), { style: { backgroundColor } })),
|
|
19
|
-
React.createElement(Content, { titleId: titleId, title: title, text: text, additionalInfo: additionalInfo, size: "s", theme: cardTheme, links:
|
|
20
|
-
areControlsInFooter && (links || buttons) && (React.createElement(CardBase.Footer, null,
|
|
21
|
-
React.createElement(Links, { className: b('links'), size: "s", links: links, titleId: titleId }),
|
|
22
|
-
React.createElement(Buttons, { className: b('buttons'), size: "s", buttons: buttons, titleId: titleId })))));
|
|
19
|
+
React.createElement(Content, { titleId: titleId, title: title, text: text, additionalInfo: additionalInfo, size: "s", theme: cardTheme, links: links, buttons: buttons, list: list, colSizes: { all: 12, md: 12 }, controlPosition: areControlsInFooter ? 'bottom' : 'default' }))));
|
|
23
20
|
};
|
|
24
21
|
export default BackgroundCard;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import omit from 'lodash/omit';
|
|
2
2
|
import { ImageObjectProps } from '../../components/Image/schema';
|
|
3
|
-
import { BaseProps, CardBase, withTheme } from '../../schema/validators/common';
|
|
3
|
+
import { BaseProps, CardBase, CardLayoutProps, withTheme } from '../../schema/validators/common';
|
|
4
4
|
import { AnalyticsEventSchema } from '../../schema/validators/event';
|
|
5
5
|
import { ContentBase } from '../Content/schema';
|
|
6
|
-
const BackgroundCardContentProps = omit(ContentBase, ['size']);
|
|
6
|
+
const BackgroundCardContentProps = omit(ContentBase, ['size', 'controlPosition']);
|
|
7
7
|
export const BackgroundCard = {
|
|
8
8
|
'background-card': {
|
|
9
9
|
additionalProperties: false,
|
|
10
10
|
required: ['title', 'text'],
|
|
11
|
-
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), BackgroundCardContentProps), { url: {
|
|
11
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), CardLayoutProps), BackgroundCardContentProps), { url: {
|
|
12
12
|
type: 'string',
|
|
13
13
|
}, urlTitle: {
|
|
14
14
|
type: 'string',
|
|
@@ -4,9 +4,9 @@ unpredictable css rules order in build */
|
|
|
4
4
|
min-height: auto;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.pc-basic-
|
|
8
|
-
|
|
7
|
+
.pc-basic-card__content {
|
|
8
|
+
display: flex;
|
|
9
9
|
}
|
|
10
|
-
.pc-basic-
|
|
11
|
-
|
|
10
|
+
.pc-basic-card__wrapper {
|
|
11
|
+
flex: auto;
|
|
12
12
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useUniqId } from '@gravity-ui/uikit';
|
|
4
|
-
import {
|
|
4
|
+
import { CardBase, IconWrapper } from '../../components';
|
|
5
5
|
import { IconPosition } from '../../models/constructor-items/sub-blocks';
|
|
6
6
|
import { block } from '../../utils';
|
|
7
7
|
import Content from '../Content/Content';
|
|
@@ -12,12 +12,9 @@ const BasicCard = (props) => {
|
|
|
12
12
|
const titleId = useUniqId();
|
|
13
13
|
const descriptionId = useUniqId();
|
|
14
14
|
const areControlsInFooter = controlPosition === 'footer';
|
|
15
|
-
return (React.createElement(CardBase, Object.assign({ className: b() }, cardParams, { extraProps: { 'aria-describedby': descriptionId, 'aria-labelledby': titleId } }),
|
|
15
|
+
return (React.createElement(CardBase, Object.assign({ className: b(), contentClassName: b('content') }, cardParams, { extraProps: { 'aria-describedby': descriptionId, 'aria-labelledby': titleId } }),
|
|
16
16
|
React.createElement(CardBase.Content, null,
|
|
17
|
-
React.createElement(IconWrapper, { icon: icon ? { value: icon, position: iconPosition } : undefined },
|
|
18
|
-
React.createElement(Content, { title: title, titleId: titleId, text: text, textId: descriptionId, additionalInfo: additionalInfo, links:
|
|
19
|
-
areControlsInFooter && (buttons || links) && (React.createElement(CardBase.Footer, { className: b('footer') },
|
|
20
|
-
React.createElement(Links, { className: b('links'), size: "s", links: links, titleId: titleId }),
|
|
21
|
-
React.createElement(Buttons, { className: b('buttons'), size: "s", buttons: buttons, titleId: titleId })))));
|
|
17
|
+
React.createElement(IconWrapper, { icon: icon ? { value: icon, position: iconPosition } : undefined, className: b('wrapper') },
|
|
18
|
+
React.createElement(Content, { title: title, titleId: titleId, text: text, textId: descriptionId, additionalInfo: additionalInfo, links: links, list: list, buttons: buttons, size: "s", colSizes: { all: 12, md: 12 }, controlPosition: areControlsInFooter ? 'bottom' : 'default' })))));
|
|
22
19
|
};
|
|
23
20
|
export default BasicCard;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import omit from 'lodash/omit';
|
|
2
2
|
import { ImageProps } from '../../components/Image/schema';
|
|
3
|
-
import { BaseProps, CardBase } from '../../schema/validators/common';
|
|
3
|
+
import { BaseProps, CardBase, CardLayoutProps } from '../../schema/validators/common';
|
|
4
4
|
import { ContentBase } from '../Content/schema';
|
|
5
|
-
const BasicCardContentProps = omit(ContentBase, ['size', 'theme']);
|
|
5
|
+
const BasicCardContentProps = omit(ContentBase, ['size', 'theme', 'controlPosition']);
|
|
6
6
|
export const BasicCard = {
|
|
7
7
|
'basic-card': {
|
|
8
8
|
additionalProperties: false,
|
|
9
9
|
required: [],
|
|
10
|
-
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), BasicCardContentProps), { url: {
|
|
10
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), CardLayoutProps), BasicCardContentProps), { url: {
|
|
11
11
|
type: 'string',
|
|
12
12
|
}, urlTitle: {
|
|
13
13
|
type: 'string',
|
|
@@ -9,6 +9,8 @@ unpredictable css rules order in build */
|
|
|
9
9
|
--pc-monochrome-button-background-color: #262626;
|
|
10
10
|
--pc-monochrome-button-background-color-hover: #393939;
|
|
11
11
|
--pc-monochrome-button-color: var(--g-color-text-light-primary);
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
12
14
|
}
|
|
13
15
|
.pc-content__notice .yfm ol,
|
|
14
16
|
.pc-content__notice .yfm ul, .pc-content__text .yfm ol,
|
|
@@ -145,4 +147,13 @@ unpredictable css rules order in build */
|
|
|
145
147
|
}
|
|
146
148
|
.pc-content_theme_light .pc-content__title a:hover {
|
|
147
149
|
color: var(--g-color-text-dark-secondary);
|
|
150
|
+
}
|
|
151
|
+
.pc-content_control-position_bottom .pc-content__notice:has(+ .pc-content__buttons), .pc-content_control-position_bottom .pc-content__notice:has(+ .pc-content__link),
|
|
152
|
+
.pc-content_control-position_bottom .pc-content__list:has(+ .pc-content__buttons),
|
|
153
|
+
.pc-content_control-position_bottom .pc-content__list:has(+ .pc-content__link),
|
|
154
|
+
.pc-content_control-position_bottom .pc-content__text:has(+ .pc-content__buttons),
|
|
155
|
+
.pc-content_control-position_bottom .pc-content__text:has(+ .pc-content__link),
|
|
156
|
+
.pc-content_control-position_bottom .pc-content__title:has(+ .pc-content__buttons),
|
|
157
|
+
.pc-content_control-position_bottom .pc-content__title:has(+ .pc-content__link) {
|
|
158
|
+
margin-bottom: auto;
|
|
148
159
|
}
|
|
@@ -16,7 +16,7 @@ function getTextSize(size) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
const Content = (props) => {
|
|
19
|
-
const { title, titleId: titleIdFromProps, text, textId, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, list, qa, } = props;
|
|
19
|
+
const { title, titleId: titleIdFromProps, text, textId, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, list, qa, controlPosition, } = props;
|
|
20
20
|
const qaAttributes = getQaAttrubutes(qa, ['links', 'link', 'buttons', 'button', 'list']);
|
|
21
21
|
const titleProps = !title || typeof title === 'string'
|
|
22
22
|
? { text: title, textSize: getTextSize(size) }
|
|
@@ -24,7 +24,7 @@ const Content = (props) => {
|
|
|
24
24
|
const hasTitle = Boolean(title);
|
|
25
25
|
const defaultTitleId = useUniqId();
|
|
26
26
|
const titleId = titleIdFromProps || defaultTitleId;
|
|
27
|
-
return (React.createElement(Col, { className: b({ size, centered, theme }, className), reset: true, sizes: colSizes, qa: qaAttributes.container },
|
|
27
|
+
return (React.createElement(Col, { className: b({ size, centered, theme, 'control-position': controlPosition }, className), reset: true, sizes: colSizes, qa: qaAttributes.container },
|
|
28
28
|
title && (React.createElement(Title, { className: b('title'), title: titleProps, colSizes: { all: 12 }, id: titleId })),
|
|
29
29
|
text && (React.createElement("div", { className: b('text', { ['without-title']: !hasTitle }) },
|
|
30
30
|
React.createElement(YFMWrapper, { content: text, modifiers: { constructor: true, [`constructor-size-${size}`]: true }, id: textId }))),
|
|
@@ -119,6 +119,10 @@ export declare const ContentBase: {
|
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
121
|
};
|
|
122
|
+
controlPosition: {
|
|
123
|
+
type: string;
|
|
124
|
+
enum: string[];
|
|
125
|
+
};
|
|
122
126
|
};
|
|
123
127
|
export declare const ContentBlock: {
|
|
124
128
|
content: {
|
|
@@ -210,6 +214,10 @@ export declare const ContentBlock: {
|
|
|
210
214
|
};
|
|
211
215
|
};
|
|
212
216
|
};
|
|
217
|
+
controlPosition: {
|
|
218
|
+
type: string;
|
|
219
|
+
enum: string[];
|
|
220
|
+
};
|
|
213
221
|
};
|
|
214
222
|
};
|
|
215
223
|
};
|
|
@@ -17,7 +17,9 @@ unpredictable css rules order in build */
|
|
|
17
17
|
border: 1px solid var(--g-color-line-generic);
|
|
18
18
|
}
|
|
19
19
|
.pc-image-card .pc-image-card__content {
|
|
20
|
+
display: flex;
|
|
20
21
|
padding: 32px;
|
|
22
|
+
flex: auto;
|
|
21
23
|
}
|
|
22
24
|
.pc-image-card .pc-image-card__image_inner {
|
|
23
25
|
width: 100%;
|
|
@@ -7,8 +7,10 @@ import { block } from '../../utils';
|
|
|
7
7
|
import Content from '../Content/Content';
|
|
8
8
|
import './ImageCard.css';
|
|
9
9
|
const b = block('image-card');
|
|
10
|
+
const CONTENT_COL_SIZES = { all: 12, md: 12 };
|
|
10
11
|
const ImageCard = (props) => {
|
|
11
|
-
const { border = 'shadow', title, text, image, enableImageBorderRadius = false, direction = ImageCardDirection.Direct, margins, backgroundColor, url, target, urlTitle, additionalInfo, links, buttons, list, theme: cardTheme = 'default', size = 's', } = props;
|
|
12
|
+
const { border = 'shadow', title, text, image, enableImageBorderRadius = false, direction = ImageCardDirection.Direct, margins, backgroundColor, url, target, urlTitle, additionalInfo, links, buttons, list, theme: cardTheme = 'default', size = 's', controlPosition = 'content', } = props;
|
|
13
|
+
const areControlsInFooter = controlPosition === 'footer';
|
|
12
14
|
const hasContent = Boolean(text || title || buttons || links || list);
|
|
13
15
|
const imageProps = getMediaImage(image);
|
|
14
16
|
const titleId = useUniqId();
|
|
@@ -16,7 +18,7 @@ const ImageCard = (props) => {
|
|
|
16
18
|
React.createElement("div", { className: b('image', { margins }) },
|
|
17
19
|
React.createElement(Image, Object.assign({ className: b('image_inner', { radius: enableImageBorderRadius }) }, imageProps))),
|
|
18
20
|
hasContent && (React.createElement("div", { className: b('content') },
|
|
19
|
-
React.createElement(Content, { titleId: titleId, title: title, text: text, links: links, buttons: buttons, list: list, theme: cardTheme, additionalInfo: additionalInfo, size: size, colSizes:
|
|
21
|
+
React.createElement(Content, { titleId: titleId, title: title, text: text, links: links, buttons: buttons, list: list, theme: cardTheme, additionalInfo: additionalInfo, size: size, colSizes: CONTENT_COL_SIZES, controlPosition: areControlsInFooter ? 'bottom' : 'default' })))));
|
|
20
22
|
return url ? (React.createElement(Link, { href: url, target: target, rel: target === '_blank' ? 'noopener noreferrer' : undefined, className: b({ border, 'with-content': hasContent, direction }), title: urlTitle, extraProps: {
|
|
21
23
|
draggable: false,
|
|
22
24
|
onDragStart: (e) => e.preventDefault(),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import omit from 'lodash/omit';
|
|
2
|
-
import { BaseProps, CardBase } from '../../schema/validators/common';
|
|
2
|
+
import { BaseProps, CardBase, CardLayoutProps } from '../../schema/validators/common';
|
|
3
3
|
import { ImageProps } from '../../schema/validators/components';
|
|
4
4
|
import { ContentBase } from '../Content/schema';
|
|
5
|
-
const ImageCardBlockContentProps = omit(ContentBase, ['centered', 'colSizes']);
|
|
5
|
+
const ImageCardBlockContentProps = omit(ContentBase, ['centered', 'colSizes', 'controlPosition']);
|
|
6
6
|
export const ImageCard = {
|
|
7
7
|
'image-card': {
|
|
8
8
|
additionalProperties: false,
|
|
9
9
|
required: ['image'],
|
|
10
|
-
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), ImageCardBlockContentProps), { image: ImageProps, direction: {
|
|
10
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, BaseProps), CardBase), CardLayoutProps), ImageCardBlockContentProps), { image: ImageProps, direction: {
|
|
11
11
|
type: 'string',
|
|
12
12
|
enum: ['direct', 'reverse'],
|
|
13
13
|
}, margins: {
|
|
@@ -17,12 +17,13 @@ unpredictable css rules order in build */
|
|
|
17
17
|
margin: 16px 0 -8px 0;
|
|
18
18
|
}
|
|
19
19
|
.pc-layout-item__content {
|
|
20
|
+
display: flex;
|
|
20
21
|
flex: auto;
|
|
21
22
|
margin: 16px 16px 0 0;
|
|
22
23
|
}
|
|
23
24
|
.pc-layout-item__content_no-media {
|
|
24
25
|
margin: 0;
|
|
25
26
|
}
|
|
26
|
-
.pc-layout-
|
|
27
|
-
|
|
27
|
+
.pc-layout-item__wrapper {
|
|
28
|
+
flex: auto;
|
|
28
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LayoutItemProps } from '../../models';
|
|
2
2
|
import './LayoutItem.css';
|
|
3
|
-
declare const LayoutItem: ({ content: { links,
|
|
3
|
+
declare const LayoutItem: ({ content: { links, ...content }, metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition, }: LayoutItemProps) => JSX.Element;
|
|
4
4
|
export default LayoutItem;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { useUniqId } from '@gravity-ui/uikit';
|
|
4
|
-
import {
|
|
4
|
+
import { FullscreenMedia, IconWrapper, Media, MetaInfo } from '../../components';
|
|
5
5
|
import { useTheme } from '../../context/theme';
|
|
6
6
|
import { block, getThemedValue } from '../../utils';
|
|
7
7
|
import Content from '../Content/Content';
|
|
@@ -9,11 +9,11 @@ import { getLayoutItemLinks, hasFullscreen, showFullscreenIcon } from './utils';
|
|
|
9
9
|
import './LayoutItem.css';
|
|
10
10
|
const b = block('layout-item');
|
|
11
11
|
const LayoutItem = (_a) => {
|
|
12
|
-
var _b = _a.content, { links
|
|
12
|
+
var _b = _a.content, { links } = _b, content = __rest(_b, ["links"]), { metaInfo, media, border, fullscreen, icon, className, analyticsEvents, controlPosition = 'content' } = _a;
|
|
13
13
|
const normalizedLinks = useMemo(() => getLayoutItemLinks(links), [links]);
|
|
14
14
|
const areControlsInFooter = controlPosition === 'footer';
|
|
15
15
|
const theme = useTheme();
|
|
16
|
-
const contentProps = Object.assign(Object.assign(
|
|
16
|
+
const contentProps = Object.assign(Object.assign({ controlPosition: areControlsInFooter ? 'bottom' : 'default' }, content), { links: normalizedLinks, size: 's', colSizes: { all: 12, md: 12 } });
|
|
17
17
|
const titleId = useUniqId();
|
|
18
18
|
const renderMedia = () => {
|
|
19
19
|
if (!media) {
|
|
@@ -29,9 +29,7 @@ const LayoutItem = (_a) => {
|
|
|
29
29
|
renderMedia(),
|
|
30
30
|
metaInfo && React.createElement(MetaInfo, { items: metaInfo, className: b('meta-info') }),
|
|
31
31
|
React.createElement("div", { className: b('content', { 'no-media': !media }) },
|
|
32
|
-
React.createElement(IconWrapper, { icon: icon },
|
|
33
|
-
React.createElement(Content, Object.assign({}, contentProps, { titleId: titleId }))))
|
|
34
|
-
areControlsInFooter && links && (React.createElement(Links, { className: b('links'), size: "s", links: links, titleId: titleId })),
|
|
35
|
-
areControlsInFooter && buttons && (React.createElement(Buttons, { className: b('buttons'), size: "s", buttons: buttons, titleId: titleId }))));
|
|
32
|
+
React.createElement(IconWrapper, { icon: icon, className: b('wrapper') },
|
|
33
|
+
React.createElement(Content, Object.assign({}, contentProps, { titleId: titleId }))))));
|
|
36
34
|
};
|
|
37
35
|
export default LayoutItem;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import omit from 'lodash/omit';
|
|
2
2
|
import metaInfo from '../../components/MetaInfo/schema';
|
|
3
|
-
import { BaseProps, MediaProps } from '../../schema/validators/common';
|
|
3
|
+
import { BaseProps, CardLayoutProps, MediaProps } from '../../schema/validators/common';
|
|
4
4
|
import { AnalyticsEventSchema } from '../../schema/validators/event';
|
|
5
5
|
import { ContentBase } from '../../sub-blocks/Content/schema';
|
|
6
6
|
export const LayoutItem = {
|
|
7
7
|
type: 'object',
|
|
8
8
|
additionalProperties: false,
|
|
9
9
|
required: ['content', 'media'],
|
|
10
|
-
properties: Object.assign(Object.assign({}, BaseProps), { media: MediaProps, content: omit(ContentBase, ['colSize', 'size', 'centered']), metaInfo: metaInfo, border: {
|
|
10
|
+
properties: Object.assign(Object.assign(Object.assign({}, BaseProps), CardLayoutProps), { media: MediaProps, content: omit(ContentBase, ['colSize', 'size', 'centered']), metaInfo: metaInfo, border: {
|
|
11
11
|
type: 'boolean',
|
|
12
12
|
}, fullscreen: {
|
|
13
13
|
type: 'boolean',
|
|
@@ -20,8 +20,5 @@ export const LayoutItem = {
|
|
|
20
20
|
optionName: 'list',
|
|
21
21
|
},
|
|
22
22
|
],
|
|
23
|
-
}, controlPosition: {
|
|
24
|
-
type: 'string',
|
|
25
|
-
enum: ['content', 'footer'],
|
|
26
23
|
} }),
|
|
27
24
|
};
|
package/package.json
CHANGED
|
@@ -96,14 +96,14 @@ export interface QuoteProps extends Themable, CardBaseProps {
|
|
|
96
96
|
quoteType?: QuoteType;
|
|
97
97
|
button?: ButtonProps;
|
|
98
98
|
}
|
|
99
|
-
export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
|
|
99
|
+
export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'controlPosition'> {
|
|
100
100
|
url?: string;
|
|
101
101
|
urlTitle?: string;
|
|
102
102
|
background?: ThemeSupporting<ImageObjectProps>;
|
|
103
103
|
paddingBottom?: 's' | 'm' | 'l' | 'xl';
|
|
104
104
|
backgroundColor?: string;
|
|
105
105
|
}
|
|
106
|
-
export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
|
|
106
|
+
export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme' | 'controlPosition'> {
|
|
107
107
|
url: string;
|
|
108
108
|
urlTitle?: string;
|
|
109
109
|
icon?: ImageProps;
|
|
@@ -141,7 +141,7 @@ export interface LayoutItemProps extends ClassNameProps, CardLayoutProps, Analyt
|
|
|
141
141
|
fullscreen?: boolean;
|
|
142
142
|
icon?: PositionedIcon;
|
|
143
143
|
}
|
|
144
|
-
export interface ImageCardProps extends CardBaseProps, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered'> {
|
|
144
|
+
export interface ImageCardProps extends CardBaseProps, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'controlPosition'> {
|
|
145
145
|
image: ImageProps;
|
|
146
146
|
enableImageBorderRadius?: boolean;
|
|
147
147
|
margins?: ImageCardMargins;
|