@gravity-ui/page-constructor 4.37.4 → 4.38.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.
Files changed (52) hide show
  1. package/build/cjs/{sub-blocks/Content → components}/ContentList/ContentList.css +13 -0
  2. package/build/cjs/components/ContentList/ContentList.d.ts +4 -0
  3. package/build/cjs/{sub-blocks/Content → components}/ContentList/ContentList.js +8 -13
  4. package/build/cjs/components/ContentList/ContentListItemIcon.d.ts +7 -0
  5. package/build/cjs/components/ContentList/ContentListItemIcon.js +23 -0
  6. package/build/cjs/components/FileLink/FileLink.js +1 -1
  7. package/build/cjs/components/index.d.ts +1 -0
  8. package/build/cjs/components/index.js +3 -1
  9. package/build/cjs/models/constructor-items/blocks.d.ts +7 -2
  10. package/build/cjs/models/constructor-items/sub-blocks.d.ts +14 -2
  11. package/build/cjs/models/constructor-items/sub-blocks.js +1 -0
  12. package/build/cjs/schema/validators/sub-blocks.d.ts +1 -0
  13. package/build/cjs/schema/validators/sub-blocks.js +1 -0
  14. package/build/cjs/sub-blocks/Content/Content.js +2 -4
  15. package/build/cjs/sub-blocks/PriceCard/PriceCard.css +80 -0
  16. package/build/cjs/sub-blocks/PriceCard/PriceCard.d.ts +3 -0
  17. package/build/cjs/sub-blocks/PriceCard/PriceCard.js +33 -0
  18. package/build/cjs/sub-blocks/PriceCard/schema.d.ts +648 -0
  19. package/build/cjs/sub-blocks/PriceCard/schema.js +34 -0
  20. package/build/cjs/sub-blocks/index.d.ts +1 -0
  21. package/build/cjs/sub-blocks/index.js +3 -1
  22. package/build/cjs/text-transform/config.js +11 -0
  23. package/build/esm/{sub-blocks/Content → components}/ContentList/ContentList.css +13 -0
  24. package/build/esm/components/ContentList/ContentList.d.ts +5 -0
  25. package/build/esm/{sub-blocks/Content → components}/ContentList/ContentList.js +6 -11
  26. package/build/esm/components/ContentList/ContentListItemIcon.d.ts +7 -0
  27. package/build/esm/components/ContentList/ContentListItemIcon.js +20 -0
  28. package/build/esm/components/FileLink/FileLink.js +1 -1
  29. package/build/esm/components/index.d.ts +1 -0
  30. package/build/esm/components/index.js +1 -0
  31. package/build/esm/models/constructor-items/blocks.d.ts +7 -2
  32. package/build/esm/models/constructor-items/sub-blocks.d.ts +14 -2
  33. package/build/esm/models/constructor-items/sub-blocks.js +1 -0
  34. package/build/esm/schema/validators/sub-blocks.d.ts +1 -0
  35. package/build/esm/schema/validators/sub-blocks.js +1 -0
  36. package/build/esm/sub-blocks/Content/Content.js +1 -3
  37. package/build/esm/sub-blocks/PriceCard/PriceCard.css +80 -0
  38. package/build/esm/sub-blocks/PriceCard/PriceCard.d.ts +4 -0
  39. package/build/esm/sub-blocks/PriceCard/PriceCard.js +31 -0
  40. package/build/esm/sub-blocks/PriceCard/schema.d.ts +648 -0
  41. package/build/esm/sub-blocks/PriceCard/schema.js +31 -0
  42. package/build/esm/sub-blocks/index.d.ts +1 -0
  43. package/build/esm/sub-blocks/index.js +1 -0
  44. package/build/esm/text-transform/config.js +11 -0
  45. package/package.json +1 -1
  46. package/server/models/constructor-items/blocks.d.ts +7 -2
  47. package/server/models/constructor-items/sub-blocks.d.ts +14 -2
  48. package/server/models/constructor-items/sub-blocks.js +1 -0
  49. package/server/text-transform/config.js +11 -0
  50. package/widget/index.js +1 -1
  51. package/build/cjs/sub-blocks/Content/ContentList/ContentList.d.ts +0 -8
  52. package/build/esm/sub-blocks/Content/ContentList/ContentList.d.ts +0 -9
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.HubspotForm = exports.Content = exports.BasicCard = exports.BackgroundCard = exports.LayoutItem = exports.BannerCard = exports.MediaCard = exports.PriceDetailed = exports.Quote = exports.Divider = void 0;
6
+ exports.PriceCard = exports.HubspotForm = exports.Content = exports.BasicCard = exports.BackgroundCard = exports.LayoutItem = exports.BannerCard = exports.MediaCard = exports.PriceDetailed = exports.Quote = exports.Divider = void 0;
7
7
  var Divider_1 = require("./Divider/Divider");
8
8
  Object.defineProperty(exports, "Divider", { enumerable: true, get: function () { return __importDefault(Divider_1).default; } });
9
9
  var Quote_1 = require("./Quote/Quote");
@@ -24,3 +24,5 @@ var Content_1 = require("./Content/Content");
24
24
  Object.defineProperty(exports, "Content", { enumerable: true, get: function () { return __importDefault(Content_1).default; } });
25
25
  var HubspotForm_1 = require("./HubspotForm");
26
26
  Object.defineProperty(exports, "HubspotForm", { enumerable: true, get: function () { return __importDefault(HubspotForm_1).default; } });
27
+ var PriceCard_1 = require("./PriceCard/PriceCard");
28
+ Object.defineProperty(exports, "PriceCard", { enumerable: true, get: function () { return __importDefault(PriceCard_1).default; } });
@@ -304,4 +304,15 @@ exports.config = {
304
304
  [models_1.BlockType.CardLayoutBlock]: exports.blockHeaderTransformer,
305
305
  [models_1.BlockType.FilterBlock]: exports.blockHeaderTransformer,
306
306
  [models_1.BlockType.IconsBlock]: exports.blockHeaderTransformer,
307
+ [models_1.SubBlockType.PriceCard]: [
308
+ {
309
+ fields: ['title'],
310
+ transformer: common_1.typografTransformer,
311
+ },
312
+ {
313
+ fields: ['list'],
314
+ transformer: common_1.yfmTransformer,
315
+ parser: (0, common_1.createItemsParser)(['text']),
316
+ },
317
+ ],
307
318
  };
@@ -15,6 +15,13 @@ unpredictable css rules order in build */
15
15
  margin-bottom: 1px;
16
16
  margin-right: 12px;
17
17
  }
18
+ .pc-content-list_size_l .pc-content-list__icon_without_title {
19
+ width: 20px;
20
+ height: 20px;
21
+ margin-top: 0;
22
+ margin-bottom: 0;
23
+ margin-right: 8px;
24
+ }
18
25
  .pc-content-list_size_l .pc-content-list__item:not(:last-child) {
19
26
  margin-bottom: 16px;
20
27
  }
@@ -33,6 +40,12 @@ unpredictable css rules order in build */
33
40
  margin-bottom: 2px;
34
41
  margin-right: 8px;
35
42
  }
43
+ .pc-content-list_size_s .pc-content-list__icon_without_title {
44
+ width: 18px;
45
+ height: 18px;
46
+ margin-top: 0;
47
+ margin-bottom: 0;
48
+ }
36
49
  .pc-content-list_size_s .pc-content-list__text {
37
50
  font-size: var(--g-text-body-1-font-size);
38
51
  line-height: var(--g-text-body-1-line-height);
@@ -0,0 +1,5 @@
1
+ import { ContentListProps } from '../../models';
2
+ import { QAProps } from '../../models/common';
3
+ import './ContentList.css';
4
+ declare const ContentList: ({ list, size, qa }: ContentListProps & QAProps) => JSX.Element;
5
+ export default ContentList;
@@ -1,11 +1,9 @@
1
1
  import React from 'react';
2
2
  import { v4 as uuidv4 } from 'uuid';
3
- import { YFMWrapper } from '../../../components';
4
- import Image from '../../../components/Image/Image';
5
- import { getMediaImage } from '../../../components/Media/Image/utils';
6
- import { useTheme } from '../../../context/theme';
7
- import { block, getThemedValue } from '../../../utils';
8
- import { getQaAttrubutes } from '../../../utils/blocks';
3
+ import { block } from '../../utils';
4
+ import { getQaAttrubutes } from '../../utils/blocks';
5
+ import YFMWrapper from '../YFMWrapper/YFMWrapper';
6
+ import ItemIcon from './ContentListItemIcon';
9
7
  import './ContentList.css';
10
8
  const b = block('content-list');
11
9
  function getHeadingLevel(size) {
@@ -17,15 +15,12 @@ function getHeadingLevel(size) {
17
15
  return 'h3';
18
16
  }
19
17
  }
20
- const ContentList = ({ list, size, qa }) => {
21
- const theme = useTheme();
18
+ const ContentList = ({ list, size = 'l', qa }) => {
22
19
  const qaAttributes = getQaAttrubutes(qa, ['image', 'title', 'text']);
23
20
  return (React.createElement("div", { className: b({ size }), "data-qa": qa }, list === null || list === void 0 ? void 0 : list.map((item) => {
24
21
  const { icon, title, text } = item;
25
- const iconThemed = getThemedValue(icon, theme);
26
- const iconData = getMediaImage(iconThemed);
27
22
  return (React.createElement("div", { className: b('item'), key: uuidv4() },
28
- React.createElement(Image, Object.assign({}, iconData, { className: b('icon'), qa: qaAttributes.image })),
23
+ React.createElement(ItemIcon, { icon: icon, className: b('icon', { without_title: !title }), qa: qaAttributes.image }),
29
24
  React.createElement("div", null,
30
25
  title &&
31
26
  React.createElement(getHeadingLevel(size), { className: b('title'), 'data-qa': qaAttributes.title }, title),
@@ -0,0 +1,7 @@
1
+ import { ClassNameProps, ImageProps, QAProps, SVGIcon } from '../../models';
2
+ import { ThemeSupporting } from '../../utils';
3
+ interface ListItemProps extends QAProps, ClassNameProps {
4
+ icon: ThemeSupporting<ImageProps | SVGIcon>;
5
+ }
6
+ declare const ContentListItemIcon: ({ icon, className, qa }: ListItemProps) => JSX.Element;
7
+ export default ContentListItemIcon;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { useTheme } from '../../context/theme';
3
+ import { getThemedValue } from '../../utils';
4
+ import Image from '../Image/Image';
5
+ import { getMediaImage } from '../Media/Image/utils';
6
+ function isIconSvg(icon) {
7
+ return typeof icon === 'function';
8
+ }
9
+ const ContentListItemIcon = ({ icon, className, qa }) => {
10
+ const theme = useTheme();
11
+ const iconThemed = getThemedValue(icon, theme);
12
+ if (isIconSvg(iconThemed)) {
13
+ const Icon = iconThemed;
14
+ return (React.createElement("div", null,
15
+ React.createElement(Icon, { className: className })));
16
+ }
17
+ const iconData = getMediaImage(iconThemed);
18
+ return React.createElement(Image, Object.assign({}, iconData, { className: className, qa: qa }));
19
+ };
20
+ export default ContentListItemIcon;
@@ -15,7 +15,7 @@ export var FileExtension;
15
15
  FileExtension["ZIP"] = "zip";
16
16
  })(FileExtension || (FileExtension = {}));
17
17
  export function getFileExt(name) {
18
- if (name.includes(FIGMA_URL)) {
18
+ if (name === null || name === void 0 ? void 0 : name.includes(FIGMA_URL)) {
19
19
  return FileExtension.FIG;
20
20
  }
21
21
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -34,5 +34,6 @@ export { default as RouterLink } from './RouterLink/RouterLink';
34
34
  export { default as HTML } from './HTML/HTML';
35
35
  export { default as MetaInfo } from './MetaInfo/MetaInfo';
36
36
  export { default as FullscreenMedia } from './FullscreenMedia/FullscreenMedia';
37
+ export { default as ContentList } from './ContentList/ContentList';
37
38
  export type { RouterLinkProps } from './RouterLink/RouterLink';
38
39
  export type { ImageBaseProps } from './ImageBase/ImageBase';
@@ -34,3 +34,4 @@ export { default as RouterLink } from './RouterLink/RouterLink';
34
34
  export { default as HTML } from './HTML/HTML';
35
35
  export { default as MetaInfo } from './MetaInfo/MetaInfo';
36
36
  export { default as FullscreenMedia } from './FullscreenMedia/FullscreenMedia';
37
+ export { default as ContentList } from './ContentList/ContentList';
@@ -3,7 +3,7 @@ import { ButtonSize } from '@gravity-ui/uikit';
3
3
  import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
4
4
  import { ThemeSupporting } from '../../utils';
5
5
  import { AnalyticsEventsBase } from '../common';
6
- import { AnchorProps, Animatable, BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleItemBaseProps, TitleItemProps, YandexFormProps } from './common';
6
+ import { AnchorProps, Animatable, BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, ImageProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleItemBaseProps, TitleItemProps, YandexFormProps } from './common';
7
7
  import { BannerCardProps, HubspotFormProps, SubBlock, SubBlockModels } from './sub-blocks';
8
8
  export declare enum BlockType {
9
9
  PromoFeaturesBlock = "promo-features-block",
@@ -270,10 +270,15 @@ export interface ContentLayoutBlockProps extends ContentLayoutBlockParams {
270
270
  textContent: ContentBlockProps;
271
271
  fileContent?: FileLinkProps[];
272
272
  }
273
+ export type SVGIcon = React.FC<React.SVGProps<SVGSVGElement>>;
273
274
  export interface ContentItemProps {
274
275
  title?: string;
275
276
  text?: string;
276
- icon: ThemedImage;
277
+ icon: ThemeSupporting<ImageProps | SVGIcon>;
278
+ }
279
+ export interface ContentListProps {
280
+ list: ContentItemProps[];
281
+ size: ContentSize;
277
282
  }
278
283
  export interface ContentBlockProps {
279
284
  title?: TitleItemBaseProps | string;
@@ -3,7 +3,7 @@ import { ThemeSupporting } from '../../utils';
3
3
  import { HubspotEventData, HubspotEventHandlers } from '../../utils/hubspot';
4
4
  import { AnalyticsEventsBase, PixelEvent } from '../common';
5
5
  import { ContentBlockProps } from './blocks';
6
- import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, MediaProps, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
6
+ import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, LinkProps, MediaProps, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
7
7
  export declare enum SubBlockType {
8
8
  Divider = "divider",
9
9
  Quote = "quote",
@@ -21,7 +21,8 @@ export declare enum SubBlockType {
21
21
  /**
22
22
  * @deprecated Will be removed, use BasicCard instead
23
23
  */
24
- Card = "card"
24
+ Card = "card",
25
+ PriceCard = "price-card"
25
26
  }
26
27
  export declare enum IconPosition {
27
28
  Top = "top",
@@ -98,6 +99,17 @@ export interface BannerCardProps {
98
99
  }
99
100
  export interface MediaCardProps extends MediaProps, AnalyticsEventsBase, CardBaseProps {
100
101
  }
102
+ export interface PriceCardProps extends CardBaseProps, Pick<ContentBlockProps, 'theme'> {
103
+ title: string;
104
+ price: string;
105
+ pricePeriod?: string;
106
+ priceDetails?: string;
107
+ description?: string;
108
+ buttons?: ButtonProps[];
109
+ links?: LinkProps[];
110
+ backgroundColor?: string;
111
+ list?: string[];
112
+ }
101
113
  export interface LayoutItemProps extends ClassNameProps, AnalyticsEventsBase {
102
114
  content: Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size'>;
103
115
  media: MediaProps;
@@ -17,6 +17,7 @@ export var SubBlockType;
17
17
  * @deprecated Will be removed, use BasicCard instead
18
18
  */
19
19
  SubBlockType["Card"] = "card";
20
+ SubBlockType["PriceCard"] = "price-card";
20
21
  })(SubBlockType || (SubBlockType = {}));
21
22
  export var IconPosition;
22
23
  (function (IconPosition) {
@@ -6,3 +6,4 @@ export * from '../../sub-blocks/LayoutItem/schema';
6
6
  export * from '../../sub-blocks/Quote/schema';
7
7
  export * from '../../sub-blocks/Divider/schema';
8
8
  export * from '../../sub-blocks/BasicCard/schema';
9
+ export * from '../../sub-blocks/PriceCard/schema';
@@ -6,3 +6,4 @@ export * from '../../sub-blocks/LayoutItem/schema';
6
6
  export * from '../../sub-blocks/Quote/schema';
7
7
  export * from '../../sub-blocks/Divider/schema';
8
8
  export * from '../../sub-blocks/BasicCard/schema';
9
+ export * from '../../sub-blocks/PriceCard/schema';
@@ -1,11 +1,9 @@
1
1
  import React from 'react';
2
2
  import { useUniqId } from '@gravity-ui/uikit';
3
- import { Button, Title, YFMWrapper } from '../../components';
4
- import LinkBlock from '../../components/Link/Link';
3
+ import { Button, ContentList, Link as LinkBlock, Title, YFMWrapper } from '../../components';
5
4
  import { Col } from '../../grid';
6
5
  import { block } from '../../utils';
7
6
  import { getQaAttrubutes } from '../../utils/blocks';
8
- import ContentList from './ContentList/ContentList';
9
7
  import './Content.css';
10
8
  const b = block('content');
11
9
  function getTextSize(size) {
@@ -0,0 +1,80 @@
1
+ /* use this for style redefinitions to awoid problems with
2
+ unpredictable css rules order in build */
3
+ .pc-price-card {
4
+ position: relative;
5
+ }
6
+ .pc-price-card__background {
7
+ position: absolute;
8
+ top: 0;
9
+ left: 0;
10
+ width: 100%;
11
+ height: 100%;
12
+ }
13
+ .pc-price-card__content {
14
+ height: 100%;
15
+ display: flex;
16
+ flex-direction: column;
17
+ position: relative;
18
+ }
19
+ .pc-price-card__content_theme_dark {
20
+ color: var(--g-color-text-light-primary);
21
+ --g-color-line-focus: var(--pc-color-line-focus-dark);
22
+ }
23
+ .pc-price-card__content_theme_dark .pc-price-card__info .yfm,
24
+ .pc-price-card__content_theme_dark .pc-price-card__info .yfm * {
25
+ color: var(--g-color-text-light-primary);
26
+ }
27
+ .pc-price-card__content_theme_dark .pc-price-card__info a {
28
+ text-decoration: underline;
29
+ }
30
+ .pc-price-card__content_theme_dark .pc-price-card__info a:hover {
31
+ color: var(--g-color-text-light-secondary);
32
+ }
33
+ .pc-price-card__content_theme_light {
34
+ color: var(--g-color-text-dark-primary);
35
+ }
36
+ .pc-price-card__content_theme_light .pc-price-card__info .yfm,
37
+ .pc-price-card__content_theme_light .pc-price-card__info .yfm * {
38
+ color: var(--g-color-text-dark-primary);
39
+ }
40
+ .pc-price-card__content_theme_light .pc-price-card__info a {
41
+ text-decoration: underline;
42
+ }
43
+ .pc-price-card__content_theme_light .pc-price-card__info a:hover {
44
+ color: var(--g-color-text-dark-secondary);
45
+ }
46
+ .pc-price-card__title {
47
+ font-size: var(--g-text-subheader-3-font-size);
48
+ line-height: var(--g-text-subheader-3-line-height);
49
+ margin-bottom: 24px;
50
+ }
51
+ .pc-price-card__price {
52
+ margin-bottom: 24px;
53
+ }
54
+ .pc-price-card__price-value {
55
+ font-size: var(--g-text-display-1-font-size);
56
+ line-height: var(--g-text-display-1-line-height);
57
+ }
58
+ .pc-price-card__price-period {
59
+ margin-left: 4px;
60
+ }
61
+ .pc-price-card__price-details {
62
+ margin-bottom: 12px;
63
+ }
64
+ .pc-price-card__main {
65
+ flex: 1;
66
+ min-height: 0;
67
+ display: flex;
68
+ flex-direction: column;
69
+ position: relative;
70
+ }
71
+ .pc-price-card__info {
72
+ margin-bottom: 24px;
73
+ flex: 1;
74
+ min-height: 0;
75
+ display: flex;
76
+ flex-direction: column;
77
+ }
78
+ .pc-price-card__links > *:not(:last-child), .pc-price-card__buttons > *:not(:last-child) {
79
+ margin-right: 16px;
80
+ }
@@ -0,0 +1,4 @@
1
+ import { PriceCardProps } from '../../models';
2
+ import './PriceCard.css';
3
+ declare const PriceCard: (props: PriceCardProps) => JSX.Element;
4
+ export default PriceCard;
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import Check from '@gravity-ui/icons/Check';
3
+ import { BackgroundImage, Button, CardBase, ContentList, Link as LinkBlock } from '../../components';
4
+ import { block } from '../../utils';
5
+ import './PriceCard.css';
6
+ const b = block('price-card');
7
+ const PriceCard = (props) => {
8
+ const { border, title, price, pricePeriod, priceDetails, theme, description, list, buttons, links, backgroundColor, } = props;
9
+ return (React.createElement(CardBase, { className: b({ theme }), border: border },
10
+ React.createElement(CardBase.Content, null,
11
+ React.createElement(BackgroundImage, { className: b('background'), style: { backgroundColor } }),
12
+ React.createElement("div", { className: b('content', { theme }) },
13
+ React.createElement("div", { className: b('info') },
14
+ React.createElement("div", { className: b('title') }, title),
15
+ React.createElement("div", { className: b('price') },
16
+ React.createElement("div", null,
17
+ React.createElement("span", { className: b('price-value') }, price),
18
+ pricePeriod && (React.createElement("span", { className: b('price-period') },
19
+ "/ ",
20
+ pricePeriod))),
21
+ priceDetails && (React.createElement("div", { className: b('price-details') }, priceDetails))),
22
+ React.createElement("div", null, description),
23
+ (list === null || list === void 0 ? void 0 : list.length) ? (React.createElement("div", { className: b('list') },
24
+ React.createElement(ContentList, { list: list.map((item) => ({
25
+ icon: Check,
26
+ text: item,
27
+ })), size: "s" }))) : null),
28
+ buttons && (React.createElement("div", { className: b('buttons') }, buttons.map((button) => (React.createElement(Button, Object.assign({ key: button.url }, button)))))),
29
+ links && (React.createElement("div", { className: b('links') }, links.map((link) => (React.createElement(LinkBlock, Object.assign({ key: link.url, textSize: "m" }, link))))))))));
30
+ };
31
+ export default PriceCard;