@gravity-ui/page-constructor 8.14.2 → 8.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -9
- package/build/cjs/components/ReactPlayer/ReactPlayer.css +0 -50
- package/build/cjs/components/ReactPlayer/ReactPlayer.js +4 -16
- package/build/cjs/components/ReactPlayer/ReactPlayer.js.map +1 -1
- package/build/cjs/components/VideoBlock/VideoBlock.css +0 -30
- package/build/cjs/components/VideoBlock/VideoBlock.d.ts +2 -1
- package/build/cjs/components/VideoBlock/VideoBlock.js +18 -2
- package/build/cjs/components/VideoBlock/VideoBlock.js.map +1 -1
- package/build/cjs/components/VideoButton/VideoButton.css +64 -0
- package/build/cjs/components/VideoButton/VideoButton.d.ts +9 -0
- package/build/cjs/components/VideoButton/VideoButton.js +50 -0
- package/build/cjs/components/VideoButton/VideoButton.js.map +1 -0
- package/build/cjs/context/projectSettingsContext/ProjectSettingsContext.d.ts +7 -0
- package/build/cjs/context/projectSettingsContext/ProjectSettingsContext.js.map +1 -1
- package/build/cjs/models/constructor-items/common.d.ts +8 -1
- package/build/cjs/models/constructor-items/common.js +1 -0
- package/build/cjs/models/constructor-items/common.js.map +1 -1
- package/build/docs/INDEX.md +191 -0
- package/build/docs/blocks/Banner.md +59 -0
- package/build/docs/blocks/CardLayout.md +79 -0
- package/build/docs/blocks/Companies.md +67 -0
- package/build/docs/blocks/ContentLayout.md +54 -0
- package/build/docs/blocks/ExtendedFeatures.md +74 -0
- package/build/docs/blocks/FilterBlock.md +112 -0
- package/build/docs/blocks/FoldableList.md +78 -0
- package/build/docs/blocks/Footer.md +110 -0
- package/build/docs/blocks/Form.md +89 -0
- package/build/docs/blocks/Header.md +70 -0
- package/build/docs/blocks/HeaderSlider.md +70 -0
- package/build/docs/blocks/Hero.md +67 -0
- package/build/docs/blocks/Icons.md +61 -0
- package/build/docs/blocks/Info.md +73 -0
- package/build/docs/blocks/Map.md +81 -0
- package/build/docs/blocks/Media.md +63 -0
- package/build/docs/blocks/PromoFeaturesBlock.md +74 -0
- package/build/docs/blocks/Questions.md +78 -0
- package/build/docs/blocks/Share.md +45 -0
- package/build/docs/blocks/Slider.md +89 -0
- package/build/docs/blocks/SliderOld.md +63 -0
- package/build/docs/blocks/Table.md +64 -0
- package/build/docs/blocks/Tabs.md +92 -0
- package/build/docs/guides/data-preparation-ru.md +257 -0
- package/build/docs/guides/data-preparation.md +259 -0
- package/build/docs/sub-blocks/BackgroundCard.md +63 -0
- package/build/docs/sub-blocks/BannerCard.md +57 -0
- package/build/docs/sub-blocks/BasicCard.md +60 -0
- package/build/docs/sub-blocks/Content.md +58 -0
- package/build/docs/sub-blocks/Divider.md +47 -0
- package/build/docs/sub-blocks/HubspotForm.md +47 -0
- package/build/docs/sub-blocks/ImageCard.md +59 -0
- package/build/docs/sub-blocks/LayoutItem.md +70 -0
- package/build/docs/sub-blocks/MediaCard.md +66 -0
- package/build/docs/sub-blocks/PriceCard.md +60 -0
- package/build/docs/sub-blocks/PriceDetailed.md +74 -0
- package/build/docs/sub-blocks/Quote.md +74 -0
- package/build/esm/components/ReactPlayer/ReactPlayer.css +0 -50
- package/build/esm/components/ReactPlayer/ReactPlayer.js +4 -16
- package/build/esm/components/ReactPlayer/ReactPlayer.js.map +1 -1
- package/build/esm/components/VideoBlock/VideoBlock.css +0 -30
- package/build/esm/components/VideoBlock/VideoBlock.d.ts +2 -1
- package/build/esm/components/VideoBlock/VideoBlock.js +19 -3
- package/build/esm/components/VideoBlock/VideoBlock.js.map +1 -1
- package/build/esm/components/VideoButton/VideoButton.css +64 -0
- package/build/esm/components/VideoButton/VideoButton.d.ts +10 -0
- package/build/esm/components/VideoButton/VideoButton.js +48 -0
- package/build/esm/components/VideoButton/VideoButton.js.map +1 -0
- package/build/esm/context/projectSettingsContext/ProjectSettingsContext.d.ts +7 -0
- package/build/esm/context/projectSettingsContext/ProjectSettingsContext.js.map +1 -1
- package/build/esm/models/constructor-items/common.d.ts +8 -1
- package/build/esm/models/constructor-items/common.js +1 -0
- package/build/esm/models/constructor-items/common.js.map +1 -1
- package/package.json +3 -2
- package/server/models/constructor-items/common.d.ts +8 -1
- package/server/models/constructor-items/common.js +1 -0
- package/widget/index.js +1 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# Data preparation
|
|
2
|
+
|
|
3
|
+
This chapter provides documentaion for server utilities for transforming content, including Yandex Flavored Markdown (YFM) to HTML conversion and text processing. Key features include:
|
|
4
|
+
|
|
5
|
+
- fullTransform: Converts YFM content into HTML with customizable options.
|
|
6
|
+
|
|
7
|
+
- Utilities: Includes typografToText, typografToHTML, and yfmTransformer for text processing in custom components.
|
|
8
|
+
|
|
9
|
+
- createItemsParser: A flexible utility for transforming specific fields in complex data structures, supporting nested fields and arrays.
|
|
10
|
+
|
|
11
|
+
## Server utils
|
|
12
|
+
|
|
13
|
+
The package provides a set of server utilities for transforming your content.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
const {fullTransform} = require('@gravity-ui/page-constructor/server');
|
|
17
|
+
|
|
18
|
+
const {html} = fullTransform(content, {
|
|
19
|
+
lang,
|
|
20
|
+
extractTitle: true,
|
|
21
|
+
allowHTML: true,
|
|
22
|
+
path: __dirname,
|
|
23
|
+
plugins,
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Under the hood, a package is used to transform Yandex Flavored Markdown into HTML - `diplodoc/transfrom`, so it is also in peer dependencies
|
|
28
|
+
|
|
29
|
+
You can also use useful utilities in the places you need, for example in your custom components
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
const {
|
|
33
|
+
typografToText,
|
|
34
|
+
typografToHTML,
|
|
35
|
+
yfmTransformer,
|
|
36
|
+
} = require('@gravity-ui/page-constructor/server');
|
|
37
|
+
|
|
38
|
+
const post = {
|
|
39
|
+
title: typografToText(title, lang),
|
|
40
|
+
content: typografToHTML(content, lang),
|
|
41
|
+
description: yfmTransformer(lang, description, {plugins}),
|
|
42
|
+
};
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
You can find more utilities in this [section](https://github.com/gravity-ui/page-constructor/tree/main/src/text-transform)
|
|
46
|
+
|
|
47
|
+
## `createItemsParser` Method Documentation
|
|
48
|
+
|
|
49
|
+
The `createItemsParser` method is a utility function designed to parse and transform items in a flexible and customizable way. It is particularly useful when dealing with complex data structures that require specific fields to be transformed using a provided transformer function. This method is highly configurable, allowing you to specify which fields to transform and how to handle nested fields.
|
|
50
|
+
|
|
51
|
+
### Method Signature
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
export const createItemsParser = (fields: string[]) => (transformer: Transformer, items: Item[]) => Item[];
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Parameters
|
|
58
|
+
|
|
59
|
+
- **fields**: An array of strings specifying the fields to be transformed. These fields can be nested, using dot notation (e.g., `'nested.field'`).
|
|
60
|
+
- **transformer**: A function that takes a string and returns a transformed string. This function will be applied to the specified fields.
|
|
61
|
+
- **items**: An array of items to be parsed and transformed. Each item can be a string or a complex object.
|
|
62
|
+
|
|
63
|
+
### Return Value
|
|
64
|
+
|
|
65
|
+
- Returns an array of items with the specified fields transformed by the `transformer` function.
|
|
66
|
+
|
|
67
|
+
## Usage Examples
|
|
68
|
+
|
|
69
|
+
### Example 1: Basic Usage
|
|
70
|
+
|
|
71
|
+
In this example, we want to transform the `text` and `additionalInfo` fields of each item in the `items` array using the `yfmTransformer`.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
const config = {
|
|
75
|
+
fields: ['items'],
|
|
76
|
+
transformer: yfmTransformer,
|
|
77
|
+
parser: createItemsParser(['text', 'additionalInfo']),
|
|
78
|
+
};
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Input:**
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
[
|
|
85
|
+
{"text": "Hello, world!", "additionalInfo": "This is a test."},
|
|
86
|
+
{"text": "Another item", "additionalInfo": "More info here."}
|
|
87
|
+
]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Output:**
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
[
|
|
94
|
+
{"text": "Transformed: Hello, world!", "additionalInfo": "Transformed: This is a test."},
|
|
95
|
+
{"text": "Transformed: Another item", "additionalInfo": "Transformed: More info here."}
|
|
96
|
+
]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Example 2: Nested Fields
|
|
100
|
+
|
|
101
|
+
In this example, we want to transform a nested field `list.text` within each item.
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
const config = {
|
|
105
|
+
fields: ['items'],
|
|
106
|
+
transformer: yfmTransformer,
|
|
107
|
+
parser: createItemsParser(['list.text']),
|
|
108
|
+
renderInline: true,
|
|
109
|
+
};
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Input:**
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
[{"list": {"text": "Nested text 1"}}, {"list": {"text": "Nested text 2"}}]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Output:**
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
[{"list": {"text": "Transformed: Nested text 1"}}, {"list": {"text": "Transformed: Nested text 2"}}]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Example 3: Mixed Data Types
|
|
125
|
+
|
|
126
|
+
In this example, the `items` array contains a mix of strings and complex objects. The `createItemsParser` will handle both types appropriately.
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
const config = {
|
|
130
|
+
fields: ['items'],
|
|
131
|
+
transformer: yfmTransformer,
|
|
132
|
+
parser: createItemsParser(['text', 'list.text']),
|
|
133
|
+
};
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Input:**
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
["Simple string", {"text": "Object text", "list": {"text": "Nested text"}}]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Output:**
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
[
|
|
146
|
+
"Transformed: Simple string",
|
|
147
|
+
{"text": "Transformed: Object text", "list": {"text": "Transformed: Nested text"}}
|
|
148
|
+
]
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Key Features
|
|
152
|
+
|
|
153
|
+
- **Flexible Field Specification**: You can specify both top-level and nested fields using dot notation.
|
|
154
|
+
- **Mixed Data Handling**: The method can handle arrays containing both strings and complex objects.
|
|
155
|
+
- **Custom Transformers**: You can pass any transformer function to apply custom transformations to the specified fields.
|
|
156
|
+
|
|
157
|
+
## Notes
|
|
158
|
+
|
|
159
|
+
- If a field is not found in an item, it will be skipped.
|
|
160
|
+
- If a nested field is specified but the parent object is not an object or is an array, the transformation will be skipped for that field.
|
|
161
|
+
- The method does not mutate the original items but returns a new array with the transformed items.
|
|
162
|
+
|
|
163
|
+
### Handling Nested Arrays
|
|
164
|
+
|
|
165
|
+
When a nested field is an array, the `createItemsParser` method will iterate over each element in the array and apply the transformer function to the specified subfield. This is particularly useful when dealing with arrays of objects that contain fields requiring transformation.
|
|
166
|
+
|
|
167
|
+
### Example 4: Nested Field as an Array
|
|
168
|
+
|
|
169
|
+
In this example, we want to transform the `text` field within each object in the `list` array, which is a nested field of the `items`.
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
const config = {
|
|
173
|
+
fields: ['items'],
|
|
174
|
+
transformer: yfmTransformer,
|
|
175
|
+
parser: createItemsParser(['list.text']),
|
|
176
|
+
};
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Input:**
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
[
|
|
183
|
+
{
|
|
184
|
+
"list": [{"text": "Nested text 1"}, {"text": "Nested text 2"}]
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"list": [{"text": "Nested text 3"}, {"text": "Nested text 4"}]
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Output:**
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
[
|
|
196
|
+
{
|
|
197
|
+
"list": [{"text": "Transformed: Nested text 1"}, {"text": "Transformed: Nested text 2"}]
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"list": [{"text": "Transformed: Nested text 3"}, {"text": "Transformed: Nested text 4"}]
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Full Example with All Cases
|
|
206
|
+
|
|
207
|
+
Here’s a comprehensive example that includes all possible cases: top-level fields, nested objects, and nested arrays.
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
const config = {
|
|
211
|
+
fields: ['items'],
|
|
212
|
+
transformer: yfmTransformer,
|
|
213
|
+
parser: createItemsParser(['text', 'list.text', 'details.info']),
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const transformedItems = config.parser(config.transformer, items);
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Input:**
|
|
220
|
+
|
|
221
|
+
```json
|
|
222
|
+
[
|
|
223
|
+
{
|
|
224
|
+
"text": "Top-level text",
|
|
225
|
+
"list": [{"text": "Nested text 1"}, {"text": "Nested text 2"}],
|
|
226
|
+
"details": {
|
|
227
|
+
"info": "Nested info"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"text": "Another top-level text",
|
|
232
|
+
"list": {"text": "Nested text 3"},
|
|
233
|
+
"details": {
|
|
234
|
+
"info": "Another nested info"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Output:**
|
|
241
|
+
|
|
242
|
+
```json
|
|
243
|
+
[
|
|
244
|
+
{
|
|
245
|
+
"text": "Transformed: Top-level text",
|
|
246
|
+
"list": [{"text": "Transformed: Nested text 1"}, {"text": "Transformed: Nested text 2"}],
|
|
247
|
+
"details": {
|
|
248
|
+
"info": "Transformed: Nested info"
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"text": "Transformed: Another top-level text",
|
|
253
|
+
"list": {"text": "Transformed: Nested text 3"},
|
|
254
|
+
"details": {
|
|
255
|
+
"info": "Transformed: Another nested info"
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# BackgroundCard
|
|
2
|
+
|
|
3
|
+
A card that renders text content (title, text, links, buttons, or a content list) over a decorative background image or solid color. Useful for promotional cards inside a card layout.
|
|
4
|
+
|
|
5
|
+
## Sub-block type
|
|
6
|
+
|
|
7
|
+
`type: 'background-card'`
|
|
8
|
+
|
|
9
|
+
## Used in
|
|
10
|
+
|
|
11
|
+
Accepted as a child of: `card-layout-block`, `slider-block`, `slider-old-block`.
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"type": "background-card",
|
|
18
|
+
"title": "Launch your product",
|
|
19
|
+
"text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco.",
|
|
20
|
+
"additionalInfo": "Duis aute irure dolor in reprehenderit.",
|
|
21
|
+
"background": {
|
|
22
|
+
"light": {"src": "/story-assets/img-bg_nopadding_4-12_light.png", "alt": "Background"},
|
|
23
|
+
"dark": {"src": "/story-assets/img-bg_nopadding_4-12_dark.png", "alt": "Background"}
|
|
24
|
+
},
|
|
25
|
+
"buttons": [
|
|
26
|
+
{"text": "Get started", "theme": "action", "url": "https://example.com"},
|
|
27
|
+
{"text": "Learn more", "theme": "outlined", "url": "https://example.com"}
|
|
28
|
+
],
|
|
29
|
+
"theme": "dark"
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Properties
|
|
34
|
+
|
|
35
|
+
| Property | Type | Default | Description |
|
|
36
|
+
| ------------------ | ------------------------------------------------- | ------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
37
|
+
| `type` _required_ | `'background-card'` | — | Sub-block discriminator. |
|
|
38
|
+
| `when` | `string` | — | Conditional rendering expression. |
|
|
39
|
+
| `title` _required_ | `string \| TitleProps` | — | Card title (plain string or Title options). |
|
|
40
|
+
| `text` _required_ | `string` | — | Body text (YFM supported). |
|
|
41
|
+
| `additionalInfo` | `string` | — | Secondary gray text (YFM supported). |
|
|
42
|
+
| `size` | `'s' \| 'm' \| 'l' \| 'xl'` | `'s'` | Content size; controls font sizes. |
|
|
43
|
+
| `theme` | `'default' \| 'dark' \| 'light'` | `'default'` | Card content theme. When not `default`, or when `backgroundColor` is set, the card border is hidden. |
|
|
44
|
+
| `links` | `LinkProps[]` | — | Array of links. |
|
|
45
|
+
| `buttons` | `ButtonProps[]` | — | Array of buttons. |
|
|
46
|
+
| `list` | `ContentItem[]` | — | Array of icon-content items (each requires `icon` or `gravityIcon`). |
|
|
47
|
+
| `border` | `'line' \| 'shadow' \| 'none'` | — | Card border style. Overridden to `'none'` when `backgroundColor` is set or `theme` is not `default`. |
|
|
48
|
+
| `controlPosition` | `'content' \| 'footer'` | `'content'` | Position of buttons/links. `'footer'` only applies when `paddingBottom` is unset. |
|
|
49
|
+
| `colSizes` | `{all?, sm?, md?, lg?, xl?}` (each `number` 1–12) | `{all: 12, md: 12}` | Column width per breakpoint. |
|
|
50
|
+
| `url` | `string` | — | Wraps the whole card in a link. |
|
|
51
|
+
| `urlTitle` | `string` | — | `title` attribute for the card link. |
|
|
52
|
+
| `background` | `ImageObjectProps \| {light, dark}` | — | Decorative background image (themed). |
|
|
53
|
+
| `backgroundColor` | `string` | — | Solid background color (CSS value). Hides the border. |
|
|
54
|
+
| `paddingBottom` | `'s' \| 'm' \| 'l' \| 'xl'` | — | Adds bottom padding. When set, `controlPosition: 'footer'` is ignored. |
|
|
55
|
+
| `analyticsEvents` | `AnalyticsEvent \| AnalyticsEvent[]` | — | Analytics events fired on card interaction. |
|
|
56
|
+
|
|
57
|
+
## Themed values
|
|
58
|
+
|
|
59
|
+
`background` accepts either a plain value or a `{light, dark}` object resolved against the active runtime theme.
|
|
60
|
+
|
|
61
|
+
## Storybook
|
|
62
|
+
|
|
63
|
+
[BackgroundCard](https://preview.gravity-ui.com/page-constructor/?path=/docs/components-cards-backgroundcard--docs)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# BannerCard
|
|
2
|
+
|
|
3
|
+
A compact banner card with a title, optional subtitle, a single call-to-action button, and a decorative background image. Designed to draw attention inside a card layout.
|
|
4
|
+
|
|
5
|
+
## Sub-block type
|
|
6
|
+
|
|
7
|
+
`type: 'banner-card'`
|
|
8
|
+
|
|
9
|
+
> The schema for this sub-block is defined in `src/blocks/Banner/schema.ts` (`BannerCardProps`) and shared with the standalone `banner-block`.
|
|
10
|
+
|
|
11
|
+
## Used in
|
|
12
|
+
|
|
13
|
+
Accepted as a child of: `card-layout-block`, `slider-block`, `slider-old-block`.
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"type": "banner-card",
|
|
20
|
+
"title": "Try the new release",
|
|
21
|
+
"subtitle": "Faster builds, simpler APIs, and improved theming.",
|
|
22
|
+
"image": {
|
|
23
|
+
"light": "/story-assets/banner_light.png",
|
|
24
|
+
"dark": "/story-assets/banner_dark.png"
|
|
25
|
+
},
|
|
26
|
+
"color": "#0275d8",
|
|
27
|
+
"theme": "light",
|
|
28
|
+
"mediaView": "full",
|
|
29
|
+
"button": {
|
|
30
|
+
"text": "Get started",
|
|
31
|
+
"url": "https://example.com",
|
|
32
|
+
"target": "_blank",
|
|
33
|
+
"theme": "raised"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Properties
|
|
39
|
+
|
|
40
|
+
| Property | Type | Default | Description |
|
|
41
|
+
| ------------------- | ------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
42
|
+
| `type` _required_ | `'banner-card'` | — | Sub-block discriminator. |
|
|
43
|
+
| `when` | `string` | — | Conditional rendering expression. |
|
|
44
|
+
| `animated` | `boolean` | — | Enables entrance animation. |
|
|
45
|
+
| `title` _required_ | `string` | — | Banner heading (rendered as `<h2>`, plain text). |
|
|
46
|
+
| `subtitle` | `string` | — | Secondary text (YFM supported). |
|
|
47
|
+
| `image` | `string \| {light, dark}` | — | Decorative background image URL (themed). |
|
|
48
|
+
| `mediaView` | `'fit' \| 'full'` | `'full'` | How the background media fills the banner. |
|
|
49
|
+
| `disableCompress` | `boolean` | — | Disables image compression for `image`. |
|
|
50
|
+
| `color` | `string \| {light, dark}` | — | Background color (CSS value, themed). Applied to the content layer. |
|
|
51
|
+
| `theme` | `'light' \| 'dark'` | `'light'` | Text color theme. |
|
|
52
|
+
| `width` | `'s' \| 'm' \| 'l'` | — | Banner width. |
|
|
53
|
+
| `button` _required_ | `ButtonProps` | — | Single call-to-action button. Uses only `text`, `url`, `target`, `theme` (`'raised'` by default). |
|
|
54
|
+
|
|
55
|
+
## Themed values
|
|
56
|
+
|
|
57
|
+
`image` and `color` each accept either a plain value or a `{light, dark}` object resolved against the active runtime theme.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# BasicCard
|
|
2
|
+
|
|
3
|
+
A general-purpose card with an optional icon (image or Gravity UI icon) and text content (title, text, links, buttons, or a content list). The simplest and most versatile card.
|
|
4
|
+
|
|
5
|
+
## Sub-block type
|
|
6
|
+
|
|
7
|
+
`type: 'basic-card'`
|
|
8
|
+
|
|
9
|
+
## Used in
|
|
10
|
+
|
|
11
|
+
Accepted as a child of: `card-layout-block`, `slider-block`, `slider-old-block`.
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"type": "basic-card",
|
|
18
|
+
"title": "Tell a story",
|
|
19
|
+
"text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco.",
|
|
20
|
+
"icon": {
|
|
21
|
+
"light": "/story-assets/icon_1_light.svg",
|
|
22
|
+
"dark": "/story-assets/icon_1_dark.svg"
|
|
23
|
+
},
|
|
24
|
+
"iconPosition": "top",
|
|
25
|
+
"url": "https://example.com",
|
|
26
|
+
"urlTitle": "Opens in a new tab",
|
|
27
|
+
"buttons": [{"text": "Read more", "theme": "action", "url": "https://example.com"}]
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Properties
|
|
32
|
+
|
|
33
|
+
| Property | Type | Default | Description |
|
|
34
|
+
| ---------------------- | -------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------- |
|
|
35
|
+
| `type` _required_ | `'basic-card'` | — | Sub-block discriminator. |
|
|
36
|
+
| `when` | `string` | — | Conditional rendering expression. |
|
|
37
|
+
| `title` | `string \| TitleProps` | — | Card title (plain string or Title options). |
|
|
38
|
+
| `text` | `string` | — | Body text (YFM supported). |
|
|
39
|
+
| `additionalInfo` | `string` | — | Secondary gray text (YFM supported). |
|
|
40
|
+
| `size` | `'s' \| 'm' \| 'l' \| 'xl'` | `'s'` | Content size; controls font sizes. |
|
|
41
|
+
| `links` | `LinkProps[]` | — | Array of links. |
|
|
42
|
+
| `buttons` | `ButtonProps[]` | — | Array of buttons. |
|
|
43
|
+
| `list` | `ContentItem[]` | — | Array of icon-content items (each requires `icon` or `gravityIcon`). |
|
|
44
|
+
| `border` | `'line' \| 'shadow' \| 'none'` | — | Card border style. |
|
|
45
|
+
| `controlPosition` | `'content' \| 'footer'` | `'content'` | Position of buttons/links inside the card. |
|
|
46
|
+
| `url` | `string` | — | Wraps the whole card in a link. |
|
|
47
|
+
| `urlTitle` | `string` | — | `title` attribute for the card link. |
|
|
48
|
+
| `target` | `'_blank' \| '_parent' \| '_top' \| '_self'` | — | Link target. |
|
|
49
|
+
| `icon` | `ImageProps` | — | Leading icon image (URL string, object, or device-aware object). |
|
|
50
|
+
| `gravityIcon` | `GravityIconProps` | — | Leading Gravity UI icon (`string` name, or `{name, color?}` where `color` is `'brand' \| 'text-color'`). |
|
|
51
|
+
| `iconPosition` | `'top' \| 'left'` | `'top'` | Position of the icon relative to the content. |
|
|
52
|
+
| `hoverBackgroundColor` | `string` | — | _Deprecated._ Background color/gradient applied on hover. |
|
|
53
|
+
|
|
54
|
+
## Themed values
|
|
55
|
+
|
|
56
|
+
`icon` and `gravityIcon` accept either a plain value or a `{light, dark}` object resolved against the active runtime theme.
|
|
57
|
+
|
|
58
|
+
## Storybook
|
|
59
|
+
|
|
60
|
+
[BasicCard](https://preview.gravity-ui.com/page-constructor/?path=/docs/components-cards-basiccard--docs)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Content
|
|
2
|
+
|
|
3
|
+
A text content block rendering a title, body text, additional info, links, buttons, and/or an icon content list. Used on its own as the textual portion of a content layout.
|
|
4
|
+
|
|
5
|
+
## Sub-block type
|
|
6
|
+
|
|
7
|
+
`type: 'content'`
|
|
8
|
+
|
|
9
|
+
## Used in
|
|
10
|
+
|
|
11
|
+
Accepted as `textContent` of: `content-layout-block`.
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"type": "content",
|
|
18
|
+
"title": "Lorem ipsum",
|
|
19
|
+
"text": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation ullamco laboris.",
|
|
20
|
+
"additionalInfo": "Duis aute irure dolor in reprehenderit.",
|
|
21
|
+
"size": "l",
|
|
22
|
+
"centered": false,
|
|
23
|
+
"links": [{"url": "#", "text": "Link", "theme": "normal", "arrow": true}],
|
|
24
|
+
"buttons": [{"text": "Button", "theme": "action", "url": "https://example.com"}],
|
|
25
|
+
"list": [
|
|
26
|
+
{
|
|
27
|
+
"icon": {"light": "/story-assets/icon_1_light.svg", "dark": "/story-assets/icon_1_dark.svg"},
|
|
28
|
+
"title": "Lorem ipsum",
|
|
29
|
+
"text": "Ut enim ad minim veniam quis nostrud exercitation."
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Properties
|
|
36
|
+
|
|
37
|
+
| Property | Type | Default | Description |
|
|
38
|
+
| ----------------- | ------------------------------------------------- | ------------------ | --------------------------------------------------------------------------------------------------- |
|
|
39
|
+
| `type` _required_ | `'content'` | — | Sub-block discriminator. |
|
|
40
|
+
| `title` | `string \| TitleProps` | — | Heading (plain string or Title options). |
|
|
41
|
+
| `text` | `string` | — | Body text (YFM supported). |
|
|
42
|
+
| `additionalInfo` | `string` | — | Secondary gray text (YFM supported). |
|
|
43
|
+
| `size` | `'s' \| 'm' \| 'l' \| 'xl'` | `'l'` | Content size; controls font sizes. |
|
|
44
|
+
| `centered` | `boolean` | `false` | Centers all content horizontally. |
|
|
45
|
+
| `theme` | `'default' \| 'dark' \| 'light'` | — | Content theme. |
|
|
46
|
+
| `links` | `LinkProps[]` | — | Array of links. |
|
|
47
|
+
| `buttons` | `ButtonProps[]` | — | Array of buttons. |
|
|
48
|
+
| `list` | `ContentItem[]` | — | Array of icon-content items (each requires `icon` or `gravityIcon`). |
|
|
49
|
+
| `controlPosition` | `'default' \| 'bottom'` | `'default'` | Position of buttons/links. |
|
|
50
|
+
| `colSizes` | `{all?, sm?, md?, lg?, xl?}` (each `number` 1–12) | `{all: 12, sm: 8}` | Column width per breakpoint. |
|
|
51
|
+
|
|
52
|
+
## Themed values
|
|
53
|
+
|
|
54
|
+
`icon`/`gravityIcon` inside `list` items accept either a plain value or a `{light, dark}` object resolved against the active runtime theme.
|
|
55
|
+
|
|
56
|
+
## Storybook
|
|
57
|
+
|
|
58
|
+
[Content](https://preview.gravity-ui.com/page-constructor/?path=/docs/components-content--docs)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Divider
|
|
2
|
+
|
|
3
|
+
A spacing/separator element that adds vertical space between sibling items, optionally drawing a horizontal line. Useful for tuning rhythm inside a layout.
|
|
4
|
+
|
|
5
|
+
## Sub-block type
|
|
6
|
+
|
|
7
|
+
`type: 'divider'`
|
|
8
|
+
|
|
9
|
+
## Used in
|
|
10
|
+
|
|
11
|
+
Registered both as a sub-block and as a standalone block; appears in the page `blocks` array.
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"type": "divider",
|
|
18
|
+
"size": "m"
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
With a horizontal line:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"type": "divider",
|
|
27
|
+
"size": "l",
|
|
28
|
+
"border": true
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Properties
|
|
33
|
+
|
|
34
|
+
| Property | Type | Default | Description |
|
|
35
|
+
| ----------------- | ---------------------------------------------------------------------- | ------- | ----------------------------------------------------------------- |
|
|
36
|
+
| `type` _required_ | `'divider'` | — | Sub-block discriminator. |
|
|
37
|
+
| `when` | `string` | — | Conditional rendering expression. |
|
|
38
|
+
| `size` | `'0' \| 'xxs' \| 'xs' \| 's' \| 'm' \| 'l' \| 'xl' \| 'xxl' \| 'xxxl'` | `'m'` | Vertical height of the divider. `'0'` collapses spacing entirely. |
|
|
39
|
+
| `border` | `boolean` | — | When `true`, draws a horizontal line across the full width. |
|
|
40
|
+
|
|
41
|
+
## Themed values
|
|
42
|
+
|
|
43
|
+
None — `Divider` has no themed properties.
|
|
44
|
+
|
|
45
|
+
## Storybook
|
|
46
|
+
|
|
47
|
+
[Divider](https://preview.gravity-ui.com/page-constructor/?path=/docs/components-divider--docs)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# HubspotForm
|
|
2
|
+
|
|
3
|
+
Embeds a HubSpot form inside a page. Loads the HubSpot scripts on demand and renders the form into a container; emits analytics events on submit and supports default field values and form event handlers.
|
|
4
|
+
|
|
5
|
+
## Sub-block type
|
|
6
|
+
|
|
7
|
+
`type: 'hubspot-form'`
|
|
8
|
+
|
|
9
|
+
## Used in
|
|
10
|
+
|
|
11
|
+
Accepted as `children` by `CardLayout`, `Slider`, `SliderOld`; also usable inside any block that renders sub-blocks (e.g. `FilterBlock` items).
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"type": "hubspot-form",
|
|
18
|
+
"region": "eu1",
|
|
19
|
+
"portalId": "25764979",
|
|
20
|
+
"formId": "a3eb06a6-e8ce-45d4-81bd-7fadb7dab313"
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Properties
|
|
25
|
+
|
|
26
|
+
| Property | Type | Default | Description |
|
|
27
|
+
| --------------------- | ---------------- | ------- | -------------------------------------------------------------------------------- |
|
|
28
|
+
| `type` _required_ | `'hubspot-form'` | — | Sub-block discriminator. |
|
|
29
|
+
| `when` | `string` | — | Conditional rendering expression. |
|
|
30
|
+
| `portalId` _required_ | `string` | — | HubSpot portal ID. |
|
|
31
|
+
| `formId` _required_ | `string` | — | HubSpot form ID. |
|
|
32
|
+
| `region` | `string` | — | HubSpot region (e.g. `'eu1'`, `'na1'`). |
|
|
33
|
+
| `formInstanceId` | `string` | — | Unique instance ID, required to render the same form multiple times on one page. |
|
|
34
|
+
|
|
35
|
+
Additional runtime-only props (`className`, `theme`, `isMobile`, `formClassName`, `createDOMElement`, `defaultValues`, `onBeforeLoad` / `onBeforeSubmit` / `onSubmit` / `onLoad` / `hubspotEvents`) are available on the React component but are not part of the JSON schema.
|
|
36
|
+
|
|
37
|
+
## Setup notes
|
|
38
|
+
|
|
39
|
+
HubSpot forms require the `formsContext` to be configured on `PageConstructorProvider`. The context wires form event handling and any HubSpot-specific runtime configuration; without it, submit analytics and the `onSubmit` / `onBeforeSubmit` / `onLoad` handlers wired through `useHandleHubspotEvents` will not fire. When the form is rendered inside an iframe, set up the `useLoopBackHubspotEvents` hook on the top-level frame so events propagate.
|
|
40
|
+
|
|
41
|
+
## Themed values
|
|
42
|
+
|
|
43
|
+
No themed media fields; theme is taken from the active theme context (or the `theme` runtime prop).
|
|
44
|
+
|
|
45
|
+
## Storybook
|
|
46
|
+
|
|
47
|
+
[HubspotForm](https://preview.gravity-ui.com/page-constructor/?path=/docs/components-hubspotform--docs)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# ImageCard
|
|
2
|
+
|
|
3
|
+
A card pairing a foreground image with text content (title, text, links, buttons, or a content list). The image and content can be ordered in either direction.
|
|
4
|
+
|
|
5
|
+
## Sub-block type
|
|
6
|
+
|
|
7
|
+
`type: 'image-card'`
|
|
8
|
+
|
|
9
|
+
## Used in
|
|
10
|
+
|
|
11
|
+
Accepted as a child of: `card-layout-block`, `slider-block`, `slider-old-block`.
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"type": "image-card",
|
|
18
|
+
"title": "Tell a story and build a narrative",
|
|
19
|
+
"text": "We are all storytellers. Stories are a powerful way to communicate ideas.",
|
|
20
|
+
"image": {
|
|
21
|
+
"dark": "/story-assets/img_8-12_dark.png",
|
|
22
|
+
"light": "/story-assets/img_8-12_light.png"
|
|
23
|
+
},
|
|
24
|
+
"direction": "direct",
|
|
25
|
+
"border": "shadow"
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Properties
|
|
30
|
+
|
|
31
|
+
| Property | Type | Default | Description |
|
|
32
|
+
| ------------------ | ------------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------ |
|
|
33
|
+
| `type` _required_ | `'image-card'` | — | Sub-block discriminator. |
|
|
34
|
+
| `when` | `string` | — | Conditional rendering expression. |
|
|
35
|
+
| `image` _required_ | `ImageProps` | — | Foreground image (URL string, object, or device-aware object). |
|
|
36
|
+
| `title` | `string \| TitleProps` | — | Card title (plain string or Title options). |
|
|
37
|
+
| `text` | `string` | — | Body text (YFM supported). |
|
|
38
|
+
| `additionalInfo` | `string` | — | Secondary gray text (YFM supported). |
|
|
39
|
+
| `size` | `'s' \| 'm' \| 'l' \| 'xl'` | `'s'` | Content size; controls font sizes. |
|
|
40
|
+
| `theme` | `'default' \| 'dark' \| 'light'` | `'default'` | Content theme. |
|
|
41
|
+
| `links` | `LinkProps[]` | — | Array of links. |
|
|
42
|
+
| `buttons` | `ButtonProps[]` | — | Array of buttons. |
|
|
43
|
+
| `list` | `ContentItem[]` | — | Array of icon-content items (each requires `icon` or `gravityIcon`). |
|
|
44
|
+
| `border` | `'line' \| 'shadow' \| 'none'` | `'shadow'` | Card border style. |
|
|
45
|
+
| `controlPosition` | `'content' \| 'footer'` | `'content'` | Position of buttons/links inside the card. |
|
|
46
|
+
| `direction` | `'direct' \| 'reverse'` | `'direct'` | Image/content order: `direct` = image first, `reverse` = content first. |
|
|
47
|
+
| `margins` | `'s' \| 'm'` | — | Internal margins around the image. |
|
|
48
|
+
| `backgroundColor` | `string` | — | Solid background color (CSS value). |
|
|
49
|
+
| `url` | `string` | — | Wraps the whole card in a link. |
|
|
50
|
+
| `urlTitle` | `string` | — | `title` attribute for the card link. |
|
|
51
|
+
| `analyticsEvents` | `AnalyticsEvent \| AnalyticsEvent[]` | — | Analytics events fired on card interaction. |
|
|
52
|
+
|
|
53
|
+
## Themed values
|
|
54
|
+
|
|
55
|
+
`image` accepts either a plain value or a `{light, dark}` object resolved against the active runtime theme.
|
|
56
|
+
|
|
57
|
+
## Storybook
|
|
58
|
+
|
|
59
|
+
[ImageCard](https://preview.gravity-ui.com/page-constructor/?path=/docs/components-cards-imagecard--docs)
|