@megafon/ui-shared 2.0.0-beta.99 → 2.0.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 (211) hide show
  1. package/CHANGELOG.md +1610 -0
  2. package/README.md +0 -5
  3. package/dist/es/components/AccordionBox/AccordionBox.css +13 -0
  4. package/dist/es/components/AccordionBox/AccordionBox.d.ts +16 -1
  5. package/dist/es/components/AccordionBox/AccordionBox.js +29 -13
  6. package/dist/es/components/BannerBox/BannerBox.js +3 -2
  7. package/dist/es/components/BenefitsIcons/BenefitsIcons.d.ts +13 -2
  8. package/dist/es/components/BenefitsIcons/BenefitsIcons.js +82 -17
  9. package/dist/es/components/BenefitsIcons/BenefitsIconsTile.d.ts +2 -1
  10. package/dist/es/components/BenefitsIcons/BenefitsIconsTile.js +15 -14
  11. package/dist/es/components/BenefitsIcons/style/BenefitsIcons.css +3 -3
  12. package/dist/es/components/BenefitsIcons/style/BenefitsIconsTile.css +19 -12
  13. package/dist/es/components/BenefitsIcons/types.d.ts +7 -2
  14. package/dist/es/components/BenefitsIcons/types.js +4 -0
  15. package/dist/es/components/BenefitsPictures/BenefitsPictures.d.ts +10 -1
  16. package/dist/es/components/BenefitsPictures/BenefitsPictures.js +28 -12
  17. package/dist/es/components/BenefitsPictures/BenfitsPictures.css +4 -4
  18. package/dist/es/components/Breadcrumbs/Breadcrumbs.css +46 -0
  19. package/dist/es/components/Breadcrumbs/Breadcrumbs.d.ts +21 -0
  20. package/dist/es/components/Breadcrumbs/Breadcrumbs.js +49 -0
  21. package/dist/es/components/ButtonBanner/ButtonBanner.css +122 -0
  22. package/dist/es/components/ButtonBanner/ButtonBanner.d.ts +54 -0
  23. package/dist/es/components/ButtonBanner/ButtonBanner.js +107 -0
  24. package/dist/es/components/ButtonLinkBox/ButtonLinkBox.css +3 -3
  25. package/dist/es/components/ButtonLinkBox/ButtonLinkBox.d.ts +22 -2
  26. package/dist/es/components/ButtonLinkBox/ButtonLinkBox.js +37 -8
  27. package/dist/es/components/Card/Card.css +71 -44
  28. package/dist/es/components/Card/Card.d.ts +33 -3
  29. package/dist/es/components/Card/Card.js +103 -42
  30. package/dist/es/components/CardsBox/CardsBox.d.ts +10 -2
  31. package/dist/es/components/CardsBox/CardsBox.js +26 -13
  32. package/dist/es/components/CarouselBox/CarouselBox.js +3 -2
  33. package/dist/es/components/Container/Container.css +1815 -547
  34. package/dist/es/components/Container/Container.d.ts +11 -1
  35. package/dist/es/components/Container/Container.js +28 -6
  36. package/dist/es/components/DownloadLinks/DownloadLink.css +5 -5
  37. package/dist/es/components/DownloadLinks/DownloadLink.d.ts +7 -0
  38. package/dist/es/components/DownloadLinks/DownloadLink.js +28 -6
  39. package/dist/es/components/DownloadLinks/DownloadLinks.css +9 -6
  40. package/dist/es/components/DownloadLinks/DownloadLinks.d.ts +2 -0
  41. package/dist/es/components/DownloadLinks/DownloadLinks.js +18 -3
  42. package/dist/es/components/Instructions/Instructions.css +189 -130
  43. package/dist/es/components/Instructions/Instructions.d.ts +21 -2
  44. package/dist/es/components/Instructions/Instructions.js +115 -74
  45. package/dist/es/components/Instructions/img/iphone12.png +0 -0
  46. package/dist/es/components/PageTitle/PageTitle.css +80 -0
  47. package/dist/es/components/PageTitle/PageTitle.d.ts +23 -0
  48. package/dist/es/components/PageTitle/PageTitle.js +65 -0
  49. package/dist/es/components/Partners/Partners.css +22 -31
  50. package/dist/es/components/Partners/Partners.d.ts +13 -1
  51. package/dist/es/components/Partners/Partners.js +40 -18
  52. package/dist/es/components/PictureWithDescription/PictureWithDescription.css +25 -10
  53. package/dist/es/components/PictureWithDescription/PictureWithDescription.d.ts +13 -0
  54. package/dist/es/components/PictureWithDescription/PictureWithDescription.js +31 -7
  55. package/dist/es/components/Property/Property.css +79 -71
  56. package/dist/es/components/Property/Property.d.ts +21 -2
  57. package/dist/es/components/Property/Property.js +80 -34
  58. package/dist/es/components/Property/PropertyDescription.css +3 -3
  59. package/dist/es/components/Property/PropertyDescription.js +19 -21
  60. package/dist/es/components/Property/types.d.ts +7 -2
  61. package/dist/es/components/Steps/Steps.css +41 -0
  62. package/dist/es/components/Steps/Steps.d.ts +10 -0
  63. package/dist/es/components/Steps/Steps.js +35 -0
  64. package/dist/es/components/Steps/StepsItem.css +37 -0
  65. package/dist/es/components/Steps/StepsItem.d.ts +10 -0
  66. package/dist/es/components/Steps/StepsItem.js +26 -0
  67. package/dist/es/components/StoreBanner/StoreBanner.css +289 -0
  68. package/dist/es/components/StoreBanner/StoreBanner.d.ts +65 -0
  69. package/dist/es/components/StoreBanner/StoreBanner.js +145 -0
  70. package/dist/es/components/StoreBanner/doc/img/new-iphone-screen.png +0 -0
  71. package/dist/es/components/StoreBanner/doc/img/qr-code.png +0 -0
  72. package/dist/es/components/StoreBanner/doc/img/screen.png +0 -0
  73. package/dist/es/components/StoreBanner/img/android.png +0 -0
  74. package/dist/es/components/StoreBanner/img/black-iphone.png +0 -0
  75. package/dist/es/components/StoreBanner/img/new-iphone.png +0 -0
  76. package/dist/es/components/StoreBanner/img/white-iphone.png +0 -0
  77. package/dist/es/components/StoreButton/StoreButton.css +15 -0
  78. package/dist/es/components/StoreButton/StoreButton.d.ts +17 -0
  79. package/dist/es/components/StoreButton/StoreButton.js +37 -0
  80. package/dist/es/components/StoreButton/img/app-store.png +0 -0
  81. package/dist/es/components/StoreButton/img/google-play.png +0 -0
  82. package/dist/es/components/StoreButton/img/huawei-store.png +0 -0
  83. package/dist/es/components/Table/Table.css +67 -67
  84. package/dist/es/components/Table/Table.js +4 -4
  85. package/dist/es/components/Table/TableRow.js +1 -0
  86. package/dist/es/components/TabsBox/TabsBox.d.ts +4 -1
  87. package/dist/es/components/TabsBox/TabsBox.js +24 -3
  88. package/dist/es/components/TextBox/TextBox.css +7 -1
  89. package/dist/es/components/TextBox/TextBox.d.ts +8 -0
  90. package/dist/es/components/TextBox/TextBox.js +37 -5
  91. package/dist/es/components/TextBox/TextBoxPicture.css +24 -0
  92. package/dist/es/components/TextBox/TextBoxPicture.d.ts +17 -0
  93. package/dist/es/components/TextBox/TextBoxPicture.js +32 -0
  94. package/dist/es/components/TitleDescriptionBox/TitleDescriptionBox.css +15 -4
  95. package/dist/es/components/TitleDescriptionBox/TitleDescriptionBox.d.ts +8 -2
  96. package/dist/es/components/TitleDescriptionBox/TitleDescriptionBox.js +34 -14
  97. package/dist/es/components/VideoBanner/VideoBanner.css +155 -76
  98. package/dist/es/components/VideoBanner/VideoBanner.d.ts +64 -13
  99. package/dist/es/components/VideoBanner/VideoBanner.js +202 -70
  100. package/dist/es/components/VideoBlock/VideoBlock.css +32 -28
  101. package/dist/es/components/VideoBlock/VideoBlock.d.ts +20 -6
  102. package/dist/es/components/VideoBlock/VideoBlock.js +63 -44
  103. package/dist/es/constants/throttleTime.d.ts +4 -0
  104. package/dist/es/constants/throttleTime.js +3 -0
  105. package/dist/es/index.d.ts +8 -0
  106. package/dist/es/index.js +8 -0
  107. package/dist/lib/components/AccordionBox/AccordionBox.css +13 -0
  108. package/dist/lib/components/AccordionBox/AccordionBox.d.ts +16 -1
  109. package/dist/lib/components/AccordionBox/AccordionBox.js +31 -19
  110. package/dist/lib/components/BannerBox/BannerBox.js +3 -5
  111. package/dist/lib/components/BenefitsIcons/BenefitsIcons.d.ts +13 -2
  112. package/dist/lib/components/BenefitsIcons/BenefitsIcons.js +84 -20
  113. package/dist/lib/components/BenefitsIcons/BenefitsIconsTile.d.ts +2 -1
  114. package/dist/lib/components/BenefitsIcons/BenefitsIconsTile.js +15 -16
  115. package/dist/lib/components/BenefitsIcons/style/BenefitsIcons.css +3 -3
  116. package/dist/lib/components/BenefitsIcons/style/BenefitsIconsTile.css +19 -12
  117. package/dist/lib/components/BenefitsIcons/types.d.ts +7 -2
  118. package/dist/lib/components/BenefitsIcons/types.js +7 -2
  119. package/dist/lib/components/BenefitsPictures/BenefitsPictures.d.ts +10 -1
  120. package/dist/lib/components/BenefitsPictures/BenefitsPictures.js +32 -15
  121. package/dist/lib/components/BenefitsPictures/BenfitsPictures.css +4 -4
  122. package/dist/lib/components/Breadcrumbs/Breadcrumbs.css +46 -0
  123. package/dist/lib/components/Breadcrumbs/Breadcrumbs.d.ts +21 -0
  124. package/dist/lib/components/Breadcrumbs/Breadcrumbs.js +65 -0
  125. package/dist/lib/components/ButtonBanner/ButtonBanner.css +122 -0
  126. package/dist/lib/components/ButtonBanner/ButtonBanner.d.ts +54 -0
  127. package/dist/lib/components/ButtonBanner/ButtonBanner.js +133 -0
  128. package/dist/lib/components/ButtonLinkBox/ButtonLinkBox.css +3 -3
  129. package/dist/lib/components/ButtonLinkBox/ButtonLinkBox.d.ts +22 -2
  130. package/dist/lib/components/ButtonLinkBox/ButtonLinkBox.js +45 -11
  131. package/dist/lib/components/Card/Card.css +71 -44
  132. package/dist/lib/components/Card/Card.d.ts +33 -3
  133. package/dist/lib/components/Card/Card.js +118 -59
  134. package/dist/lib/components/CardsBox/CardsBox.d.ts +10 -2
  135. package/dist/lib/components/CardsBox/CardsBox.js +30 -16
  136. package/dist/lib/components/CarouselBox/CarouselBox.js +3 -5
  137. package/dist/lib/components/Container/Container.css +1815 -547
  138. package/dist/lib/components/Container/Container.d.ts +11 -1
  139. package/dist/lib/components/Container/Container.js +32 -11
  140. package/dist/lib/components/DownloadLinks/DownloadLink.css +5 -5
  141. package/dist/lib/components/DownloadLinks/DownloadLink.d.ts +7 -0
  142. package/dist/lib/components/DownloadLinks/DownloadLink.js +32 -11
  143. package/dist/lib/components/DownloadLinks/DownloadLinks.css +9 -6
  144. package/dist/lib/components/DownloadLinks/DownloadLinks.d.ts +2 -0
  145. package/dist/lib/components/DownloadLinks/DownloadLinks.js +20 -6
  146. package/dist/lib/components/Instructions/Instructions.css +189 -130
  147. package/dist/lib/components/Instructions/Instructions.d.ts +21 -2
  148. package/dist/lib/components/Instructions/Instructions.js +148 -104
  149. package/dist/lib/components/Instructions/img/iphone12.png +0 -0
  150. package/dist/lib/components/PageTitle/PageTitle.css +80 -0
  151. package/dist/lib/components/PageTitle/PageTitle.d.ts +23 -0
  152. package/dist/lib/components/PageTitle/PageTitle.js +85 -0
  153. package/dist/lib/components/Partners/Partners.css +22 -31
  154. package/dist/lib/components/Partners/Partners.d.ts +13 -1
  155. package/dist/lib/components/Partners/Partners.js +43 -23
  156. package/dist/lib/components/PictureWithDescription/PictureWithDescription.css +25 -10
  157. package/dist/lib/components/PictureWithDescription/PictureWithDescription.d.ts +13 -0
  158. package/dist/lib/components/PictureWithDescription/PictureWithDescription.js +33 -8
  159. package/dist/lib/components/Property/Property.css +79 -71
  160. package/dist/lib/components/Property/Property.d.ts +21 -2
  161. package/dist/lib/components/Property/Property.js +93 -53
  162. package/dist/lib/components/Property/PropertyDescription.css +3 -3
  163. package/dist/lib/components/Property/PropertyDescription.js +21 -25
  164. package/dist/lib/components/Property/types.d.ts +7 -2
  165. package/dist/lib/components/Steps/Steps.css +41 -0
  166. package/dist/lib/components/Steps/Steps.d.ts +10 -0
  167. package/dist/lib/components/Steps/Steps.js +55 -0
  168. package/dist/lib/components/Steps/StepsItem.css +37 -0
  169. package/dist/lib/components/Steps/StepsItem.d.ts +10 -0
  170. package/dist/lib/components/Steps/StepsItem.js +39 -0
  171. package/dist/lib/components/StoreBanner/StoreBanner.css +289 -0
  172. package/dist/lib/components/StoreBanner/StoreBanner.d.ts +65 -0
  173. package/dist/lib/components/StoreBanner/StoreBanner.js +169 -0
  174. package/dist/lib/components/StoreBanner/doc/img/new-iphone-screen.png +0 -0
  175. package/dist/lib/components/StoreBanner/doc/img/qr-code.png +0 -0
  176. package/dist/lib/components/StoreBanner/doc/img/screen.png +0 -0
  177. package/dist/lib/components/StoreBanner/img/android.png +0 -0
  178. package/dist/lib/components/StoreBanner/img/black-iphone.png +0 -0
  179. package/dist/lib/components/StoreBanner/img/new-iphone.png +0 -0
  180. package/dist/lib/components/StoreBanner/img/white-iphone.png +0 -0
  181. package/dist/lib/components/StoreButton/StoreButton.css +15 -0
  182. package/dist/lib/components/StoreButton/StoreButton.d.ts +17 -0
  183. package/dist/lib/components/StoreButton/StoreButton.js +58 -0
  184. package/dist/lib/components/StoreButton/img/app-store.png +0 -0
  185. package/dist/lib/components/StoreButton/img/google-play.png +0 -0
  186. package/dist/lib/components/StoreButton/img/huawei-store.png +0 -0
  187. package/dist/lib/components/Table/Table.css +67 -67
  188. package/dist/lib/components/Table/Table.js +6 -8
  189. package/dist/lib/components/Table/TableRow.js +1 -0
  190. package/dist/lib/components/TabsBox/TabsBox.d.ts +4 -1
  191. package/dist/lib/components/TabsBox/TabsBox.js +25 -2
  192. package/dist/lib/components/TextBox/TextBox.css +7 -1
  193. package/dist/lib/components/TextBox/TextBox.d.ts +8 -0
  194. package/dist/lib/components/TextBox/TextBox.js +39 -6
  195. package/dist/lib/components/TextBox/TextBoxPicture.css +24 -0
  196. package/dist/lib/components/TextBox/TextBoxPicture.d.ts +17 -0
  197. package/dist/lib/components/TextBox/TextBoxPicture.js +49 -0
  198. package/dist/lib/components/TitleDescriptionBox/TitleDescriptionBox.css +15 -4
  199. package/dist/lib/components/TitleDescriptionBox/TitleDescriptionBox.d.ts +8 -2
  200. package/dist/lib/components/TitleDescriptionBox/TitleDescriptionBox.js +39 -19
  201. package/dist/lib/components/VideoBanner/VideoBanner.css +155 -76
  202. package/dist/lib/components/VideoBanner/VideoBanner.d.ts +64 -13
  203. package/dist/lib/components/VideoBanner/VideoBanner.js +225 -89
  204. package/dist/lib/components/VideoBlock/VideoBlock.css +32 -28
  205. package/dist/lib/components/VideoBlock/VideoBlock.d.ts +20 -6
  206. package/dist/lib/components/VideoBlock/VideoBlock.js +76 -68
  207. package/dist/lib/constants/throttleTime.d.ts +4 -0
  208. package/dist/lib/constants/throttleTime.js +10 -0
  209. package/dist/lib/index.d.ts +8 -0
  210. package/dist/lib/index.js +64 -0
  211. package/package.json +19 -75
@@ -2,59 +2,141 @@ import "core-js/modules/es.symbol";
2
2
  import "core-js/modules/es.symbol.description";
3
3
  import "core-js/modules/es.array.concat";
4
4
  import "core-js/modules/es.object.values";
5
+ import "core-js/modules/es.string.link";
6
+ import _extends from "@babel/runtime/helpers/extends";
5
7
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
- import * as React from 'react';
7
- import * as PropTypes from 'prop-types';
8
+ import React from 'react';
9
+ import { Button, Header, ContentArea, TextLink, Grid, GridColumn } from '@megafon/ui-core';
10
+ import { breakpoints, cnCreate, filterDataAttrs, convert } from '@megafon/ui-helpers';
8
11
  import throttle from 'lodash.throttle';
12
+ import * as PropTypes from 'prop-types';
13
+ import throttleTime from "../../constants/throttleTime";
14
+ import Breadcrumbs from "../Breadcrumbs/Breadcrumbs";
9
15
  import "./VideoBanner.css";
10
- import { Button, cnCreate, Header, Paragraph, breakpoints, throttleTime } from '@megafon/ui-core';
11
- export var VideoTypes = {
16
+ var cn = cnCreate('mfui-video-banner');
17
+ export var ClassName;
18
+
19
+ (function (ClassName) {
20
+ ClassName["BUTTON"] = "button";
21
+ ClassName["LINK"] = "link";
22
+ })(ClassName || (ClassName = {}));
23
+
24
+ var typographyConfig = {
25
+ b: {
26
+ component: function component(_ref) {
27
+ var children = _ref.children;
28
+ return /*#__PURE__*/React.createElement(Header, {
29
+ className: cn('value'),
30
+ as: "h3",
31
+ color: "inherit"
32
+ }, children);
33
+ }
34
+ }
35
+ };
36
+ export var VideoType = {
12
37
  YOUTUBE: 'youtube',
13
38
  VIDEO: 'video'
14
39
  };
15
- var cn = cnCreate('mfui-beta-video-banner');
40
+ export var ButtonColor = {
41
+ GREEN: 'green',
42
+ PURPLE: 'purple'
43
+ };
44
+ export var TextColor = {
45
+ BLACK: 'black',
46
+ WHITE: 'white'
47
+ };
16
48
 
17
- var VideoBanner = function VideoBanner(_ref) {
18
- var videoSrc = _ref.videoSrc,
19
- videoType = _ref.videoType,
20
- image = _ref.image,
21
- content = _ref.content,
22
- _ref$isMuted = _ref.isMuted,
23
- isMuted = _ref$isMuted === void 0 ? true : _ref$isMuted;
49
+ var VideoBanner = function VideoBanner(_ref2) {
50
+ var dataAttrs = _ref2.dataAttrs,
51
+ className = _ref2.className,
52
+ _ref2$classes = _ref2.classes,
53
+ classes = _ref2$classes === void 0 ? {} : _ref2$classes,
54
+ rootRef = _ref2.rootRef,
55
+ videoSrc = _ref2.videoSrc,
56
+ videoType = _ref2.videoType,
57
+ imageMobile = _ref2.imageMobile,
58
+ imageTablet = _ref2.imageTablet,
59
+ _ref2$imageDesktop = _ref2.imageDesktop,
60
+ imageDesktop = _ref2$imageDesktop === void 0 ? '' : _ref2$imageDesktop,
61
+ _ref2$imageDesktopWid = _ref2.imageDesktopWide,
62
+ imageDesktopWide = _ref2$imageDesktopWid === void 0 ? '' : _ref2$imageDesktopWid,
63
+ content = _ref2.content,
64
+ _ref2$isMuted = _ref2.isMuted,
65
+ isMuted = _ref2$isMuted === void 0 ? true : _ref2$isMuted,
66
+ breadcrumbs = _ref2.breadcrumbs;
24
67
 
25
68
  var _React$useState = React.useState(true),
26
69
  _React$useState2 = _slicedToArray(_React$useState, 2),
27
70
  isMobile = _React$useState2[0],
28
71
  setIsMobile = _React$useState2[1];
29
72
 
30
- var isVideo = !!videoSrc && !!videoType;
31
- var isRenderVideo = !isMobile && isVideo;
32
- var renderContent = React.useCallback(function (_ref2) {
33
- var title = _ref2.title,
34
- description = _ref2.description,
35
- buttonTitle = _ref2.buttonTitle,
36
- href = _ref2.href,
37
- onButtonClick = _ref2.onButtonClick;
38
- return /*#__PURE__*/React.createElement("div", {
39
- className: cn('content')
73
+ var _React$useState3 = React.useState(imageMobile),
74
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
75
+ imageSrc = _React$useState4[0],
76
+ setImageSrc = _React$useState4[1];
77
+
78
+ var isVideoData = !!videoSrc && !!videoType;
79
+ var isRenderVideo = !isMobile && isVideoData;
80
+ var renderContent = React.useCallback(function (_ref3) {
81
+ var title = _ref3.title,
82
+ description = _ref3.description,
83
+ buttonTitle = _ref3.buttonTitle,
84
+ buttonHref = _ref3.buttonHref,
85
+ buttonDownload = _ref3.buttonDownload,
86
+ _ref3$buttonColor = _ref3.buttonColor,
87
+ buttonColor = _ref3$buttonColor === void 0 ? ButtonColor.GREEN : _ref3$buttonColor,
88
+ onButtonClick = _ref3.onButtonClick,
89
+ onLinkClick = _ref3.onLinkClick,
90
+ _ref3$textColor = _ref3.textColor,
91
+ textColor = _ref3$textColor === void 0 ? TextColor.BLACK : _ref3$textColor,
92
+ textColorMobile = _ref3.textColorMobile,
93
+ linkTitle = _ref3.linkTitle,
94
+ linkUrl = _ref3.linkUrl,
95
+ linkDownload = _ref3.linkDownload,
96
+ cost = _ref3.cost;
97
+ return /*#__PURE__*/React.createElement(Grid, {
98
+ className: cn('grid'),
99
+ guttersLeft: "medium"
100
+ }, /*#__PURE__*/React.createElement(GridColumn, {
101
+ mobile: "12",
102
+ tablet: "7",
103
+ desktop: "7",
104
+ wide: "6"
105
+ }, /*#__PURE__*/React.createElement("div", {
106
+ className: cn('content', {
107
+ 'text-color': textColor,
108
+ 'text-color-mobile': textColorMobile
109
+ })
40
110
  }, /*#__PURE__*/React.createElement(Header, {
41
111
  className: cn('title'),
42
- color: "white",
43
- as: "h1"
112
+ as: "h1",
113
+ color: "inherit"
44
114
  }, title), /*#__PURE__*/React.createElement("div", {
45
115
  className: cn('text')
46
- }, /*#__PURE__*/React.createElement(Paragraph, {
47
- color: "clearWhite",
48
- hasMargin: false
49
- }, description)), /*#__PURE__*/React.createElement(Button, {
50
- className: cn('button'),
51
- href: href,
52
- onClick: onButtonClick
53
- }, buttonTitle));
54
- }, []);
116
+ }, /*#__PURE__*/React.createElement(Header, {
117
+ as: "h5",
118
+ color: "inherit",
119
+ className: cn('description')
120
+ }, description), cost && /*#__PURE__*/React.createElement("div", {
121
+ className: cn('cost')
122
+ }, convert(cost, typographyConfig))), /*#__PURE__*/React.createElement("div", {
123
+ className: cn('btns-wrapper')
124
+ }, buttonTitle && /*#__PURE__*/React.createElement(Button, {
125
+ className: cn(ClassName.BUTTON, [classes.button]),
126
+ theme: buttonColor,
127
+ href: buttonHref,
128
+ onClick: onButtonClick,
129
+ download: buttonDownload
130
+ }, buttonTitle), linkTitle && /*#__PURE__*/React.createElement(TextLink, {
131
+ className: cn(ClassName.LINK, [classes.link]),
132
+ href: linkUrl,
133
+ download: linkDownload,
134
+ onClick: onLinkClick
135
+ }, linkTitle)))));
136
+ }, [classes.button, classes.link]);
55
137
  var renderVideo = React.useCallback(function () {
56
138
  switch (videoType) {
57
- case VideoTypes.YOUTUBE:
139
+ case VideoType.YOUTUBE:
58
140
  {
59
141
  var url = "https://www.youtube.com/embed/".concat(videoSrc, "?");
60
142
  var autoplay = '&autoplay=1';
@@ -67,6 +149,7 @@ var VideoBanner = function VideoBanner(_ref) {
67
149
  var playlist = "&playlist=".concat(videoSrc);
68
150
  var src = "".concat(url).concat(autoplay).concat(mute).concat(loop).concat(rel).concat(controls).concat(info).concat(policy).concat(playlist);
69
151
  return /*#__PURE__*/React.createElement("iframe", {
152
+ title: "iframe",
70
153
  className: cn('video'),
71
154
  src: src,
72
155
  width: "100%",
@@ -76,17 +159,21 @@ var VideoBanner = function VideoBanner(_ref) {
76
159
  });
77
160
  }
78
161
 
79
- case VideoTypes.VIDEO:
162
+ case VideoType.VIDEO:
80
163
  {
81
- return /*#__PURE__*/React.createElement("video", {
82
- className: cn('video'),
83
- autoPlay: true,
84
- loop: true,
85
- muted: isMuted
86
- }, /*#__PURE__*/React.createElement("source", {
87
- src: videoSrc,
88
- type: "video/mp4"
89
- }));
164
+ return (
165
+ /*#__PURE__*/
166
+ // eslint-disable-next-line jsx-a11y/media-has-caption
167
+ React.createElement("video", {
168
+ className: cn('video'),
169
+ autoPlay: true,
170
+ loop: true,
171
+ muted: isMuted
172
+ }, /*#__PURE__*/React.createElement("source", {
173
+ src: videoSrc,
174
+ type: "video/mp4"
175
+ }))
176
+ );
90
177
  }
91
178
 
92
179
  default:
@@ -95,20 +182,28 @@ var VideoBanner = function VideoBanner(_ref) {
95
182
  }
96
183
  }
97
184
  }, [videoType, videoSrc, isMuted]);
98
- var renderImage = React.useCallback(function (_ref3) {
99
- var mobile = _ref3.mobile,
100
- desktop = _ref3.desktop;
101
- var src = desktop && !isMobile ? desktop : mobile;
102
- return /*#__PURE__*/React.createElement("img", {
103
- src: src,
104
- className: cn('background-image', {
105
- 'mobile': !desktop
106
- })
107
- });
108
- }, [isMobile]);
109
185
  React.useEffect(function () {
186
+ var getImageSrc = function getImageSrc() {
187
+ var windowWidth = window.innerWidth;
188
+
189
+ switch (true) {
190
+ case windowWidth >= breakpoints.DESKTOP_MIDDLE_START:
191
+ return imageDesktopWide;
192
+
193
+ case windowWidth >= breakpoints.DESKTOP_SMALL_START && windowWidth <= breakpoints.DESKTOP_SMALL_END:
194
+ return imageDesktop;
195
+
196
+ case windowWidth >= breakpoints.MOBILE_BIG_START && windowWidth <= breakpoints.MOBILE_BIG_END:
197
+ return imageTablet;
198
+
199
+ default:
200
+ return imageMobile;
201
+ }
202
+ };
203
+
110
204
  var resizeHandler = function resizeHandler() {
111
- return window.innerWidth <= breakpoints.mobileBigEnd ? setIsMobile(true) : setIsMobile(false);
205
+ setIsMobile(window.innerWidth < breakpoints.DESKTOP_SMALL_START);
206
+ setImageSrc(getImageSrc());
112
207
  };
113
208
 
114
209
  var resizeHandlerThrottled = throttle(resizeHandler, throttleTime.resize);
@@ -117,28 +212,65 @@ var VideoBanner = function VideoBanner(_ref) {
117
212
  return function () {
118
213
  window.removeEventListener('resize', resizeHandlerThrottled);
119
214
  };
120
- }, []);
121
- return /*#__PURE__*/React.createElement("div", {
122
- className: cn()
123
- }, /*#__PURE__*/React.createElement("div", {
215
+ }, [imageDesktop, imageDesktopWide, imageMobile, imageTablet]);
216
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs), {
217
+ className: cn([className, classes.root]),
218
+ ref: rootRef
219
+ }), /*#__PURE__*/React.createElement(ContentArea, null, /*#__PURE__*/React.createElement("div", {
124
220
  className: cn('wrapper')
125
- }, renderImage(image), content && renderContent(content), isRenderVideo && renderVideo()));
221
+ }, !!(breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.length) && /*#__PURE__*/React.createElement(Breadcrumbs, {
222
+ className: cn('breadcrumbs'),
223
+ items: breadcrumbs,
224
+ color: content === null || content === void 0 ? void 0 : content.textColor,
225
+ classes: {
226
+ item: classes.breadcrumbs
227
+ }
228
+ }), content && renderContent(content), isRenderVideo && renderVideo(), !isRenderVideo && /*#__PURE__*/React.createElement("div", {
229
+ style: {
230
+ backgroundImage: "url(".concat(imageSrc, ")")
231
+ },
232
+ className: cn('background-image')
233
+ }))));
126
234
  };
127
235
 
128
236
  VideoBanner.propTypes = {
237
+ dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
238
+ className: PropTypes.string,
239
+ classes: PropTypes.shape({
240
+ root: PropTypes.string,
241
+ button: PropTypes.string,
242
+ link: PropTypes.string,
243
+ breadcrumbs: PropTypes.string
244
+ }),
245
+ rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
246
+ current: PropTypes.elementType
247
+ }), PropTypes.any])]),
129
248
  videoSrc: PropTypes.string,
130
- videoType: PropTypes.oneOf(Object.values(VideoTypes)),
249
+ videoType: PropTypes.oneOf(Object.values(VideoType)),
131
250
  content: PropTypes.shape({
132
251
  title: PropTypes.string.isRequired,
133
252
  description: PropTypes.string.isRequired,
134
- buttonTitle: PropTypes.string.isRequired,
135
- href: PropTypes.string,
136
- onButtonClick: PropTypes.func
253
+ buttonTitle: PropTypes.string,
254
+ buttonHref: PropTypes.string,
255
+ buttonDownload: PropTypes.bool,
256
+ buttonColor: PropTypes.oneOf(Object.values(ButtonColor)),
257
+ onButtonClick: PropTypes.func,
258
+ onLinkClick: PropTypes.func,
259
+ textColor: PropTypes.oneOf(Object.values(TextColor)),
260
+ textColorMobile: PropTypes.oneOf(Object.values(TextColor)),
261
+ linkTitle: PropTypes.string,
262
+ linkUrl: PropTypes.string,
263
+ linkDownload: PropTypes.bool,
264
+ cost: PropTypes.string
137
265
  }),
138
- image: PropTypes.shape({
139
- mobile: PropTypes.string.isRequired,
140
- desktop: PropTypes.string
141
- }).isRequired,
142
- isMuted: PropTypes.bool
266
+ isMuted: PropTypes.bool,
267
+ imageMobile: PropTypes.string.isRequired,
268
+ imageTablet: PropTypes.string.isRequired,
269
+ imageDesktop: PropTypes.string,
270
+ imageDesktopWide: PropTypes.string,
271
+ breadcrumbs: PropTypes.arrayOf(PropTypes.shape({
272
+ title: PropTypes.string.isRequired,
273
+ href: PropTypes.string
274
+ }).isRequired)
143
275
  };
144
276
  export default VideoBanner;
@@ -5,7 +5,7 @@ h4,
5
5
  h5 {
6
6
  margin: 0;
7
7
  }
8
- .mfui-beta-video-block {
8
+ .mfui-video-block {
9
9
  display: -webkit-box;
10
10
  display: -ms-flexbox;
11
11
  display: flex;
@@ -13,7 +13,7 @@ h5 {
13
13
  -ms-flex-align: center;
14
14
  align-items: center;
15
15
  }
16
- .mfui-beta-video-block__content {
16
+ .mfui-video-block__content {
17
17
  display: -webkit-box;
18
18
  display: -ms-flexbox;
19
19
  display: flex;
@@ -21,103 +21,107 @@ h5 {
21
21
  -webkit-box-direction: normal;
22
22
  -ms-flex-direction: column;
23
23
  flex-direction: column;
24
- height: 100%;
25
24
  -webkit-box-pack: center;
26
25
  -ms-flex-pack: center;
27
26
  justify-content: center;
27
+ height: 100%;
28
28
  }
29
29
  @media screen and (max-width: 767px) {
30
- .mfui-beta-video-block__content {
30
+ .mfui-video-block__content {
31
31
  margin-top: 24px;
32
32
  }
33
33
  }
34
34
  @media screen and (min-width: 768px) and (max-width: 1023px) {
35
- .mfui-beta-video-block__content {
35
+ .mfui-video-block__content {
36
36
  margin-top: 32px;
37
37
  }
38
38
  }
39
39
  @media screen and (min-width: 768px) {
40
- .mfui-beta-video-block__content {
41
- padding-right: 20px;
40
+ .mfui-video-block__content {
42
41
  margin-right: 20px;
42
+ padding-right: 20px;
43
43
  }
44
44
  }
45
- .mfui-beta-video-block__header {
45
+ .mfui-video-block__header {
46
46
  margin-bottom: 24px;
47
47
  }
48
48
  @media screen and (max-width: 1023px) {
49
- .mfui-beta-video-block__header {
49
+ .mfui-video-block__header {
50
50
  margin-bottom: 16px;
51
51
  }
52
52
  }
53
- .mfui-beta-video-block__text:not(:first-child) {
54
- margin-top: 24px;
53
+ .mfui-video-block__description {
54
+ font-size: 15px;
55
+ line-height: 24px;
56
+ font-weight: 400;
55
57
  }
56
- .mfui-beta-video-block__button {
58
+ .mfui-video-block__button {
59
+ -ms-flex-item-align: start;
60
+ align-self: flex-start;
61
+ max-width: 100%;
57
62
  margin-top: 32px;
58
- width: 171px;
59
63
  }
60
64
  @media screen and (max-width: 767px) {
61
- .mfui-beta-video-block__button {
65
+ .mfui-video-block__button {
62
66
  -ms-flex-item-align: center;
63
67
  align-self: center;
64
68
  }
65
69
  }
66
- .mfui-beta-video-block__video {
70
+ .mfui-video-block__video {
67
71
  width: 100%;
68
72
  height: 100%;
69
73
  -o-object-fit: contain;
70
74
  object-fit: contain;
71
75
  }
72
- .mfui-beta-video-block__video-wrapper {
76
+ .mfui-video-block__video-wrapper {
73
77
  height: 674px;
74
78
  overflow: hidden;
75
79
  }
76
80
  @media screen and (min-width: 1440px) and (max-width: 1599px) {
77
- .mfui-beta-video-block__video-wrapper {
81
+ .mfui-video-block__video-wrapper {
78
82
  height: 600px;
79
83
  }
80
84
  }
81
85
  @media screen and (min-width: 1280px) and (max-width: 1439px) {
82
- .mfui-beta-video-block__video-wrapper {
86
+ .mfui-video-block__video-wrapper {
83
87
  height: 524px;
84
88
  }
85
89
  }
86
90
  @media screen and (min-width: 1024px) and (max-width: 1279px) {
87
- .mfui-beta-video-block__video-wrapper {
91
+ .mfui-video-block__video-wrapper {
88
92
  height: 505px;
89
93
  }
90
94
  }
91
- .mfui-beta-video-block__video-wrapper_with-content {
95
+ .mfui-video-block__video-wrapper_with-content {
92
96
  height: 468px;
93
97
  }
94
98
  @media screen and (min-width: 1440px) and (max-width: 1599px) {
95
- .mfui-beta-video-block__video-wrapper_with-content {
99
+ .mfui-video-block__video-wrapper_with-content {
96
100
  height: 415px;
97
101
  }
98
102
  }
99
103
  @media screen and (min-width: 1280px) and (max-width: 1439px) {
100
- .mfui-beta-video-block__video-wrapper_with-content {
104
+ .mfui-video-block__video-wrapper_with-content {
101
105
  height: 363px;
102
106
  }
103
107
  }
104
108
  @media screen and (min-width: 1024px) and (max-width: 1279px) {
105
- .mfui-beta-video-block__video-wrapper_with-content {
109
+ .mfui-video-block__video-wrapper_with-content {
106
110
  height: 328px;
107
111
  }
108
112
  }
109
113
  @media screen and (min-width: 768px) and (max-width: 1023px) {
110
- .mfui-beta-video-block__video-wrapper,
111
- .mfui-beta-video-block__video-wrapper_with-content {
114
+ .mfui-video-block__video-wrapper,
115
+ .mfui-video-block__video-wrapper_with-content {
112
116
  height: 379px;
113
117
  }
114
118
  }
115
119
  @media screen and (max-width: 767px) {
116
- .mfui-beta-video-block__video-wrapper,
117
- .mfui-beta-video-block__video-wrapper_with-content {
120
+ .mfui-video-block__video-wrapper,
121
+ .mfui-video-block__video-wrapper_with-content {
118
122
  height: 162px;
119
123
  }
120
124
  }
121
- .mfui-beta-video-block__grid {
125
+ .mfui-video-block__grid {
122
126
  width: 100%;
123
127
  }
@@ -1,12 +1,14 @@
1
- import * as React from 'react';
1
+ import React, { Ref } from 'react';
2
2
  import './VideoBlock.less';
3
3
  export interface IContent {
4
4
  /** Заголовок */
5
5
  title: string;
6
6
  /** Текст-описание */
7
- description: string[];
7
+ description: string | React.ReactNode[] | React.ReactNode;
8
8
  /** Текст кнопки */
9
9
  buttonTitle: string;
10
+ /** Добавляет атрибут download для тега <a> компонента Button */
11
+ buttonDownload?: boolean;
10
12
  /** Ссылка на кнопке */
11
13
  href?: string;
12
14
  /** Обработчик клика по кнопке */
@@ -17,7 +19,21 @@ export declare const VideoTypes: {
17
19
  readonly VIDEO: "video";
18
20
  };
19
21
  declare type VideoType = typeof VideoTypes[keyof typeof VideoTypes];
20
- export interface Props {
22
+ export interface IVideoBlockProps {
23
+ /** Дата атрибуты для корневого элемента */
24
+ dataAttrs?: {
25
+ [key: string]: string;
26
+ };
27
+ /** Дополнительный класс корневого элемента */
28
+ className?: string;
29
+ /** Дополнительные классы для корневого и внутренних элементов */
30
+ classes?: {
31
+ root?: string;
32
+ button?: string;
33
+ description?: string;
34
+ };
35
+ /** Ссылка на корневой элемент */
36
+ rootRef?: Ref<HTMLDivElement>;
21
37
  /** Данные для блока с контентом */
22
38
  content?: IContent;
23
39
  /** Тип видео */
@@ -28,8 +44,6 @@ export interface Props {
28
44
  isMuted?: boolean;
29
45
  /** Автоматическое проигрывание видео */
30
46
  isAutoplay?: boolean;
31
- /** Дополнительный класс корневого элемента */
32
- className?: string;
33
47
  }
34
- declare const VideoBlock: React.FC<Props>;
48
+ declare const VideoBlock: React.FC<IVideoBlockProps>;
35
49
  export default VideoBlock;