@gravity-ui/page-constructor 4.11.0 → 4.12.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.
@@ -75,10 +75,6 @@ unpredictable css rules order in build */
75
75
  }
76
76
  .pc-header-block__description {
77
77
  margin-top: 16px;
78
- font-weight: normal;
79
- font-size: var(--g-text-caption-2-font-size);
80
- line-height: var(--g-text-caption-2-line-height);
81
- margin-block-end: var(--g-text-body-1-line-height);
82
78
  }
83
79
  .pc-header-block__description .yfm,
84
80
  .pc-header-block__description .yfm * {
@@ -170,9 +166,7 @@ unpredictable css rules order in build */
170
166
  .pc-header-block__overtitle {
171
167
  font-size: var(--g-text-body-3-font-size);
172
168
  line-height: var(--g-text-body-3-line-height);
173
- margin-block-start: var(--g-text-body-3-line-height);
174
169
  margin-bottom: 8px;
175
- font-weight: 400;
176
170
  }
177
171
  .pc-header-block__overtitle a {
178
172
  outline: none;
@@ -4,6 +4,7 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const components_1 = require("../../components");
6
6
  const locationContext_1 = require("../../context/locationContext");
7
+ const hooks_1 = require("../../hooks");
7
8
  const utils_1 = require("../../utils");
8
9
  const b = (0, utils_1.block)('icons-block');
9
10
  const getItemContent = (item) => (react_1.default.createElement(react_1.Fragment, null,
@@ -11,12 +12,16 @@ const getItemContent = (item) => (react_1.default.createElement(react_1.Fragment
11
12
  react_1.default.createElement("p", { className: b('text') }, item.text)));
12
13
  const Icons = ({ title, size = 's', items }) => {
13
14
  const { hostname } = (0, react_1.useContext)(locationContext_1.LocationContext);
15
+ const handleAnalytics = (0, hooks_1.useAnalytics)();
16
+ const onClick = (0, react_1.useCallback)(({ analyticsEvents, url }) => {
17
+ handleAnalytics(analyticsEvents, { url });
18
+ }, [handleAnalytics]);
14
19
  return (react_1.default.createElement("div", { className: b({ size }) },
15
20
  title && react_1.default.createElement(components_1.Title, { className: b('header'), title: title, colSizes: { all: 12 } }),
16
21
  items.map((item) => {
17
22
  const itemContent = getItemContent(item);
18
23
  const { url, text } = item;
19
- return url ? (react_1.default.createElement("a", Object.assign({ className: b('item'), key: url, href: url, "aria-label": text, title: text }, (0, utils_1.getLinkProps)(url, hostname)), itemContent)) : (react_1.default.createElement("div", { className: b('item'), key: url }, itemContent));
24
+ return url ? (react_1.default.createElement("a", Object.assign({ className: b('item'), key: url, href: url, "aria-label": text, title: text }, (0, utils_1.getLinkProps)(url, hostname), { onClick: () => onClick(item) }), itemContent)) : (react_1.default.createElement("div", { className: b('item'), key: url }, itemContent));
20
25
  })));
21
26
  };
22
27
  exports.default = Icons;
@@ -29,6 +29,87 @@ export declare const IconsProps: {
29
29
  type: string;
30
30
  };
31
31
  };
32
+ analyticsEvents: {
33
+ oneOf: ({
34
+ optionName: string;
35
+ type: string;
36
+ additionalProperties: {
37
+ type: string;
38
+ };
39
+ required: string[];
40
+ properties: {
41
+ name: {
42
+ type: string;
43
+ };
44
+ type: {
45
+ type: string;
46
+ };
47
+ counters: {
48
+ type: string;
49
+ additionalProperties: boolean;
50
+ required: never[];
51
+ properties: {
52
+ include: {
53
+ type: string;
54
+ items: {
55
+ type: string;
56
+ };
57
+ };
58
+ exclude: {
59
+ type: string;
60
+ items: {
61
+ type: string;
62
+ };
63
+ };
64
+ };
65
+ };
66
+ context: {
67
+ type: string;
68
+ };
69
+ };
70
+ items?: undefined;
71
+ } | {
72
+ type: string;
73
+ items: {
74
+ type: string;
75
+ additionalProperties: {
76
+ type: string;
77
+ };
78
+ required: string[];
79
+ properties: {
80
+ name: {
81
+ type: string;
82
+ };
83
+ type: {
84
+ type: string;
85
+ };
86
+ counters: {
87
+ type: string;
88
+ additionalProperties: boolean;
89
+ required: never[];
90
+ properties: {
91
+ include: {
92
+ type: string;
93
+ items: {
94
+ type: string;
95
+ };
96
+ };
97
+ exclude: {
98
+ type: string;
99
+ items: {
100
+ type: string;
101
+ };
102
+ };
103
+ };
104
+ };
105
+ context: {
106
+ type: string;
107
+ };
108
+ };
109
+ };
110
+ optionName: string;
111
+ })[];
112
+ };
32
113
  };
33
114
  };
34
115
  animated: {
@@ -96,6 +177,87 @@ export declare const IconsBlock: {
96
177
  type: string;
97
178
  };
98
179
  };
180
+ analyticsEvents: {
181
+ oneOf: ({
182
+ optionName: string;
183
+ type: string;
184
+ additionalProperties: {
185
+ type: string;
186
+ };
187
+ required: string[];
188
+ properties: {
189
+ name: {
190
+ type: string;
191
+ };
192
+ type: {
193
+ type: string;
194
+ };
195
+ counters: {
196
+ type: string;
197
+ additionalProperties: boolean;
198
+ required: never[];
199
+ properties: {
200
+ include: {
201
+ type: string;
202
+ items: {
203
+ type: string;
204
+ };
205
+ };
206
+ exclude: {
207
+ type: string;
208
+ items: {
209
+ type: string;
210
+ };
211
+ };
212
+ };
213
+ };
214
+ context: {
215
+ type: string;
216
+ };
217
+ };
218
+ items?: undefined;
219
+ } | {
220
+ type: string;
221
+ items: {
222
+ type: string;
223
+ additionalProperties: {
224
+ type: string;
225
+ };
226
+ required: string[];
227
+ properties: {
228
+ name: {
229
+ type: string;
230
+ };
231
+ type: {
232
+ type: string;
233
+ };
234
+ counters: {
235
+ type: string;
236
+ additionalProperties: boolean;
237
+ required: never[];
238
+ properties: {
239
+ include: {
240
+ type: string;
241
+ items: {
242
+ type: string;
243
+ };
244
+ };
245
+ exclude: {
246
+ type: string;
247
+ items: {
248
+ type: string;
249
+ };
250
+ };
251
+ };
252
+ };
253
+ context: {
254
+ type: string;
255
+ };
256
+ };
257
+ };
258
+ optionName: string;
259
+ })[];
260
+ };
99
261
  };
100
262
  };
101
263
  animated: {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IconsBlock = exports.IconsProps = void 0;
4
4
  const common_1 = require("../../schema/validators/common");
5
+ const event_1 = require("../../schema/validators/event");
5
6
  exports.IconsProps = {
6
7
  additionalProperties: false,
7
8
  required: ['size', 'items'],
@@ -30,6 +31,16 @@ exports.IconsProps = {
30
31
  type: 'string',
31
32
  },
32
33
  },
34
+ analyticsEvents: {
35
+ oneOf: [
36
+ Object.assign(Object.assign({}, event_1.AnalyticsEventSchema), { optionName: 'single' }),
37
+ {
38
+ type: 'array',
39
+ items: event_1.AnalyticsEventSchema,
40
+ optionName: 'list',
41
+ },
42
+ ],
43
+ },
33
44
  },
34
45
  } }),
35
46
  };
@@ -2,6 +2,7 @@
2
2
  import { ButtonSize } from '@gravity-ui/uikit';
3
3
  import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
4
4
  import { ThemeSupporting } from '../../utils';
5
+ import { AnalyticsEventsBase } from '../common';
5
6
  import { AnchorProps, Animatable, BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleItemBaseProps, TitleItemProps } from './common';
6
7
  import { BannerCardProps, SubBlock, SubBlockModels } from './sub-blocks';
7
8
  export declare enum BlockType {
@@ -241,14 +242,15 @@ export interface FilterBlockProps extends Animatable, LoadableChildren {
241
242
  colSizes?: GridColumnSizesType;
242
243
  centered?: boolean;
243
244
  }
245
+ export interface IconsBlockItemProps extends AnalyticsEventsBase {
246
+ url: string;
247
+ text: string;
248
+ src: string;
249
+ }
244
250
  export interface IconsBlockProps {
245
251
  title?: string;
246
252
  size?: 's' | 'm' | 'l';
247
- items: {
248
- url: string;
249
- text: string;
250
- src: string;
251
- }[];
253
+ items: IconsBlockItemProps[];
252
254
  }
253
255
  interface ContentLayoutBlockParams {
254
256
  size?: ContentSize;
@@ -75,10 +75,6 @@ unpredictable css rules order in build */
75
75
  }
76
76
  .pc-header-block__description {
77
77
  margin-top: 16px;
78
- font-weight: normal;
79
- font-size: var(--g-text-caption-2-font-size);
80
- line-height: var(--g-text-caption-2-line-height);
81
- margin-block-end: var(--g-text-body-1-line-height);
82
78
  }
83
79
  .pc-header-block__description .yfm,
84
80
  .pc-header-block__description .yfm * {
@@ -170,9 +166,7 @@ unpredictable css rules order in build */
170
166
  .pc-header-block__overtitle {
171
167
  font-size: var(--g-text-body-3-font-size);
172
168
  line-height: var(--g-text-body-3-line-height);
173
- margin-block-start: var(--g-text-body-3-line-height);
174
169
  margin-bottom: 8px;
175
- font-weight: 400;
176
170
  }
177
171
  .pc-header-block__overtitle a {
178
172
  outline: none;
@@ -1,6 +1,7 @@
1
- import React, { Fragment, useContext } from 'react';
1
+ import React, { Fragment, useCallback, useContext } from 'react';
2
2
  import { Image, Title } from '../../components';
3
3
  import { LocationContext } from '../../context/locationContext';
4
+ import { useAnalytics } from '../../hooks';
4
5
  import { block, getLinkProps } from '../../utils';
5
6
  import './Icons.css';
6
7
  const b = block('icons-block');
@@ -9,12 +10,16 @@ const getItemContent = (item) => (React.createElement(Fragment, null,
9
10
  React.createElement("p", { className: b('text') }, item.text)));
10
11
  const Icons = ({ title, size = 's', items }) => {
11
12
  const { hostname } = useContext(LocationContext);
13
+ const handleAnalytics = useAnalytics();
14
+ const onClick = useCallback(({ analyticsEvents, url }) => {
15
+ handleAnalytics(analyticsEvents, { url });
16
+ }, [handleAnalytics]);
12
17
  return (React.createElement("div", { className: b({ size }) },
13
18
  title && React.createElement(Title, { className: b('header'), title: title, colSizes: { all: 12 } }),
14
19
  items.map((item) => {
15
20
  const itemContent = getItemContent(item);
16
21
  const { url, text } = item;
17
- return url ? (React.createElement("a", Object.assign({ className: b('item'), key: url, href: url, "aria-label": text, title: text }, getLinkProps(url, hostname)), itemContent)) : (React.createElement("div", { className: b('item'), key: url }, itemContent));
22
+ return url ? (React.createElement("a", Object.assign({ className: b('item'), key: url, href: url, "aria-label": text, title: text }, getLinkProps(url, hostname), { onClick: () => onClick(item) }), itemContent)) : (React.createElement("div", { className: b('item'), key: url }, itemContent));
18
23
  })));
19
24
  };
20
25
  export default Icons;
@@ -29,6 +29,87 @@ export declare const IconsProps: {
29
29
  type: string;
30
30
  };
31
31
  };
32
+ analyticsEvents: {
33
+ oneOf: ({
34
+ optionName: string;
35
+ type: string;
36
+ additionalProperties: {
37
+ type: string;
38
+ };
39
+ required: string[];
40
+ properties: {
41
+ name: {
42
+ type: string;
43
+ };
44
+ type: {
45
+ type: string;
46
+ };
47
+ counters: {
48
+ type: string;
49
+ additionalProperties: boolean;
50
+ required: never[];
51
+ properties: {
52
+ include: {
53
+ type: string;
54
+ items: {
55
+ type: string;
56
+ };
57
+ };
58
+ exclude: {
59
+ type: string;
60
+ items: {
61
+ type: string;
62
+ };
63
+ };
64
+ };
65
+ };
66
+ context: {
67
+ type: string;
68
+ };
69
+ };
70
+ items?: undefined;
71
+ } | {
72
+ type: string;
73
+ items: {
74
+ type: string;
75
+ additionalProperties: {
76
+ type: string;
77
+ };
78
+ required: string[];
79
+ properties: {
80
+ name: {
81
+ type: string;
82
+ };
83
+ type: {
84
+ type: string;
85
+ };
86
+ counters: {
87
+ type: string;
88
+ additionalProperties: boolean;
89
+ required: never[];
90
+ properties: {
91
+ include: {
92
+ type: string;
93
+ items: {
94
+ type: string;
95
+ };
96
+ };
97
+ exclude: {
98
+ type: string;
99
+ items: {
100
+ type: string;
101
+ };
102
+ };
103
+ };
104
+ };
105
+ context: {
106
+ type: string;
107
+ };
108
+ };
109
+ };
110
+ optionName: string;
111
+ })[];
112
+ };
32
113
  };
33
114
  };
34
115
  animated: {
@@ -96,6 +177,87 @@ export declare const IconsBlock: {
96
177
  type: string;
97
178
  };
98
179
  };
180
+ analyticsEvents: {
181
+ oneOf: ({
182
+ optionName: string;
183
+ type: string;
184
+ additionalProperties: {
185
+ type: string;
186
+ };
187
+ required: string[];
188
+ properties: {
189
+ name: {
190
+ type: string;
191
+ };
192
+ type: {
193
+ type: string;
194
+ };
195
+ counters: {
196
+ type: string;
197
+ additionalProperties: boolean;
198
+ required: never[];
199
+ properties: {
200
+ include: {
201
+ type: string;
202
+ items: {
203
+ type: string;
204
+ };
205
+ };
206
+ exclude: {
207
+ type: string;
208
+ items: {
209
+ type: string;
210
+ };
211
+ };
212
+ };
213
+ };
214
+ context: {
215
+ type: string;
216
+ };
217
+ };
218
+ items?: undefined;
219
+ } | {
220
+ type: string;
221
+ items: {
222
+ type: string;
223
+ additionalProperties: {
224
+ type: string;
225
+ };
226
+ required: string[];
227
+ properties: {
228
+ name: {
229
+ type: string;
230
+ };
231
+ type: {
232
+ type: string;
233
+ };
234
+ counters: {
235
+ type: string;
236
+ additionalProperties: boolean;
237
+ required: never[];
238
+ properties: {
239
+ include: {
240
+ type: string;
241
+ items: {
242
+ type: string;
243
+ };
244
+ };
245
+ exclude: {
246
+ type: string;
247
+ items: {
248
+ type: string;
249
+ };
250
+ };
251
+ };
252
+ };
253
+ context: {
254
+ type: string;
255
+ };
256
+ };
257
+ };
258
+ optionName: string;
259
+ })[];
260
+ };
99
261
  };
100
262
  };
101
263
  animated: {
@@ -1,4 +1,5 @@
1
1
  import { AnimatableProps, BlockBaseProps } from '../../schema/validators/common';
2
+ import { AnalyticsEventSchema } from '../../schema/validators/event';
2
3
  export const IconsProps = {
3
4
  additionalProperties: false,
4
5
  required: ['size', 'items'],
@@ -27,6 +28,16 @@ export const IconsProps = {
27
28
  type: 'string',
28
29
  },
29
30
  },
31
+ analyticsEvents: {
32
+ oneOf: [
33
+ Object.assign(Object.assign({}, AnalyticsEventSchema), { optionName: 'single' }),
34
+ {
35
+ type: 'array',
36
+ items: AnalyticsEventSchema,
37
+ optionName: 'list',
38
+ },
39
+ ],
40
+ },
30
41
  },
31
42
  } }),
32
43
  };
@@ -2,6 +2,7 @@
2
2
  import { ButtonSize } from '@gravity-ui/uikit';
3
3
  import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
4
4
  import { ThemeSupporting } from '../../utils';
5
+ import { AnalyticsEventsBase } from '../common';
5
6
  import { AnchorProps, Animatable, BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleItemBaseProps, TitleItemProps } from './common';
6
7
  import { BannerCardProps, SubBlock, SubBlockModels } from './sub-blocks';
7
8
  export declare enum BlockType {
@@ -241,14 +242,15 @@ export interface FilterBlockProps extends Animatable, LoadableChildren {
241
242
  colSizes?: GridColumnSizesType;
242
243
  centered?: boolean;
243
244
  }
245
+ export interface IconsBlockItemProps extends AnalyticsEventsBase {
246
+ url: string;
247
+ text: string;
248
+ src: string;
249
+ }
244
250
  export interface IconsBlockProps {
245
251
  title?: string;
246
252
  size?: 's' | 'm' | 'l';
247
- items: {
248
- url: string;
249
- text: string;
250
- src: string;
251
- }[];
253
+ items: IconsBlockItemProps[];
252
254
  }
253
255
  interface ContentLayoutBlockParams {
254
256
  size?: ContentSize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "4.11.0",
3
+ "version": "4.12.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -2,6 +2,7 @@
2
2
  import { ButtonSize } from '@gravity-ui/uikit';
3
3
  import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
4
4
  import { ThemeSupporting } from '../../utils';
5
+ import { AnalyticsEventsBase } from '../common';
5
6
  import { AnchorProps, Animatable, BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleItemBaseProps, TitleItemProps } from './common';
6
7
  import { BannerCardProps, SubBlock, SubBlockModels } from './sub-blocks';
7
8
  export declare enum BlockType {
@@ -241,14 +242,15 @@ export interface FilterBlockProps extends Animatable, LoadableChildren {
241
242
  colSizes?: GridColumnSizesType;
242
243
  centered?: boolean;
243
244
  }
245
+ export interface IconsBlockItemProps extends AnalyticsEventsBase {
246
+ url: string;
247
+ text: string;
248
+ src: string;
249
+ }
244
250
  export interface IconsBlockProps {
245
251
  title?: string;
246
252
  size?: 's' | 'm' | 'l';
247
- items: {
248
- url: string;
249
- text: string;
250
- src: string;
251
- }[];
253
+ items: IconsBlockItemProps[];
252
254
  }
253
255
  interface ContentLayoutBlockParams {
254
256
  size?: ContentSize;