@gravity-ui/page-constructor 7.21.1 → 7.22.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 (128) hide show
  1. package/build/cjs/blocks/ContentLayout/schema.d.ts +11 -0
  2. package/build/cjs/blocks/FoldableList/schema.d.ts +11 -0
  3. package/build/cjs/blocks/Form/Form.css +5 -2
  4. package/build/cjs/blocks/Form/Form.js +12 -9
  5. package/build/cjs/blocks/Form/Form.js.map +1 -1
  6. package/build/cjs/blocks/Form/schema.d.ts +12 -4
  7. package/build/cjs/blocks/Form/schema.js +1 -4
  8. package/build/cjs/blocks/Form/schema.js.map +1 -1
  9. package/build/cjs/blocks/Form/utils.d.ts +3 -0
  10. package/build/cjs/blocks/Form/utils.js +20 -0
  11. package/build/cjs/blocks/Form/utils.js.map +1 -0
  12. package/build/cjs/blocks/Info/schema.d.ts +22 -0
  13. package/build/cjs/blocks/Map/schema.d.ts +11 -0
  14. package/build/cjs/blocks/Media/schema.d.ts +22 -0
  15. package/build/cjs/blocks/Questions/schema.d.ts +11 -0
  16. package/build/cjs/blocks/Tabs/schema.d.ts +11 -0
  17. package/build/cjs/components/{ContentList/ContentListItemIcon.d.ts → ContentIcon/ContentIcon.d.ts} +3 -3
  18. package/build/cjs/components/{ContentList/ContentListItemIcon.js → ContentIcon/ContentIcon.js} +3 -3
  19. package/build/cjs/components/ContentIcon/ContentIcon.js.map +1 -0
  20. package/build/cjs/components/ContentLabels/ContentLabels.css +53 -0
  21. package/build/cjs/components/ContentLabels/ContentLabels.d.ts +3 -0
  22. package/build/cjs/components/ContentLabels/ContentLabels.js +16 -0
  23. package/build/cjs/components/ContentLabels/ContentLabels.js.map +1 -0
  24. package/build/cjs/components/ContentList/ContentList.js +2 -2
  25. package/build/cjs/components/ContentList/ContentList.js.map +1 -1
  26. package/build/cjs/context/windowWidthContext/{BreakpointContext.js → WindowWidthContext.js} +2 -7
  27. package/build/cjs/context/windowWidthContext/WindowWidthContext.js.map +1 -0
  28. package/build/cjs/context/windowWidthContext/index.d.ts +1 -1
  29. package/build/cjs/context/windowWidthContext/index.js +1 -1
  30. package/build/cjs/context/windowWidthContext/index.js.map +1 -1
  31. package/build/cjs/hooks/useDeviceValue.d.ts +2 -0
  32. package/build/cjs/hooks/useDeviceValue.js +33 -0
  33. package/build/cjs/hooks/useDeviceValue.js.map +1 -0
  34. package/build/cjs/models/constructor-items/blocks.d.ts +25 -9
  35. package/build/cjs/models/constructor-items/blocks.js.map +1 -1
  36. package/build/cjs/models/constructor-items/sub-blocks.d.ts +5 -5
  37. package/build/cjs/models/constructor-items/sub-blocks.js.map +1 -1
  38. package/build/cjs/schema/constants.d.ts +33 -0
  39. package/build/cjs/schema/validators/common.d.ts +12 -1
  40. package/build/cjs/schema/validators/common.js +21 -0
  41. package/build/cjs/schema/validators/common.js.map +1 -1
  42. package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +11 -0
  43. package/build/cjs/sub-blocks/BasicCard/schema.d.ts +11 -0
  44. package/build/cjs/sub-blocks/Content/Content.css +16 -0
  45. package/build/cjs/sub-blocks/Content/Content.js +12 -3
  46. package/build/cjs/sub-blocks/Content/Content.js.map +1 -1
  47. package/build/cjs/sub-blocks/Content/schema.d.ts +103 -1
  48. package/build/cjs/sub-blocks/Content/schema.js +22 -2
  49. package/build/cjs/sub-blocks/Content/schema.js.map +1 -1
  50. package/build/cjs/sub-blocks/ImageCard/schema.d.ts +11 -0
  51. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +11 -0
  52. package/build/cjs/utils/breakpoint.d.ts +7 -0
  53. package/build/cjs/utils/breakpoint.js +12 -0
  54. package/build/cjs/utils/breakpoint.js.map +1 -0
  55. package/build/cjs/utils/index.d.ts +1 -0
  56. package/build/cjs/utils/index.js +1 -0
  57. package/build/cjs/utils/index.js.map +1 -1
  58. package/build/esm/blocks/ContentLayout/schema.d.ts +11 -0
  59. package/build/esm/blocks/FoldableList/schema.d.ts +11 -0
  60. package/build/esm/blocks/Form/Form.css +5 -2
  61. package/build/esm/blocks/Form/Form.js +12 -9
  62. package/build/esm/blocks/Form/Form.js.map +1 -1
  63. package/build/esm/blocks/Form/schema.d.ts +12 -4
  64. package/build/esm/blocks/Form/schema.js +1 -4
  65. package/build/esm/blocks/Form/schema.js.map +1 -1
  66. package/build/esm/blocks/Form/utils.d.ts +3 -0
  67. package/build/esm/blocks/Form/utils.js +16 -0
  68. package/build/esm/blocks/Form/utils.js.map +1 -0
  69. package/build/esm/blocks/Info/schema.d.ts +22 -0
  70. package/build/esm/blocks/Map/schema.d.ts +11 -0
  71. package/build/esm/blocks/Media/schema.d.ts +22 -0
  72. package/build/esm/blocks/Questions/schema.d.ts +11 -0
  73. package/build/esm/blocks/Tabs/schema.d.ts +11 -0
  74. package/build/esm/components/{ContentList/ContentListItemIcon.d.ts → ContentIcon/ContentIcon.d.ts} +3 -3
  75. package/build/esm/components/{ContentList/ContentListItemIcon.js → ContentIcon/ContentIcon.js} +3 -3
  76. package/build/esm/components/ContentIcon/ContentIcon.js.map +1 -0
  77. package/build/esm/components/ContentLabels/ContentLabels.css +53 -0
  78. package/build/esm/components/ContentLabels/ContentLabels.d.ts +4 -0
  79. package/build/esm/components/ContentLabels/ContentLabels.js +14 -0
  80. package/build/esm/components/ContentLabels/ContentLabels.js.map +1 -0
  81. package/build/esm/components/ContentList/ContentList.js +2 -2
  82. package/build/esm/components/ContentList/ContentList.js.map +1 -1
  83. package/build/esm/context/windowWidthContext/{BreakpointContext.js → WindowWidthContext.js} +2 -7
  84. package/build/esm/context/windowWidthContext/WindowWidthContext.js.map +1 -0
  85. package/build/esm/context/windowWidthContext/index.d.ts +1 -1
  86. package/build/esm/context/windowWidthContext/index.js +1 -1
  87. package/build/esm/context/windowWidthContext/index.js.map +1 -1
  88. package/build/esm/hooks/useDeviceValue.d.ts +2 -0
  89. package/build/esm/hooks/useDeviceValue.js +29 -0
  90. package/build/esm/hooks/useDeviceValue.js.map +1 -0
  91. package/build/esm/models/constructor-items/blocks.d.ts +25 -9
  92. package/build/esm/models/constructor-items/blocks.js.map +1 -1
  93. package/build/esm/models/constructor-items/sub-blocks.d.ts +5 -5
  94. package/build/esm/models/constructor-items/sub-blocks.js.map +1 -1
  95. package/build/esm/schema/constants.d.ts +33 -0
  96. package/build/esm/schema/validators/common.d.ts +12 -1
  97. package/build/esm/schema/validators/common.js +21 -1
  98. package/build/esm/schema/validators/common.js.map +1 -1
  99. package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +11 -0
  100. package/build/esm/sub-blocks/BasicCard/schema.d.ts +11 -0
  101. package/build/esm/sub-blocks/Content/Content.css +16 -0
  102. package/build/esm/sub-blocks/Content/Content.js +11 -3
  103. package/build/esm/sub-blocks/Content/Content.js.map +1 -1
  104. package/build/esm/sub-blocks/Content/schema.d.ts +103 -1
  105. package/build/esm/sub-blocks/Content/schema.js +21 -1
  106. package/build/esm/sub-blocks/Content/schema.js.map +1 -1
  107. package/build/esm/sub-blocks/ImageCard/schema.d.ts +11 -0
  108. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +11 -0
  109. package/build/esm/utils/breakpoint.d.ts +7 -0
  110. package/build/esm/utils/breakpoint.js +9 -0
  111. package/build/esm/utils/breakpoint.js.map +1 -0
  112. package/build/esm/utils/index.d.ts +1 -0
  113. package/build/esm/utils/index.js +1 -0
  114. package/build/esm/utils/index.js.map +1 -1
  115. package/package.json +1 -1
  116. package/schema/index.js +1 -1
  117. package/server/models/constructor-items/blocks.d.ts +25 -9
  118. package/server/models/constructor-items/sub-blocks.d.ts +5 -5
  119. package/server/utils/breakpoint.d.ts +7 -0
  120. package/server/utils/breakpoint.js +11 -0
  121. package/server/utils/index.d.ts +1 -0
  122. package/server/utils/index.js +1 -0
  123. package/build/cjs/components/ContentList/ContentListItemIcon.js.map +0 -1
  124. package/build/cjs/context/windowWidthContext/BreakpointContext.js.map +0 -1
  125. package/build/esm/components/ContentList/ContentListItemIcon.js.map +0 -1
  126. package/build/esm/context/windowWidthContext/BreakpointContext.js.map +0 -1
  127. /package/build/cjs/context/windowWidthContext/{BreakpointContext.d.ts → WindowWidthContext.d.ts} +0 -0
  128. /package/build/esm/context/windowWidthContext/{BreakpointContext.d.ts → WindowWidthContext.d.ts} +0 -0
@@ -221,6 +221,17 @@ export declare const BackgroundCard: {
221
221
  type: string;
222
222
  enum: string[];
223
223
  };
224
+ labels: {
225
+ type: string;
226
+ items: {
227
+ type: string;
228
+ properties: {
229
+ when: {
230
+ type: string;
231
+ };
232
+ };
233
+ };
234
+ };
224
235
  additionalInfo: {
225
236
  type: string;
226
237
  contentType: string;
@@ -109,6 +109,17 @@ export declare const BasicCard: {
109
109
  contentType: string;
110
110
  inputType: string;
111
111
  };
112
+ labels: {
113
+ type: string;
114
+ items: {
115
+ type: string;
116
+ properties: {
117
+ when: {
118
+ type: string;
119
+ };
120
+ };
121
+ };
122
+ };
112
123
  additionalInfo: {
113
124
  type: string;
114
125
  contentType: string;
@@ -38,6 +38,10 @@ unpredictable css rules order in build */
38
38
  text-align: center;
39
39
  }
40
40
 
41
+ .pc-content_centered .pc-content__labels {
42
+ justify-content: center;
43
+ margin-inline: auto;
44
+ }
41
45
  .pc-content_centered .pc-content__list {
42
46
  margin-inline: auto;
43
47
  }
@@ -62,11 +66,15 @@ unpredictable css rules order in build */
62
66
  .pc-content_size_s .pc-content__text_without-title {
63
67
  margin-top: 0;
64
68
  }
69
+ .pc-content_size_s .pc-content__labels,
65
70
  .pc-content_size_s .pc-content__list,
66
71
  .pc-content_size_s .pc-content__links,
67
72
  .pc-content_size_s .pc-content__notice {
68
73
  margin-top: 16px;
69
74
  }
75
+ .pc-content_size_s .pc-content__labels + .pc-content__list, .pc-content_size_s .pc-content__labels + .pc-content__link, .pc-content_size_s .pc-content__labels + .pc-content__notice {
76
+ margin-top: 20px;
77
+ }
70
78
  .pc-content_size_s .pc-content__buttons {
71
79
  margin-top: 20px;
72
80
  }
@@ -93,11 +101,15 @@ unpredictable css rules order in build */
93
101
  font-size: var(--g-text-body-2-font-size);
94
102
  line-height: var(--g-text-body-2-line-height);
95
103
  }
104
+ .pc-content_size_m .pc-content__labels,
96
105
  .pc-content_size_m .pc-content__list,
97
106
  .pc-content_size_m .pc-content__links,
98
107
  .pc-content_size_m .pc-content__notice {
99
108
  margin-top: 20px;
100
109
  }
110
+ .pc-content_size_m .pc-content__labels + .pc-content__list, .pc-content_size_m .pc-content__labels + .pc-content__link, .pc-content_size_m .pc-content__labels + .pc-content__notice {
111
+ margin-top: 24px;
112
+ }
101
113
  .pc-content_size_m .pc-content__buttons {
102
114
  margin-top: 24px;
103
115
  }
@@ -120,11 +132,15 @@ unpredictable css rules order in build */
120
132
  font-size: var(--g-text-body-2-font-size);
121
133
  line-height: var(--g-text-body-2-line-height);
122
134
  }
135
+ .pc-content_size_l .pc-content__labels,
123
136
  .pc-content_size_l .pc-content__list,
124
137
  .pc-content_size_l .pc-content__links,
125
138
  .pc-content_size_l .pc-content__notice {
126
139
  margin-top: 20px;
127
140
  }
141
+ .pc-content_size_l .pc-content__labels + .pc-content__list, .pc-content_size_l .pc-content__labels + .pc-content__link, .pc-content_size_l .pc-content__labels + .pc-content__notice {
142
+ margin-top: 24px;
143
+ }
128
144
  .pc-content_size_l .pc-content__buttons {
129
145
  margin-top: 24px;
130
146
  }
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
3
4
  const jsx_runtime_1 = require("react/jsx-runtime");
4
5
  const uikit_1 = require("@gravity-ui/uikit");
5
6
  const components_1 = require("../../components/index.js");
7
+ const ContentLabels_1 = tslib_1.__importDefault(require("../../components/ContentLabels/ContentLabels.js"));
6
8
  const grid_1 = require("../../grid/index.js");
7
9
  const utils_1 = require("../../utils/index.js");
8
10
  const blocks_1 = require("../../utils/blocks.js");
@@ -19,15 +21,22 @@ function getTextSize(size) {
19
21
  }
20
22
  }
21
23
  const Content = (props) => {
22
- const { title, titleId: titleIdFromProps, text, textId, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, list, qa, controlPosition, } = props;
23
- const qaAttributes = (0, blocks_1.getQaAttrubutes)(qa, ['links', 'link', 'buttons', 'button', 'list']);
24
+ const { title, titleId: titleIdFromProps, text, textId, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, list, labels, qa, controlPosition, } = props;
25
+ const qaAttributes = (0, blocks_1.getQaAttrubutes)(qa, [
26
+ 'links',
27
+ 'link',
28
+ 'buttons',
29
+ 'button',
30
+ 'list',
31
+ 'labels',
32
+ ]);
24
33
  const titleProps = !title || typeof title === 'string'
25
34
  ? { text: title, textSize: getTextSize(size) }
26
35
  : title;
27
36
  const hasTitle = Boolean(title);
28
37
  const defaultTitleId = (0, uikit_1.useUniqId)();
29
38
  const titleId = titleIdFromProps || defaultTitleId;
30
- return ((0, jsx_runtime_1.jsxs)(grid_1.Col, { className: b({ size, centered, theme, 'control-position': controlPosition }, className), reset: true, sizes: colSizes, qa: qaAttributes.container, children: [title && ((0, jsx_runtime_1.jsx)(components_1.Title, { className: b('title'), title: titleProps, colSizes: { all: 12 }, id: titleId })), text && ((0, jsx_runtime_1.jsx)("div", { className: b('text', { ['without-title']: !hasTitle }), children: (0, jsx_runtime_1.jsx)(components_1.YFMWrapper, { content: text, modifiers: { constructor: true, [`constructor-size-${size}`]: true }, id: textId, qa: qaAttributes.list }) })), list?.length ? ((0, jsx_runtime_1.jsx)("div", { className: b('list'), children: (0, jsx_runtime_1.jsx)(components_1.ContentList, { list: list, size: size, qa: qaAttributes.list, theme: theme }) })) : null, additionalInfo && ((0, jsx_runtime_1.jsx)("div", { className: b('notice'), children: (0, jsx_runtime_1.jsx)(components_1.YFMWrapper, { content: additionalInfo, modifiers: {
39
+ return ((0, jsx_runtime_1.jsxs)(grid_1.Col, { className: b({ size, centered, theme, 'control-position': controlPosition }, className), reset: true, sizes: colSizes, qa: qaAttributes.container, children: [title && ((0, jsx_runtime_1.jsx)(components_1.Title, { className: b('title'), title: titleProps, colSizes: { all: 12 }, id: titleId })), text && ((0, jsx_runtime_1.jsx)("div", { className: b('text', { ['without-title']: !hasTitle }), children: (0, jsx_runtime_1.jsx)(components_1.YFMWrapper, { content: text, modifiers: { constructor: true, [`constructor-size-${size}`]: true }, id: textId, qa: qaAttributes.list }) })), labels?.length ? ((0, jsx_runtime_1.jsx)("div", { className: b('labels'), children: (0, jsx_runtime_1.jsx)(ContentLabels_1.default, { labels: labels, theme: theme, size: size, qa: qaAttributes.labels }) })) : null, list?.length ? ((0, jsx_runtime_1.jsx)("div", { className: b('list'), children: (0, jsx_runtime_1.jsx)(components_1.ContentList, { list: list, size: size, qa: qaAttributes.list, theme: theme }) })) : null, additionalInfo && ((0, jsx_runtime_1.jsx)("div", { className: b('notice'), children: (0, jsx_runtime_1.jsx)(components_1.YFMWrapper, { content: additionalInfo, modifiers: {
31
40
  constructor: true,
32
41
  'constructor-notice': true,
33
42
  [`constructor-size-${size}`]: true,
@@ -1 +1 @@
1
- {"version":3,"file":"Content.js","sourceRoot":"../../../../src","sources":["sub-blocks/Content/Content.tsx"],"names":[],"mappings":";;;AAAA,6CAA4C;AAE5C,0DAAgF;AAChF,8CAA+B;AAS/B,gDAAkC;AAClC,kDAAmD;AAInD,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,SAAS,CAAC,CAAC;AAE3B,SAAS,WAAW,CAAC,IAAiB;IAClC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,GAAG;YACJ,OAAO,GAAG,CAAC;QACf,KAAK,GAAG;YACJ,OAAO,IAAI,CAAC;QAChB,KAAK,GAAG,CAAC;QACT;YACI,OAAO,GAAG,CAAC;IACnB,CAAC;AACL,CAAC;AAID,MAAM,OAAO,GAAG,CAAC,KAAmB,EAAE,EAAE;IACpC,MAAM,EACF,KAAK,EACL,OAAO,EAAE,gBAAgB,EACzB,IAAI,EACJ,MAAM,EACN,cAAc,EACd,IAAI,GAAG,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;AACN,CAAC,CAAC;AAEF,kBAAe,OAAO,CAAC","sourcesContent":["import {useUniqId} from '@gravity-ui/uikit';\n\nimport {Buttons, ContentList, Links, Title, YFMWrapper} from '../../components';\nimport {Col} from '../../grid';\nimport {\n ClassNameProps,\n ContentBlockProps,\n ContentSize,\n TextSize,\n TitleItemProps,\n} from '../../models';\nimport {QAProps} from '../../models/common';\nimport {block} from '../../utils';\nimport {getQaAttrubutes} from '../../utils/blocks';\n\nimport './Content.scss';\n\nconst b = block('content');\n\nfunction getTextSize(size: ContentSize): TextSize {\n switch (size) {\n case 's':\n return 's';\n case 'm':\n return 'sm';\n case 'l':\n default:\n return 'm';\n }\n}\n\nexport type ContentProps = ContentBlockProps & ClassNameProps & QAProps;\n\nconst Content = (props: ContentProps) => {\n const {\n title,\n titleId: titleIdFromProps,\n text,\n textId,\n additionalInfo,\n size = 'l',\n links,\n buttons,\n colSizes = {all: 12, sm: 8},\n centered,\n theme,\n className,\n list,\n qa,\n controlPosition,\n } = props;\n const qaAttributes = getQaAttrubutes(qa, ['links', 'link', 'buttons', 'button', 'list']);\n\n const titleProps =\n !title || typeof title === 'string'\n ? ({text: title, textSize: getTextSize(size)} as TitleItemProps)\n : title;\n\n const hasTitle = Boolean(title);\n const defaultTitleId = useUniqId();\n const titleId = titleIdFromProps || defaultTitleId;\n\n return (\n <Col\n className={b({size, centered, theme, 'control-position': controlPosition}, className)}\n reset\n sizes={colSizes}\n qa={qaAttributes.container}\n >\n {title && (\n <Title\n className={b('title')}\n title={titleProps}\n colSizes={{all: 12}}\n id={titleId}\n />\n )}\n {text && (\n <div className={b('text', {['without-title']: !hasTitle})}>\n <YFMWrapper\n content={text}\n modifiers={{constructor: true, [`constructor-size-${size}`]: true}}\n id={textId}\n qa={qaAttributes.list}\n />\n </div>\n )}\n {list?.length ? (\n <div className={b('list')}>\n <ContentList list={list} size={size} qa={qaAttributes.list} theme={theme} />\n </div>\n ) : null}\n {additionalInfo && (\n <div className={b('notice')}>\n <YFMWrapper\n content={additionalInfo}\n modifiers={{\n constructor: true,\n 'constructor-notice': true,\n [`constructor-size-${size}`]: true,\n }}\n />\n </div>\n )}\n {links && (\n <Links\n className={b('links', {size})}\n size={size}\n links={links}\n titleId={titleId}\n qa={qaAttributes.links}\n linkQa={qaAttributes.link}\n />\n )}\n {buttons && (\n <Buttons\n className={b('buttons', {size})}\n size={size}\n buttons={buttons}\n titleId={titleId}\n qa={qaAttributes.buttons}\n buttonQa={qaAttributes.button}\n />\n )}\n </Col>\n );\n};\n\nexport default Content;\n"]}
1
+ {"version":3,"file":"Content.js","sourceRoot":"../../../../src","sources":["sub-blocks/Content/Content.tsx"],"names":[],"mappings":";;;;AAAA,6CAA4C;AAE5C,0DAAgF;AAChF,4GAAyE;AACzE,8CAA+B;AAS/B,gDAAkC;AAClC,kDAAmD;AAInD,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,SAAS,CAAC,CAAC;AAE3B,SAAS,WAAW,CAAC,IAAiB;IAClC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,GAAG;YACJ,OAAO,GAAG,CAAC;QACf,KAAK,GAAG;YACJ,OAAO,IAAI,CAAC;QAChB,KAAK,GAAG,CAAC;QACT;YACI,OAAO,GAAG,CAAC;IACnB,CAAC;AACL,CAAC;AAID,MAAM,OAAO,GAAG,CAAC,KAAmB,EAAE,EAAE;IACpC,MAAM,EACF,KAAK,EACL,OAAO,EAAE,gBAAgB,EACzB,IAAI,EACJ,MAAM,EACN,cAAc,EACd,IAAI,GAAG,GAAG,EACV,KAAK,EACL,OAAO,EACP,QAAQ,GAAG,EAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAC,EAC3B,QAAQ,EACR,KAAK,EACL,SAAS,EACT,IAAI,EACJ,MAAM,EACN,EAAE,EACF,eAAe,GAClB,GAAG,KAAK,CAAC;IACV,MAAM,YAAY,GAAG,IAAA,wBAAe,EAAC,EAAE,EAAE;QACrC,OAAO;QACP,MAAM;QACN,SAAS;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F,kBAAe,OAAO,CAAC","sourcesContent":["import {useUniqId} from '@gravity-ui/uikit';\n\nimport {Buttons, ContentList, Links, Title, YFMWrapper} from '../../components';\nimport ContentLabels from '../../components/ContentLabels/ContentLabels';\nimport {Col} from '../../grid';\nimport {\n ClassNameProps,\n ContentBlockProps,\n ContentSize,\n TextSize,\n TitleItemProps,\n} from '../../models';\nimport {QAProps} from '../../models/common';\nimport {block} from '../../utils';\nimport {getQaAttrubutes} from '../../utils/blocks';\n\nimport './Content.scss';\n\nconst b = block('content');\n\nfunction getTextSize(size: ContentSize): TextSize {\n switch (size) {\n case 's':\n return 's';\n case 'm':\n return 'sm';\n case 'l':\n default:\n return 'm';\n }\n}\n\nexport type ContentProps = ContentBlockProps & ClassNameProps & QAProps;\n\nconst Content = (props: ContentProps) => {\n const {\n title,\n titleId: titleIdFromProps,\n text,\n textId,\n additionalInfo,\n size = 'l',\n links,\n buttons,\n colSizes = {all: 12, sm: 8},\n centered,\n theme,\n className,\n list,\n labels,\n qa,\n controlPosition,\n } = props;\n const qaAttributes = getQaAttrubutes(qa, [\n 'links',\n 'link',\n 'buttons',\n 'button',\n 'list',\n 'labels',\n ]);\n\n const titleProps =\n !title || typeof title === 'string'\n ? ({text: title, textSize: getTextSize(size)} as TitleItemProps)\n : title;\n\n const hasTitle = Boolean(title);\n const defaultTitleId = useUniqId();\n const titleId = titleIdFromProps || defaultTitleId;\n\n return (\n <Col\n className={b({size, centered, theme, 'control-position': controlPosition}, className)}\n reset\n sizes={colSizes}\n qa={qaAttributes.container}\n >\n {title && (\n <Title\n className={b('title')}\n title={titleProps}\n colSizes={{all: 12}}\n id={titleId}\n />\n )}\n {text && (\n <div className={b('text', {['without-title']: !hasTitle})}>\n <YFMWrapper\n content={text}\n modifiers={{constructor: true, [`constructor-size-${size}`]: true}}\n id={textId}\n qa={qaAttributes.list}\n />\n </div>\n )}\n {labels?.length ? (\n <div className={b('labels')}>\n <ContentLabels\n labels={labels}\n theme={theme}\n size={size}\n qa={qaAttributes.labels}\n />\n </div>\n ) : null}\n {list?.length ? (\n <div className={b('list')}>\n <ContentList list={list} size={size} qa={qaAttributes.list} theme={theme} />\n </div>\n ) : null}\n {additionalInfo && (\n <div className={b('notice')}>\n <YFMWrapper\n content={additionalInfo}\n modifiers={{\n constructor: true,\n 'constructor-notice': true,\n [`constructor-size-${size}`]: true,\n }}\n />\n </div>\n )}\n {links && (\n <Links\n className={b('links', {size})}\n size={size}\n links={links}\n titleId={titleId}\n qa={qaAttributes.links}\n linkQa={qaAttributes.link}\n />\n )}\n {buttons && (\n <Buttons\n className={b('buttons', {size})}\n size={size}\n buttons={buttons}\n titleId={titleId}\n qa={qaAttributes.buttons}\n buttonQa={qaAttributes.button}\n />\n )}\n </Col>\n );\n};\n\nexport default Content;\n"]}
@@ -1,6 +1,8 @@
1
1
  export declare const ContentItem: {
2
2
  additionalProperties: boolean;
3
- required: string[];
3
+ oneOf: {
4
+ required: string[];
5
+ }[];
4
6
  properties: {
5
7
  title: {
6
8
  type: string;
@@ -80,6 +82,84 @@ export declare const ContentItem: {
80
82
  };
81
83
  };
82
84
  };
85
+ export declare const ContentLabel: {
86
+ additionalProperties: boolean;
87
+ required: string[];
88
+ properties: {
89
+ text: {
90
+ type: string;
91
+ contentType: string;
92
+ };
93
+ icon: {
94
+ oneOf: (({
95
+ oneOf: ({
96
+ type: string;
97
+ properties: {
98
+ when: {
99
+ type: string;
100
+ };
101
+ };
102
+ } | {
103
+ type: string;
104
+ pattern: string;
105
+ optionName: string;
106
+ items?: undefined;
107
+ } | {
108
+ type: string;
109
+ items: {
110
+ type: string;
111
+ properties: {
112
+ when: {
113
+ type: string;
114
+ };
115
+ };
116
+ };
117
+ optionName: string;
118
+ pattern?: undefined;
119
+ })[];
120
+ } & {
121
+ optionName: string;
122
+ }) | {
123
+ type: string;
124
+ additionalProperties: boolean;
125
+ required: import("../../index.js").Theme[];
126
+ properties: {};
127
+ optionName: string;
128
+ })[];
129
+ };
130
+ gravityIcon: {
131
+ oneOf: (({
132
+ oneOf: ({
133
+ type: string;
134
+ additionalProperties?: undefined;
135
+ required?: undefined;
136
+ properties?: undefined;
137
+ } | {
138
+ type: string;
139
+ additionalProperties: boolean;
140
+ required: string[];
141
+ properties: {
142
+ name: {
143
+ type: string;
144
+ };
145
+ color: {
146
+ type: string;
147
+ enum: string[];
148
+ };
149
+ };
150
+ })[];
151
+ } & {
152
+ optionName: string;
153
+ }) | {
154
+ type: string;
155
+ additionalProperties: boolean;
156
+ required: import("../../index.js").Theme[];
157
+ properties: {};
158
+ optionName: string;
159
+ })[];
160
+ };
161
+ };
162
+ };
83
163
  export declare const ContentBase: {
84
164
  title: {
85
165
  oneOf: ({
@@ -163,6 +243,17 @@ export declare const ContentBase: {
163
243
  };
164
244
  };
165
245
  };
246
+ labels: {
247
+ type: string;
248
+ items: {
249
+ type: string;
250
+ properties: {
251
+ when: {
252
+ type: string;
253
+ };
254
+ };
255
+ };
256
+ };
166
257
  controlPosition: {
167
258
  type: string;
168
259
  enum: string[];
@@ -258,6 +349,17 @@ export declare const ContentBlock: {
258
349
  };
259
350
  };
260
351
  };
352
+ labels: {
353
+ type: string;
354
+ items: {
355
+ type: string;
356
+ properties: {
357
+ when: {
358
+ type: string;
359
+ };
360
+ };
361
+ };
362
+ };
261
363
  controlPosition: {
262
364
  type: string;
263
365
  enum: string[];
@@ -1,12 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContentBlock = exports.ContentBase = exports.ContentItem = void 0;
3
+ exports.ContentBlock = exports.ContentBase = exports.ContentLabel = exports.ContentItem = void 0;
4
4
  const schema_1 = require("../../components/Image/schema.js");
5
5
  const common_1 = require("../../schema/validators/common.js");
6
6
  const utils_1 = require("../../schema/validators/utils.js");
7
7
  exports.ContentItem = {
8
8
  additionalProperties: false,
9
- required: ['icon'],
9
+ oneOf: [
10
+ {
11
+ required: ['icon'],
12
+ },
13
+ {
14
+ required: ['gravityIcon'],
15
+ },
16
+ ],
10
17
  properties: {
11
18
  title: {
12
19
  type: 'string',
@@ -20,6 +27,18 @@ exports.ContentItem = {
20
27
  gravityIcon: (0, common_1.withTheme)(common_1.GravityIconProps),
21
28
  },
22
29
  };
30
+ exports.ContentLabel = {
31
+ additionalProperties: false,
32
+ required: ['text'],
33
+ properties: {
34
+ text: {
35
+ type: 'string',
36
+ contentType: 'text',
37
+ },
38
+ icon: (0, common_1.withTheme)(schema_1.ImageProps),
39
+ gravityIcon: (0, common_1.withTheme)(common_1.GravityIconProps),
40
+ },
41
+ };
23
42
  exports.ContentBase = {
24
43
  title: {
25
44
  oneOf: [
@@ -54,6 +73,7 @@ exports.ContentBase = {
54
73
  enum: common_1.contentThemes,
55
74
  },
56
75
  list: (0, utils_1.filteredArray)(exports.ContentItem),
76
+ labels: (0, utils_1.filteredArray)(exports.ContentLabel),
57
77
  controlPosition: {
58
78
  type: 'string',
59
79
  enum: ['default', 'bottom'],
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["sub-blocks/Content/schema.ts"],"names":[],"mappings":";;;AAAA,6DAAyD;AACzD,8DAUwC;AACxC,4DAA4D;AAE/C,QAAA,WAAW,GAAG;IACvB,oBAAoB,EAAE,KAAK;IAC3B,QAAQ,EAAE,CAAC,MAAM,CAAC;IAClB,UAAU,EAAE;QACR,KAAK,EAAE;YACH,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,MAAM;SACtB;QACD,IAAI,EAAE;YACF,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,KAAK;SACrB;QACD,IAAI,EAAE,IAAA,kBAAS,EAAC,mBAAU,CAAC;QAC3B,WAAW,EAAE,IAAA,kBAAS,EAAC,yBAAgB,CAAC;KAC3C;CACJ,CAAC;AAEW,QAAA,WAAW,GAAG;IACvB,KAAK,EAAE;QACH,KAAK,EAAE;YACH;gBACI,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,MAAM;gBACnB,UAAU,EAAE,MAAM;aACrB;YACD;gBACI,GAAG,mBAAU;gBACb,UAAU,EAAE,SAAS;aACxB;SACJ;KACJ;IACD,IAAI,EAAE;QACF,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,UAAU;KACxB;IACD,cAAc,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,KAAK;KACrB;IACD,IAAI,EAAE;QACF,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,qBAAY;KACrB;IACD,KAAK,EAAE,IAAA,qBAAa,EAAC,kBAAS,CAAC;IAC/B,OAAO,EAAE,IAAA,qBAAa,EAAC,oBAAW,CAAC;IACnC,KAAK,EAAE;QACH,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,sBAAa;KACtB;IACD,IAAI,EAAE,IAAA,qBAAa,EAAC,mBAAW,CAAC;IAChC,eAAe,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;KAC9B;CACJ,CAAC;AAEW,QAAA,YAAY,GAAG;IACxB,OAAO,EAAE;QACL,oBAAoB,EAAE,KAAK;QAC3B,UAAU,EAAE;YACR,GAAG,mBAAW;YACd,QAAQ,EAAE,4BAAmB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,mBAAU,EAAC,CAAC,EAAE,EAAE,CAAC;YACvF,QAAQ,EAAE;gBACN,IAAI,EAAE,SAAS;aAClB;SACJ;KACJ;CACJ,CAAC","sourcesContent":["import {ImageProps} from '../../components/Image/schema';\nimport {\n ButtonBlock,\n GravityIconProps,\n LinkProps,\n TitleProps,\n containerSizesArray,\n contentSizes,\n contentThemes,\n sizeNumber,\n withTheme,\n} from '../../schema/validators/common';\nimport {filteredArray} from '../../schema/validators/utils';\n\nexport const ContentItem = {\n additionalProperties: false,\n required: ['icon'],\n properties: {\n title: {\n type: 'string',\n contentType: 'text',\n },\n text: {\n type: 'string',\n contentType: 'yfm',\n },\n icon: withTheme(ImageProps),\n gravityIcon: withTheme(GravityIconProps),\n },\n};\n\nexport const ContentBase = {\n title: {\n oneOf: [\n {\n type: 'string',\n contentType: 'text',\n optionName: 'text',\n },\n {\n ...TitleProps,\n optionName: 'options',\n },\n ],\n },\n text: {\n type: 'string',\n contentType: 'yfm',\n inputType: 'textarea',\n },\n additionalInfo: {\n type: 'string',\n contentType: 'yfm',\n },\n size: {\n type: 'string',\n enum: contentSizes,\n },\n links: filteredArray(LinkProps),\n buttons: filteredArray(ButtonBlock),\n theme: {\n type: 'string',\n enum: contentThemes,\n },\n list: filteredArray(ContentItem),\n controlPosition: {\n type: 'string',\n enum: ['default', 'bottom'],\n },\n};\n\nexport const ContentBlock = {\n content: {\n additionalProperties: false,\n properties: {\n ...ContentBase,\n colSizes: containerSizesArray.reduce((acc, size) => ({...acc, [size]: sizeNumber}), {}),\n centered: {\n type: 'boolean',\n },\n },\n },\n};\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["sub-blocks/Content/schema.ts"],"names":[],"mappings":";;;AAAA,6DAAyD;AACzD,8DAUwC;AACxC,4DAA4D;AAE/C,QAAA,WAAW,GAAG;IACvB,oBAAoB,EAAE,KAAK;IAC3B,KAAK,EAAE;QACH;YACI,QAAQ,EAAE,CAAC,MAAM,CAAC;SACrB;QACD;YACI,QAAQ,EAAE,CAAC,aAAa,CAAC;SAC5B;KACJ;IACD,UAAU,EAAE;QACR,KAAK,EAAE;YACH,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,MAAM;SACtB;QACD,IAAI,EAAE;YACF,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,KAAK;SACrB;QACD,IAAI,EAAE,IAAA,kBAAS,EAAC,mBAAU,CAAC;QAC3B,WAAW,EAAE,IAAA,kBAAS,EAAC,yBAAgB,CAAC;KAC3C;CACJ,CAAC;AAEW,QAAA,YAAY,GAA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AmB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,mBAAU,EAAC,CAAC,EAAE,EAAE,CAAC;YACvF,QAAQ,EAAE;gBACN,IAAI,EAAE,SAAS;aAClB;SACJ;KACJ;CACJ,CAAC","sourcesContent":["import {ImageProps} from '../../components/Image/schema';\nimport {\n ButtonBlock,\n GravityIconProps,\n LinkProps,\n TitleProps,\n containerSizesArray,\n contentSizes,\n contentThemes,\n sizeNumber,\n withTheme,\n} from '../../schema/validators/common';\nimport {filteredArray} from '../../schema/validators/utils';\n\nexport const ContentItem = {\n additionalProperties: false,\n oneOf: [\n {\n required: ['icon'],\n },\n {\n required: ['gravityIcon'],\n },\n ],\n properties: {\n title: {\n type: 'string',\n contentType: 'text',\n },\n text: {\n type: 'string',\n contentType: 'yfm',\n },\n icon: withTheme(ImageProps),\n gravityIcon: withTheme(GravityIconProps),\n },\n};\n\nexport const ContentLabel = {\n additionalProperties: false,\n required: ['text'],\n properties: {\n text: {\n type: 'string',\n contentType: 'text',\n },\n icon: withTheme(ImageProps),\n gravityIcon: withTheme(GravityIconProps),\n },\n};\n\nexport const ContentBase = {\n title: {\n oneOf: [\n {\n type: 'string',\n contentType: 'text',\n optionName: 'text',\n },\n {\n ...TitleProps,\n optionName: 'options',\n },\n ],\n },\n text: {\n type: 'string',\n contentType: 'yfm',\n inputType: 'textarea',\n },\n additionalInfo: {\n type: 'string',\n contentType: 'yfm',\n },\n size: {\n type: 'string',\n enum: contentSizes,\n },\n links: filteredArray(LinkProps),\n buttons: filteredArray(ButtonBlock),\n theme: {\n type: 'string',\n enum: contentThemes,\n },\n list: filteredArray(ContentItem),\n labels: filteredArray(ContentLabel),\n controlPosition: {\n type: 'string',\n enum: ['default', 'bottom'],\n },\n};\n\nexport const ContentBlock = {\n content: {\n additionalProperties: false,\n properties: {\n ...ContentBase,\n colSizes: containerSizesArray.reduce((acc, size) => ({...acc, [size]: sizeNumber}), {}),\n centered: {\n type: 'boolean',\n },\n },\n },\n};\n"]}
@@ -129,6 +129,17 @@ export declare const ImageCard: {
129
129
  };
130
130
  };
131
131
  } | undefined;
132
+ labels?: {
133
+ type: string;
134
+ items: {
135
+ type: string;
136
+ properties: {
137
+ when: {
138
+ type: string;
139
+ };
140
+ };
141
+ };
142
+ } | undefined;
132
143
  controlPosition: {
133
144
  type: string;
134
145
  enum: string[];
@@ -394,6 +394,17 @@ export declare const LayoutItem: {
394
394
  };
395
395
  };
396
396
  };
397
+ labels: {
398
+ type: string;
399
+ items: {
400
+ type: string;
401
+ properties: {
402
+ when: {
403
+ type: string;
404
+ };
405
+ };
406
+ };
407
+ };
397
408
  controlPosition: {
398
409
  type: string;
399
410
  enum: string[];
@@ -0,0 +1,7 @@
1
+ import { Device } from "../models/index.js";
2
+ export interface ValueWithDevice<T> extends Partial<Record<Device, T>> {
3
+ [Device.Desktop]: T;
4
+ [Device.Mobile]: T;
5
+ }
6
+ export type DeviceSupporting<T> = T | ValueWithDevice<T>;
7
+ export declare function isDeviceValue<T>(value: DeviceSupporting<T>): value is ValueWithDevice<T>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDeviceValue = isDeviceValue;
4
+ const models_1 = require("../models/index.js");
5
+ function isDeviceValue(value) {
6
+ return (typeof value === 'object' &&
7
+ value !== null &&
8
+ !Array.isArray(value) &&
9
+ models_1.Device.Desktop in value &&
10
+ models_1.Device.Mobile in value);
11
+ }
12
+ //# sourceMappingURL=breakpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoint.js","sourceRoot":"../../../src","sources":["utils/breakpoint.ts"],"names":[],"mappings":";;AASA,sCAQC;AAjBD,+CAAiC;AASjC,SAAgB,aAAa,CAAI,KAA0B;IACvD,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrB,eAAM,CAAC,OAAO,IAAI,KAAK;QACvB,eAAM,CAAC,MAAM,IAAI,KAAK,CACzB,CAAC;AACN,CAAC","sourcesContent":["import {Device} from '../models';\n\nexport interface ValueWithDevice<T> extends Partial<Record<Device, T>> {\n [Device.Desktop]: T;\n [Device.Mobile]: T;\n}\n\nexport type DeviceSupporting<T> = T | ValueWithDevice<T>;\n\nexport function isDeviceValue<T>(value: DeviceSupporting<T>): value is ValueWithDevice<T> {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n Device.Desktop in value &&\n Device.Mobile in value\n );\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  export * from "./common.js";
2
2
  export * from "./analytics.js";
3
+ export * from "./breakpoint.js";
3
4
  export * from "./blocks.js";
4
5
  export * from "./url.js";
5
6
  export * from "./cn.js";
@@ -4,6 +4,7 @@ exports.isHubspotEventData = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  tslib_1.__exportStar(require("./common.js"), exports);
6
6
  tslib_1.__exportStar(require("./analytics.js"), exports);
7
+ tslib_1.__exportStar(require("./breakpoint.js"), exports);
7
8
  tslib_1.__exportStar(require("./blocks.js"), exports);
8
9
  tslib_1.__exportStar(require("./url.js"), exports);
9
10
  tslib_1.__exportStar(require("./cn.js"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../../../src","sources":["utils/index.ts"],"names":[],"mappings":";;;;AAAA,sDAAyB;AACzB,yDAA4B;AAC5B,sDAAyB;AACzB,mDAAsB;AACtB,kDAAqB;AACrB,mDAAsB;AACtB,qDAAwB;AACxB,qDAAwB;AAGxB,wCAA6C;AAArC,6GAAA,kBAAkB,OAAA","sourcesContent":["export * from './common';\nexport * from './analytics';\nexport * from './blocks';\nexport * from './url';\nexport * from './cn';\nexport * from './url';\nexport * from './theme';\nexport * from './icons';\n\nexport type {HubspotEventData, HubspotEventHandlers, HubspotEventName} from './hubspot';\nexport {isHubspotEventData} from './hubspot';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../../../src","sources":["utils/index.ts"],"names":[],"mappings":";;;;AAAA,sDAAyB;AACzB,yDAA4B;AAC5B,0DAA6B;AAC7B,sDAAyB;AACzB,mDAAsB;AACtB,kDAAqB;AACrB,mDAAsB;AACtB,qDAAwB;AACxB,qDAAwB;AAGxB,wCAA6C;AAArC,6GAAA,kBAAkB,OAAA","sourcesContent":["export * from './common';\nexport * from './analytics';\nexport * from './breakpoint';\nexport * from './blocks';\nexport * from './url';\nexport * from './cn';\nexport * from './url';\nexport * from './theme';\nexport * from './icons';\n\nexport type {HubspotEventData, HubspotEventHandlers, HubspotEventName} from './hubspot';\nexport {isHubspotEventData} from './hubspot';\n"]}
@@ -225,6 +225,17 @@ export declare const ContentLayoutBlock: {
225
225
  };
226
226
  };
227
227
  };
228
+ labels: {
229
+ type: string;
230
+ items: {
231
+ type: string;
232
+ properties: {
233
+ when: {
234
+ type: string;
235
+ };
236
+ };
237
+ };
238
+ };
228
239
  controlPosition: {
229
240
  type: string;
230
241
  enum: string[];
@@ -51,6 +51,17 @@ export declare const FoldableListBlock: {
51
51
  contentType: string;
52
52
  inputType: string;
53
53
  };
54
+ labels: {
55
+ type: string;
56
+ items: {
57
+ type: string;
58
+ properties: {
59
+ when: {
60
+ type: string;
61
+ };
62
+ };
63
+ };
64
+ };
54
65
  additionalInfo: {
55
66
  type: string;
56
67
  contentType: string;
@@ -69,7 +69,7 @@ unpredictable css rules order in build */
69
69
  width: fit-content;
70
70
  }
71
71
  }
72
- @media (max-width: 1081px) and (min-width: 769px) {
72
+ @media (max-width: 1080px) and (min-width: 769px) {
73
73
  .pc-form-block__row {
74
74
  flex-direction: column;
75
75
  }
@@ -94,11 +94,14 @@ unpredictable css rules order in build */
94
94
  text-align: center;
95
95
  padding-bottom: 32px;
96
96
  }
97
+ .pc-form-block_with-background .pc-form-block__row .pc-form-block__content-wrapper .pc-content-labels, .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__content-wrapper .pc-content-labels {
98
+ justify-content: center;
99
+ }
97
100
  .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__content-wrapper {
98
101
  padding: 0 0 32px 0;
99
102
  }
100
103
  }
101
- @media (max-width: 769px) {
104
+ @media (max-width: 768px) {
102
105
  .pc-form-block__full-form {
103
106
  padding: 32px;
104
107
  }
@@ -5,26 +5,29 @@ import InnerForm from "../../components/InnerForm/InnerForm.js";
5
5
  import { MobileContext } from "../../context/mobileContext/index.js";
6
6
  import { useTheme } from "../../context/theme/index.js";
7
7
  import { Col, Grid, GridAlignItems, GridColumnSize, Row } from "../../grid/index.js";
8
+ import { useDeviceValue } from "../../hooks/useDeviceValue.js";
8
9
  import { FormBlockDataTypes, FormBlockDirection, isHubspotDataForm, isYandexDataForm, } from "../../models/index.js";
9
10
  import { Content } from "../../sub-blocks/index.js";
10
11
  import { block, getThemedValue } from "../../utils/index.js";
12
+ import { hasBackgroundCSS } from "./utils.js";
11
13
  import './Form.css';
12
14
  const b = block('form-block');
13
15
  const colSizes = { [GridColumnSize.Lg]: 6, [GridColumnSize.All]: 12 };
14
16
  const Form = (props) => {
15
- const { formData, title, textContent, direction = FormBlockDirection.Center, background } = props;
17
+ const { formData, title, textContent, direction = FormBlockDirection.Center, background, customFormNode, } = props;
16
18
  const [contentLoaded, setContentLoaded] = React.useState(false);
17
19
  const isMobile = React.useContext(MobileContext);
18
20
  const theme = useTheme();
19
21
  const themedBackground = getThemedValue(background, theme) || undefined;
22
+ const themedBackgroundStyle = useDeviceValue(themedBackground?.style) || undefined;
20
23
  const withBackground = Boolean(themedBackground &&
21
24
  (themedBackground.src ||
22
25
  themedBackground.desktop ||
23
- themedBackground.style?.backgroundColor));
26
+ hasBackgroundCSS(themedBackgroundStyle ?? {})));
24
27
  const onContentLoad = React.useCallback(() => {
25
28
  setContentLoaded(true);
26
29
  }, []);
27
- if (!formData) {
30
+ if (!formData && !customFormNode) {
28
31
  return null;
29
32
  }
30
33
  let formType;
@@ -37,16 +40,16 @@ const Form = (props) => {
37
40
  return (_jsxs("div", { className: b({
38
41
  'with-background': withBackground,
39
42
  'form-type': formType,
40
- }), children: [themedBackground && (_jsx(BackgroundImage, { ...themedBackground, className: b('media'), imageClassName: b('image') })), _jsx(Grid, { children: _jsxs(Row, { alignItems: direction === FormBlockDirection.Center
43
+ }), children: [themedBackground && (_jsx(BackgroundImage, { ...themedBackground, style: themedBackgroundStyle, className: b('media'), imageClassName: b('image') })), _jsx(Grid, { children: _jsxs(Row, { alignItems: direction === FormBlockDirection.Center
41
44
  ? GridAlignItems.Center
42
45
  : GridAlignItems.Start, className: b('row', {
43
46
  direction,
44
- }), children: [_jsx(Col, { sizes: colSizes, className: b('content-col'), children: textContent && (_jsx("div", { className: b('content-wrapper'), children: _jsx(Content, { theme: "default", ...textContent, centered: direction === FormBlockDirection.Center, colSizes: { all: 12 }, className: b('content') }) })) }), _jsx(Col, { sizes: colSizes, className: b('form-col'), children: _jsx("div", { className: b('form-wrapper'), children: _jsxs("div", { className: b('full-form', {
47
+ }), children: [_jsx(Col, { sizes: colSizes, className: b('content-col'), children: textContent && (_jsx("div", { className: b('content-wrapper'), children: _jsx(Content, { theme: "default", ...textContent, centered: direction === FormBlockDirection.Center, colSizes: { all: 12 }, className: b('content') }) })) }), _jsx(Col, { sizes: colSizes, className: b('form-col'), children: _jsx("div", { className: b('form-wrapper'), children: _jsx("div", { className: b('full-form', {
45
48
  hidden: !contentLoaded,
46
- }), children: [title && (_jsx(Title, { title: {
47
- text: title,
48
- textSize: 's',
49
- }, className: b('title', { mobile: isMobile }), colSizes: { all: 12 } })), _jsx(InnerForm, { className: b('form'), formData: formData, onContentLoad: onContentLoad })] }) }) })] }) })] }));
49
+ }), children: customFormNode || (_jsxs(React.Fragment, { children: [title && (_jsx(Title, { title: {
50
+ text: title,
51
+ textSize: 's',
52
+ }, className: b('title', { mobile: isMobile }), colSizes: { all: 12 } })), _jsx(InnerForm, { className: b('form'), formData: formData, onContentLoad: onContentLoad })] })) }) }) })] }) })] }));
50
53
  };
51
54
  export default Form;
52
55
  //# sourceMappingURL=Form.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","sourceRoot":"../../../../src","sources":["blocks/Form/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,eAAe,EAAE,KAAK,EAAC,kCAAyB;AACxD,OAAO,SAAS,gDAA6C;AAC7D,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,EAAC,4BAAmB;AAE1E,OAAO,EACH,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACnB,8BAAqB;AACtB,OAAO,EAAC,OAAO,EAAC,kCAAyB;AACzC,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,6BAAoB;AAElD,OAAO,YAAY,CAAC;AAEpB,MAAM,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;AAE9B,MAAM,QAAQ,GAAG,EAAC,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,EAAC,CAAC;AAEpE,MAAM,IAAI,GAAG,CAAC,KAAqB,EAAE,EAAE;IACnC,MAAM,EAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,GAAG,kBAAkB,CAAC,MAAM,EAAE,UAAU,EAAC,GAAG,KAAK,CAAC;IAChG,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjD,MAAM,KA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AK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,aAAa,CAAC,YAC5C,WAAW,IAAI,CACZ,cAAK,SAAS,EAAE,CAAC,CAAC,iBAAiB,CAAC,YAChC,KAAC,OAAO,IACJ,KAAK,EAAC,SAAS,KACX,WAAW,EACf,QAAQ,EAAE,SAAS,KAAK,kBAAkB,CAAC,MAAM,EACjD,QAAQ,EAAE,EAAC,GAAG,EAAE,EAAE,EAAC,EACnB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,GACzB,GACA,CACT,GACC,EACN,KAAC,GAAG,IAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,YAC1C,cAAK,SAAS,EAAE,CAAC,CAAC,cAAc,CAAC,YAC7B,eACI,SAAS,EAAE,CAAC,CAAC,WAAW,EAAE;wCACtB,MAAM,EAAE,CAAC,aAAa;qCACzB,CAAC,aAED,KAAK,IAAI,CACN,KAAC,KAAK,IACF,KAAK,EAAE;gDACH,IAAI,EAAE,KAAK;gDACX,QAAQ,EAAE,GAAG;6CAChB,EACD,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,CAAC,EACzC,QAAQ,EAAE,EAAC,GAAG,EAAE,EAAE,EAAC,GACrB,CACL,EACD,KAAC,SAAS,IACN,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EACpB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,GAC9B,IACA,GACJ,GACJ,IACJ,GACH,IACL,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BackgroundImage, Title} from '../../components';\nimport InnerForm from '../../components/InnerForm/InnerForm';\nimport {MobileContext} from '../../context/mobileContext';\nimport {useTheme} from '../../context/theme';\nimport {Col, Grid, GridAlignItems, GridColumnSize, Row} from '../../grid';\nimport type {FormBlockProps} from '../../models';\nimport {\n FormBlockDataTypes,\n FormBlockDirection,\n isHubspotDataForm,\n isYandexDataForm,\n} from '../../models';\nimport {Content} from '../../sub-blocks';\nimport {block, getThemedValue} from '../../utils';\n\nimport './Form.scss';\n\nconst b = block('form-block');\n\nconst colSizes = {[GridColumnSize.Lg]: 6, [GridColumnSize.All]: 12};\n\nconst Form = (props: FormBlockProps) => {\n const {formData, title, textContent, direction = FormBlockDirection.Center, background} = props;\n const [contentLoaded, setContentLoaded] = React.useState(false);\n const isMobile = React.useContext(MobileContext);\n const theme = useTheme();\n\n const themedBackground = getThemedValue(background, theme) || undefined;\n\n const withBackground = Boolean(\n themedBackground &&\n (themedBackground.src ||\n themedBackground.desktop ||\n themedBackground.style?.backgroundColor),\n );\n const onContentLoad = React.useCallback(() => {\n setContentLoaded(true);\n }, []);\n\n if (!formData) {\n return null;\n }\n\n let formType;\n\n if (isYandexDataForm(formData)) {\n formType = FormBlockDataTypes.YANDEX;\n } else if (isHubspotDataForm(formData)) {\n formType = FormBlockDataTypes.HUBSPOT;\n }\n\n return (\n <div\n className={b({\n 'with-background': withBackground,\n 'form-type': formType,\n })}\n >\n {themedBackground && (\n <BackgroundImage\n {...themedBackground}\n className={b('media')}\n imageClassName={b('image')}\n />\n )}\n <Grid>\n <Row\n alignItems={\n direction === FormBlockDirection.Center\n ? GridAlignItems.Center\n : GridAlignItems.Start\n }\n className={b('row', {\n direction,\n })}\n >\n <Col sizes={colSizes} className={b('content-col')}>\n {textContent && (\n <div className={b('content-wrapper')}>\n <Content\n theme=\"default\"\n {...textContent}\n centered={direction === FormBlockDirection.Center}\n colSizes={{all: 12}}\n className={b('content')}\n />\n </div>\n )}\n </Col>\n <Col sizes={colSizes} className={b('form-col')}>\n <div className={b('form-wrapper')}>\n <div\n className={b('full-form', {\n hidden: !contentLoaded,\n })}\n >\n {title && (\n <Title\n title={{\n text: title,\n textSize: 's',\n }}\n className={b('title', {mobile: isMobile})}\n colSizes={{all: 12}}\n />\n )}\n <InnerForm\n className={b('form')}\n formData={formData}\n onContentLoad={onContentLoad}\n />\n </div>\n </div>\n </Col>\n </Row>\n </Grid>\n </div>\n );\n};\n\nexport default Form;\n"]}
1
+ {"version":3,"file":"Form.js","sourceRoot":"../../../../src","sources":["blocks/Form/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,eAAe,EAAE,KAAK,EAAC,kCAAyB;AACxD,OAAO,SAAS,gDAA6C;AAC7D,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,EAAC,4BAAmB;AAC1E,OAAO,EAAC,cAAc,EAAC,sCAAmC;AAE1D,OAAO,EACH,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACnB,8BAAqB;AACtB,OAAO,EAAC,OAAO,EAAC,kCAAyB;AACzC,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,6BAAoB;AAElD,OAAO,EAAC,gBAAgB,EAAC,mBAAgB;AAEzC,OAAO,YAAY,CAAC;AAEpB,MAAM,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;AAE9B,MAAM,QAAQ,GAAG,EAAC,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,EAAC,CAAC;AAEpE,MAAM,IAAI,GAAG,CAAC,KAAqB,EAAE,EAAE;IACnC,MAAM,EACF,QAAQ,EACR,KAAK,EACL,WAAW,EACX,SAAS,GAAG,kBAAkB,CAAC,MAAM,EACrC,UAAU,EACV,cAAc,GACjB,GAAG,KAAK,CAAC;IACV,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChE,MAAM,QAAQ,GAAG,KAAK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AC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BackgroundImage, Title} from '../../components';\nimport InnerForm from '../../components/InnerForm/InnerForm';\nimport {MobileContext} from '../../context/mobileContext';\nimport {useTheme} from '../../context/theme';\nimport {Col, Grid, GridAlignItems, GridColumnSize, Row} from '../../grid';\nimport {useDeviceValue} from '../../hooks/useDeviceValue';\nimport type {FormBlockProps} from '../../models';\nimport {\n FormBlockDataTypes,\n FormBlockDirection,\n isHubspotDataForm,\n isYandexDataForm,\n} from '../../models';\nimport {Content} from '../../sub-blocks';\nimport {block, getThemedValue} from '../../utils';\n\nimport {hasBackgroundCSS} from './utils';\n\nimport './Form.scss';\n\nconst b = block('form-block');\n\nconst colSizes = {[GridColumnSize.Lg]: 6, [GridColumnSize.All]: 12};\n\nconst Form = (props: FormBlockProps) => {\n const {\n formData,\n title,\n textContent,\n direction = FormBlockDirection.Center,\n background,\n customFormNode,\n } = props;\n const [contentLoaded, setContentLoaded] = React.useState(false);\n const isMobile = React.useContext(MobileContext);\n const theme = useTheme();\n\n const themedBackground = getThemedValue(background, theme) || undefined;\n const themedBackgroundStyle = useDeviceValue(themedBackground?.style) || undefined;\n\n const withBackground = Boolean(\n themedBackground &&\n (themedBackground.src ||\n themedBackground.desktop ||\n hasBackgroundCSS(themedBackgroundStyle ?? {})),\n );\n\n const onContentLoad = React.useCallback(() => {\n setContentLoaded(true);\n }, []);\n\n if (!formData && !customFormNode) {\n return null;\n }\n\n let formType;\n\n if (isYandexDataForm(formData)) {\n formType = FormBlockDataTypes.YANDEX;\n } else if (isHubspotDataForm(formData)) {\n formType = FormBlockDataTypes.HUBSPOT;\n }\n\n return (\n <div\n className={b({\n 'with-background': withBackground,\n 'form-type': formType,\n })}\n >\n {themedBackground && (\n <BackgroundImage\n {...themedBackground}\n style={themedBackgroundStyle}\n className={b('media')}\n imageClassName={b('image')}\n />\n )}\n <Grid>\n <Row\n alignItems={\n direction === FormBlockDirection.Center\n ? GridAlignItems.Center\n : GridAlignItems.Start\n }\n className={b('row', {\n direction,\n })}\n >\n <Col sizes={colSizes} className={b('content-col')}>\n {textContent && (\n <div className={b('content-wrapper')}>\n <Content\n theme=\"default\"\n {...textContent}\n centered={direction === FormBlockDirection.Center}\n colSizes={{all: 12}}\n className={b('content')}\n />\n </div>\n )}\n </Col>\n <Col sizes={colSizes} className={b('form-col')}>\n <div className={b('form-wrapper')}>\n <div\n className={b('full-form', {\n hidden: !contentLoaded,\n })}\n >\n {customFormNode || (\n <React.Fragment>\n {title && (\n <Title\n title={{\n text: title,\n textSize: 's',\n }}\n className={b('title', {mobile: isMobile})}\n colSizes={{all: 12}}\n />\n )}\n <InnerForm\n className={b('form')}\n formData={formData}\n onContentLoad={onContentLoad}\n />\n </React.Fragment>\n )}\n </div>\n </div>\n </Col>\n </Row>\n </Grid>\n </div>\n );\n};\n\nexport default Form;\n"]}