@gravity-ui/page-constructor 5.7.1 → 5.8.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.
@@ -5,6 +5,7 @@ const react_1 = tslib_1.__importStar(require("react"));
5
5
  const components_1 = require("../../components");
6
6
  const InnerForm_1 = tslib_1.__importDefault(require("../../components/InnerForm/InnerForm"));
7
7
  const mobileContext_1 = require("../../context/mobileContext");
8
+ const theme_1 = require("../../context/theme");
8
9
  const grid_1 = require("../../grid");
9
10
  const models_1 = require("../../models");
10
11
  const sub_blocks_1 = require("../../sub-blocks");
@@ -16,7 +17,12 @@ const FormBlock = (props) => {
16
17
  const { formData, title, textContent, direction = models_1.FormBlockDirection.Center, background } = props;
17
18
  const [contentLoaded, setContentLoaded] = (0, react_1.useState)(false);
18
19
  const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
19
- const withBackground = Boolean(background && (background.src || background.desktop || ((_a = background.style) === null || _a === void 0 ? void 0 : _a.backgroundColor)));
20
+ const theme = (0, theme_1.useTheme)();
21
+ const themedBackground = (0, utils_1.getThemedValue)(background, theme) || undefined;
22
+ const withBackground = Boolean(themedBackground &&
23
+ (themedBackground.src ||
24
+ themedBackground.desktop ||
25
+ ((_a = themedBackground.style) === null || _a === void 0 ? void 0 : _a.backgroundColor)));
20
26
  const onContentLoad = (0, react_1.useCallback)(() => {
21
27
  setContentLoaded(true);
22
28
  }, []);
@@ -34,7 +40,7 @@ const FormBlock = (props) => {
34
40
  'with-background': withBackground,
35
41
  'form-type': formType,
36
42
  }) },
37
- background && (react_1.default.createElement(components_1.BackgroundImage, Object.assign({}, background, { className: b('media'), imageClassName: b('image') }))),
43
+ themedBackground && (react_1.default.createElement(components_1.BackgroundImage, Object.assign({}, themedBackground, { className: b('media'), imageClassName: b('image') }))),
38
44
  react_1.default.createElement(grid_1.Grid, null,
39
45
  react_1.default.createElement(grid_1.Row, { alignItems: direction === models_1.FormBlockDirection.Center
40
46
  ? grid_1.GridAlignItems.Center
@@ -12,20 +12,30 @@ export declare const FormBlock: {
12
12
  optionName: string;
13
13
  properties: {
14
14
  yandex: {
15
- type: string;
16
- required: string[];
17
- properties: {
18
- id: {
19
- type: string;
20
- };
21
- containerId: {
22
- type: string;
23
- };
24
- type: {};
25
- when: {
26
- type: string;
27
- };
28
- };
15
+ oneOf: (({
16
+ type: string;
17
+ required: string[];
18
+ properties: {
19
+ id: {
20
+ type: string;
21
+ };
22
+ containerId: {
23
+ type: string;
24
+ };
25
+ type: {};
26
+ when: {
27
+ type: string;
28
+ };
29
+ };
30
+ } & {
31
+ optionName: string;
32
+ }) | {
33
+ type: string;
34
+ additionalProperties: boolean;
35
+ required: import("../..").Theme[];
36
+ properties: {};
37
+ optionName: string;
38
+ })[];
29
39
  };
30
40
  hubspot?: undefined;
31
41
  };
@@ -34,26 +44,36 @@ export declare const FormBlock: {
34
44
  optionName: string;
35
45
  properties: {
36
46
  hubspot: {
37
- type: string;
38
- required: string[];
39
- properties: {
40
- region: {
41
- type: string;
42
- };
43
- portalId: {
44
- type: string;
45
- };
46
- formId: {
47
- type: string;
48
- };
49
- formInstanceId: {
50
- type: string;
51
- };
52
- type: {};
53
- when: {
54
- type: string;
55
- };
56
- };
47
+ oneOf: (({
48
+ type: string;
49
+ required: string[];
50
+ properties: {
51
+ region: {
52
+ type: string;
53
+ };
54
+ portalId: {
55
+ type: string;
56
+ };
57
+ formId: {
58
+ type: string;
59
+ };
60
+ formInstanceId: {
61
+ type: string;
62
+ };
63
+ type: {};
64
+ when: {
65
+ type: string;
66
+ };
67
+ };
68
+ } & {
69
+ optionName: string;
70
+ }) | {
71
+ type: string;
72
+ additionalProperties: boolean;
73
+ required: import("../..").Theme[];
74
+ properties: {};
75
+ optionName: string;
76
+ })[];
57
77
  };
58
78
  yandex?: undefined;
59
79
  };
@@ -21,14 +21,14 @@ exports.FormBlock = {
21
21
  type: 'object',
22
22
  optionName: 'yandex',
23
23
  properties: {
24
- yandex: schema_2.YandexFormProps,
24
+ yandex: (0, common_1.withTheme)(schema_2.YandexFormProps),
25
25
  },
26
26
  },
27
27
  {
28
28
  type: 'object',
29
29
  optionName: 'hubspot',
30
30
  properties: {
31
- hubspot: schema_4.HubspotFormProps,
31
+ hubspot: (0, common_1.withTheme)(schema_4.HubspotFormProps),
32
32
  },
33
33
  },
34
34
  ],
@@ -28,9 +28,9 @@ const InfoBlock = (props) => {
28
28
  react_1.default.createElement(grid_1.Grid, null,
29
29
  react_1.default.createElement(grid_1.Row, null,
30
30
  react_1.default.createElement(grid_1.Col, { sizes: sizes, className: b('left') },
31
- react_1.default.createElement(Content_1.default, Object.assign({ title: title || (leftContent === null || leftContent === void 0 ? void 0 : leftContent.title), text: leftContent === null || leftContent === void 0 ? void 0 : leftContent.text, links: leftContent === null || leftContent === void 0 ? void 0 : leftContent.links, buttons: leftButtons, additionalInfo: leftContent === null || leftContent === void 0 ? void 0 : leftContent.additionalInfo }, commonProps))),
31
+ react_1.default.createElement(Content_1.default, Object.assign({ title: title || (leftContent === null || leftContent === void 0 ? void 0 : leftContent.title), text: leftContent === null || leftContent === void 0 ? void 0 : leftContent.text, links: leftContent === null || leftContent === void 0 ? void 0 : leftContent.links, list: leftContent === null || leftContent === void 0 ? void 0 : leftContent.list, buttons: leftButtons, additionalInfo: leftContent === null || leftContent === void 0 ? void 0 : leftContent.additionalInfo }, commonProps))),
32
32
  react_1.default.createElement(grid_1.Col, { sizes: sizes, className: b('right') },
33
- react_1.default.createElement(Content_1.default, Object.assign({ title: sectionsTitle || (rightContent === null || rightContent === void 0 ? void 0 : rightContent.title), text: rightContent === null || rightContent === void 0 ? void 0 : rightContent.text, links: rightLinks, buttons: rightContent === null || rightContent === void 0 ? void 0 : rightContent.buttons, additionalInfo: rightContent === null || rightContent === void 0 ? void 0 : rightContent.additionalInfo }, commonProps))))))));
33
+ react_1.default.createElement(Content_1.default, Object.assign({ title: sectionsTitle || (rightContent === null || rightContent === void 0 ? void 0 : rightContent.title), text: rightContent === null || rightContent === void 0 ? void 0 : rightContent.text, links: rightLinks, list: rightContent === null || rightContent === void 0 ? void 0 : rightContent.list, buttons: rightContent === null || rightContent === void 0 ? void 0 : rightContent.buttons, additionalInfo: rightContent === null || rightContent === void 0 ? void 0 : rightContent.additionalInfo }, commonProps))))))));
34
34
  };
35
35
  exports.InfoBlock = InfoBlock;
36
36
  exports.default = exports.InfoBlock;
@@ -9,7 +9,7 @@ const QuestionBlockItem_1 = require("./QuestionBlockItem/QuestionBlockItem");
9
9
  const models_1 = require("./models");
10
10
  const b = (0, utils_1.block)('QuestionsBlock');
11
11
  const QuestionsBlock = (props) => {
12
- const { title, text, additionalInfo, links, buttons, items } = props;
12
+ const { title, text, additionalInfo, links, buttons, items, list } = props;
13
13
  const [opened, setOpened] = (0, react_1.useState)([0]);
14
14
  const toggleItem = (index) => {
15
15
  let newState;
@@ -25,7 +25,7 @@ const QuestionsBlock = (props) => {
25
25
  react_1.default.createElement(grid_1.Row, null,
26
26
  react_1.default.createElement(grid_1.Col, { sizes: { all: 12, md: 4 } },
27
27
  react_1.default.createElement("div", { className: b('title') },
28
- react_1.default.createElement(sub_blocks_1.Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 } }))),
28
+ react_1.default.createElement(sub_blocks_1.Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, list: list, buttons: buttons, colSizes: { all: 12, md: 12 } }))),
29
29
  react_1.default.createElement(grid_1.Col, { sizes: { all: 12, md: 8 }, role: 'list' }, items.map(({ title: itemTitle, text: itemText, link, listStyle = 'dash' }, index) => {
30
30
  const isOpened = opened.includes(index);
31
31
  const onClick = () => toggleItem(index);
@@ -6,5 +6,5 @@ interface TextContentProps extends Pick<TabsBlockProps, 'centered' | 'contentSiz
6
6
  centered?: boolean;
7
7
  imageProps?: ImageObjectProps | ImageDeviceProps;
8
8
  }
9
- export declare const TabsTextContent: ({ centered, contentSize, showMedia, data, imageProps, isReverse, }: TextContentProps) => JSX.Element;
9
+ export declare const TabsTextContent: ({ centered, contentSize, showMedia, data: { media, title, text, additionalInfo, link, links, buttons, list }, imageProps, isReverse, }: TextContentProps) => JSX.Element;
10
10
  export default TabsTextContent;
@@ -7,14 +7,11 @@ const grid_1 = require("../../../grid");
7
7
  const sub_blocks_1 = require("../../../sub-blocks");
8
8
  const utils_1 = require("../../../utils");
9
9
  const b = (0, utils_1.block)('tabs-block-text-content');
10
- const TabsTextContent = ({ centered, contentSize = 's', showMedia, data, imageProps, isReverse, }) => {
11
- const isImage = (data === null || data === void 0 ? void 0 : data.media) || imageProps;
12
- return (react_1.default.createElement(grid_1.Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b({ centered: centered }) },
13
- react_1.default.createElement("div", { className: b('wrapper', {
14
- reverse: isReverse,
15
- 'no-image': !isImage,
16
- }) },
17
- react_1.default.createElement(sub_blocks_1.Content, { title: data.title, text: data.text, additionalInfo: data.additionalInfo, size: contentSize, links: [...(data.link ? [data.link] : []), ...(data.links || [])], buttons: data.buttons, colSizes: { all: 12 } }))));
18
- };
10
+ const TabsTextContent = ({ centered, contentSize = 's', showMedia, data: { media, title, text, additionalInfo, link, links, buttons, list }, imageProps, isReverse, }) => (react_1.default.createElement(grid_1.Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b({ centered: centered }) },
11
+ react_1.default.createElement("div", { className: b('wrapper', {
12
+ reverse: isReverse,
13
+ 'no-image': !(media || imageProps),
14
+ }) },
15
+ react_1.default.createElement(sub_blocks_1.Content, { title: title, text: text, additionalInfo: additionalInfo, size: contentSize, list: list, links: [...(link ? [link] : []), ...(links || [])], buttons: buttons, colSizes: { all: 12 } }))));
19
16
  exports.TabsTextContent = TabsTextContent;
20
17
  exports.default = exports.TabsTextContent;
@@ -1,6 +1,6 @@
1
1
  import React, { HTMLAttributeAnchorTarget, PropsWithChildren } from 'react';
2
- import { AnalyticsEventsBase, CardBaseProps as CardBaseParams, ImageProps, WithChildren } from '../../models';
3
- export interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams, PropsWithChildren {
2
+ import { AnalyticsEventsBase, CardBaseProps as CardBaseParams, ImageProps } from '../../models';
3
+ interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams {
4
4
  className?: string;
5
5
  bodyClassName?: string;
6
6
  contentClassName?: string;
@@ -10,6 +10,7 @@ export interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams, Prop
10
10
  qa?: string;
11
11
  extraProps?: React.HTMLAttributes<HTMLElement>;
12
12
  }
13
+ export type CardBasePropsType = PropsWithChildren<CardBaseProps>;
13
14
  export interface CardHeaderBaseProps {
14
15
  className?: string;
15
16
  image?: ImageProps | null;
@@ -18,11 +19,11 @@ export interface CardFooterBaseProps {
18
19
  className?: string;
19
20
  }
20
21
  export declare const Layout: {
21
- (props: CardBaseProps): JSX.Element;
22
- Header: React.FC<WithChildren<CardHeaderBaseProps>>;
22
+ (props: CardBasePropsType): JSX.Element;
23
+ Header: React.FC<React.PropsWithChildren<CardHeaderBaseProps>>;
23
24
  Content: React.FC<{
24
25
  children?: React.ReactNode;
25
26
  }>;
26
- Footer: React.FC<WithChildren<CardFooterBaseProps>>;
27
+ Footer: React.FC<React.PropsWithChildren<CardFooterBaseProps>>;
27
28
  };
28
29
  export default Layout;
@@ -4,18 +4,21 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const __1 = require("..");
6
6
  const FormsContext_1 = require("../../context/formsContext/FormsContext");
7
+ const theme_1 = require("../../context/theme");
7
8
  const models_1 = require("../../models");
8
9
  const sub_blocks_1 = require("../../sub-blocks");
10
+ const utils_1 = require("../../utils");
9
11
  const InnerForm = (props) => {
10
12
  const { formData, onContentLoad, className } = props;
11
13
  const formsConfig = (0, react_1.useContext)(FormsContext_1.FormsContext);
14
+ const theme = (0, theme_1.useTheme)();
12
15
  (0, react_1.useEffect)(() => {
13
16
  if ((0, models_1.isHubspotDataForm)(formData)) {
14
17
  onContentLoad();
15
18
  }
16
19
  }, [onContentLoad, formData]);
17
20
  if ((0, models_1.isYandexDataForm)(formData)) {
18
- const _a = formData.yandex, { onLoad } = _a, rest = tslib_1.__rest(_a, ["onLoad"]);
21
+ const _a = (0, utils_1.getThemedValue)(formData.yandex, theme), { onLoad } = _a, rest = tslib_1.__rest(_a, ["onLoad"]);
19
22
  return (react_1.default.createElement("div", { className: className },
20
23
  react_1.default.createElement(__1.YandexForm, Object.assign({}, formsConfig.yandex, rest, { onLoad: () => {
21
24
  onContentLoad();
@@ -23,7 +26,8 @@ const InnerForm = (props) => {
23
26
  } }))));
24
27
  }
25
28
  if ((0, models_1.isHubspotDataForm)(formData)) {
26
- return (react_1.default.createElement(sub_blocks_1.HubspotForm, Object.assign({ createDOMElement: true }, formsConfig.hubspot, formData.hubspot)));
29
+ const themedFormData = (0, utils_1.getThemedValue)(formData.hubspot, theme);
30
+ return (react_1.default.createElement(sub_blocks_1.HubspotForm, Object.assign({ createDOMElement: true }, formsConfig.hubspot, themedFormData)));
27
31
  }
28
32
  return null;
29
33
  };
@@ -287,6 +287,7 @@ export interface ContentItemProps {
287
287
  export interface ContentListProps {
288
288
  list: ContentItemProps[];
289
289
  size: ContentSize;
290
+ theme?: ContentTheme;
290
291
  }
291
292
  export interface ContentBlockProps {
292
293
  title?: TitleItemBaseProps | string;
@@ -323,10 +324,10 @@ export declare enum FormBlockDirection {
323
324
  Center = "center"
324
325
  }
325
326
  export interface FormBlockYandexData {
326
- yandex: YandexFormProps;
327
+ yandex: ThemeSupporting<YandexFormProps>;
327
328
  }
328
329
  export interface FormBlockHubspotData {
329
- hubspot: HubspotFormProps;
330
+ hubspot: ThemeSupporting<HubspotFormProps>;
330
331
  }
331
332
  export type FormBlockData = FormBlockYandexData | FormBlockHubspotData;
332
333
  export interface FormBlockProps {
@@ -334,7 +335,7 @@ export interface FormBlockProps {
334
335
  title?: string;
335
336
  textContent?: Omit<ContentBlockProps, 'centered' | 'colSizes' | 'size'>;
336
337
  direction?: FormBlockDirection;
337
- background?: BackgroundImageProps;
338
+ background?: ThemeSupporting<BackgroundImageProps>;
338
339
  }
339
340
  export type HeaderBlockModel = {
340
341
  type: BlockType.HeaderBlock;
@@ -9,7 +9,7 @@ const utils_1 = require("../../utils");
9
9
  const Content_1 = tslib_1.__importDefault(require("../Content/Content"));
10
10
  const b = (0, utils_1.block)('background-card');
11
11
  const BackgroundCard = (props) => {
12
- const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, urlTitle, controlPosition = 'content', } = props;
12
+ const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, urlTitle, controlPosition = 'content', list, } = props;
13
13
  const titleId = (0, uikit_1.useUniqId)();
14
14
  const theme = (0, theme_1.useTheme)();
15
15
  const hasBackgroundColor = backgroundColor || cardTheme !== 'default';
@@ -18,7 +18,7 @@ const BackgroundCard = (props) => {
18
18
  return (react_1.default.createElement(components_1.CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), url: url, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle },
19
19
  react_1.default.createElement(components_1.CardBase.Content, null,
20
20
  react_1.default.createElement(components_1.BackgroundImage, Object.assign({ className: b('image') }, (0, utils_1.getThemedValue)(background, theme), { style: { backgroundColor } })),
21
- react_1.default.createElement(Content_1.default, { titleId: titleId, title: title, text: text, additionalInfo: additionalInfo, size: "s", theme: cardTheme, links: areControlsInFooter ? undefined : links, buttons: areControlsInFooter ? undefined : buttons, colSizes: { all: 12, md: 12 } })),
21
+ react_1.default.createElement(Content_1.default, { titleId: titleId, title: title, text: text, additionalInfo: additionalInfo, size: "s", theme: cardTheme, links: areControlsInFooter ? undefined : links, buttons: areControlsInFooter ? undefined : buttons, list: list, colSizes: { all: 12, md: 12 } })),
22
22
  areControlsInFooter && (links || buttons) && (react_1.default.createElement(components_1.CardBase.Footer, null,
23
23
  react_1.default.createElement(components_1.Links, { className: b('links'), size: "s", links: links, titleId: titleId }),
24
24
  react_1.default.createElement(components_1.Buttons, { className: b('buttons'), size: "s", buttons: buttons, titleId: titleId })))));
@@ -2,10 +2,11 @@ import React, { useCallback, useContext, useState } from 'react';
2
2
  import { BackgroundImage, Title } from '../../components';
3
3
  import InnerForm from '../../components/InnerForm/InnerForm';
4
4
  import { MobileContext } from '../../context/mobileContext';
5
+ import { useTheme } from '../../context/theme';
5
6
  import { Col, Grid, GridAlignItems, GridColumnSize, Row } from '../../grid';
6
7
  import { FormBlockDataTypes, FormBlockDirection, isHubspotDataForm, isYandexDataForm, } from '../../models';
7
8
  import { Content } from '../../sub-blocks';
8
- import { block } from '../../utils';
9
+ import { block, getThemedValue } from '../../utils';
9
10
  import './Form.css';
10
11
  const b = block('form-block');
11
12
  const colSizes = { [GridColumnSize.Lg]: 6, [GridColumnSize.All]: 12 };
@@ -14,7 +15,12 @@ const FormBlock = (props) => {
14
15
  const { formData, title, textContent, direction = FormBlockDirection.Center, background } = props;
15
16
  const [contentLoaded, setContentLoaded] = useState(false);
16
17
  const isMobile = useContext(MobileContext);
17
- const withBackground = Boolean(background && (background.src || background.desktop || ((_a = background.style) === null || _a === void 0 ? void 0 : _a.backgroundColor)));
18
+ const theme = useTheme();
19
+ const themedBackground = getThemedValue(background, theme) || undefined;
20
+ const withBackground = Boolean(themedBackground &&
21
+ (themedBackground.src ||
22
+ themedBackground.desktop ||
23
+ ((_a = themedBackground.style) === null || _a === void 0 ? void 0 : _a.backgroundColor)));
18
24
  const onContentLoad = useCallback(() => {
19
25
  setContentLoaded(true);
20
26
  }, []);
@@ -32,7 +38,7 @@ const FormBlock = (props) => {
32
38
  'with-background': withBackground,
33
39
  'form-type': formType,
34
40
  }) },
35
- background && (React.createElement(BackgroundImage, Object.assign({}, background, { className: b('media'), imageClassName: b('image') }))),
41
+ themedBackground && (React.createElement(BackgroundImage, Object.assign({}, themedBackground, { className: b('media'), imageClassName: b('image') }))),
36
42
  React.createElement(Grid, null,
37
43
  React.createElement(Row, { alignItems: direction === FormBlockDirection.Center
38
44
  ? GridAlignItems.Center
@@ -12,20 +12,30 @@ export declare const FormBlock: {
12
12
  optionName: string;
13
13
  properties: {
14
14
  yandex: {
15
- type: string;
16
- required: string[];
17
- properties: {
18
- id: {
19
- type: string;
20
- };
21
- containerId: {
22
- type: string;
23
- };
24
- type: {};
25
- when: {
26
- type: string;
27
- };
28
- };
15
+ oneOf: (({
16
+ type: string;
17
+ required: string[];
18
+ properties: {
19
+ id: {
20
+ type: string;
21
+ };
22
+ containerId: {
23
+ type: string;
24
+ };
25
+ type: {};
26
+ when: {
27
+ type: string;
28
+ };
29
+ };
30
+ } & {
31
+ optionName: string;
32
+ }) | {
33
+ type: string;
34
+ additionalProperties: boolean;
35
+ required: import("../..").Theme[];
36
+ properties: {};
37
+ optionName: string;
38
+ })[];
29
39
  };
30
40
  hubspot?: undefined;
31
41
  };
@@ -34,26 +44,36 @@ export declare const FormBlock: {
34
44
  optionName: string;
35
45
  properties: {
36
46
  hubspot: {
37
- type: string;
38
- required: string[];
39
- properties: {
40
- region: {
41
- type: string;
42
- };
43
- portalId: {
44
- type: string;
45
- };
46
- formId: {
47
- type: string;
48
- };
49
- formInstanceId: {
50
- type: string;
51
- };
52
- type: {};
53
- when: {
54
- type: string;
55
- };
56
- };
47
+ oneOf: (({
48
+ type: string;
49
+ required: string[];
50
+ properties: {
51
+ region: {
52
+ type: string;
53
+ };
54
+ portalId: {
55
+ type: string;
56
+ };
57
+ formId: {
58
+ type: string;
59
+ };
60
+ formInstanceId: {
61
+ type: string;
62
+ };
63
+ type: {};
64
+ when: {
65
+ type: string;
66
+ };
67
+ };
68
+ } & {
69
+ optionName: string;
70
+ }) | {
71
+ type: string;
72
+ additionalProperties: boolean;
73
+ required: import("../..").Theme[];
74
+ properties: {};
75
+ optionName: string;
76
+ })[];
57
77
  };
58
78
  yandex?: undefined;
59
79
  };
@@ -1,7 +1,7 @@
1
1
  import omit from 'lodash/omit';
2
2
  import { ImageProps } from '../../components/Image/schema';
3
3
  import { YandexFormProps } from '../../components/YandexForm/schema';
4
- import { BlockBaseProps } from '../../schema/validators/common';
4
+ import { BlockBaseProps, withTheme } from '../../schema/validators/common';
5
5
  import { ContentBase } from '../../sub-blocks/Content/schema';
6
6
  import { HubspotFormProps } from '../../sub-blocks/HubspotForm/schema';
7
7
  const FormBlockContentProps = omit(ContentBase, ['size', 'centered', 'colSizes']);
@@ -17,14 +17,14 @@ export const FormBlock = {
17
17
  type: 'object',
18
18
  optionName: 'yandex',
19
19
  properties: {
20
- yandex: YandexFormProps,
20
+ yandex: withTheme(YandexFormProps),
21
21
  },
22
22
  },
23
23
  {
24
24
  type: 'object',
25
25
  optionName: 'hubspot',
26
26
  properties: {
27
- hubspot: HubspotFormProps,
27
+ hubspot: withTheme(HubspotFormProps),
28
28
  },
29
29
  },
30
30
  ],
@@ -25,8 +25,8 @@ export const InfoBlock = (props) => {
25
25
  React.createElement(Grid, null,
26
26
  React.createElement(Row, null,
27
27
  React.createElement(Col, { sizes: sizes, className: b('left') },
28
- React.createElement(Content, Object.assign({ title: title || (leftContent === null || leftContent === void 0 ? void 0 : leftContent.title), text: leftContent === null || leftContent === void 0 ? void 0 : leftContent.text, links: leftContent === null || leftContent === void 0 ? void 0 : leftContent.links, buttons: leftButtons, additionalInfo: leftContent === null || leftContent === void 0 ? void 0 : leftContent.additionalInfo }, commonProps))),
28
+ React.createElement(Content, Object.assign({ title: title || (leftContent === null || leftContent === void 0 ? void 0 : leftContent.title), text: leftContent === null || leftContent === void 0 ? void 0 : leftContent.text, links: leftContent === null || leftContent === void 0 ? void 0 : leftContent.links, list: leftContent === null || leftContent === void 0 ? void 0 : leftContent.list, buttons: leftButtons, additionalInfo: leftContent === null || leftContent === void 0 ? void 0 : leftContent.additionalInfo }, commonProps))),
29
29
  React.createElement(Col, { sizes: sizes, className: b('right') },
30
- React.createElement(Content, Object.assign({ title: sectionsTitle || (rightContent === null || rightContent === void 0 ? void 0 : rightContent.title), text: rightContent === null || rightContent === void 0 ? void 0 : rightContent.text, links: rightLinks, buttons: rightContent === null || rightContent === void 0 ? void 0 : rightContent.buttons, additionalInfo: rightContent === null || rightContent === void 0 ? void 0 : rightContent.additionalInfo }, commonProps))))))));
30
+ React.createElement(Content, Object.assign({ title: sectionsTitle || (rightContent === null || rightContent === void 0 ? void 0 : rightContent.title), text: rightContent === null || rightContent === void 0 ? void 0 : rightContent.text, links: rightLinks, list: rightContent === null || rightContent === void 0 ? void 0 : rightContent.list, buttons: rightContent === null || rightContent === void 0 ? void 0 : rightContent.buttons, additionalInfo: rightContent === null || rightContent === void 0 ? void 0 : rightContent.additionalInfo }, commonProps))))))));
31
31
  };
32
32
  export default InfoBlock;
@@ -7,7 +7,7 @@ import { FaqMicrodataValues } from './models';
7
7
  import './Questions.css';
8
8
  const b = block('QuestionsBlock');
9
9
  const QuestionsBlock = (props) => {
10
- const { title, text, additionalInfo, links, buttons, items } = props;
10
+ const { title, text, additionalInfo, links, buttons, items, list } = props;
11
11
  const [opened, setOpened] = useState([0]);
12
12
  const toggleItem = (index) => {
13
13
  let newState;
@@ -23,7 +23,7 @@ const QuestionsBlock = (props) => {
23
23
  React.createElement(Row, null,
24
24
  React.createElement(Col, { sizes: { all: 12, md: 4 } },
25
25
  React.createElement("div", { className: b('title') },
26
- React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, buttons: buttons, colSizes: { all: 12, md: 12 } }))),
26
+ React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, links: links, list: list, buttons: buttons, colSizes: { all: 12, md: 12 } }))),
27
27
  React.createElement(Col, { sizes: { all: 12, md: 8 }, role: 'list' }, items.map(({ title: itemTitle, text: itemText, link, listStyle = 'dash' }, index) => {
28
28
  const isOpened = opened.includes(index);
29
29
  const onClick = () => toggleItem(index);
@@ -7,5 +7,5 @@ interface TextContentProps extends Pick<TabsBlockProps, 'centered' | 'contentSiz
7
7
  centered?: boolean;
8
8
  imageProps?: ImageObjectProps | ImageDeviceProps;
9
9
  }
10
- export declare const TabsTextContent: ({ centered, contentSize, showMedia, data, imageProps, isReverse, }: TextContentProps) => JSX.Element;
10
+ export declare const TabsTextContent: ({ centered, contentSize, showMedia, data: { media, title, text, additionalInfo, link, links, buttons, list }, imageProps, isReverse, }: TextContentProps) => JSX.Element;
11
11
  export default TabsTextContent;
@@ -4,13 +4,10 @@ import { Content } from '../../../sub-blocks';
4
4
  import { block } from '../../../utils';
5
5
  import './TabsTextContent.css';
6
6
  const b = block('tabs-block-text-content');
7
- export const TabsTextContent = ({ centered, contentSize = 's', showMedia, data, imageProps, isReverse, }) => {
8
- const isImage = (data === null || data === void 0 ? void 0 : data.media) || imageProps;
9
- return (React.createElement(Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b({ centered: centered }) },
10
- React.createElement("div", { className: b('wrapper', {
11
- reverse: isReverse,
12
- 'no-image': !isImage,
13
- }) },
14
- React.createElement(Content, { title: data.title, text: data.text, additionalInfo: data.additionalInfo, size: contentSize, links: [...(data.link ? [data.link] : []), ...(data.links || [])], buttons: data.buttons, colSizes: { all: 12 } }))));
15
- };
7
+ export const TabsTextContent = ({ centered, contentSize = 's', showMedia, data: { media, title, text, additionalInfo, link, links, buttons, list }, imageProps, isReverse, }) => (React.createElement(Col, { sizes: { all: 12, md: showMedia ? 4 : 8 }, className: b({ centered: centered }) },
8
+ React.createElement("div", { className: b('wrapper', {
9
+ reverse: isReverse,
10
+ 'no-image': !(media || imageProps),
11
+ }) },
12
+ React.createElement(Content, { title: title, text: text, additionalInfo: additionalInfo, size: contentSize, list: list, links: [...(link ? [link] : []), ...(links || [])], buttons: buttons, colSizes: { all: 12 } }))));
16
13
  export default TabsTextContent;
@@ -1,7 +1,7 @@
1
1
  import React, { HTMLAttributeAnchorTarget, PropsWithChildren } from 'react';
2
- import { AnalyticsEventsBase, CardBaseProps as CardBaseParams, ImageProps, WithChildren } from '../../models';
2
+ import { AnalyticsEventsBase, CardBaseProps as CardBaseParams, ImageProps } from '../../models';
3
3
  import './CardBase.css';
4
- export interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams, PropsWithChildren {
4
+ interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams {
5
5
  className?: string;
6
6
  bodyClassName?: string;
7
7
  contentClassName?: string;
@@ -11,6 +11,7 @@ export interface CardBaseProps extends AnalyticsEventsBase, CardBaseParams, Prop
11
11
  qa?: string;
12
12
  extraProps?: React.HTMLAttributes<HTMLElement>;
13
13
  }
14
+ export type CardBasePropsType = PropsWithChildren<CardBaseProps>;
14
15
  export interface CardHeaderBaseProps {
15
16
  className?: string;
16
17
  image?: ImageProps | null;
@@ -19,11 +20,11 @@ export interface CardFooterBaseProps {
19
20
  className?: string;
20
21
  }
21
22
  export declare const Layout: {
22
- (props: CardBaseProps): JSX.Element;
23
- Header: React.FC<WithChildren<CardHeaderBaseProps>>;
23
+ (props: CardBasePropsType): JSX.Element;
24
+ Header: React.FC<React.PropsWithChildren<CardHeaderBaseProps>>;
24
25
  Content: React.FC<{
25
26
  children?: React.ReactNode;
26
27
  }>;
27
- Footer: React.FC<WithChildren<CardFooterBaseProps>>;
28
+ Footer: React.FC<React.PropsWithChildren<CardFooterBaseProps>>;
28
29
  };
29
30
  export default Layout;