@gravity-ui/page-constructor 3.0.0-alpha.6 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +16 -1
  3. package/build/cjs/blocks/CardLayout/CardLayout.js +1 -1
  4. package/build/cjs/blocks/CardLayout/schema.d.ts +2 -2
  5. package/build/cjs/blocks/CardLayout/schema.js +1 -1
  6. package/build/cjs/blocks/FilterBlock/FilterBlock.js +9 -13
  7. package/build/cjs/blocks/Header/schema.d.ts +243 -0
  8. package/build/cjs/blocks/HeaderSlider/schema.d.ts +81 -0
  9. package/build/cjs/blocks/Media/schema.d.ts +162 -0
  10. package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +81 -0
  11. package/build/cjs/blocks/Slider/Slider.js +1 -1
  12. package/build/cjs/blocks/Tabs/schema.d.ts +81 -0
  13. package/build/cjs/components/FullscreenImage/{FullScreenImage.css → FullscreenImage.css} +13 -13
  14. package/build/cjs/components/FullscreenImage/FullscreenImage.d.ts +3 -3
  15. package/build/cjs/components/FullscreenImage/FullscreenImage.js +7 -7
  16. package/build/cjs/components/FullscreenImage/i18n/index.js +1 -1
  17. package/build/cjs/components/FullscreenMedia/FullscreenMedia.d.ts +9 -0
  18. package/build/cjs/components/FullscreenMedia/{FullScreenMedia.js → FullscreenMedia.js} +5 -5
  19. package/build/cjs/components/Media/FullscreenVideo/FullscreenVideo.d.ts +4 -0
  20. package/build/cjs/components/Media/FullscreenVideo/FullscreenVideo.js +10 -0
  21. package/build/cjs/components/Media/Image/Image.d.ts +1 -0
  22. package/build/cjs/components/Media/Image/Image.js +10 -3
  23. package/build/cjs/components/Media/Media.js +25 -5
  24. package/build/cjs/components/Media/Video/Video.d.ts +1 -1
  25. package/build/cjs/components/VideoBlock/VideoBlock.d.ts +3 -2
  26. package/build/cjs/components/VideoBlock/VideoBlock.js +8 -4
  27. package/build/cjs/components/index.d.ts +1 -1
  28. package/build/cjs/components/index.js +3 -3
  29. package/build/cjs/constructor-items.d.ts +1 -1
  30. package/build/cjs/grid/Col/Col.d.ts +1 -1
  31. package/build/cjs/icons/Fullscreen.d.ts +2 -0
  32. package/build/cjs/icons/{FullScreen.js → Fullscreen.js} +3 -3
  33. package/build/cjs/icons/index.d.ts +1 -1
  34. package/build/cjs/icons/index.js +1 -1
  35. package/build/cjs/models/common.d.ts +2 -1
  36. package/build/cjs/models/common.js +1 -0
  37. package/build/cjs/models/constructor-items/blocks.d.ts +1 -1
  38. package/build/cjs/models/constructor-items/common.d.ts +1 -1
  39. package/build/cjs/models/constructor-items/sub-blocks.d.ts +1 -1
  40. package/build/cjs/schema/validators/common.d.ts +81 -0
  41. package/build/cjs/schema/validators/common.js +6 -0
  42. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
  43. package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +4 -4
  44. package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +82 -1
  45. package/build/cjs/sub-blocks/LayoutItem/schema.js +1 -1
  46. package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +2 -2
  47. package/build/cjs/sub-blocks/LayoutItem/utils.js +6 -6
  48. package/build/cjs/sub-blocks/MediaCard/schema.d.ts +85 -0
  49. package/build/cjs/sub-blocks/MediaCard/schema.js +1 -1
  50. package/build/esm/blocks/CardLayout/CardLayout.js +1 -1
  51. package/build/esm/blocks/CardLayout/schema.d.ts +2 -2
  52. package/build/esm/blocks/CardLayout/schema.js +1 -1
  53. package/build/esm/blocks/FilterBlock/FilterBlock.js +10 -14
  54. package/build/esm/blocks/Header/schema.d.ts +243 -0
  55. package/build/esm/blocks/HeaderSlider/schema.d.ts +81 -0
  56. package/build/esm/blocks/Media/schema.d.ts +162 -0
  57. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +81 -0
  58. package/build/esm/blocks/Slider/Slider.js +2 -2
  59. package/build/esm/blocks/Tabs/Tabs.js +2 -2
  60. package/build/esm/blocks/Tabs/schema.d.ts +81 -0
  61. package/build/esm/components/FullscreenImage/{FullScreenImage.css → FullscreenImage.css} +13 -13
  62. package/build/esm/components/FullscreenImage/FullscreenImage.d.ts +4 -4
  63. package/build/esm/components/FullscreenImage/FullscreenImage.js +9 -9
  64. package/build/esm/components/FullscreenImage/i18n/index.js +1 -1
  65. package/build/esm/components/FullscreenMedia/FullscreenMedia.d.ts +10 -0
  66. package/build/esm/components/FullscreenMedia/{FullScreenMedia.js → FullscreenMedia.js} +7 -7
  67. package/build/esm/components/Media/FullscreenVideo/FullscreenVideo.d.ts +4 -0
  68. package/build/esm/components/Media/FullscreenVideo/FullscreenVideo.js +7 -0
  69. package/build/esm/components/Media/Image/Image.d.ts +1 -0
  70. package/build/esm/components/Media/Image/Image.js +12 -5
  71. package/build/esm/components/Media/Media.js +25 -5
  72. package/build/esm/components/Media/Video/Video.d.ts +1 -1
  73. package/build/esm/components/VideoBlock/VideoBlock.d.ts +3 -2
  74. package/build/esm/components/VideoBlock/VideoBlock.js +8 -4
  75. package/build/esm/components/index.d.ts +1 -1
  76. package/build/esm/components/index.js +1 -1
  77. package/build/esm/constructor-items.d.ts +1 -1
  78. package/build/esm/grid/Col/Col.d.ts +1 -1
  79. package/build/esm/icons/Fullscreen.d.ts +2 -0
  80. package/build/esm/icons/{FullScreen.js → Fullscreen.js} +1 -1
  81. package/build/esm/icons/index.d.ts +1 -1
  82. package/build/esm/icons/index.js +1 -1
  83. package/build/esm/models/common.d.ts +2 -1
  84. package/build/esm/models/common.js +1 -0
  85. package/build/esm/models/constructor-items/blocks.d.ts +1 -1
  86. package/build/esm/models/constructor-items/common.d.ts +1 -1
  87. package/build/esm/models/constructor-items/sub-blocks.d.ts +1 -1
  88. package/build/esm/schema/validators/common.d.ts +81 -0
  89. package/build/esm/schema/validators/common.js +6 -0
  90. package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
  91. package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +6 -6
  92. package/build/esm/sub-blocks/LayoutItem/schema.d.ts +82 -1
  93. package/build/esm/sub-blocks/LayoutItem/schema.js +1 -1
  94. package/build/esm/sub-blocks/LayoutItem/utils.d.ts +2 -2
  95. package/build/esm/sub-blocks/LayoutItem/utils.js +3 -3
  96. package/build/esm/sub-blocks/MediaCard/schema.d.ts +85 -0
  97. package/build/esm/sub-blocks/MediaCard/schema.js +2 -2
  98. package/package.json +1 -4
  99. package/server/models/common.d.ts +2 -1
  100. package/server/models/common.js +1 -0
  101. package/server/models/constructor-items/blocks.d.ts +1 -1
  102. package/server/models/constructor-items/common.d.ts +1 -1
  103. package/server/models/constructor-items/sub-blocks.d.ts +1 -1
  104. package/build/cjs/components/FullscreenMedia/FullScreenMedia.d.ts +0 -9
  105. package/build/cjs/icons/FullScreen.d.ts +0 -2
  106. package/build/esm/components/FullscreenMedia/FullScreenMedia.d.ts +0 -10
  107. package/build/esm/icons/FullScreen.d.ts +0 -2
  108. /package/build/cjs/components/FullscreenMedia/{FullScreenMedia.css → FullscreenMedia.css} +0 -0
  109. /package/build/esm/components/FullscreenMedia/{FullScreenMedia.css → FullscreenMedia.css} +0 -0
@@ -1,7 +1,7 @@
1
1
  import React, { Fragment, useContext, useRef, useState } from 'react';
2
2
  import AnimateBlock from '../../components/AnimateBlock/AnimateBlock';
3
3
  import ButtonTabs from '../../components/ButtonTabs/ButtonTabs';
4
- import FullScreenImage from '../../components/FullscreenImage/FullscreenImage';
4
+ import FullscreenImage from '../../components/FullscreenImage/FullscreenImage';
5
5
  import { getMediaImage } from '../../components/Media/Image/utils';
6
6
  import Media from '../../components/Media/Media';
7
7
  import Title from '../../components/Title/Title';
@@ -44,7 +44,7 @@ export const TabsBlock = ({ items, title, description, animated, tabsColSizes, c
44
44
  }, className: b('col', { centered: centered }) },
45
45
  React.createElement("div", { ref: ref }, (activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.media) && (React.createElement(Media, Object.assign({}, getThemedValue(activeTabData.media, theme), { key: activeTab, className: b('media'), playVideo: play, height: mediaHeight })))),
46
46
  imageProps && (React.createElement(Fragment, null,
47
- React.createElement(FullScreenImage, Object.assign({}, imageProps, { imageClassName: b('image') })))),
47
+ React.createElement(FullscreenImage, Object.assign({}, imageProps, { imageClassName: b('image') })))),
48
48
  (activeTabData === null || activeTabData === void 0 ? void 0 : activeTabData.caption) && React.createElement("p", { className: b('caption') }, activeTabData.caption)));
49
49
  const onSelectTab = (id, e) => {
50
50
  setActiveTab(id);
@@ -142,6 +142,87 @@ export declare const tabsItem: {
142
142
  type: string;
143
143
  })[];
144
144
  };
145
+ fullscreen: {
146
+ type: string;
147
+ };
148
+ analyticsEvents: {
149
+ anyOf: ({
150
+ type: string;
151
+ additionalProperties: {
152
+ type: string;
153
+ };
154
+ required: string[];
155
+ properties: {
156
+ name: {
157
+ type: string;
158
+ };
159
+ type: {
160
+ type: string;
161
+ };
162
+ counters: {
163
+ type: string;
164
+ additionalProperties: boolean;
165
+ required: never[];
166
+ properties: {
167
+ include: {
168
+ type: string;
169
+ items: {
170
+ type: string;
171
+ };
172
+ };
173
+ exclude: {
174
+ type: string;
175
+ items: {
176
+ type: string;
177
+ };
178
+ };
179
+ };
180
+ };
181
+ context: {
182
+ type: string;
183
+ };
184
+ };
185
+ } | {
186
+ type: string;
187
+ items: {
188
+ type: string;
189
+ additionalProperties: {
190
+ type: string;
191
+ };
192
+ required: string[];
193
+ properties: {
194
+ name: {
195
+ type: string;
196
+ };
197
+ type: {
198
+ type: string;
199
+ };
200
+ counters: {
201
+ type: string;
202
+ additionalProperties: boolean;
203
+ required: never[];
204
+ properties: {
205
+ include: {
206
+ type: string;
207
+ items: {
208
+ type: string;
209
+ };
210
+ };
211
+ exclude: {
212
+ type: string;
213
+ items: {
214
+ type: string;
215
+ };
216
+ };
217
+ };
218
+ };
219
+ context: {
220
+ type: string;
221
+ };
222
+ };
223
+ };
224
+ })[];
225
+ };
145
226
  };
146
227
  } | {
147
228
  type: string;
@@ -1,24 +1,24 @@
1
1
  /* use this for style redefinitions to awoid problems with
2
2
  unpredictable css rules order in build */
3
- .pc-FullScreenImage__image {
3
+ .pc-fullscreen-image__image {
4
4
  cursor: pointer;
5
5
  }
6
- .pc-FullScreenImage__image-wrapper {
6
+ .pc-fullscreen-image__image-wrapper {
7
7
  position: relative;
8
8
  }
9
- .pc-FullScreenImage__modal-content {
9
+ .pc-fullscreen-image__modal-content {
10
10
  position: relative;
11
11
  }
12
- .pc-FullScreenImage__modal-image {
12
+ .pc-fullscreen-image__modal-image {
13
13
  display: block;
14
14
  max-width: 1232px;
15
15
  max-height: 70vh;
16
16
  overflow: hidden;
17
17
  }
18
- .pc-FullScreenImage__modal .yc-modal__content, .pc-FullScreenImage__modal-image {
18
+ .pc-fullscreen-image__modal .yc-modal__content, .pc-fullscreen-image__modal-image {
19
19
  border-radius: var(--pc-border-radius);
20
20
  }
21
- .pc-FullScreenImage__icon-wrapper {
21
+ .pc-fullscreen-image__icon-wrapper {
22
22
  display: flex;
23
23
  align-items: center;
24
24
  justify-content: center;
@@ -33,28 +33,28 @@ unpredictable css rules order in build */
33
33
  opacity: 0;
34
34
  transition: 0.3s;
35
35
  }
36
- .pc-FullScreenImage__icon-wrapper_visible {
36
+ .pc-fullscreen-image__icon-wrapper_visible {
37
37
  opacity: 1;
38
38
  }
39
- .pc-FullScreenImage__icon {
39
+ .pc-fullscreen-image__icon {
40
40
  color: var(--yc-color-text-hint);
41
41
  }
42
- .pc-FullScreenImage__icon_hover:hover {
42
+ .pc-fullscreen-image__icon_hover:hover {
43
43
  color: var(--yc-color-text-secondary);
44
44
  }
45
45
  @media (max-width: 1185px) {
46
- .pc-FullScreenImage__modal-image {
46
+ .pc-fullscreen-image__modal-image {
47
47
  width: 100%;
48
48
  }
49
49
  }
50
50
  @media (max-width: 1081px) {
51
- .pc-FullScreenImage__image {
51
+ .pc-fullscreen-image__image {
52
52
  pointer-events: none;
53
53
  }
54
- .pc-FullScreenImage__icon-wrapper {
54
+ .pc-fullscreen-image__icon-wrapper {
55
55
  display: none;
56
56
  }
57
- .pc-FullScreenImage__modal {
57
+ .pc-fullscreen-image__modal {
58
58
  display: none !important; /* stylelint-disable-line declaration-no-important */
59
59
  }
60
60
  }
@@ -1,10 +1,10 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { ImageProps } from '../Image/Image';
3
- import './FullScreenImage.css';
4
- export interface FullScreenImageProps extends ImageProps {
3
+ import './FullscreenImage.css';
4
+ export interface FullscreenImageProps extends ImageProps {
5
5
  imageClassName?: string;
6
6
  modalImageClass?: string;
7
7
  imageStyle?: CSSProperties;
8
8
  }
9
- declare const FullScreenImage: (props: FullScreenImageProps) => JSX.Element;
10
- export default FullScreenImage;
9
+ declare const FullscreenImage: (props: FullscreenImageProps) => JSX.Element;
10
+ export default FullscreenImage;
@@ -1,30 +1,30 @@
1
1
  import React, { useState } from 'react';
2
2
  import { Icon, Modal } from '@gravity-ui/uikit';
3
- import { FullScreen, PreviewClose } from '../../icons';
3
+ import { Fullscreen, PreviewClose } from '../../icons';
4
4
  import { block } from '../../utils';
5
5
  import Image from '../Image/Image';
6
6
  import i18n from './i18n';
7
- import './FullScreenImage.css';
8
- const b = block('FullScreenImage');
7
+ import './FullscreenImage.css';
8
+ const b = block('fullscreen-image');
9
9
  const FULL_SCREEN_ICON_SIZE = 18;
10
10
  const CLOSE_ICON_SIZE = 30;
11
- const FullScreenImage = (props) => {
11
+ const FullscreenImage = (props) => {
12
12
  const { imageClassName, modalImageClass, imageStyle, alt = i18n('img-alt') } = props;
13
13
  const [isOpened, setIsOpened] = useState(false);
14
14
  const [isMouseEnter, setIsMouseEnter] = useState(false);
15
15
  const openModal = () => setIsOpened(true);
16
16
  const closeModal = () => setIsOpened(false);
17
- const showFullScreenIcon = () => setIsMouseEnter(true);
18
- const hideFullScreenIcon = () => setIsMouseEnter(false);
17
+ const showFullscreenIcon = () => setIsMouseEnter(true);
18
+ const hideFullscreenIcon = () => setIsMouseEnter(false);
19
19
  return (React.createElement("div", { className: b() },
20
- React.createElement("div", { className: b('image-wrapper'), onMouseEnter: showFullScreenIcon, onMouseLeave: hideFullScreenIcon },
20
+ React.createElement("div", { className: b('image-wrapper'), onMouseEnter: showFullscreenIcon, onMouseLeave: hideFullscreenIcon },
21
21
  React.createElement(Image, Object.assign({}, props, { alt: alt, className: b('image', imageClassName), onClick: openModal, style: imageStyle })),
22
22
  React.createElement("div", { className: b('icon-wrapper', { visible: isMouseEnter }), onClick: openModal },
23
- React.createElement(Icon, { data: FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') }))),
23
+ React.createElement(Icon, { data: Fullscreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') }))),
24
24
  isOpened && (React.createElement(Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
25
25
  React.createElement("div", { className: b('modal-content') },
26
26
  React.createElement("div", { className: b('icon-wrapper', { visible: true }), onClick: closeModal },
27
27
  React.createElement(Icon, { data: PreviewClose, width: CLOSE_ICON_SIZE, height: CLOSE_ICON_SIZE, className: b('icon', { hover: true }) })),
28
28
  React.createElement(Image, Object.assign({}, props, { className: b('modal-image', modalImageClass) })))))));
29
29
  };
30
- export default FullScreenImage;
30
+ export default FullscreenImage;
@@ -1,5 +1,5 @@
1
1
  import { registerKeyset } from '../../../utils/registerKeyset';
2
2
  import en from './en.json';
3
3
  import ru from './ru.json';
4
- const COMPONENT = 'FullScreenImage';
4
+ const COMPONENT = 'FullscreenImage';
5
5
  export default registerKeyset({ en, ru }, COMPONENT);
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { MediaAllProps } from '../Media/Media';
3
+ import './FullscreenMedia.css';
4
+ export type ChildMediaRenderProps = Pick<MediaAllProps, 'fullscreen' | 'imageClassName' | 'videoClassName' | 'youtubeClassName' | 'className'>;
5
+ export interface FullscreenMediaProps {
6
+ showFullscreenIcon?: boolean;
7
+ children: (props?: ChildMediaRenderProps) => JSX.Element;
8
+ }
9
+ declare const FullscreenMedia: ({ children, showFullscreenIcon }: FullscreenMediaProps) => JSX.Element;
10
+ export default FullscreenMedia;
@@ -1,14 +1,14 @@
1
1
  import React, { useContext, useState } from 'react';
2
2
  import { Icon, Modal } from '@gravity-ui/uikit';
3
3
  import { MobileContext } from '../../context/mobileContext';
4
- import { FullScreen, PreviewClose } from '../../icons';
4
+ import { Fullscreen, PreviewClose } from '../../icons';
5
5
  import { block } from '../../utils';
6
- import './FullScreenMedia.css';
6
+ import './FullscreenMedia.css';
7
7
  const b = block('full-screen-media');
8
8
  const FULL_SCREEN_ICON_SIZE = 18;
9
9
  const CLOSE_ICON_SIZE = 30;
10
10
  const getMediaClass = (type) => b('modal-media', { type });
11
- const FullScreenMedia = ({ children, showFullScreenIcon = true }) => {
11
+ const FullscreenMedia = ({ children, showFullscreenIcon = true }) => {
12
12
  const [isOpened, setIsOpened] = useState(false);
13
13
  const isMobile = useContext(MobileContext);
14
14
  const openModal = (e) => {
@@ -22,8 +22,8 @@ const FullScreenMedia = ({ children, showFullScreenIcon = true }) => {
22
22
  return (React.createElement("div", { className: b() },
23
23
  React.createElement("div", { className: b('media-wrapper'), onClickCapture: openModal },
24
24
  children({ className: b('inline-media') }),
25
- showFullScreenIcon && (React.createElement("div", { className: b('icon-wrapper'), onClickCapture: openModal },
26
- React.createElement(Icon, { data: FullScreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') })))),
25
+ showFullscreenIcon && (React.createElement("div", { className: b('icon-wrapper'), onClickCapture: openModal },
26
+ React.createElement(Icon, { data: Fullscreen, width: FULL_SCREEN_ICON_SIZE, height: FULL_SCREEN_ICON_SIZE, className: b('icon') })))),
27
27
  isOpened && (React.createElement(Modal, { open: isOpened, onClose: closeModal, className: b('modal') },
28
28
  React.createElement("div", { className: b('modal-content') },
29
29
  React.createElement("div", { className: b('icon-wrapper', { visible: true }), onClick: closeModal },
@@ -32,7 +32,7 @@ const FullScreenMedia = ({ children, showFullScreenIcon = true }) => {
32
32
  imageClassName: getMediaClass('image'),
33
33
  videoClassName: getMediaClass('video'),
34
34
  youtubeClassName: getMediaClass('youtube'),
35
- fullScreen: true,
35
+ fullscreen: true,
36
36
  }))))));
37
37
  };
38
- export default FullScreenMedia;
38
+ export default FullscreenMedia;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { VideoAllProps } from '../Video/Video';
3
+ declare const FullscreenVideo: React.FC<VideoAllProps>;
4
+ export default FullscreenVideo;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import FullscreenMedia from '../../FullscreenMedia/FullscreenMedia';
3
+ import Video from '../Video/Video';
4
+ const FullscreenVideo = (props) => {
5
+ return (React.createElement(FullscreenMedia, null, (classNames) => React.createElement(Video, Object.assign({}, props, classNames))));
6
+ };
7
+ export default FullscreenVideo;
@@ -3,6 +3,7 @@ import './Image.css';
3
3
  export interface ImageAdditionProps {
4
4
  imageClassName?: string;
5
5
  isBackground?: boolean;
6
+ fullscreen?: boolean;
6
7
  }
7
8
  interface InnerImageProps {
8
9
  hasVideoFallback: boolean;
@@ -5,13 +5,13 @@ import SliderBlock from '../../../blocks/Slider/Slider';
5
5
  import { SliderType } from '../../../models';
6
6
  import { block } from '../../../utils';
7
7
  import BackgroundImage from '../../BackgroundImage/BackgroundImage';
8
- import FullScreenImage from '../../FullscreenImage/FullscreenImage';
8
+ import FullscreenImage from '../../FullscreenImage/FullscreenImage';
9
9
  import ImageView from '../../Image/Image';
10
10
  import { getMediaImage } from './utils';
11
11
  import './Image.css';
12
12
  const b = block('media-component-image');
13
13
  const Image = (props) => {
14
- const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video } = props;
14
+ const { parallax, image, height, imageClassName, isBackground, hasVideoFallback, video, fullscreen, } = props;
15
15
  const [scrollY, setScrollY] = useState(0);
16
16
  const [{ springScrollY }, springSetScrollY] = useSpring(() => ({
17
17
  springScrollY: 0,
@@ -32,10 +32,10 @@ const Image = (props) => {
32
32
  parallaxInterpolate = springScrollY.interpolate((value) => `translateY(-${Number(value) / parallaxLevel}px)`);
33
33
  }
34
34
  const imageClass = b('item', { withVideo: Boolean(video) && !hasVideoFallback }, imageClassName);
35
- const imageSlider = (imageArray) => (React.createElement(SliderBlock, { slidesToShow: 1, type: SliderType.MediaCard }, imageArray.map((item) => {
35
+ const renderFullscreenImage = (item) => {
36
36
  const itemData = getMediaImage(item);
37
- return (React.createElement(FullScreenImage, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height } })));
38
- })));
37
+ return (React.createElement(FullscreenImage, Object.assign({ key: itemData.alt }, itemData, { imageClassName: imageClass, imageStyle: { height } })));
38
+ };
39
39
  const imageBackground = (oneImage) => {
40
40
  const imageData = getMediaImage(oneImage);
41
41
  return (React.createElement(animated.div, { style: { transform: parallaxInterpolate } },
@@ -45,9 +45,16 @@ const Image = (props) => {
45
45
  const imageData = getMediaImage(oneImage);
46
46
  return React.createElement(ImageView, Object.assign({}, imageData, { className: imageClass, style: { height } }));
47
47
  };
48
+ const imageSlider = (imageArray) => {
49
+ const fullscreenItem = fullscreen === undefined || fullscreen;
50
+ return (React.createElement(SliderBlock, { slidesToShow: 1, type: SliderType.MediaCard }, imageArray.map((item) => fullscreenItem ? renderFullscreenImage(item) : imageOnly(item))));
51
+ };
48
52
  if (Array.isArray(image)) {
49
53
  return imageSlider(image);
50
54
  }
55
+ if (fullscreen) {
56
+ return renderFullscreenImage(image);
57
+ }
51
58
  return isBackground ? imageBackground(image) : imageOnly(image);
52
59
  };
53
60
  export default Image;
@@ -2,24 +2,44 @@ import React, { useMemo, useState } from 'react';
2
2
  import { block } from '../../utils';
3
3
  import YoutubeBlock from '../VideoBlock/VideoBlock';
4
4
  import DataLens from './DataLens/DataLens';
5
+ import FullscreenVideo from './FullscreenVideo/FullscreenVideo';
5
6
  import Image from './Image/Image';
6
7
  import Video from './Video/Video';
7
8
  import './Media.css';
8
9
  const b = block('Media');
9
10
  export const Media = (props) => {
10
- const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullScreen, analyticsEvents, } = props;
11
+ const { image, video, youtube, dataLens, color, height, previewImg, parallax = false, metrika, fullscreen, analyticsEvents, } = props;
11
12
  const { className, imageClassName, videoClassName, youtubeClassName, playVideo = true, isBackground, playButton, customBarControlsClassName, } = props;
12
13
  const [hasVideoFallback, setHasVideoFallback] = useState(false);
13
14
  const content = useMemo(() => {
14
15
  let result = [];
15
16
  if (image) {
16
- result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback }));
17
+ result.push(React.createElement(Image, { key: "image", parallax: parallax, image: image, height: height, imageClassName: imageClassName, isBackground: isBackground, video: video, hasVideoFallback: hasVideoFallback, fullscreen: fullscreen }));
17
18
  }
18
19
  if (video) {
19
- result.push(React.createElement(Video, { key: "video", video: video, videoClassName: videoClassName, height: height, metrika: metrika, analyticsEvents: analyticsEvents, playVideo: playVideo, previewImg: previewImg, playButton: playButton, customBarControlsClassName: customBarControlsClassName, hasVideoFallback: hasVideoFallback, setHasVideoFallback: setHasVideoFallback }));
20
+ const videoProps = {
21
+ key: 'video',
22
+ video,
23
+ videoClassName,
24
+ height,
25
+ metrika,
26
+ analyticsEvents,
27
+ playVideo,
28
+ previewImg,
29
+ playButton,
30
+ customBarControlsClassName,
31
+ hasVideoFallback,
32
+ setHasVideoFallback,
33
+ };
34
+ if (fullscreen) {
35
+ result.push(React.createElement(FullscreenVideo, Object.assign({}, videoProps)));
36
+ }
37
+ else {
38
+ result.push(React.createElement(Video, Object.assign({}, videoProps)));
39
+ }
20
40
  }
21
41
  if (youtube) {
22
- result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullScreen: fullScreen }));
42
+ result = (React.createElement(YoutubeBlock, { className: b('youtube', youtubeClassName), record: youtube, attributes: { color: 'white', rel: '0' }, previewImg: previewImg, height: height, fullscreen: fullscreen, analyticsEvents: analyticsEvents }));
23
43
  }
24
44
  if (dataLens) {
25
45
  result = React.createElement(DataLens, { dataLens: dataLens });
@@ -43,7 +63,7 @@ export const Media = (props) => {
43
63
  playButton,
44
64
  customBarControlsClassName,
45
65
  youtubeClassName,
46
- fullScreen,
66
+ fullscreen,
47
67
  ]);
48
68
  return (React.createElement("div", { className: b(null, className), style: { backgroundColor: color } }, content));
49
69
  };
@@ -11,6 +11,6 @@ interface InnerVideoProps {
11
11
  setHasVideoFallback: React.Dispatch<boolean>;
12
12
  hasVideoFallback: boolean;
13
13
  }
14
- type VideoAllProps = VideoAdditionProps & MediaComponentVideoProps & InnerVideoProps;
14
+ export type VideoAllProps = VideoAdditionProps & MediaComponentVideoProps & InnerVideoProps;
15
15
  declare const Video: (props: VideoAllProps) => JSX.Element | null;
16
16
  export default Video;
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
+ import { AnalyticsEventsBase } from '../../models/common';
2
3
  import './VideoBlock.css';
3
4
  export declare const AUTOPLAY_ATTRIBUTES: {
4
5
  autoplay: number;
5
6
  mute: number;
6
7
  };
7
8
  export declare function getHeight(width: number): number;
8
- export interface VideoBlockProps {
9
+ export interface VideoBlockProps extends AnalyticsEventsBase {
9
10
  id?: string;
10
11
  stream?: string;
11
12
  record?: string;
@@ -14,7 +15,7 @@ export interface VideoBlockProps {
14
15
  previewImg?: string;
15
16
  playButton?: React.ReactNode;
16
17
  height?: number;
17
- fullScreen?: boolean;
18
+ fullscreen?: boolean;
18
19
  }
19
20
  declare const VideoBlock: (props: VideoBlockProps) => JSX.Element | null;
20
21
  export default VideoBlock;
@@ -2,7 +2,9 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { Icon } from '@gravity-ui/uikit';
3
3
  import _ from 'lodash';
4
4
  import { v4 as uuidv4 } from 'uuid';
5
+ import { useAnalytics } from '../../hooks/useAnalytics';
5
6
  import { PlayVideo } from '../../icons';
7
+ import { DefaultEventNames } from '../../models/common';
6
8
  import { block, getPageSearchParams } from '../../utils';
7
9
  import Image from '../Image/Image';
8
10
  import i18n from './i18n';
@@ -35,7 +37,8 @@ export function getHeight(width) {
35
37
  return (width / 16) * 9;
36
38
  }
37
39
  const VideoBlock = (props) => {
38
- const { stream, record, attributes, className, id, previewImg, playButton, height, fullScreen } = props;
40
+ const { stream, record, attributes, className, id, previewImg, playButton, height, fullscreen, analyticsEvents, } = props;
41
+ const handleAnalytics = useAnalytics(DefaultEventNames.VideoPreview);
39
42
  const src = getVideoSrc(stream, record);
40
43
  const ref = useRef(null);
41
44
  const iframeRef = useRef();
@@ -44,11 +47,12 @@ const VideoBlock = (props) => {
44
47
  const [currentHeight, setCurrentHeight] = useState(height || undefined);
45
48
  const fullId = id || uuidv4();
46
49
  const onPreviewClick = useCallback(() => {
50
+ handleAnalytics(analyticsEvents);
47
51
  if (iframeRef.current) {
48
52
  iframeRef.current.src = `${src}?${getPageSearchParams(Object.assign(Object.assign({}, AUTOPLAY_ATTRIBUTES), (attributes || {})))}`;
49
53
  }
50
54
  setTimeout(() => setHidePreview(true), AUTOPLAY_DELAY);
51
- }, [src, attributes]);
55
+ }, [handleAnalytics, analyticsEvents, src, attributes]);
52
56
  useEffect(() => {
53
57
  const updateSize = _.debounce(() => {
54
58
  setCurrentHeight(ref.current ? Math.round(getHeight(ref.current.offsetWidth)) : undefined);
@@ -78,14 +82,14 @@ const VideoBlock = (props) => {
78
82
  ref.current.appendChild(iframe);
79
83
  iframeRef.current = iframe;
80
84
  }
81
- }, [stream, record, norender, src, fullId, attributes, iframeRef, fullScreen]);
85
+ }, [stream, record, norender, src, fullId, attributes, iframeRef, fullscreen]);
82
86
  useEffect(() => {
83
87
  setHidePreview(false);
84
88
  }, [src, setHidePreview]);
85
89
  if (norender) {
86
90
  return null;
87
91
  }
88
- return (React.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && !fullScreen && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
92
+ return (React.createElement("div", { className: b(null, className), ref: ref, style: { height: currentHeight } }, previewImg && !hidePreview && !fullscreen && (React.createElement("div", { className: b('preview'), onClick: onPreviewClick },
89
93
  React.createElement(Image, { src: previewImg, className: b('image'), containerClassName: b('image-wrapper') }),
90
94
  playButton || (React.createElement("button", { className: b('button') },
91
95
  React.createElement(Icon, { className: b('icon'), data: PlayVideo, size: 24 })))))));
@@ -33,6 +33,6 @@ export { default as Author } from './Author/Author';
33
33
  export { default as RouterLink } from './RouterLink/RouterLink';
34
34
  export { default as HTML } from './HTML/HTML';
35
35
  export { default as MetaInfo } from './MetaInfo/MetaInfo';
36
- export { default as FullScreenMedia } from './FullscreenMedia/FullScreenMedia';
36
+ export { default as FullscreenMedia } from './FullscreenMedia/FullscreenMedia';
37
37
  export type { RouterLinkProps } from './RouterLink/RouterLink';
38
38
  export type { ImageBaseProps } from './ImageBase/ImageBase';
@@ -33,4 +33,4 @@ export { default as Author } from './Author/Author';
33
33
  export { default as RouterLink } from './RouterLink/RouterLink';
34
34
  export { default as HTML } from './HTML/HTML';
35
35
  export { default as MetaInfo } from './MetaInfo/MetaInfo';
36
- export { default as FullScreenMedia } from './FullscreenMedia/FullScreenMedia';
36
+ export { default as FullscreenMedia } from './FullscreenMedia/FullscreenMedia';
@@ -23,7 +23,7 @@ export declare const subBlockMap: {
23
23
  "price-detailed": (props: import("./models").PriceDetailedProps) => JSX.Element;
24
24
  "media-card": ({ border, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
25
25
  "banner-card": (props: import("./models").BannerCardProps) => JSX.Element;
26
- "layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullScreen, className, }: import("./models").LayoutItemProps) => JSX.Element;
26
+ "layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullscreen, className, }: import("./models").LayoutItemProps) => JSX.Element;
27
27
  "background-card": (props: import("./models").BackgroundCardProps) => JSX.Element;
28
28
  "basic-card": (props: import("./models").BasicCardProps) => JSX.Element;
29
29
  content: (props: import("./models").ContentBlockProps & import("./models").ClassNameProps) => JSX.Element;
@@ -7,4 +7,4 @@ export interface GridColumnProps extends GridColumnClassParams, Refable<HTMLDivE
7
7
  dataQa?: string;
8
8
  children?: React.ReactNode;
9
9
  }
10
- export declare const Col: React.ForwardRefExoticComponent<Pick<WithChildren<GridColumnProps>, "style" | "children" | "className" | "reset" | "sizes" | "offsets" | "orders" | "hidden" | "visible" | "alignSelf" | "justifyContent" | "dataQa"> & React.RefAttributes<HTMLDivElement>>;
10
+ export declare const Col: React.ForwardRefExoticComponent<Pick<WithChildren<GridColumnProps>, "style" | "children" | "className" | "reset" | "visible" | "sizes" | "offsets" | "orders" | "hidden" | "alignSelf" | "justifyContent" | "dataQa"> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const Fullscreen: React.FC<React.SVGProps<SVGSVGElement>>;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { a11yHiddenSvgProps } from '../utils/svg';
3
- export const FullScreen = (props) => (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor" }, a11yHiddenSvgProps, props),
3
+ export const Fullscreen = (props) => (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor" }, a11yHiddenSvgProps, props),
4
4
  React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M18 4.654v.291a10 10 0 0 0-1.763 1.404l-2.944 2.944a1 1 0 0 0 1.414 1.414l2.933-2.932A9.996 9.996 0 0 0 19.05 6h.296l-.09.39A9.993 9.993 0 0 0 19 8.64v.857a1 1 0 0 0 2 0V4.503a1.5 1.5 0 0 0-1.5-1.5L14.5 3a1 1 0 1 0 0 2h.861a10 10 0 0 0 2.249-.256l.39-.09zM4.95 18a10 10 0 0 1 1.41-1.775l2.933-2.932a1 1 0 0 1 1.414 1.414l-2.944 2.944A9.998 9.998 0 0 1 6 19.055v.291l.39-.09A9.993 9.993 0 0 1 8.64 19h.86a1 1 0 0 1 0 2l-5-.003a1.5 1.5 0 0 1-1.5-1.5V14.5a1 1 0 1 1 2 0v.861a10 10 0 0 1-.256 2.249l-.09.39h.296z" })));
@@ -1,7 +1,7 @@
1
1
  export * from './ArrowConstructor';
2
2
  export * from './ArrowSidebar';
3
3
  export * from './Chevron';
4
- export * from './FullScreen';
4
+ export * from './Fullscreen';
5
5
  export * from './Github';
6
6
  export * from './NavigationChevron';
7
7
  export * from './PlayVideo';
@@ -1,7 +1,7 @@
1
1
  export * from './ArrowConstructor';
2
2
  export * from './ArrowSidebar';
3
3
  export * from './Chevron';
4
- export * from './FullScreen';
4
+ export * from './Fullscreen';
5
5
  export * from './Github';
6
6
  export * from './NavigationChevron';
7
7
  export * from './PlayVideo';
@@ -79,7 +79,8 @@ export declare enum DefaultEventNames {
79
79
  HubspotFormSubmit = "hubspot-form-submit",
80
80
  QuoteButton = "quote-button-click",
81
81
  BackLink = "back-link-click",
82
- Breadcrumb = "breadcrumb-click"
82
+ Breadcrumb = "breadcrumb-click",
83
+ VideoPreview = "video-preview-click"
83
84
  }
84
85
  export type AnalyticsCounters = {
85
86
  include?: string[];
@@ -45,4 +45,5 @@ export var DefaultEventNames;
45
45
  DefaultEventNames["QuoteButton"] = "quote-button-click";
46
46
  DefaultEventNames["BackLink"] = "back-link-click";
47
47
  DefaultEventNames["Breadcrumb"] = "breadcrumb-click";
48
+ DefaultEventNames["VideoPreview"] = "video-preview-click";
48
49
  })(DefaultEventNames || (DefaultEventNames = {}));
@@ -212,7 +212,7 @@ export interface TabsBlockProps extends Animatable {
212
212
  items: TabsBlockItem[];
213
213
  }
214
214
  export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
215
- title: TitleItemProps | string;
215
+ title?: TitleItemProps | string;
216
216
  description?: string;
217
217
  colSizes?: GridColumnSizesType;
218
218
  }
@@ -169,7 +169,7 @@ export interface MediaComponentVideoProps extends AnalyticsEventsBase {
169
169
  export interface MediaComponentYoutubeProps {
170
170
  youtube: string;
171
171
  previewImg?: string;
172
- fullScreen?: boolean;
172
+ fullscreen?: boolean;
173
173
  }
174
174
  export interface MediaComponentImageProps {
175
175
  image: ImageProps | ImageProps[] | ImageDeviceProps;
@@ -94,7 +94,7 @@ export interface LayoutItemProps extends ClassNameProps {
94
94
  media: MediaProps;
95
95
  metaInfo?: string[];
96
96
  border?: boolean;
97
- fullScreen?: boolean;
97
+ fullscreen?: boolean;
98
98
  }
99
99
  export type DividerModel = {
100
100
  type: SubBlockType.Divider;