@gravity-ui/blog-constructor 11.0.1-alpha.1 → 11.1.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.
@@ -13,10 +13,13 @@ const ColoredText = (_a) => {
13
13
  var { background, paddingTop, paddingBottom, qa } = _a, content = tslib_1.__rest(_a, ["background", "paddingTop", "paddingBottom", "qa"]);
14
14
  const contentData = (0, common_1.updateContentSizes)(content);
15
15
  const qaAttributes = (0, common_1.getQaAttributes)(qa);
16
+ const theme = (0, page_constructor_1.useTheme)();
17
+ const themedColor = (0, page_constructor_1.getThemedValue)(background === null || background === void 0 ? void 0 : background.color, theme);
18
+ const themedImage = (0, page_constructor_1.getThemedValue)(background === null || background === void 0 ? void 0 : background.image, theme);
16
19
  return ((0, jsx_runtime_1.jsx)(Wrapper_1.Wrapper, { paddings: {
17
20
  [paddings_1.PaddingsDirections.top]: paddingTop,
18
21
  [paddings_1.PaddingsDirections.bottom]: paddingBottom,
19
- }, qa: qaAttributes.wrapper, children: (0, jsx_runtime_1.jsxs)("div", { className: b('container'), style: { backgroundColor: (background === null || background === void 0 ? void 0 : background.color) || 'none' }, "data-qa": qaAttributes.container, children: [(0, jsx_runtime_1.jsx)("div", { className: b('picture-container'), children: (background === null || background === void 0 ? void 0 : background.image) && ((0, jsx_runtime_1.jsx)(page_constructor_1.BackgroundImage, { className: b('picture'), alt: background === null || background === void 0 ? void 0 : background.altText, src: background === null || background === void 0 ? void 0 : background.image })) }), (0, jsx_runtime_1.jsx)("div", { className: b('text-content'), children: (0, jsx_runtime_1.jsx)(page_constructor_1.Content, Object.assign({}, contentData, { qa: qaAttributes.content })) })] }) }));
22
+ }, qa: qaAttributes.wrapper, children: (0, jsx_runtime_1.jsxs)("div", { className: b('container'), style: { backgroundColor: themedColor || 'none' }, "data-qa": qaAttributes.container, children: [(0, jsx_runtime_1.jsx)("div", { className: b('picture-container'), children: themedImage && ((0, jsx_runtime_1.jsx)(page_constructor_1.BackgroundImage, { className: b('picture'), alt: background === null || background === void 0 ? void 0 : background.altText, src: themedImage })) }), (0, jsx_runtime_1.jsx)("div", { className: b('text-content'), children: (0, jsx_runtime_1.jsx)(page_constructor_1.Content, Object.assign({}, contentData, { qa: qaAttributes.content })) })] }) }));
20
23
  };
21
24
  exports.ColoredText = ColoredText;
22
25
  //# sourceMappingURL=ColoredText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColoredText.js","sourceRoot":"../../../../src","sources":["blocks/ColoredText/ColoredText.tsx"],"names":[],"mappings":";;;;;AAAA,mEAAsE;AAEtE,iEAAyD;AAEzD,uDAAyD;AACzD,0CAAqC;AACrC,kDAAuE;AAIvE,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,cAAc,CAAC,CAAC;AAEzB,MAAM,WAAW,GAAG,CAAC,EAMT,EAAE,EAAE;QANK,EACxB,UAAU,EACV,UAAU,EACV,aAAa,EACb,EAAE,OAEa,EADZ,OAAO,sBALc,mDAM3B,CADa;IAEV,MAAM,WAAW,GAAG,IAAA,2BAAkB,EAAC,OAAO,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,IAAA,wBAAe,EAAC,EAAE,CAAC,CAAC;IAEzC,OAAO,CACH,uBAAC,iBAAO,IACJ,QAAQ,EAAE;YACN,CAAC,6BAAkB,CAAC,GAAG,CAAC,EAAE,UAAU;YACpC,CAAC,6BAAkB,CAAC,MAAM,CAAC,EAAE,aAAa;SAC7C,EACD,EAAE,EAAE,YAAY,CAAC,OAAO,YAExB,iCACI,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,EACzB,KAAK,EAAE,EAAC,eAAe,EAAE,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,KAAI,MAAM,EAAC,aAC5C,YAAY,CAAC,SAAS,aAE/B,gCAAK,SAAS,EAAE,CAAC,CAAC,mBAAmB,CAAC,YACjC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,KAAI,CAClB,uBAAC,kCAAe,IACZ,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,EACvB,GAAG,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,EACxB,GAAG,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,GACxB,CACL,GACC,EACN,gCAAK,SAAS,EAAE,CAAC,CAAC,cAAc,CAAC,YAC7B,uBAAC,0BAAO,oBAAK,WAAW,IAAE,EAAE,EAAE,YAAY,CAAC,OAAO,IAAI,GACpD,IACJ,GACA,CACb,CAAC;AACN,CAAC,CAAC;AAtCW,QAAA,WAAW,eAsCtB","sourcesContent":["import {BackgroundImage, Content} from '@gravity-ui/page-constructor';\n\nimport {Wrapper} from '../../components/Wrapper/Wrapper';\nimport {ColoredTextProps} from '../../models/blocks';\nimport {PaddingsDirections} from '../../models/paddings';\nimport {block} from '../../utils/cn';\nimport {getQaAttributes, updateContentSizes} from '../../utils/common';\n\nimport './ColoredText.scss';\n\nconst b = block('colored-text');\n\nexport const ColoredText = ({\n background,\n paddingTop,\n paddingBottom,\n qa,\n ...content\n}: ColoredTextProps) => {\n const contentData = updateContentSizes(content);\n const qaAttributes = getQaAttributes(qa);\n\n return (\n <Wrapper\n paddings={{\n [PaddingsDirections.top]: paddingTop,\n [PaddingsDirections.bottom]: paddingBottom,\n }}\n qa={qaAttributes.wrapper}\n >\n <div\n className={b('container')}\n style={{backgroundColor: background?.color || 'none'}}\n data-qa={qaAttributes.container}\n >\n <div className={b('picture-container')}>\n {background?.image && (\n <BackgroundImage\n className={b('picture')}\n alt={background?.altText}\n src={background?.image}\n />\n )}\n </div>\n <div className={b('text-content')}>\n <Content {...contentData} qa={qaAttributes.content} />\n </div>\n </div>\n </Wrapper>\n );\n};\n"]}
1
+ {"version":3,"file":"ColoredText.js","sourceRoot":"../../../../src","sources":["blocks/ColoredText/ColoredText.tsx"],"names":[],"mappings":";;;;;AAAA,mEAAgG;AAEhG,iEAAyD;AAEzD,uDAAyD;AACzD,0CAAqC;AACrC,kDAAuE;AAIvE,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,cAAc,CAAC,CAAC;AAEzB,MAAM,WAAW,GAAG,CAAC,EAMT,EAAE,EAAE;QANK,EACxB,UAAU,EACV,UAAU,EACV,aAAa,EACb,EAAE,OAEa,EADZ,OAAO,sBALc,mDAM3B,CADa;IAEV,MAAM,WAAW,GAAG,IAAA,2BAAkB,EAAC,OAAO,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,IAAA,wBAAe,EAAC,EAAE,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,IAAA,2BAAQ,GAAE,CAAC;IAEzB,MAAM,WAAW,GAAG,IAAA,iCAAc,EAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC7D,MAAM,WAAW,GAAG,IAAA,iCAAc,EAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAE7D,OAAO,CACH,uBAAC,iBAAO,IACJ,QAAQ,EAAE;YACN,CAAC,6BAAkB,CAAC,GAAG,CAAC,EAAE,UAAU;YACpC,CAAC,6BAAkB,CAAC,MAAM,CAAC,EAAE,aAAa;SAC7C,EACD,EAAE,EAAE,YAAY,CAAC,OAAO,YAExB,iCACI,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,EACzB,KAAK,EAAE,EAAC,eAAe,EAAE,WAAW,IAAI,MAAM,EAAC,aACtC,YAAY,CAAC,SAAS,aAE/B,gCAAK,SAAS,EAAE,CAAC,CAAC,mBAAmB,CAAC,YACjC,WAAW,IAAI,CACZ,uBAAC,kCAAe,IACZ,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,EACvB,GAAG,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,EACxB,GAAG,EAAE,WAAW,GAClB,CACL,GACC,EACN,gCAAK,SAAS,EAAE,CAAC,CAAC,cAAc,CAAC,YAC7B,uBAAC,0BAAO,oBAAK,WAAW,IAAE,EAAE,EAAE,YAAY,CAAC,OAAO,IAAI,GACpD,IACJ,GACA,CACb,CAAC;AACN,CAAC,CAAC;AA1CW,QAAA,WAAW,eA0CtB","sourcesContent":["import {BackgroundImage, Content, getThemedValue, useTheme} from '@gravity-ui/page-constructor';\n\nimport {Wrapper} from '../../components/Wrapper/Wrapper';\nimport {ColoredTextProps} from '../../models/blocks';\nimport {PaddingsDirections} from '../../models/paddings';\nimport {block} from '../../utils/cn';\nimport {getQaAttributes, updateContentSizes} from '../../utils/common';\n\nimport './ColoredText.scss';\n\nconst b = block('colored-text');\n\nexport const ColoredText = ({\n background,\n paddingTop,\n paddingBottom,\n qa,\n ...content\n}: ColoredTextProps) => {\n const contentData = updateContentSizes(content);\n const qaAttributes = getQaAttributes(qa);\n const theme = useTheme();\n\n const themedColor = getThemedValue(background?.color, theme);\n const themedImage = getThemedValue(background?.image, theme);\n\n return (\n <Wrapper\n paddings={{\n [PaddingsDirections.top]: paddingTop,\n [PaddingsDirections.bottom]: paddingBottom,\n }}\n qa={qaAttributes.wrapper}\n >\n <div\n className={b('container')}\n style={{backgroundColor: themedColor || 'none'}}\n data-qa={qaAttributes.container}\n >\n <div className={b('picture-container')}>\n {themedImage && (\n <BackgroundImage\n className={b('picture')}\n alt={background?.altText}\n src={themedImage}\n />\n )}\n </div>\n <div className={b('text-content')}>\n <Content {...contentData} qa={qaAttributes.content} />\n </div>\n </div>\n </Wrapper>\n );\n};\n"]}
@@ -11,32 +11,52 @@ export declare const ColoredText: {
11
11
  image: {
12
12
  oneOf: ({
13
13
  type: string;
14
- properties: {
15
- when: {
16
- type: string;
17
- };
18
- };
19
- } | {
20
- type: string;
21
- pattern: string;
14
+ additionalProperties: boolean;
15
+ required: import("@gravity-ui/page-constructor").Theme[];
16
+ properties: {};
22
17
  optionName: string;
23
- items?: undefined;
24
- } | {
25
- type: string;
26
- items: {
18
+ } | ({
19
+ oneOf: ({
27
20
  type: string;
28
21
  properties: {
29
22
  when: {
30
23
  type: string;
31
24
  };
32
25
  };
33
- };
26
+ } | {
27
+ type: string;
28
+ pattern: string;
29
+ optionName: string;
30
+ items?: undefined;
31
+ } | {
32
+ type: string;
33
+ items: {
34
+ type: string;
35
+ properties: {
36
+ when: {
37
+ type: string;
38
+ };
39
+ };
40
+ };
41
+ optionName: string;
42
+ pattern?: undefined;
43
+ })[];
44
+ } & {
34
45
  optionName: string;
35
- pattern?: undefined;
36
- })[];
46
+ }))[];
37
47
  };
38
48
  color: {
39
- type: string;
49
+ oneOf: ({
50
+ type: string;
51
+ additionalProperties: boolean;
52
+ required: import("@gravity-ui/page-constructor").Theme[];
53
+ properties: {};
54
+ optionName: string;
55
+ } | ({
56
+ type: string;
57
+ } & {
58
+ optionName: string;
59
+ }))[];
40
60
  };
41
61
  altText: {
42
62
  type: string;
@@ -4,15 +4,15 @@ exports.ColoredText = void 0;
4
4
  const page_constructor_1 = require("@gravity-ui/page-constructor");
5
5
  const common_1 = require("../../models/common.js");
6
6
  const common_2 = require("../../schema/common.js");
7
- const { subBlocks: { ContentBase }, components: { ImageProps }, common: { BlockBaseProps }, } = page_constructor_1.validators;
7
+ const { subBlocks: { ContentBase }, components: { ImageProps }, common: { BlockBaseProps, withTheme }, } = page_constructor_1.validators;
8
8
  const BackgroundProps = {
9
9
  type: 'object',
10
10
  additionalProperties: false,
11
11
  properties: {
12
- image: ImageProps,
13
- color: {
12
+ image: withTheme(ImageProps),
13
+ color: withTheme({
14
14
  type: 'string',
15
- },
15
+ }),
16
16
  altText: {
17
17
  type: 'string',
18
18
  contentType: 'text',
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["blocks/ColoredText/schema.ts"],"names":[],"mappings":";;;AAAA,mEAAwD;AAExD,mDAA8C;AAC9C,mDAAkD;AAElD,MAAM,EACF,SAAS,EAAE,EAAC,WAAW,EAAC,EACxB,UAAU,EAAE,EAAC,UAAU,EAAC,EACxB,MAAM,EAAE,EAAC,cAAc,EAAC,GAC3B,GAAG,6BAAU,CAAC;AAEf,MAAM,eAAe,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE;YACH,IAAI,EAAE,QAAQ;SACjB;QACD,OAAO,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,MAAM;SACtB;KACJ;CACJ,CAAC;AAEW,QAAA,WAAW,GAAG;IACvB,CAAC,kBAAS,CAAC,WAAW,CAAC,EAAE;QACrB,IAAI,EAAE,QAAQ;QACd,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,CAAC,MAAM,CAAC;QAClB,UAAU,8DACH,cAAc,GACd,sBAAa,GACb,WAAW,KACd,UAAU,EAAE,eAAe,GAC9B;KACJ;CACJ,CAAC","sourcesContent":["import {validators} from '@gravity-ui/page-constructor';\n\nimport {BlockType} from '../../models/common';\nimport {BlogBlockBase} from '../../schema/common';\n\nconst {\n subBlocks: {ContentBase},\n components: {ImageProps},\n common: {BlockBaseProps},\n} = validators;\n\nconst BackgroundProps = {\n type: 'object',\n additionalProperties: false,\n properties: {\n image: ImageProps,\n color: {\n type: 'string',\n },\n altText: {\n type: 'string',\n contentType: 'text',\n },\n },\n};\n\nexport const ColoredText = {\n [BlockType.ColoredText]: {\n type: 'object',\n additionalProperties: false,\n required: ['text'],\n properties: {\n ...BlockBaseProps,\n ...BlogBlockBase,\n ...ContentBase,\n background: BackgroundProps,\n },\n },\n};\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["blocks/ColoredText/schema.ts"],"names":[],"mappings":";;;AAAA,mEAAwD;AAExD,mDAA8C;AAC9C,mDAAkD;AAElD,MAAM,EACF,SAAS,EAAE,EAAC,WAAW,EAAC,EACxB,UAAU,EAAE,EAAC,UAAU,EAAC,EACxB,MAAM,EAAE,EAAC,cAAc,EAAE,SAAS,EAAC,GACtC,GAAG,6BAAU,CAAC;AAEf,MAAM,eAAe,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACR,KAAK,EAAE,SAAS,CAAC,UAAU,CAAC;QAC5B,KAAK,EAAE,SAAS,CAAC;YACb,IAAI,EAAE,QAAQ;SACjB,CAAC;QACF,OAAO,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,MAAM;SACtB;KACJ;CACJ,CAAC;AAEW,QAAA,WAAW,GAAG;IACvB,CAAC,kBAAS,CAAC,WAAW,CAAC,EAAE;QACrB,IAAI,EAAE,QAAQ;QACd,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,CAAC,MAAM,CAAC;QAClB,UAAU,8DACH,cAAc,GACd,sBAAa,GACb,WAAW,KACd,UAAU,EAAE,eAAe,GAC9B;KACJ;CACJ,CAAC","sourcesContent":["import {validators} from '@gravity-ui/page-constructor';\n\nimport {BlockType} from '../../models/common';\nimport {BlogBlockBase} from '../../schema/common';\n\nconst {\n subBlocks: {ContentBase},\n components: {ImageProps},\n common: {BlockBaseProps, withTheme},\n} = validators;\n\nconst BackgroundProps = {\n type: 'object',\n additionalProperties: false,\n properties: {\n image: withTheme(ImageProps),\n color: withTheme({\n type: 'string',\n }),\n altText: {\n type: 'string',\n contentType: 'text',\n },\n },\n};\n\nexport const ColoredText = {\n [BlockType.ColoredText]: {\n type: 'object',\n additionalProperties: false,\n required: ['text'],\n properties: {\n ...BlockBaseProps,\n ...BlogBlockBase,\n ...ContentBase,\n background: BackgroundProps,\n },\n },\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { AuthorItem, ContentBlockProps, FormBlockData, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme } from '@gravity-ui/page-constructor';
2
+ import { AuthorItem, ContentBlockProps, FormBlockData, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme, ThemeSupporting } from '@gravity-ui/page-constructor';
3
3
  import { BlockType, ClassNameProps, PostData, QAProps } from "./common.js";
4
4
  import { PaddingsYFMProps } from "./paddings.js";
5
5
  export type AuthorProps = ClassNameProps & {
@@ -13,8 +13,8 @@ export type BannerProps = ContentBlockProps & QAProps & {
13
13
  } & PaddingsYFMProps;
14
14
  export type ColoredTextProps = ContentBlockProps & QAProps & {
15
15
  background?: {
16
- color?: string;
17
- image?: string;
16
+ color?: ThemeSupporting<string>;
17
+ image?: ThemeSupporting<string>;
18
18
  altText?: string;
19
19
  };
20
20
  } & PaddingsYFMProps;
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.js","sourceRoot":"../../../src","sources":["models/blocks.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nimport {\n AuthorItem,\n ContentBlockProps,\n FormBlockData,\n HeaderBlockProps,\n MediaProps as PCMediaProps,\n TextTheme,\n} from '@gravity-ui/page-constructor';\n\nimport {BlockType, ClassNameProps, PostData, QAProps} from './common';\nimport {PaddingsYFMProps} from './paddings';\n\n// blocks props\nexport type AuthorProps = ClassNameProps & {\n authorId: number | string;\n image: string;\n} & PaddingsYFMProps &\n QAProps;\n\nexport type BannerProps = ContentBlockProps &\n QAProps & {\n color?: string;\n image?: string;\n imageSize?: 's' | 'm';\n } & PaddingsYFMProps;\n\nexport type ColoredTextProps = ContentBlockProps &\n QAProps & {\n background?: {\n color?: string;\n image?: string;\n altText?: string;\n };\n } & PaddingsYFMProps;\n\nexport type CTAProps = QAProps & {\n items: Array<ContentBlockProps>;\n} & PaddingsYFMProps;\n\ntype HeaderBlogProps = {\n imageInGrid?: boolean;\n};\n\nexport type HeaderProps = HeaderBlockProps & PaddingsYFMProps & HeaderBlogProps;\n\nexport type LayoutProps = {\n fullWidth?: boolean;\n mobileOrder?: string;\n children: React.ReactElement[];\n} & PaddingsYFMProps;\n\nexport type MediaProps = ClassNameProps &\n PaddingsYFMProps &\n Partial<\n Pick<\n PCMediaProps,\n | 'youtube'\n | 'previewImg'\n | 'image'\n | 'video'\n | 'dataLens'\n | 'videoIframe'\n | 'videoMicrodata'\n >\n > & {\n text?: string;\n };\n\nexport type MetaProps = QAProps & {\n locale: string;\n theme?: TextTheme;\n} & PaddingsYFMProps;\n\nexport type SuggestProps = ClassNameProps & {\n posts: PostData[];\n} & PaddingsYFMProps;\n\nexport type YFMProps = {\n text: string;\n} & PaddingsYFMProps &\n QAProps;\n\nexport type FeedProps = {\n image: string;\n title?: string;\n resetTitleMargin?: boolean;\n};\n\nexport type FormProps = {\n formData: FormBlockData;\n border?: 'shadow' | 'line' | 'none';\n} & PaddingsYFMProps &\n QAProps;\n\nexport type CompactMediaProps = {\n description?: string;\n} & PaddingsYFMProps &\n Partial<Pick<PCMediaProps, 'image'>>;\n\nexport type TakeProps = YFMProps & {\n author: AuthorItem;\n color?: string;\n noBackground?: boolean;\n};\n\nexport type SideCard = Pick<PCMediaProps, 'image'> & {\n description: string;\n url: string;\n};\n\nexport type SideCardListProps = {\n title?: string;\n items: SideCard[];\n} & PaddingsYFMProps;\n\n// blocks models\nexport type AuthorBlockModel = {\n type: BlockType.Author;\n} & AuthorProps;\n\nexport type BannerBlockModel = {\n type: BlockType.Banner;\n} & BannerProps;\n\nexport type ColoredTextBlockModel = {\n type: BlockType.ColoredText;\n} & ColoredTextProps;\n\nexport type CTABlockModel = {\n type: BlockType.CTA;\n} & CTAProps;\n\nexport type HeaderBlockModel = {\n type: BlockType.Header;\n} & HeaderProps;\n\nexport type LayoutBlockModel = {\n type: BlockType.Layout;\n} & LayoutProps;\n\nexport type MediaBlockModel = {\n type: BlockType.Media;\n} & MediaProps;\n\nexport type MetaBlockModel = {\n type: BlockType.Meta;\n} & MetaProps;\n\nexport type SuggestBlockModel = {\n type: BlockType.Suggest;\n} & SuggestProps;\n\nexport type YFMBlockModel = {\n type: BlockType.YFM;\n} & YFMProps;\n\nexport type FeedBlockModel = {\n type: BlockType.Feed;\n} & FeedProps;\n\nexport type FormBlockModel = {\n type: BlockType.Form;\n} & FormProps;\n\nexport type CompactMediaBlockModel = {\n type: BlockType.CompactMedia;\n} & CompactMediaProps;\n\nexport type TakeBlockModel = {\n type: BlockType.Take;\n} & TakeProps;\n\nexport type SideCardListBlockModel = {\n type: BlockType.SideCardList;\n} & SideCardListProps;\n\nexport type BlockModel =\n | AuthorBlockModel\n | BannerBlockModel\n | ColoredTextBlockModel\n | CTABlockModel\n | HeaderBlockModel\n | LayoutBlockModel\n | MediaBlockModel\n | MetaBlockModel\n | SuggestBlockModel\n | YFMBlockModel\n | FeedBlockModel\n | CompactMediaBlockModel\n | TakeBlockModel\n | SideCardListBlockModel;\n\nexport type Block = BlockModel & {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [x: string]: any;\n};\n"]}
1
+ {"version":3,"file":"blocks.js","sourceRoot":"../../../src","sources":["models/blocks.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nimport {\n AuthorItem,\n ContentBlockProps,\n FormBlockData,\n HeaderBlockProps,\n MediaProps as PCMediaProps,\n TextTheme,\n ThemeSupporting,\n} from '@gravity-ui/page-constructor';\n\nimport {BlockType, ClassNameProps, PostData, QAProps} from './common';\nimport {PaddingsYFMProps} from './paddings';\n\n// blocks props\nexport type AuthorProps = ClassNameProps & {\n authorId: number | string;\n image: string;\n} & PaddingsYFMProps &\n QAProps;\n\nexport type BannerProps = ContentBlockProps &\n QAProps & {\n color?: string;\n image?: string;\n imageSize?: 's' | 'm';\n } & PaddingsYFMProps;\n\nexport type ColoredTextProps = ContentBlockProps &\n QAProps & {\n background?: {\n color?: ThemeSupporting<string>;\n image?: ThemeSupporting<string>;\n altText?: string;\n };\n } & PaddingsYFMProps;\n\nexport type CTAProps = QAProps & {\n items: Array<ContentBlockProps>;\n} & PaddingsYFMProps;\n\ntype HeaderBlogProps = {\n imageInGrid?: boolean;\n};\n\nexport type HeaderProps = HeaderBlockProps & PaddingsYFMProps & HeaderBlogProps;\n\nexport type LayoutProps = {\n fullWidth?: boolean;\n mobileOrder?: string;\n children: React.ReactElement[];\n} & PaddingsYFMProps;\n\nexport type MediaProps = ClassNameProps &\n PaddingsYFMProps &\n Partial<\n Pick<\n PCMediaProps,\n | 'youtube'\n | 'previewImg'\n | 'image'\n | 'video'\n | 'dataLens'\n | 'videoIframe'\n | 'videoMicrodata'\n >\n > & {\n text?: string;\n };\n\nexport type MetaProps = QAProps & {\n locale: string;\n theme?: TextTheme;\n} & PaddingsYFMProps;\n\nexport type SuggestProps = ClassNameProps & {\n posts: PostData[];\n} & PaddingsYFMProps;\n\nexport type YFMProps = {\n text: string;\n} & PaddingsYFMProps &\n QAProps;\n\nexport type FeedProps = {\n image: string;\n title?: string;\n resetTitleMargin?: boolean;\n};\n\nexport type FormProps = {\n formData: FormBlockData;\n border?: 'shadow' | 'line' | 'none';\n} & PaddingsYFMProps &\n QAProps;\n\nexport type CompactMediaProps = {\n description?: string;\n} & PaddingsYFMProps &\n Partial<Pick<PCMediaProps, 'image'>>;\n\nexport type TakeProps = YFMProps & {\n author: AuthorItem;\n color?: string;\n noBackground?: boolean;\n};\n\nexport type SideCard = Pick<PCMediaProps, 'image'> & {\n description: string;\n url: string;\n};\n\nexport type SideCardListProps = {\n title?: string;\n items: SideCard[];\n} & PaddingsYFMProps;\n\n// blocks models\nexport type AuthorBlockModel = {\n type: BlockType.Author;\n} & AuthorProps;\n\nexport type BannerBlockModel = {\n type: BlockType.Banner;\n} & BannerProps;\n\nexport type ColoredTextBlockModel = {\n type: BlockType.ColoredText;\n} & ColoredTextProps;\n\nexport type CTABlockModel = {\n type: BlockType.CTA;\n} & CTAProps;\n\nexport type HeaderBlockModel = {\n type: BlockType.Header;\n} & HeaderProps;\n\nexport type LayoutBlockModel = {\n type: BlockType.Layout;\n} & LayoutProps;\n\nexport type MediaBlockModel = {\n type: BlockType.Media;\n} & MediaProps;\n\nexport type MetaBlockModel = {\n type: BlockType.Meta;\n} & MetaProps;\n\nexport type SuggestBlockModel = {\n type: BlockType.Suggest;\n} & SuggestProps;\n\nexport type YFMBlockModel = {\n type: BlockType.YFM;\n} & YFMProps;\n\nexport type FeedBlockModel = {\n type: BlockType.Feed;\n} & FeedProps;\n\nexport type FormBlockModel = {\n type: BlockType.Form;\n} & FormProps;\n\nexport type CompactMediaBlockModel = {\n type: BlockType.CompactMedia;\n} & CompactMediaProps;\n\nexport type TakeBlockModel = {\n type: BlockType.Take;\n} & TakeProps;\n\nexport type SideCardListBlockModel = {\n type: BlockType.SideCardList;\n} & SideCardListProps;\n\nexport type BlockModel =\n | AuthorBlockModel\n | BannerBlockModel\n | ColoredTextBlockModel\n | CTABlockModel\n | HeaderBlockModel\n | LayoutBlockModel\n | MediaBlockModel\n | MetaBlockModel\n | SuggestBlockModel\n | YFMBlockModel\n | FeedBlockModel\n | CompactMediaBlockModel\n | TakeBlockModel\n | SideCardListBlockModel;\n\nexport type Block = BlockModel & {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [x: string]: any;\n};\n"]}
@@ -935,32 +935,52 @@ export declare const schemasForCustom: {
935
935
  image: {
936
936
  oneOf: ({
937
937
  type: string;
938
- properties: {
939
- when: {
940
- type: string;
941
- };
942
- };
943
- } | {
944
- type: string;
945
- pattern: string;
938
+ additionalProperties: boolean;
939
+ required: import("@gravity-ui/page-constructor").Theme[];
940
+ properties: {};
946
941
  optionName: string;
947
- items?: undefined;
948
- } | {
949
- type: string;
950
- items: {
942
+ } | ({
943
+ oneOf: ({
951
944
  type: string;
952
945
  properties: {
953
946
  when: {
954
947
  type: string;
955
948
  };
956
949
  };
957
- };
950
+ } | {
951
+ type: string;
952
+ pattern: string;
953
+ optionName: string;
954
+ items?: undefined;
955
+ } | {
956
+ type: string;
957
+ items: {
958
+ type: string;
959
+ properties: {
960
+ when: {
961
+ type: string;
962
+ };
963
+ };
964
+ };
965
+ optionName: string;
966
+ pattern?: undefined;
967
+ })[];
968
+ } & {
958
969
  optionName: string;
959
- pattern?: undefined;
960
- })[];
970
+ }))[];
961
971
  };
962
972
  color: {
963
- type: string;
973
+ oneOf: ({
974
+ type: string;
975
+ additionalProperties: boolean;
976
+ required: import("@gravity-ui/page-constructor").Theme[];
977
+ properties: {};
978
+ optionName: string;
979
+ } | ({
980
+ type: string;
981
+ } & {
982
+ optionName: string;
983
+ }))[];
964
984
  };
965
985
  altText: {
966
986
  type: string;
@@ -1,6 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { BackgroundImage, Content } from '@gravity-ui/page-constructor';
3
+ import { BackgroundImage, Content, getThemedValue, useTheme } from '@gravity-ui/page-constructor';
4
4
  import { Wrapper } from "../../components/Wrapper/Wrapper.js";
5
5
  import { PaddingsDirections } from "../../models/paddings.js";
6
6
  import { block } from "../../utils/cn.js";
@@ -11,9 +11,12 @@ export const ColoredText = (_a) => {
11
11
  var { background, paddingTop, paddingBottom, qa } = _a, content = __rest(_a, ["background", "paddingTop", "paddingBottom", "qa"]);
12
12
  const contentData = updateContentSizes(content);
13
13
  const qaAttributes = getQaAttributes(qa);
14
+ const theme = useTheme();
15
+ const themedColor = getThemedValue(background === null || background === void 0 ? void 0 : background.color, theme);
16
+ const themedImage = getThemedValue(background === null || background === void 0 ? void 0 : background.image, theme);
14
17
  return (_jsx(Wrapper, { paddings: {
15
18
  [PaddingsDirections.top]: paddingTop,
16
19
  [PaddingsDirections.bottom]: paddingBottom,
17
- }, qa: qaAttributes.wrapper, children: _jsxs("div", { className: b('container'), style: { backgroundColor: (background === null || background === void 0 ? void 0 : background.color) || 'none' }, "data-qa": qaAttributes.container, children: [_jsx("div", { className: b('picture-container'), children: (background === null || background === void 0 ? void 0 : background.image) && (_jsx(BackgroundImage, { className: b('picture'), alt: background === null || background === void 0 ? void 0 : background.altText, src: background === null || background === void 0 ? void 0 : background.image })) }), _jsx("div", { className: b('text-content'), children: _jsx(Content, Object.assign({}, contentData, { qa: qaAttributes.content })) })] }) }));
20
+ }, qa: qaAttributes.wrapper, children: _jsxs("div", { className: b('container'), style: { backgroundColor: themedColor || 'none' }, "data-qa": qaAttributes.container, children: [_jsx("div", { className: b('picture-container'), children: themedImage && (_jsx(BackgroundImage, { className: b('picture'), alt: background === null || background === void 0 ? void 0 : background.altText, src: themedImage })) }), _jsx("div", { className: b('text-content'), children: _jsx(Content, Object.assign({}, contentData, { qa: qaAttributes.content })) })] }) }));
18
21
  };
19
22
  //# sourceMappingURL=ColoredText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColoredText.js","sourceRoot":"../../../../src","sources":["blocks/ColoredText/ColoredText.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAC,eAAe,EAAE,OAAO,EAAC,MAAM,8BAA8B,CAAC;AAEtE,OAAO,EAAC,OAAO,EAAC,4CAAyC;AAEzD,OAAO,EAAC,kBAAkB,EAAC,iCAA8B;AACzD,OAAO,EAAC,KAAK,EAAC,0BAAuB;AACrC,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,8BAA2B;AAEvE,OAAO,mBAAmB,CAAC;AAE3B,MAAM,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAEhC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAMT,EAAE,EAAE;QANK,EACxB,UAAU,EACV,UAAU,EACV,aAAa,EACb,EAAE,OAEa,EADZ,OAAO,cALc,mDAM3B,CADa;IAEV,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;IAEzC,OAAO,CACH,KAAC,OAAO,IACJ,QAAQ,EAAE;YACN,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,UAAU;YACpC,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,aAAa;SAC7C,EACD,EAAE,EAAE,YAAY,CAAC,OAAO,YAExB,eACI,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,EACzB,KAAK,EAAE,EAAC,eAAe,EAAE,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,KAAI,MAAM,EAAC,aAC5C,YAAY,CAAC,SAAS,aAE/B,cAAK,SAAS,EAAE,CAAC,CAAC,mBAAmB,CAAC,YACjC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,KAAI,CAClB,KAAC,eAAe,IACZ,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,EACvB,GAAG,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,EACxB,GAAG,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,GACxB,CACL,GACC,EACN,cAAK,SAAS,EAAE,CAAC,CAAC,cAAc,CAAC,YAC7B,KAAC,OAAO,oBAAK,WAAW,IAAE,EAAE,EAAE,YAAY,CAAC,OAAO,IAAI,GACpD,IACJ,GACA,CACb,CAAC;AACN,CAAC,CAAC","sourcesContent":["import {BackgroundImage, Content} from '@gravity-ui/page-constructor';\n\nimport {Wrapper} from '../../components/Wrapper/Wrapper';\nimport {ColoredTextProps} from '../../models/blocks';\nimport {PaddingsDirections} from '../../models/paddings';\nimport {block} from '../../utils/cn';\nimport {getQaAttributes, updateContentSizes} from '../../utils/common';\n\nimport './ColoredText.scss';\n\nconst b = block('colored-text');\n\nexport const ColoredText = ({\n background,\n paddingTop,\n paddingBottom,\n qa,\n ...content\n}: ColoredTextProps) => {\n const contentData = updateContentSizes(content);\n const qaAttributes = getQaAttributes(qa);\n\n return (\n <Wrapper\n paddings={{\n [PaddingsDirections.top]: paddingTop,\n [PaddingsDirections.bottom]: paddingBottom,\n }}\n qa={qaAttributes.wrapper}\n >\n <div\n className={b('container')}\n style={{backgroundColor: background?.color || 'none'}}\n data-qa={qaAttributes.container}\n >\n <div className={b('picture-container')}>\n {background?.image && (\n <BackgroundImage\n className={b('picture')}\n alt={background?.altText}\n src={background?.image}\n />\n )}\n </div>\n <div className={b('text-content')}>\n <Content {...contentData} qa={qaAttributes.content} />\n </div>\n </div>\n </Wrapper>\n );\n};\n"]}
1
+ {"version":3,"file":"ColoredText.js","sourceRoot":"../../../../src","sources":["blocks/ColoredText/ColoredText.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAC,eAAe,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAC,MAAM,8BAA8B,CAAC;AAEhG,OAAO,EAAC,OAAO,EAAC,4CAAyC;AAEzD,OAAO,EAAC,kBAAkB,EAAC,iCAA8B;AACzD,OAAO,EAAC,KAAK,EAAC,0BAAuB;AACrC,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,8BAA2B;AAEvE,OAAO,mBAAmB,CAAC;AAE3B,MAAM,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAEhC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAMT,EAAE,EAAE;QANK,EACxB,UAAU,EACV,UAAU,EACV,aAAa,EACb,EAAE,OAEa,EADZ,OAAO,cALc,mDAM3B,CADa;IAEV,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,MAAM,WAAW,GAAG,cAAc,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC7D,MAAM,WAAW,GAAG,cAAc,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAE7D,OAAO,CACH,KAAC,OAAO,IACJ,QAAQ,EAAE;YACN,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,UAAU;YACpC,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,aAAa;SAC7C,EACD,EAAE,EAAE,YAAY,CAAC,OAAO,YAExB,eACI,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,EACzB,KAAK,EAAE,EAAC,eAAe,EAAE,WAAW,IAAI,MAAM,EAAC,aACtC,YAAY,CAAC,SAAS,aAE/B,cAAK,SAAS,EAAE,CAAC,CAAC,mBAAmB,CAAC,YACjC,WAAW,IAAI,CACZ,KAAC,eAAe,IACZ,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,EACvB,GAAG,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,EACxB,GAAG,EAAE,WAAW,GAClB,CACL,GACC,EACN,cAAK,SAAS,EAAE,CAAC,CAAC,cAAc,CAAC,YAC7B,KAAC,OAAO,oBAAK,WAAW,IAAE,EAAE,EAAE,YAAY,CAAC,OAAO,IAAI,GACpD,IACJ,GACA,CACb,CAAC;AACN,CAAC,CAAC","sourcesContent":["import {BackgroundImage, Content, getThemedValue, useTheme} from '@gravity-ui/page-constructor';\n\nimport {Wrapper} from '../../components/Wrapper/Wrapper';\nimport {ColoredTextProps} from '../../models/blocks';\nimport {PaddingsDirections} from '../../models/paddings';\nimport {block} from '../../utils/cn';\nimport {getQaAttributes, updateContentSizes} from '../../utils/common';\n\nimport './ColoredText.scss';\n\nconst b = block('colored-text');\n\nexport const ColoredText = ({\n background,\n paddingTop,\n paddingBottom,\n qa,\n ...content\n}: ColoredTextProps) => {\n const contentData = updateContentSizes(content);\n const qaAttributes = getQaAttributes(qa);\n const theme = useTheme();\n\n const themedColor = getThemedValue(background?.color, theme);\n const themedImage = getThemedValue(background?.image, theme);\n\n return (\n <Wrapper\n paddings={{\n [PaddingsDirections.top]: paddingTop,\n [PaddingsDirections.bottom]: paddingBottom,\n }}\n qa={qaAttributes.wrapper}\n >\n <div\n className={b('container')}\n style={{backgroundColor: themedColor || 'none'}}\n data-qa={qaAttributes.container}\n >\n <div className={b('picture-container')}>\n {themedImage && (\n <BackgroundImage\n className={b('picture')}\n alt={background?.altText}\n src={themedImage}\n />\n )}\n </div>\n <div className={b('text-content')}>\n <Content {...contentData} qa={qaAttributes.content} />\n </div>\n </div>\n </Wrapper>\n );\n};\n"]}
@@ -11,32 +11,52 @@ export declare const ColoredText: {
11
11
  image: {
12
12
  oneOf: ({
13
13
  type: string;
14
- properties: {
15
- when: {
16
- type: string;
17
- };
18
- };
19
- } | {
20
- type: string;
21
- pattern: string;
14
+ additionalProperties: boolean;
15
+ required: import("@gravity-ui/page-constructor").Theme[];
16
+ properties: {};
22
17
  optionName: string;
23
- items?: undefined;
24
- } | {
25
- type: string;
26
- items: {
18
+ } | ({
19
+ oneOf: ({
27
20
  type: string;
28
21
  properties: {
29
22
  when: {
30
23
  type: string;
31
24
  };
32
25
  };
33
- };
26
+ } | {
27
+ type: string;
28
+ pattern: string;
29
+ optionName: string;
30
+ items?: undefined;
31
+ } | {
32
+ type: string;
33
+ items: {
34
+ type: string;
35
+ properties: {
36
+ when: {
37
+ type: string;
38
+ };
39
+ };
40
+ };
41
+ optionName: string;
42
+ pattern?: undefined;
43
+ })[];
44
+ } & {
34
45
  optionName: string;
35
- pattern?: undefined;
36
- })[];
46
+ }))[];
37
47
  };
38
48
  color: {
39
- type: string;
49
+ oneOf: ({
50
+ type: string;
51
+ additionalProperties: boolean;
52
+ required: import("@gravity-ui/page-constructor").Theme[];
53
+ properties: {};
54
+ optionName: string;
55
+ } | ({
56
+ type: string;
57
+ } & {
58
+ optionName: string;
59
+ }))[];
40
60
  };
41
61
  altText: {
42
62
  type: string;
@@ -1,15 +1,15 @@
1
1
  import { validators } from '@gravity-ui/page-constructor';
2
2
  import { BlockType } from "../../models/common.js";
3
3
  import { BlogBlockBase } from "../../schema/common.js";
4
- const { subBlocks: { ContentBase }, components: { ImageProps }, common: { BlockBaseProps }, } = validators;
4
+ const { subBlocks: { ContentBase }, components: { ImageProps }, common: { BlockBaseProps, withTheme }, } = validators;
5
5
  const BackgroundProps = {
6
6
  type: 'object',
7
7
  additionalProperties: false,
8
8
  properties: {
9
- image: ImageProps,
10
- color: {
9
+ image: withTheme(ImageProps),
10
+ color: withTheme({
11
11
  type: 'string',
12
- },
12
+ }),
13
13
  altText: {
14
14
  type: 'string',
15
15
  contentType: 'text',
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["blocks/ColoredText/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAC,SAAS,EAAC,+BAA4B;AAC9C,OAAO,EAAC,aAAa,EAAC,+BAA4B;AAElD,MAAM,EACF,SAAS,EAAE,EAAC,WAAW,EAAC,EACxB,UAAU,EAAE,EAAC,UAAU,EAAC,EACxB,MAAM,EAAE,EAAC,cAAc,EAAC,GAC3B,GAAG,UAAU,CAAC;AAEf,MAAM,eAAe,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE;YACH,IAAI,EAAE,QAAQ;SACjB;QACD,OAAO,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,MAAM;SACtB;KACJ;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE;QACrB,IAAI,EAAE,QAAQ;QACd,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,CAAC,MAAM,CAAC;QAClB,UAAU,8DACH,cAAc,GACd,aAAa,GACb,WAAW,KACd,UAAU,EAAE,eAAe,GAC9B;KACJ;CACJ,CAAC","sourcesContent":["import {validators} from '@gravity-ui/page-constructor';\n\nimport {BlockType} from '../../models/common';\nimport {BlogBlockBase} from '../../schema/common';\n\nconst {\n subBlocks: {ContentBase},\n components: {ImageProps},\n common: {BlockBaseProps},\n} = validators;\n\nconst BackgroundProps = {\n type: 'object',\n additionalProperties: false,\n properties: {\n image: ImageProps,\n color: {\n type: 'string',\n },\n altText: {\n type: 'string',\n contentType: 'text',\n },\n },\n};\n\nexport const ColoredText = {\n [BlockType.ColoredText]: {\n type: 'object',\n additionalProperties: false,\n required: ['text'],\n properties: {\n ...BlockBaseProps,\n ...BlogBlockBase,\n ...ContentBase,\n background: BackgroundProps,\n },\n },\n};\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["blocks/ColoredText/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAC,SAAS,EAAC,+BAA4B;AAC9C,OAAO,EAAC,aAAa,EAAC,+BAA4B;AAElD,MAAM,EACF,SAAS,EAAE,EAAC,WAAW,EAAC,EACxB,UAAU,EAAE,EAAC,UAAU,EAAC,EACxB,MAAM,EAAE,EAAC,cAAc,EAAE,SAAS,EAAC,GACtC,GAAG,UAAU,CAAC;AAEf,MAAM,eAAe,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACR,KAAK,EAAE,SAAS,CAAC,UAAU,CAAC;QAC5B,KAAK,EAAE,SAAS,CAAC;YACb,IAAI,EAAE,QAAQ;SACjB,CAAC;QACF,OAAO,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,MAAM;SACtB;KACJ;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE;QACrB,IAAI,EAAE,QAAQ;QACd,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,CAAC,MAAM,CAAC;QAClB,UAAU,8DACH,cAAc,GACd,aAAa,GACb,WAAW,KACd,UAAU,EAAE,eAAe,GAC9B;KACJ;CACJ,CAAC","sourcesContent":["import {validators} from '@gravity-ui/page-constructor';\n\nimport {BlockType} from '../../models/common';\nimport {BlogBlockBase} from '../../schema/common';\n\nconst {\n subBlocks: {ContentBase},\n components: {ImageProps},\n common: {BlockBaseProps, withTheme},\n} = validators;\n\nconst BackgroundProps = {\n type: 'object',\n additionalProperties: false,\n properties: {\n image: withTheme(ImageProps),\n color: withTheme({\n type: 'string',\n }),\n altText: {\n type: 'string',\n contentType: 'text',\n },\n },\n};\n\nexport const ColoredText = {\n [BlockType.ColoredText]: {\n type: 'object',\n additionalProperties: false,\n required: ['text'],\n properties: {\n ...BlockBaseProps,\n ...BlogBlockBase,\n ...ContentBase,\n background: BackgroundProps,\n },\n },\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { AuthorItem, ContentBlockProps, FormBlockData, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme } from '@gravity-ui/page-constructor';
2
+ import { AuthorItem, ContentBlockProps, FormBlockData, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme, ThemeSupporting } from '@gravity-ui/page-constructor';
3
3
  import { BlockType, ClassNameProps, PostData, QAProps } from "./common.js";
4
4
  import { PaddingsYFMProps } from "./paddings.js";
5
5
  export type AuthorProps = ClassNameProps & {
@@ -13,8 +13,8 @@ export type BannerProps = ContentBlockProps & QAProps & {
13
13
  } & PaddingsYFMProps;
14
14
  export type ColoredTextProps = ContentBlockProps & QAProps & {
15
15
  background?: {
16
- color?: string;
17
- image?: string;
16
+ color?: ThemeSupporting<string>;
17
+ image?: ThemeSupporting<string>;
18
18
  altText?: string;
19
19
  };
20
20
  } & PaddingsYFMProps;
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.js","sourceRoot":"../../../src","sources":["models/blocks.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nimport {\n AuthorItem,\n ContentBlockProps,\n FormBlockData,\n HeaderBlockProps,\n MediaProps as PCMediaProps,\n TextTheme,\n} from '@gravity-ui/page-constructor';\n\nimport {BlockType, ClassNameProps, PostData, QAProps} from './common';\nimport {PaddingsYFMProps} from './paddings';\n\n// blocks props\nexport type AuthorProps = ClassNameProps & {\n authorId: number | string;\n image: string;\n} & PaddingsYFMProps &\n QAProps;\n\nexport type BannerProps = ContentBlockProps &\n QAProps & {\n color?: string;\n image?: string;\n imageSize?: 's' | 'm';\n } & PaddingsYFMProps;\n\nexport type ColoredTextProps = ContentBlockProps &\n QAProps & {\n background?: {\n color?: string;\n image?: string;\n altText?: string;\n };\n } & PaddingsYFMProps;\n\nexport type CTAProps = QAProps & {\n items: Array<ContentBlockProps>;\n} & PaddingsYFMProps;\n\ntype HeaderBlogProps = {\n imageInGrid?: boolean;\n};\n\nexport type HeaderProps = HeaderBlockProps & PaddingsYFMProps & HeaderBlogProps;\n\nexport type LayoutProps = {\n fullWidth?: boolean;\n mobileOrder?: string;\n children: React.ReactElement[];\n} & PaddingsYFMProps;\n\nexport type MediaProps = ClassNameProps &\n PaddingsYFMProps &\n Partial<\n Pick<\n PCMediaProps,\n | 'youtube'\n | 'previewImg'\n | 'image'\n | 'video'\n | 'dataLens'\n | 'videoIframe'\n | 'videoMicrodata'\n >\n > & {\n text?: string;\n };\n\nexport type MetaProps = QAProps & {\n locale: string;\n theme?: TextTheme;\n} & PaddingsYFMProps;\n\nexport type SuggestProps = ClassNameProps & {\n posts: PostData[];\n} & PaddingsYFMProps;\n\nexport type YFMProps = {\n text: string;\n} & PaddingsYFMProps &\n QAProps;\n\nexport type FeedProps = {\n image: string;\n title?: string;\n resetTitleMargin?: boolean;\n};\n\nexport type FormProps = {\n formData: FormBlockData;\n border?: 'shadow' | 'line' | 'none';\n} & PaddingsYFMProps &\n QAProps;\n\nexport type CompactMediaProps = {\n description?: string;\n} & PaddingsYFMProps &\n Partial<Pick<PCMediaProps, 'image'>>;\n\nexport type TakeProps = YFMProps & {\n author: AuthorItem;\n color?: string;\n noBackground?: boolean;\n};\n\nexport type SideCard = Pick<PCMediaProps, 'image'> & {\n description: string;\n url: string;\n};\n\nexport type SideCardListProps = {\n title?: string;\n items: SideCard[];\n} & PaddingsYFMProps;\n\n// blocks models\nexport type AuthorBlockModel = {\n type: BlockType.Author;\n} & AuthorProps;\n\nexport type BannerBlockModel = {\n type: BlockType.Banner;\n} & BannerProps;\n\nexport type ColoredTextBlockModel = {\n type: BlockType.ColoredText;\n} & ColoredTextProps;\n\nexport type CTABlockModel = {\n type: BlockType.CTA;\n} & CTAProps;\n\nexport type HeaderBlockModel = {\n type: BlockType.Header;\n} & HeaderProps;\n\nexport type LayoutBlockModel = {\n type: BlockType.Layout;\n} & LayoutProps;\n\nexport type MediaBlockModel = {\n type: BlockType.Media;\n} & MediaProps;\n\nexport type MetaBlockModel = {\n type: BlockType.Meta;\n} & MetaProps;\n\nexport type SuggestBlockModel = {\n type: BlockType.Suggest;\n} & SuggestProps;\n\nexport type YFMBlockModel = {\n type: BlockType.YFM;\n} & YFMProps;\n\nexport type FeedBlockModel = {\n type: BlockType.Feed;\n} & FeedProps;\n\nexport type FormBlockModel = {\n type: BlockType.Form;\n} & FormProps;\n\nexport type CompactMediaBlockModel = {\n type: BlockType.CompactMedia;\n} & CompactMediaProps;\n\nexport type TakeBlockModel = {\n type: BlockType.Take;\n} & TakeProps;\n\nexport type SideCardListBlockModel = {\n type: BlockType.SideCardList;\n} & SideCardListProps;\n\nexport type BlockModel =\n | AuthorBlockModel\n | BannerBlockModel\n | ColoredTextBlockModel\n | CTABlockModel\n | HeaderBlockModel\n | LayoutBlockModel\n | MediaBlockModel\n | MetaBlockModel\n | SuggestBlockModel\n | YFMBlockModel\n | FeedBlockModel\n | CompactMediaBlockModel\n | TakeBlockModel\n | SideCardListBlockModel;\n\nexport type Block = BlockModel & {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [x: string]: any;\n};\n"]}
1
+ {"version":3,"file":"blocks.js","sourceRoot":"../../../src","sources":["models/blocks.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nimport {\n AuthorItem,\n ContentBlockProps,\n FormBlockData,\n HeaderBlockProps,\n MediaProps as PCMediaProps,\n TextTheme,\n ThemeSupporting,\n} from '@gravity-ui/page-constructor';\n\nimport {BlockType, ClassNameProps, PostData, QAProps} from './common';\nimport {PaddingsYFMProps} from './paddings';\n\n// blocks props\nexport type AuthorProps = ClassNameProps & {\n authorId: number | string;\n image: string;\n} & PaddingsYFMProps &\n QAProps;\n\nexport type BannerProps = ContentBlockProps &\n QAProps & {\n color?: string;\n image?: string;\n imageSize?: 's' | 'm';\n } & PaddingsYFMProps;\n\nexport type ColoredTextProps = ContentBlockProps &\n QAProps & {\n background?: {\n color?: ThemeSupporting<string>;\n image?: ThemeSupporting<string>;\n altText?: string;\n };\n } & PaddingsYFMProps;\n\nexport type CTAProps = QAProps & {\n items: Array<ContentBlockProps>;\n} & PaddingsYFMProps;\n\ntype HeaderBlogProps = {\n imageInGrid?: boolean;\n};\n\nexport type HeaderProps = HeaderBlockProps & PaddingsYFMProps & HeaderBlogProps;\n\nexport type LayoutProps = {\n fullWidth?: boolean;\n mobileOrder?: string;\n children: React.ReactElement[];\n} & PaddingsYFMProps;\n\nexport type MediaProps = ClassNameProps &\n PaddingsYFMProps &\n Partial<\n Pick<\n PCMediaProps,\n | 'youtube'\n | 'previewImg'\n | 'image'\n | 'video'\n | 'dataLens'\n | 'videoIframe'\n | 'videoMicrodata'\n >\n > & {\n text?: string;\n };\n\nexport type MetaProps = QAProps & {\n locale: string;\n theme?: TextTheme;\n} & PaddingsYFMProps;\n\nexport type SuggestProps = ClassNameProps & {\n posts: PostData[];\n} & PaddingsYFMProps;\n\nexport type YFMProps = {\n text: string;\n} & PaddingsYFMProps &\n QAProps;\n\nexport type FeedProps = {\n image: string;\n title?: string;\n resetTitleMargin?: boolean;\n};\n\nexport type FormProps = {\n formData: FormBlockData;\n border?: 'shadow' | 'line' | 'none';\n} & PaddingsYFMProps &\n QAProps;\n\nexport type CompactMediaProps = {\n description?: string;\n} & PaddingsYFMProps &\n Partial<Pick<PCMediaProps, 'image'>>;\n\nexport type TakeProps = YFMProps & {\n author: AuthorItem;\n color?: string;\n noBackground?: boolean;\n};\n\nexport type SideCard = Pick<PCMediaProps, 'image'> & {\n description: string;\n url: string;\n};\n\nexport type SideCardListProps = {\n title?: string;\n items: SideCard[];\n} & PaddingsYFMProps;\n\n// blocks models\nexport type AuthorBlockModel = {\n type: BlockType.Author;\n} & AuthorProps;\n\nexport type BannerBlockModel = {\n type: BlockType.Banner;\n} & BannerProps;\n\nexport type ColoredTextBlockModel = {\n type: BlockType.ColoredText;\n} & ColoredTextProps;\n\nexport type CTABlockModel = {\n type: BlockType.CTA;\n} & CTAProps;\n\nexport type HeaderBlockModel = {\n type: BlockType.Header;\n} & HeaderProps;\n\nexport type LayoutBlockModel = {\n type: BlockType.Layout;\n} & LayoutProps;\n\nexport type MediaBlockModel = {\n type: BlockType.Media;\n} & MediaProps;\n\nexport type MetaBlockModel = {\n type: BlockType.Meta;\n} & MetaProps;\n\nexport type SuggestBlockModel = {\n type: BlockType.Suggest;\n} & SuggestProps;\n\nexport type YFMBlockModel = {\n type: BlockType.YFM;\n} & YFMProps;\n\nexport type FeedBlockModel = {\n type: BlockType.Feed;\n} & FeedProps;\n\nexport type FormBlockModel = {\n type: BlockType.Form;\n} & FormProps;\n\nexport type CompactMediaBlockModel = {\n type: BlockType.CompactMedia;\n} & CompactMediaProps;\n\nexport type TakeBlockModel = {\n type: BlockType.Take;\n} & TakeProps;\n\nexport type SideCardListBlockModel = {\n type: BlockType.SideCardList;\n} & SideCardListProps;\n\nexport type BlockModel =\n | AuthorBlockModel\n | BannerBlockModel\n | ColoredTextBlockModel\n | CTABlockModel\n | HeaderBlockModel\n | LayoutBlockModel\n | MediaBlockModel\n | MetaBlockModel\n | SuggestBlockModel\n | YFMBlockModel\n | FeedBlockModel\n | CompactMediaBlockModel\n | TakeBlockModel\n | SideCardListBlockModel;\n\nexport type Block = BlockModel & {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [x: string]: any;\n};\n"]}
@@ -935,32 +935,52 @@ export declare const schemasForCustom: {
935
935
  image: {
936
936
  oneOf: ({
937
937
  type: string;
938
- properties: {
939
- when: {
940
- type: string;
941
- };
942
- };
943
- } | {
944
- type: string;
945
- pattern: string;
938
+ additionalProperties: boolean;
939
+ required: import("@gravity-ui/page-constructor").Theme[];
940
+ properties: {};
946
941
  optionName: string;
947
- items?: undefined;
948
- } | {
949
- type: string;
950
- items: {
942
+ } | ({
943
+ oneOf: ({
951
944
  type: string;
952
945
  properties: {
953
946
  when: {
954
947
  type: string;
955
948
  };
956
949
  };
957
- };
950
+ } | {
951
+ type: string;
952
+ pattern: string;
953
+ optionName: string;
954
+ items?: undefined;
955
+ } | {
956
+ type: string;
957
+ items: {
958
+ type: string;
959
+ properties: {
960
+ when: {
961
+ type: string;
962
+ };
963
+ };
964
+ };
965
+ optionName: string;
966
+ pattern?: undefined;
967
+ })[];
968
+ } & {
958
969
  optionName: string;
959
- pattern?: undefined;
960
- })[];
970
+ }))[];
961
971
  };
962
972
  color: {
963
- type: string;
973
+ oneOf: ({
974
+ type: string;
975
+ additionalProperties: boolean;
976
+ required: import("@gravity-ui/page-constructor").Theme[];
977
+ properties: {};
978
+ optionName: string;
979
+ } | ({
980
+ type: string;
981
+ } & {
982
+ optionName: string;
983
+ }))[];
964
984
  };
965
985
  altText: {
966
986
  type: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/blog-constructor",
3
- "version": "11.0.1-alpha.1",
3
+ "version": "11.1.0",
4
4
  "description": "Gravity UI Blog Constructor",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { AuthorItem, ContentBlockProps, FormBlockData, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme } from '@gravity-ui/page-constructor';
2
+ import { AuthorItem, ContentBlockProps, FormBlockData, HeaderBlockProps, MediaProps as PCMediaProps, TextTheme, ThemeSupporting } from '@gravity-ui/page-constructor';
3
3
  import { BlockType, ClassNameProps, PostData, QAProps } from './common';
4
4
  import { PaddingsYFMProps } from './paddings';
5
5
  export type AuthorProps = ClassNameProps & {
@@ -13,8 +13,8 @@ export type BannerProps = ContentBlockProps & QAProps & {
13
13
  } & PaddingsYFMProps;
14
14
  export type ColoredTextProps = ContentBlockProps & QAProps & {
15
15
  background?: {
16
- color?: string;
17
- image?: string;
16
+ color?: ThemeSupporting<string>;
17
+ image?: ThemeSupporting<string>;
18
18
  altText?: string;
19
19
  };
20
20
  } & PaddingsYFMProps;