@gravity-ui/page-constructor 1.15.0-alpha.22 → 1.15.0-alpha.23

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 (106) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.md +3 -15
  3. package/build/cjs/blocks/Slider/Arrow/Arrow.js +2 -2
  4. package/build/cjs/blocks/Slider/Slider.css +0 -4
  5. package/build/cjs/components/Foldable/Foldable.css +4 -1
  6. package/build/cjs/components/Foldable/Foldable.js +7 -10
  7. package/build/cjs/components/FullscreenImage/FullscreenImage.js +8 -6
  8. package/build/cjs/components/FullscreenMedia/FullScreenMedia.css +70 -0
  9. package/build/cjs/components/FullscreenMedia/FullScreenMedia.d.ts +9 -0
  10. package/build/cjs/components/FullscreenMedia/FullScreenMedia.js +40 -0
  11. package/build/cjs/components/HeightCalculator/HeightCalculator.d.ts +4 -0
  12. package/build/cjs/components/HeightCalculator/HeightCalculator.js +4 -0
  13. package/build/cjs/components/Media/Media.js +3 -2
  14. package/build/cjs/components/MetaInfo/MetaInfo.css +13 -0
  15. package/build/cjs/components/MetaInfo/MetaInfo.d.ts +6 -0
  16. package/build/cjs/components/MetaInfo/MetaInfo.js +8 -0
  17. package/build/cjs/components/MetaInfo/schema.d.ts +8 -0
  18. package/build/cjs/components/MetaInfo/schema.js +10 -0
  19. package/build/cjs/components/VideoBlock/VideoBlock.d.ts +1 -0
  20. package/build/cjs/components/VideoBlock/VideoBlock.js +6 -10
  21. package/build/cjs/components/index.d.ts +2 -0
  22. package/build/cjs/components/index.js +5 -1
  23. package/build/cjs/constructor-items.d.ts +4 -0
  24. package/build/cjs/constructor-items.js +4 -0
  25. package/build/cjs/containers/PageConstructor/PageConstructor.css +1 -0
  26. package/build/cjs/hooks/useHeightCalculator.d.ts +6 -0
  27. package/build/cjs/hooks/useHeightCalculator.js +27 -0
  28. package/build/cjs/models/constructor-items/common.d.ts +1 -17
  29. package/build/cjs/models/constructor-items/sub-blocks.d.ts +15 -0
  30. package/build/cjs/models/constructor-items/sub-blocks.js +4 -0
  31. package/build/cjs/schema/index.js +1 -0
  32. package/build/cjs/schema/validators/sub-blocks.d.ts +1 -0
  33. package/build/cjs/schema/validators/sub-blocks.js +1 -0
  34. package/build/cjs/sub-blocks/BannerCard/BannerCard.js +2 -1
  35. package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +14 -9
  36. package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +1 -1
  37. package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.js +26 -8
  38. package/build/cjs/sub-blocks/HubspotForm/index.js +4 -2
  39. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.css +16 -0
  40. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +3 -0
  41. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +21 -0
  42. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +218 -0
  43. package/build/cjs/sub-blocks/LayoutItem/schema.js +18 -0
  44. package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +29 -0
  45. package/build/cjs/sub-blocks/LayoutItem/utils.js +12 -0
  46. package/build/cjs/sub-blocks/index.d.ts +1 -0
  47. package/build/cjs/sub-blocks/index.js +3 -1
  48. package/build/cjs/text-transform/blocks.js +17 -0
  49. package/build/cjs/utils/hubspot.d.ts +2 -1
  50. package/build/cjs/utils/hubspot.js +5 -1
  51. package/build/esm/blocks/Slider/Arrow/Arrow.js +2 -2
  52. package/build/esm/blocks/Slider/Slider.css +0 -4
  53. package/build/esm/components/Foldable/Foldable.css +4 -1
  54. package/build/esm/components/Foldable/Foldable.js +8 -11
  55. package/build/esm/components/FullscreenImage/FullscreenImage.js +9 -7
  56. package/build/esm/components/FullscreenMedia/FullScreenMedia.css +70 -0
  57. package/build/esm/components/FullscreenMedia/FullScreenMedia.d.ts +10 -0
  58. package/build/esm/components/FullscreenMedia/FullScreenMedia.js +38 -0
  59. package/build/esm/components/HeightCalculator/HeightCalculator.d.ts +4 -0
  60. package/build/esm/components/HeightCalculator/HeightCalculator.js +4 -0
  61. package/build/esm/components/Media/Media.js +3 -2
  62. package/build/esm/components/MetaInfo/MetaInfo.css +13 -0
  63. package/build/esm/components/MetaInfo/MetaInfo.d.ts +7 -0
  64. package/build/esm/components/MetaInfo/MetaInfo.js +6 -0
  65. package/build/esm/components/MetaInfo/schema.d.ts +8 -0
  66. package/build/esm/components/MetaInfo/schema.js +8 -0
  67. package/build/esm/components/VideoBlock/VideoBlock.d.ts +1 -0
  68. package/build/esm/components/VideoBlock/VideoBlock.js +6 -10
  69. package/build/esm/components/index.d.ts +2 -0
  70. package/build/esm/components/index.js +2 -0
  71. package/build/esm/constructor-items.d.ts +4 -0
  72. package/build/esm/constructor-items.js +5 -1
  73. package/build/esm/containers/PageConstructor/PageConstructor.css +1 -0
  74. package/build/esm/hooks/useHeightCalculator.d.ts +6 -0
  75. package/build/esm/hooks/useHeightCalculator.js +24 -0
  76. package/build/esm/models/constructor-items/common.d.ts +1 -17
  77. package/build/esm/models/constructor-items/sub-blocks.d.ts +15 -0
  78. package/build/esm/models/constructor-items/sub-blocks.js +4 -0
  79. package/build/esm/schema/index.js +1 -0
  80. package/build/esm/schema/validators/sub-blocks.d.ts +1 -0
  81. package/build/esm/schema/validators/sub-blocks.js +1 -0
  82. package/build/esm/sub-blocks/BannerCard/BannerCard.js +3 -2
  83. package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +14 -9
  84. package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +1 -1
  85. package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.js +26 -8
  86. package/build/esm/sub-blocks/HubspotForm/index.js +4 -2
  87. package/build/esm/sub-blocks/LayoutItem/LayoutItem.css +16 -0
  88. package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +4 -0
  89. package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +20 -0
  90. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +218 -0
  91. package/build/esm/sub-blocks/LayoutItem/schema.js +14 -0
  92. package/build/esm/sub-blocks/LayoutItem/utils.d.ts +29 -0
  93. package/build/esm/sub-blocks/LayoutItem/utils.js +6 -0
  94. package/build/esm/sub-blocks/index.d.ts +1 -0
  95. package/build/esm/sub-blocks/index.js +1 -0
  96. package/build/esm/text-transform/blocks.js +17 -0
  97. package/build/esm/utils/hubspot.d.ts +2 -1
  98. package/build/esm/utils/hubspot.js +5 -1
  99. package/package.json +5 -2
  100. package/server/models/constructor-items/common.d.ts +1 -17
  101. package/server/models/constructor-items/sub-blocks.d.ts +15 -0
  102. package/server/models/constructor-items/sub-blocks.js +4 -0
  103. package/server/text-transform/blocks.js +17 -0
  104. package/server/utils/hubspot.d.ts +2 -1
  105. package/server/utils/hubspot.js +5 -1
  106. package/styles/root.scss +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,93 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.16.2](https://github.com/gravity-ui/page-constructor/compare/v1.16.1...v1.16.2) (2023-02-16)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **HubspotForm:** required checkbox ([#154](https://github.com/gravity-ui/page-constructor/issues/154)) ([6c948d1](https://github.com/gravity-ui/page-constructor/commit/6c948d1a3511e16902e6808d83ac3f0ac14b6d9c))
9
+
10
+ ## [1.16.1](https://github.com/gravity-ui/page-constructor/compare/v1.16.0...v1.16.1) (2023-02-14)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * youtube dimensions ratio for large screens ([#151](https://github.com/gravity-ui/page-constructor/issues/151)) ([5ee3c9c](https://github.com/gravity-ui/page-constructor/commit/5ee3c9cabe641bd437a02d137528424df7fd2c5a))
16
+
17
+ ## [1.16.0](https://github.com/gravity-ui/page-constructor/compare/v1.15.4...v1.16.0) (2023-02-14)
18
+
19
+
20
+ ### Features
21
+
22
+ * **HubspotForm:** add render outside virtual dom ([#138](https://github.com/gravity-ui/page-constructor/issues/138)) ([1b8694c](https://github.com/gravity-ui/page-constructor/commit/1b8694c6893df63ffabab84779febad57362804c))
23
+
24
+ ## [1.15.4](https://github.com/gravity-ui/page-constructor/compare/v1.15.3...v1.15.4) (2023-02-13)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * freeze-es-5-ext ([#146](https://github.com/gravity-ui/page-constructor/issues/146)) ([72ca5f9](https://github.com/gravity-ui/page-constructor/commit/72ca5f90dee5b3a45d895695416b3398a46973b4))
30
+
31
+ ## [1.15.3](https://github.com/gravity-ui/page-constructor/compare/v1.15.2...v1.15.3) (2023-02-10)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * fullscreen icon hide ([#141](https://github.com/gravity-ui/page-constructor/issues/141)) ([dfec755](https://github.com/gravity-ui/page-constructor/commit/dfec75544102299d0f82b72dbb5f334759a63cb0))
37
+
38
+ ## [1.15.2](https://github.com/gravity-ui/page-constructor/compare/v1.15.1...v1.15.2) (2023-02-10)
39
+
40
+
41
+ ### Bug Fixes
42
+
43
+ * add layout item to card stories ([#143](https://github.com/gravity-ui/page-constructor/issues/143)) ([078c7f2](https://github.com/gravity-ui/page-constructor/commit/078c7f24e1e6a620ad57b929f08dd703092463f5))
44
+
45
+ ## [1.15.1](https://github.com/gravity-ui/page-constructor/compare/v1.15.0...v1.15.1) (2023-02-10)
46
+
47
+
48
+ ### Bug Fixes
49
+
50
+ * change meta info tag to h4 ([#140](https://github.com/gravity-ui/page-constructor/issues/140)) ([8cd84bd](https://github.com/gravity-ui/page-constructor/commit/8cd84bd5e313b41caf240b1ff155a9698ec9c17a))
51
+
52
+ ## [1.15.0](https://github.com/gravity-ui/page-constructor/compare/v1.14.4...v1.15.0) (2023-02-10)
53
+
54
+
55
+ ### Features
56
+
57
+ * add handler for submit error in hubspot forms ([#135](https://github.com/gravity-ui/page-constructor/issues/135)) ([5f9b7a8](https://github.com/gravity-ui/page-constructor/commit/5f9b7a89996b0d2237d62ffccbea6d08f19a8d35))
58
+
59
+ ## [1.14.4](https://github.com/gravity-ui/page-constructor/compare/v1.14.3...v1.14.4) (2023-02-10)
60
+
61
+
62
+ ### Bug Fixes
63
+
64
+ * changelog ([#136](https://github.com/gravity-ui/page-constructor/issues/136)) ([a07c738](https://github.com/gravity-ui/page-constructor/commit/a07c738e09898a952e63e1f0712cc9a31076cc1c))
65
+
66
+ ## [1.14.3](https://github.com/gravity-ui/page-constructor/compare/v1.14.2...v1.14.3) (2023-02-10)
67
+
68
+ ### Features
69
+
70
+ * LayoutItem was added and CardWithImage was deprecated ([#132](https://github.com/gravity-ui/page-constructor/issues/132))([4abebb5](https://github.com/gravity-ui/page-constructor/commit/4abebb573e12d0976d61541e2f33c17f3d25453a))
71
+
72
+ ### Bug Fixes
73
+
74
+ * remove unused card types ([#130](https://github.com/gravity-ui/page-constructor/issues/130)) ([22da2fa](https://github.com/gravity-ui/page-constructor/commit/22da2fadd433e12e84cf8afd238c369cff5f2c24))
75
+
76
+ ## [1.14.2](https://github.com/gravity-ui/page-constructor/compare/v1.14.1...v1.14.2) (2023-02-02)
77
+
78
+
79
+ ### Bug Fixes
80
+
81
+ * **HubspotForm:** border-radius ([#128](https://github.com/gravity-ui/page-constructor/issues/128)) ([437344b](https://github.com/gravity-ui/page-constructor/commit/437344b510cbde11bdf6e3a3ceb914fb0818a016))
82
+
83
+ ## [1.14.1](https://github.com/gravity-ui/page-constructor/compare/v1.14.0...v1.14.1) (2023-02-01)
84
+
85
+
86
+ ### Bug Fixes
87
+
88
+ * enable addons menu by default ([7772a55](https://github.com/gravity-ui/page-constructor/commit/7772a554950643d7cdbb86a8dedade6f916ae176))
89
+ * **Storybook:** fix links ([#123](https://github.com/gravity-ui/page-constructor/issues/123)) ([10cfe80](https://github.com/gravity-ui/page-constructor/commit/10cfe8054178bd577014dfff83033ff0c0dd9add))
90
+
3
91
  ## [1.14.0](https://github.com/gravity-ui/page-constructor/compare/v1.13.2...v1.14.0) (2023-01-25)
4
92
 
5
93
 
package/README.md CHANGED
@@ -82,18 +82,6 @@ interface SSR {
82
82
  isServer?: boolean;
83
83
  }
84
84
 
85
- type AnalyticsCounters = {
86
- include?: string[];
87
- exclude?: string[];
88
- };
89
-
90
- type AnalyticsEvent<T = {}> = T & {
91
- name: string;
92
- type?: string;
93
- counters?: AnalyticsCounters;
94
- context?: string;
95
- };
96
-
97
85
  interface NavigationData {
98
86
  logo: NavigationLogo;
99
87
  header: HeaderData;
@@ -261,7 +249,7 @@ It is possible to configure an event type needed for a project.
261
249
 
262
250
  ```ts
263
251
  type MyEventType = AnalyticsEvent<{
264
- anyParameterName?: string; // only a 'string' type is supported
252
+ [key: string]?: string; // only a 'string' type is supported
265
253
  }>;
266
254
  ```
267
255
 
@@ -271,8 +259,8 @@ It is possible to configure an event to which an analytics system to sent.
271
259
 
272
260
  ```ts
273
261
  type AnalyticsCounters = {
274
- include?: string[];
275
- exclude?: string[];
262
+ include?: string[]; // array of analytics counter ids that will be applied
263
+ exclude?: string[]; // array of analytics counter ids that will not be applied
276
264
  };
277
265
  ```
278
266
 
@@ -5,8 +5,8 @@ const react_1 = tslib_1.__importDefault(require("react"));
5
5
  const utils_1 = require("../../../utils");
6
6
  const ToggleArrow_1 = tslib_1.__importDefault(require("../../../components/ToggleArrow/ToggleArrow"));
7
7
  const b = (0, utils_1.block)('slider-block-arrow');
8
- const Arrow = ({ type, handleClick, className, size = 16 }) => (react_1.default.createElement("div", { className: b({ type }, className), onClick: () => handleClick && handleClick(type) },
9
- react_1.default.createElement("button", { className: b('button') },
8
+ const Arrow = ({ type, handleClick, className, size = 16 }) => (react_1.default.createElement("div", { className: b({ type }, className) },
9
+ react_1.default.createElement("button", { className: b('button'), onClick: () => handleClick && handleClick(type) },
10
10
  react_1.default.createElement("div", { className: b('icon-wrapper') },
11
11
  react_1.default.createElement(ToggleArrow_1.default, { size: size, type: 'horizontal', iconType: "navigation", className: b('icon') })))));
12
12
  exports.default = Arrow;
@@ -179,11 +179,7 @@ unpredictable css rules order in build */
179
179
  }
180
180
  .pc-SliderBlock_type_media-card .slick-arrow {
181
181
  display: none;
182
- height: 100%;
183
182
  width: 64px;
184
- top: 0;
185
- }
186
- .pc-SliderBlock_type_media-card .slick-arrow button {
187
183
  top: 50%;
188
184
  transform: translate(0, -50%);
189
185
  }
@@ -1,7 +1,10 @@
1
1
  /* use this for style redefinitions to awoid problems with
2
2
  unpredictable css rules order in build */
3
- .pc-foldable-block__content-container {
3
+ .pc-foldable-block {
4
4
  height: 0;
5
5
  overflow-y: hidden;
6
6
  transition: height 300ms, margin-bottom 300ms;
7
+ }
8
+ .pc-foldable-block__content-container {
9
+ overflow: auto;
7
10
  }
@@ -3,21 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const utils_1 = require("../../utils");
6
- const HeightCalculator_1 = tslib_1.__importDefault(require("../../components/HeightCalculator/HeightCalculator"));
6
+ const useHeightCalculator_1 = tslib_1.__importDefault(require("../../hooks/useHeightCalculator"));
7
7
  const b = (0, utils_1.block)('foldable-block');
8
8
  const Foldable = ({ isOpened, children, className }) => {
9
+ const blockRef = (0, react_1.useRef)(null);
9
10
  const contentRef = (0, react_1.useRef)(null);
10
- const [contentHeight, setContentHeight] = (0, react_1.useState)();
11
- const onHeightCalculation = (0, react_1.useCallback)((height) => {
12
- setContentHeight(height);
13
- }, []);
11
+ const contentHeight = (0, useHeightCalculator_1.default)(contentRef);
14
12
  (0, react_1.useEffect)(() => {
15
- if (contentRef && contentRef.current) {
16
- contentRef.current.style.height = isOpened ? `${contentHeight}px` : '0';
13
+ if (blockRef && blockRef.current) {
14
+ blockRef.current.style.height = isOpened && contentHeight ? `${contentHeight}px` : '0';
17
15
  }
18
16
  }, [isOpened, contentHeight]);
19
- return (react_1.default.createElement("div", { className: b(null, className) },
20
- react_1.default.createElement("div", { ref: contentRef, className: b('content-container', { open: isOpened }) }, children),
21
- react_1.default.createElement(HeightCalculator_1.default, { onCalculate: onHeightCalculation }, children)));
17
+ return (react_1.default.createElement("div", { ref: blockRef, className: b({ open: isOpened }, className) },
18
+ react_1.default.createElement("div", { ref: contentRef, className: b('content-container') }, children)));
22
19
  };
23
20
  exports.default = Foldable;
@@ -7,23 +7,25 @@ const utils_1 = require("../../utils");
7
7
  const Image_1 = tslib_1.__importDefault(require("../Image/Image"));
8
8
  const icons_1 = require("../../icons");
9
9
  const b = (0, utils_1.block)('FullScreenImage');
10
+ const FULL_SCREEN_ICON_SIZE = 18;
11
+ const CLOSE_ICON_SIZE = 30;
10
12
  const FullScreenImage = (props) => {
11
13
  const { imageClassName, modalImageClass, imageStyle } = props;
12
14
  const [isOpened, setIsOpened] = (0, react_1.useState)(false);
13
15
  const [isMouseEnter, setIsMouseEnter] = (0, react_1.useState)(false);
14
- const openModal = (0, react_1.useCallback)(() => setIsOpened(true), []);
15
- const closeModal = (0, react_1.useCallback)(() => setIsOpened(false), []);
16
- const showFullScreenIcon = (0, react_1.useCallback)(() => setIsMouseEnter(true), []);
17
- const hideFullScreenIcon = (0, react_1.useCallback)(() => setIsMouseEnter(false), []);
16
+ const openModal = () => setIsOpened(true);
17
+ const closeModal = () => setIsOpened(false);
18
+ const showFullScreenIcon = () => setIsMouseEnter(true);
19
+ const hideFullScreenIcon = () => setIsMouseEnter(false);
18
20
  return (react_1.default.createElement("div", { className: b() },
19
21
  react_1.default.createElement("div", { className: b('image-wrapper'), onMouseEnter: showFullScreenIcon, onMouseLeave: hideFullScreenIcon },
20
22
  react_1.default.createElement(Image_1.default, Object.assign({}, props, { className: b('image', imageClassName), onClick: openModal, style: imageStyle })),
21
23
  react_1.default.createElement("div", { className: b('icon-wrapper', { visible: isMouseEnter }), onClick: openModal },
22
- react_1.default.createElement(uikit_1.Icon, { data: icons_1.FullScreen, width: 18, height: 18, className: b('icon') }))),
24
+ react_1.default.createElement(uikit_1.Icon, { data: icons_1.FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') }))),
23
25
  isOpened && (react_1.default.createElement(uikit_1.Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
24
26
  react_1.default.createElement("div", { className: b('modal-content') },
25
27
  react_1.default.createElement("div", { className: b('icon-wrapper', { visible: true }), onClick: closeModal },
26
- react_1.default.createElement(uikit_1.Icon, { data: icons_1.PreviewClose, width: 30, height: 30, className: b('icon', { hover: true }) })),
28
+ react_1.default.createElement(uikit_1.Icon, { data: icons_1.PreviewClose, width: CLOSE_ICON_SIZE, height: CLOSE_ICON_SIZE, className: b('icon', { hover: true }) })),
27
29
  react_1.default.createElement(Image_1.default, Object.assign({}, props, { className: b('modal-image', modalImageClass) })))))));
28
30
  };
29
31
  exports.default = FullScreenImage;
@@ -0,0 +1,70 @@
1
+ /* use this for style redefinitions to awoid problems with
2
+ unpredictable css rules order in build */
3
+ .pc-full-screen-media__modal-media_type_youtube, .pc-full-screen-media__modal-media_type_video video, .pc-full-screen-media__modal-media_type_image {
4
+ display: block;
5
+ position: relative;
6
+ width: 100%;
7
+ max-width: 1232px;
8
+ max-height: 70vh;
9
+ }
10
+
11
+ .pc-full-screen-media__media {
12
+ cursor: pointer;
13
+ }
14
+ .pc-full-screen-media__media-wrapper {
15
+ cursor: pointer;
16
+ position: relative;
17
+ }
18
+ .pc-full-screen-media__modal-content {
19
+ position: relative;
20
+ }
21
+ .pc-full-screen-media__inline-media {
22
+ transform: translateZ(0);
23
+ }
24
+ .pc-full-screen-media__modal-media {
25
+ border-radius: var(--pc-border-radius);
26
+ }
27
+ .pc-full-screen-media__modal-media_type_youtube {
28
+ width: min(65vw, 1232px);
29
+ height: calc(min(65vw, 1232px) * 9 / 16);
30
+ }
31
+ .pc-full-screen-media__modal .yc-modal__content, .pc-full-screen-media__modal-image {
32
+ border-radius: var(--pc-border-radius);
33
+ }
34
+ .pc-full-screen-media__icon-wrapper {
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ position: absolute;
39
+ right: 16px;
40
+ top: 16px;
41
+ width: 36px;
42
+ height: 36px;
43
+ border-radius: 8px;
44
+ background-color: var(--yc-color-base-simple-hover-solid);
45
+ cursor: pointer;
46
+ z-index: 10;
47
+ }
48
+ .pc-full-screen-media__modal-content .pc-full-screen-media__icon-wrapper, .pc-full-screen-media__media-wrapper .pc-full-screen-media__icon-wrapper {
49
+ opacity: 0;
50
+ transition: opacity 0.3s;
51
+ pointer-events: none;
52
+ }
53
+ .pc-full-screen-media__modal-content:hover .pc-full-screen-media__icon-wrapper, .pc-full-screen-media__media-wrapper:hover .pc-full-screen-media__icon-wrapper {
54
+ opacity: 1;
55
+ pointer-events: inherit;
56
+ }
57
+ .pc-full-screen-media__icon {
58
+ color: var(--yc-color-text-hint);
59
+ }
60
+ .pc-full-screen-media__icon_hover:hover {
61
+ color: var(--yc-color-text-secondary);
62
+ }
63
+ @media (max-width: 577px) {
64
+ .pc-full-screen-media__icon-wrapper {
65
+ display: none;
66
+ }
67
+ .pc-full-screen-media__modal {
68
+ display: none !important; /* stylelint-disable-line declaration-no-important */
69
+ }
70
+ }
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { MediaAllProps } from '../Media/Media';
3
+ export type ChildMediaRenderProps = Pick<MediaAllProps, 'fullScreen' | 'imageClassName' | 'videoClassName' | 'youtubeClassName' | 'className'>;
4
+ export interface FullScreenMediaProps {
5
+ showFullScreenIcon?: boolean;
6
+ children: (props?: ChildMediaRenderProps) => JSX.Element;
7
+ }
8
+ declare const FullScreenMedia: ({ children, showFullScreenIcon }: FullScreenMediaProps) => JSX.Element;
9
+ export default FullScreenMedia;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importStar(require("react"));
5
+ const uikit_1 = require("@gravity-ui/uikit");
6
+ const utils_1 = require("../../utils");
7
+ const icons_1 = require("../../icons");
8
+ const mobileContext_1 = require("../../context/mobileContext");
9
+ const b = (0, utils_1.block)('full-screen-media');
10
+ const FULL_SCREEN_ICON_SIZE = 18;
11
+ const CLOSE_ICON_SIZE = 30;
12
+ const getMediaClass = (type) => b('modal-media', { type });
13
+ const FullScreenMedia = ({ children, showFullScreenIcon = true }) => {
14
+ const [isOpened, setIsOpened] = (0, react_1.useState)(false);
15
+ const isMobile = (0, react_1.useContext)(mobileContext_1.MobileContext);
16
+ const openModal = (e) => {
17
+ e.stopPropagation();
18
+ setIsOpened(true);
19
+ };
20
+ const closeModal = () => setIsOpened(false);
21
+ if (isMobile) {
22
+ return children();
23
+ }
24
+ return (react_1.default.createElement("div", { className: b() },
25
+ react_1.default.createElement("div", { className: b('media-wrapper'), onClickCapture: openModal },
26
+ children({ className: b('inline-media') }),
27
+ showFullScreenIcon && (react_1.default.createElement("div", { className: b('icon-wrapper'), onClickCapture: openModal },
28
+ react_1.default.createElement(uikit_1.Icon, { data: icons_1.FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') })))),
29
+ isOpened && (react_1.default.createElement(uikit_1.Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
30
+ react_1.default.createElement("div", { className: b('modal-content') },
31
+ react_1.default.createElement("div", { className: b('icon-wrapper', { visible: true }), onClick: closeModal },
32
+ react_1.default.createElement(uikit_1.Icon, { data: icons_1.PreviewClose, width: CLOSE_ICON_SIZE, height: CLOSE_ICON_SIZE, className: b('icon', { hover: true }) })),
33
+ children({
34
+ imageClassName: getMediaClass('image'),
35
+ videoClassName: getMediaClass('video'),
36
+ youtubeClassName: getMediaClass('youtube'),
37
+ fullScreen: true,
38
+ }))))));
39
+ };
40
+ exports.default = FullScreenMedia;
@@ -2,5 +2,9 @@ import { WithChildren } from '../../models';
2
2
  export interface HeightCalculatorProps {
3
3
  onCalculate: (height: number) => void;
4
4
  }
5
+ /**
6
+ * @deprecated Will be removed, use the useHeightCalculator hook instead.
7
+ * @returns The HeightCalculator component.
8
+ */
5
9
  declare const HeightCalculator: ({ onCalculate, children }: WithChildren<HeightCalculatorProps>) => JSX.Element | null;
6
10
  export default HeightCalculator;
@@ -5,6 +5,10 @@ const react_1 = tslib_1.__importStar(require("react"));
5
5
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
6
6
  const utils_1 = require("../../utils");
7
7
  const b = (0, utils_1.block)('height-calculator');
8
+ /**
9
+ * @deprecated Will be removed, use the useHeightCalculator hook instead.
10
+ * @returns The HeightCalculator component.
11
+ */
8
12
  const HeightCalculator = ({ onCalculate, children }) => {
9
13
  const [isCalculating, setIsCalculating] = (0, react_1.useState)(true);
10
14
  const container = (0, react_1.useRef)(null);
@@ -10,7 +10,7 @@ const Video_1 = tslib_1.__importDefault(require("./Video/Video"));
10
10
  const VideoBlock_1 = tslib_1.__importDefault(require("../VideoBlock/VideoBlock"));
11
11
  const b = (0, utils_1.block)('Media');
12
12
  const Media = (props) => {
13
- const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, analyticsEvents, } = props;
13
+ const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullScreen, analyticsEvents, } = props;
14
14
  const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
15
15
  const [hasVideoFallback, setHasVideoFallback] = (0, react_1.useState)(false);
16
16
  const content = (0, react_1.useMemo)(() => {
@@ -22,7 +22,7 @@ const Media = (props) => {
22
22
  result.push(react_1.default.createElement(Video_1.default, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, analyticsEvents: analyticsEvents, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
23
23
  }
24
24
  if (youtube) {
25
- result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height }));
25
+ result = (react_1.default.createElement(VideoBlock_1.default, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullScreen: fullScreen }));
26
26
  }
27
27
  if (dataLens) {
28
28
  result = react_1.default.createElement(DataLens_1.default, { dataLens: dataLens });
@@ -46,6 +46,7 @@ const Media = (props) => {
46
46
  playButton,
47
47
  customBarControlsClassName,
48
48
  youtubeClassName,
49
+ fullScreen,
49
50
  ]);
50
51
  return (react_1.default.createElement("div", { className: b(null, className), style: { backgroundColor: color } }, content));
51
52
  };
@@ -0,0 +1,13 @@
1
+ /* use this for style redefinitions to awoid problems with
2
+ unpredictable css rules order in build */
3
+ .pc-meta-info {
4
+ font-size: var(--yc-text-body-2-font-size);
5
+ line-height: var(--yc-text-body-2-line-height);
6
+ display: flex;
7
+ align-items: center;
8
+ font-weight: 500;
9
+ color: var(--pc-media-card-meta-info-color);
10
+ }
11
+ .pc-meta-info__item:not(:first-child) {
12
+ margin-left: 16px;
13
+ }
@@ -0,0 +1,6 @@
1
+ import { ClassNameProps } from 'src/models';
2
+ export interface MetaInfpoProps extends ClassNameProps {
3
+ items: string[];
4
+ }
5
+ declare const MetaInfo: ({ items, className }: MetaInfpoProps) => JSX.Element;
6
+ export default MetaInfo;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = tslib_1.__importDefault(require("react"));
5
+ const utils_1 = require("../../utils");
6
+ const b = (0, utils_1.block)('meta-info');
7
+ const MetaInfo = ({ items, className }) => (react_1.default.createElement("h4", { className: b(null, className) }, items.map((metaInfoItem) => (react_1.default.createElement("div", { key: metaInfoItem, className: b('item') }, metaInfoItem)))));
8
+ exports.default = MetaInfo;
@@ -0,0 +1,8 @@
1
+ declare const metaInfo: {
2
+ type: string;
3
+ items: {
4
+ type: string;
5
+ contentType: string;
6
+ };
7
+ };
8
+ export default metaInfo;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const metaInfo = {
4
+ type: 'array',
5
+ items: {
6
+ type: 'string',
7
+ contentType: 'text',
8
+ },
9
+ };
10
+ exports.default = metaInfo;
@@ -13,6 +13,7 @@ export interface VideoBlockProps {
13
13
  previewImg?: string;
14
14
  playButton?: React.ReactNode;
15
15
  height?: number;
16
+ fullScreen?: boolean;
16
17
  }
17
18
  declare const VideoBlock: (props: VideoBlockProps) => JSX.Element | null;
18
19
  export default VideoBlock;
@@ -4,6 +4,7 @@ exports.getHeight = exports.AUTOPLAY_ATTRIBUTES = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importStar(require("react"));
6
6
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
7
+ const uuid_1 = require("uuid");
7
8
  const uikit_1 = require("@gravity-ui/uikit");
8
9
  const utils_1 = require("../../utils");
9
10
  const Image_1 = tslib_1.__importDefault(require("../Image/Image"));
@@ -18,7 +19,6 @@ exports.AUTOPLAY_ATTRIBUTES = {
18
19
  mute: 1,
19
20
  };
20
21
  const b = (0, utils_1.block)('VideoBlock');
21
- const iframeId = 'video-block';
22
22
  function getVideoSrc(stream, record) {
23
23
  if (!stream && !record) {
24
24
  return null;
@@ -38,14 +38,14 @@ function getHeight(width) {
38
38
  }
39
39
  exports.getHeight = getHeight;
40
40
  const VideoBlock = (props) => {
41
- const { stream, record, attributes, className, id, previewImg, playButton, height } = props;
41
+ const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen } = props;
42
42
  const src = getVideoSrc(stream, record);
43
43
  const ref = (0, react_1.useRef)(null);
44
44
  const iframeRef = (0, react_1.useRef)();
45
45
  const [hidePreview, setHidePreview] = (0, react_1.useState)(false);
46
46
  const norender = (!stream && !record) || !src;
47
47
  const [currentHeight, setCurrentHeight] = (0, react_1.useState)(height || undefined);
48
- const fullId = `${iframeId}-${id || src}`;
48
+ const fullId = id || (0, uuid_1.v4)();
49
49
  const onPreviewClick = (0, react_1.useCallback)(() => {
50
50
  if (iframeRef.current) {
51
51
  iframeRef.current.src = `${src}?${(0, utils_1.getPageSearchParams)(Object.assign(Object.assign({}, exports.AUTOPLAY_ATTRIBUTES), (attributes || {})))}`;
@@ -66,12 +66,8 @@ const VideoBlock = (props) => {
66
66
  if (norender) {
67
67
  return;
68
68
  }
69
- const prevPageVideo = document.getElementById(fullId);
70
69
  const fullSrc = `${src}?${(0, utils_1.getPageSearchParams)(attributes || {})}`;
71
- if (prevPageVideo) {
72
- prevPageVideo.src = fullSrc;
73
- }
74
- else if (ref.current) {
70
+ if (ref.current && !iframeRef.current) {
75
71
  const iframe = document.createElement('iframe');
76
72
  iframe.id = fullId;
77
73
  iframe.src = fullSrc;
@@ -83,14 +79,14 @@ const VideoBlock = (props) => {
83
79
  ref.current.appendChild(iframe);
84
80
  iframeRef.current = iframe;
85
81
  }
86
- }, [stream, record, norender, src, fullId, attributes, iframeRef]);
82
+ }, [stream, record, norender, src, fullId, attributes, iframeRef, fullScreen]);
87
83
  (0, react_1.useEffect)(() => {
88
84
  setHidePreview(false);
89
85
  }, [src, setHidePreview]);
90
86
  if (norender) {
91
87
  return null;
92
88
  }
93
- return (react_1.default.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && (react_1.default.createElement("div", { className: b('preview'), onClick: onPreviewClick },
89
+ return (react_1.default.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && !fullScreen && (react_1.default.createElement("div", { className: b('preview'), onClick: onPreviewClick },
94
90
  react_1.default.createElement(Image_1.default, { src: previewImg, className: b('image'), containerClassName: b('image-wrapper') }),
95
91
  playButton || (react_1.default.createElement("button", { className: b('button') },
96
92
  react_1.default.createElement(uikit_1.Icon, { className: b('icon'), data: icons_1.PlayVideo, size: 24 })))))));
@@ -33,4 +33,6 @@ export { default as OverflowScroller } from './OverflowScroller/OverflowScroller
33
33
  export { default as Author } from './Author/Author';
34
34
  export { default as RouterLink } from './RouterLink/RouterLink';
35
35
  export { default as HTML } from './HTML/HTML';
36
+ export { default as MetaInfo } from './MetaInfo/MetaInfo';
37
+ export { default as FullScreenMedia } from './FullscreenMedia/FullScreenMedia';
36
38
  export type { RouterLinkProps } from './RouterLink/RouterLink';
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.HTML = exports.RouterLink = exports.Author = exports.OverflowScroller = exports.Control = exports.YandexForm = exports.YFMWrapper = exports.VideoBlock = exports.UnpublishedLabel = exports.ToggleArrow = exports.Title = exports.Table = exports.ReactPlayer = exports.OutsideClick = exports.Media = exports.Links = exports.Link = exports.Image = exports.HeightCalculator = exports.HeaderBreadcrumbs = exports.FullWidthBackground = exports.FullscreenImage = exports.Foldable = exports.FileLink = exports.ErrorWrapper = exports.CardBase = exports.Button = exports.BlockHeader = exports.BlockBase = exports.BalancedMasonry = exports.BackLink = exports.BackgroundMedia = exports.BackgroundImage = exports.AnimateBlock = exports.Anchor = void 0;
6
+ exports.FullScreenMedia = exports.MetaInfo = exports.HTML = exports.RouterLink = exports.Author = exports.OverflowScroller = exports.Control = exports.YandexForm = exports.YFMWrapper = exports.VideoBlock = exports.UnpublishedLabel = exports.ToggleArrow = exports.Title = exports.Table = exports.ReactPlayer = exports.OutsideClick = exports.Media = exports.Links = exports.Link = exports.Image = exports.HeightCalculator = exports.HeaderBreadcrumbs = exports.FullWidthBackground = exports.FullscreenImage = exports.Foldable = exports.FileLink = exports.ErrorWrapper = exports.CardBase = exports.Button = exports.BlockHeader = exports.BlockBase = exports.BalancedMasonry = exports.BackLink = exports.BackgroundMedia = exports.BackgroundImage = exports.AnimateBlock = exports.Anchor = void 0;
7
7
  var Anchor_1 = require("./Anchor/Anchor");
8
8
  Object.defineProperty(exports, "Anchor", { enumerable: true, get: function () { return __importDefault(Anchor_1).default; } });
9
9
  var AnimateBlock_1 = require("./AnimateBlock/AnimateBlock");
@@ -74,3 +74,7 @@ var RouterLink_1 = require("./RouterLink/RouterLink");
74
74
  Object.defineProperty(exports, "RouterLink", { enumerable: true, get: function () { return __importDefault(RouterLink_1).default; } });
75
75
  var HTML_1 = require("./HTML/HTML");
76
76
  Object.defineProperty(exports, "HTML", { enumerable: true, get: function () { return __importDefault(HTML_1).default; } });
77
+ var MetaInfo_1 = require("./MetaInfo/MetaInfo");
78
+ Object.defineProperty(exports, "MetaInfo", { enumerable: true, get: function () { return __importDefault(MetaInfo_1).default; } });
79
+ var FullScreenMedia_1 = require("./FullscreenMedia/FullScreenMedia");
80
+ Object.defineProperty(exports, "FullScreenMedia", { enumerable: true, get: function () { return __importDefault(FullScreenMedia_1).default; } });
@@ -34,6 +34,10 @@ export declare const subBlockMap: {
34
34
  "media-card": ({ border, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
35
35
  "banner-card": (props: import("./models").BannerCardProps) => JSX.Element;
36
36
  "news-card": (props: import("./models").NewsCardProps) => JSX.Element;
37
+ "layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullScreen, className, }: import("./models").LayoutItemProps) => JSX.Element;
38
+ /**
39
+ * @deprecated Use LayoutItem
40
+ */
37
41
  "card-with-image": ({ title, description, image, disableCompress, links, border, fullScreen, className, additionalInfo, buttons, }: import("./models").CardWithImageProps) => JSX.Element;
38
42
  "background-card": (props: import("./models").BackgroundCardProps) => JSX.Element;
39
43
  "basic-card": (props: import("./models").BasicCardProps) => JSX.Element;
@@ -40,6 +40,10 @@ exports.subBlockMap = {
40
40
  [models_1.SubBlockType.MediaCard]: sub_blocks_1.MediaCard,
41
41
  [models_1.SubBlockType.BannerCard]: sub_blocks_1.BannerCard,
42
42
  [models_1.SubBlockType.NewsCard]: sub_blocks_1.NewsCard,
43
+ [models_1.SubBlockType.LayoutItem]: sub_blocks_1.LayoutItem,
44
+ /**
45
+ * @deprecated Use LayoutItem
46
+ */
43
47
  [models_1.SubBlockType.CardWithImage]: sub_blocks_1.CardWithImage,
44
48
  [models_1.SubBlockType.BackgroundCard]: sub_blocks_1.BackgroundCard,
45
49
  [models_1.SubBlockType.BasicCard]: sub_blocks_1.BasicCard,
@@ -18,6 +18,7 @@ unpredictable css rules order in build */
18
18
  --pc-monochrome-button-background-color-hover: #393939;
19
19
  --pc-monochrome-button-color: var(--yc-color-text-light-primary);
20
20
  --pc-text-header-color: var(--yc-color-text-primary);
21
+ --pc-media-card-meta-info-color: var(--yc-color-text-secondary);
21
22
  }
22
23
  .yc-root.yc-root_theme_dark {
23
24
  --pc-color-sfx-shadow: var(--yc-color-sfx-shadow);
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ type HeightCalculatorOptions = {
3
+ recalculateOnResizeDelay: number;
4
+ };
5
+ declare const useHeightCalculator: (containerRef: React.RefObject<HTMLElement>, options?: HeightCalculatorOptions) => number | undefined;
6
+ export default useHeightCalculator;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const react_1 = require("react");
5
+ const lodash_1 = tslib_1.__importDefault(require("lodash"));
6
+ const DEFAULT_RECALCULATE_ON_RESIZE_DELAY = 1000;
7
+ const DEFAULT_OPTIONS = {
8
+ recalculateOnResizeDelay: DEFAULT_RECALCULATE_ON_RESIZE_DELAY,
9
+ };
10
+ const useHeightCalculator = (containerRef, options = DEFAULT_OPTIONS) => {
11
+ const recalculateOnResizeDelay = options.recalculateOnResizeDelay;
12
+ const [containerHeight, setContainerHeight] = (0, react_1.useState)(undefined);
13
+ const calculateContainerHeight = (0, react_1.useCallback)(() => {
14
+ if (containerRef.current && containerRef.current.offsetHeight !== containerHeight)
15
+ setContainerHeight(containerRef.current.offsetHeight);
16
+ }, [containerRef, containerHeight, setContainerHeight]);
17
+ (0, react_1.useEffect)(() => {
18
+ const handleResize = lodash_1.default.debounce(calculateContainerHeight, recalculateOnResizeDelay);
19
+ calculateContainerHeight();
20
+ window.addEventListener('resize', handleResize);
21
+ return () => {
22
+ window.removeEventListener('resize', handleResize);
23
+ };
24
+ }, [calculateContainerHeight, recalculateOnResizeDelay]);
25
+ return containerHeight;
26
+ };
27
+ exports.default = useHeightCalculator;