@meduza/ui-kit-2 0.1.37 → 0.1.39

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 (45) hide show
  1. package/dist/Image/Image.types.d.ts +1 -0
  2. package/dist/RelatedBlock/RelatedBlock.types.d.ts +0 -1
  3. package/dist/SensitiveBlock/SensitiveBlock.stories.d.ts +10 -0
  4. package/dist/SensitiveBlock/SensitiveBlock.types.d.ts +15 -0
  5. package/dist/SensitiveBlock/index.d.ts +3 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/ui-kit-2.cjs.development.js +193 -142
  8. package/dist/ui-kit-2.cjs.development.js.map +1 -1
  9. package/dist/ui-kit-2.cjs.production.min.js +1 -1
  10. package/dist/ui-kit-2.cjs.production.min.js.map +1 -1
  11. package/dist/ui-kit-2.esm.js +193 -143
  12. package/dist/ui-kit-2.esm.js.map +1 -1
  13. package/dist/ui-kit.css +1860 -1704
  14. package/package.json +6 -6
  15. package/src/.DS_Store +0 -0
  16. package/src/EmbedBlock/EmbedBlock.module.css +30 -63
  17. package/src/EmbedBlock/EmbedBlock.tsx +10 -12
  18. package/src/GroupedBlock/index.tsx +22 -8
  19. package/src/GroupedBlock/mock.json +54 -47
  20. package/src/Image/Image.module.css +7 -11
  21. package/src/Image/Image.types.ts +1 -0
  22. package/src/Image/RenderPicture.tsx +3 -1
  23. package/src/Image/index.tsx +9 -5
  24. package/src/Lazy/Lazy.module.css +0 -4
  25. package/src/RawHtmlBlock/RawHtmlBlock.stories.module.css +3 -0
  26. package/src/RawHtmlBlock/RawHtmlBlock.stories.tsx +6 -1
  27. package/src/RawHtmlBlock/index.tsx +5 -0
  28. package/src/RawHtmlBlock/mock.json +113 -24
  29. package/src/RelatedBlock/RelatedBlock.types.ts +0 -1
  30. package/src/RelatedBlock/index.tsx +0 -9
  31. package/src/RelatedRichBlock/RelatedRichBlock.module.css +19 -12
  32. package/src/RelatedRichBlock/index.tsx +3 -28
  33. package/src/RenderBlocks/index.tsx +4 -5
  34. package/src/RenderBlocks/mock.json +0 -73
  35. package/src/SensitiveBlock/SensitiveBlock.module.css +177 -0
  36. package/src/SensitiveBlock/SensitiveBlock.stories.module.css +8 -0
  37. package/src/SensitiveBlock/SensitiveBlock.stories.tsx +40 -0
  38. package/src/SensitiveBlock/SensitiveBlock.test.tsx +20 -0
  39. package/src/SensitiveBlock/SensitiveBlock.types.ts +15 -0
  40. package/src/SensitiveBlock/index.tsx +74 -0
  41. package/src/SensitiveBlock/mock.json +61 -0
  42. package/src/Spoiler/index.tsx +2 -1
  43. package/src/SvgSymbol/SvgSymbol.module.css +1 -1
  44. package/src/index.tsx +1 -0
  45. package/src/vars.css +8 -8
@@ -33,4 +33,5 @@ export interface PictureProps {
33
33
  alt?: string;
34
34
  fallbackSource: string;
35
35
  display: string;
36
+ onLoad: (boolean: any) => void;
36
37
  }
@@ -13,6 +13,5 @@ export interface RelatedBlockProps {
13
13
  };
14
14
  only_on?: string;
15
15
  };
16
- trackClick?: boolean;
17
16
  styleContext?: string[] | string;
18
17
  }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ declare const _default: {
3
+ title: string;
4
+ component: React.FC<import("./SensitiveBlock.types").SensitiveBlockProps>;
5
+ parameters: {
6
+ themeWrapperSideBySide: boolean;
7
+ };
8
+ };
9
+ export default _default;
10
+ export declare const Default: React.FC;
@@ -0,0 +1,15 @@
1
+ export interface SensitiveBlockProps {
2
+ block: {
3
+ id: string;
4
+ title: string;
5
+ blurred_image: string;
6
+ button: {
7
+ text: string;
8
+ };
9
+ item: any;
10
+ credit?: string;
11
+ caption?: string;
12
+ cc: string;
13
+ };
14
+ styleContext?: string[];
15
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { SensitiveBlockProps } from './SensitiveBlock.types';
3
+ export declare const SensitiveBlock: React.FC<SensitiveBlockProps>;
package/dist/index.d.ts CHANGED
@@ -38,3 +38,4 @@ export * from './DocumentItemsCount';
38
38
  export * from './ToolbarButton';
39
39
  export * from './Footnote';
40
40
  export * from './RelatedRichBlock';
41
+ export * from './SensitiveBlock';
@@ -339,7 +339,7 @@ var imageConditionalKeys = {
339
339
  narrow: [600, 325]
340
340
  };
341
341
 
342
- var styles$3 = {"root":"Lazy-module_root__2Z72l","visible":"Lazy-module_visible__3-SdX"};
342
+ var styles$3 = {"root":"Lazy-module_root__2Z72l"};
343
343
 
344
344
  var Lazy = function Lazy(_ref) {
345
345
  var children = _ref.children,
@@ -387,7 +387,8 @@ var RenderPicture = function RenderPicture(_ref) {
387
387
  fallbackSource = _ref.fallbackSource,
388
388
  optimized = _ref.optimized,
389
389
  alt = _ref.alt,
390
- display = _ref.display;
390
+ display = _ref.display,
391
+ _onLoad = _ref.onLoad;
391
392
 
392
393
  var _useState = React.useState(false),
393
394
  fallback = _useState[0],
@@ -423,11 +424,14 @@ var RenderPicture = function RenderPicture(_ref) {
423
424
  }));
424
425
  }), React__default.createElement("img", {
425
426
  src: fallback ? fallbackSource : 'data:image/gif;base64,R0lGODlhAQABAPAAAPLy8gAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==',
426
- alt: alt
427
+ alt: alt,
428
+ onLoad: function onLoad() {
429
+ return _onLoad(true);
430
+ }
427
431
  }));
428
432
  };
429
433
 
430
- var styles$4 = {"root":"Image-module_root__1vsA_","placeholder":"Image-module_placeholder__1p4ob","wrapper":"Image-module_wrapper__3fLjs","loaded":"Image-module_loaded__w9FVT","fullscreen":"Image-module_fullscreen__29apx"};
434
+ var styles$4 = {"root":"Image-module_root__1vsA_","isLoaded":"Image-module_isLoaded__3XhU5","wrapper":"Image-module_wrapper__3fLjs","fullscreen":"Image-module_fullscreen__29apx"};
431
435
 
432
436
  var Image = function Image(_ref) {
433
437
  var alt = _ref.alt,
@@ -443,6 +447,10 @@ var Image = function Image(_ref) {
443
447
  var _useContext = React.useContext(BlockContext),
444
448
  lightBox = _useContext.lightBox;
445
449
 
450
+ var _useState = React.useState(false),
451
+ isLoaded = _useState[0],
452
+ setIsLoaded = _useState[1];
453
+
446
454
  var handleClick = function handleClick() {
447
455
  if (!fullscreen || !lightBox || optimized && !optimized.original) {
448
456
  return;
@@ -462,17 +470,17 @@ var Image = function Image(_ref) {
462
470
  lightBox.show(optimized, width, height, alt);
463
471
  };
464
472
 
465
- var pictureStyles = {
466
- paddingBottom: 100 / (ratio || width / height) + "%"
467
- };
468
473
  var blockStyles = {
469
474
  maxWidth: width <= 649 ? width : '100%'
470
475
  };
476
+ var pictureStyles = {
477
+ paddingBottom: 100 / (ratio || width / height) + "%"
478
+ };
471
479
  /* fallback w325 url until w6 was released */
472
480
 
473
481
  var fallbackSource = source && source[0] || optimized.w325 && optimized.w325['1x'] || optimized.original;
474
482
  return React__default.createElement("div", {
475
- className: makeClassName([[styles$4.root, true], [styles$4.fullscreen, fullscreen && fullscreen.desktop]]),
483
+ className: makeClassName([[styles$4.root, true], [styles$4.isLoaded, !isLoaded], [styles$4.fullscreen, fullscreen && fullscreen.desktop]]),
476
484
  style: blockStyles,
477
485
  "data-testid": "image"
478
486
  }, React__default.createElement("div", {
@@ -493,7 +501,8 @@ var Image = function Image(_ref) {
493
501
  source: source,
494
502
  optimized: optimized,
495
503
  alt: alt,
496
- display: display
504
+ display: display,
505
+ onLoad: setIsLoaded
497
506
  })), React__default.createElement("noscript", null, React__default.createElement("img", {
498
507
  src: fallbackSource,
499
508
  alt: alt
@@ -502,7 +511,8 @@ var Image = function Image(_ref) {
502
511
  source: source,
503
512
  optimized: optimized,
504
513
  alt: alt,
505
- display: display
514
+ display: display,
515
+ onLoad: setIsLoaded
506
516
  })));
507
517
  };
508
518
 
@@ -1142,7 +1152,7 @@ var DangerousHTML = function DangerousHTML(_ref) {
1142
1152
  }));
1143
1153
  };
1144
1154
 
1145
- var styles$i = {"root":"EmbedBlock-module_root__28k9U","object":"EmbedBlock-module_object__2_UZ7","objectWrap":"EmbedBlock-module_objectWrap__1aDVd","proportional":"EmbedBlock-module_proportional__3lAv4","attachment":"EmbedBlock-module_attachment__2pE0t","default":"EmbedBlock-module_default__LSDny","xs":"EmbedBlock-module_xs__1hFgW","full":"EmbedBlock-module_full__1TEjx","super_full":"EmbedBlock-module_super_full__1Fn9A","figure":"EmbedBlock-module_figure__vAvcN","dark":"EmbedBlock-module_dark__1be2G","isInGroupedBlock":"EmbedBlock-module_isInGroupedBlock__3r_i-","gameEmbed":"EmbedBlock-module_gameEmbed__AZQSo","mobile":"EmbedBlock-module_mobile__1P-eo","desktop":"EmbedBlock-module_desktop__SF5a_","control":"EmbedBlock-module_control__xr8dZ","raw_html":"EmbedBlock-module_raw_html__MQoAA","mobileFullwidth":"EmbedBlock-module_mobileFullwidth__QFFLH","isInCard":"EmbedBlock-module_isInCard__37rtq","isInSlide":"EmbedBlock-module_isInSlide__2ea5q","cc":"EmbedBlock-module_cc__1BQ5g","isInAnswer":"EmbedBlock-module_isInAnswer__tLlgs","picture":"EmbedBlock-module_picture__186q0","wrapper":"EmbedBlock-module_wrapper__33XvX"};
1155
+ var styles$i = {"root":"EmbedBlock-module_root__28k9U","object":"EmbedBlock-module_object__2_UZ7","objectWrap":"EmbedBlock-module_objectWrap__1aDVd","gameEmbed":"EmbedBlock-module_gameEmbed__AZQSo","proportional":"EmbedBlock-module_proportional__3lAv4","default":"EmbedBlock-module_default__LSDny","xs":"EmbedBlock-module_xs__1hFgW","full":"EmbedBlock-module_full__1TEjx","super_full":"EmbedBlock-module_super_full__1Fn9A","figure":"EmbedBlock-module_figure__vAvcN","dark":"EmbedBlock-module_dark__1be2G","isInGroupedBlock":"EmbedBlock-module_isInGroupedBlock__3r_i-","control":"EmbedBlock-module_control__xr8dZ","raw_html":"EmbedBlock-module_raw_html__MQoAA","mobileFullwidth":"EmbedBlock-module_mobileFullwidth__QFFLH","isInCard":"EmbedBlock-module_isInCard__37rtq","isInSlide":"EmbedBlock-module_isInSlide__2ea5q","cc":"EmbedBlock-module_cc__1BQ5g","isInSensitiveBlock":"EmbedBlock-module_isInSensitiveBlock__3wWYF","isInAnswer":"EmbedBlock-module_isInAnswer__tLlgs","picture":"EmbedBlock-module_picture__186q0","wrapper":"EmbedBlock-module_wrapper__33XvX","mobile":"EmbedBlock-module_mobile__1P-eo","desktop":"EmbedBlock-module_desktop__SF5a_"};
1146
1156
 
1147
1157
  var EmbedGif = function EmbedGif(_ref) {
1148
1158
  var gif = _ref.gif,
@@ -1259,7 +1269,7 @@ var EmbedBlock = function EmbedBlock(_ref) {
1259
1269
  {
1260
1270
  return React__default.createElement("div", {
1261
1271
  className: styles$i.figure
1262
- }, (small || optimized) && React__default.createElement(Image, {
1272
+ }, React__default.createElement(Image, {
1263
1273
  fullscreen: {
1264
1274
  desktop: block.data.fullscreen,
1265
1275
  mobile: true
@@ -1604,7 +1614,6 @@ var RelatedBlock = function RelatedBlock(_ref) {
1604
1614
  title = _ref$block$data.title,
1605
1615
  related = _ref$block$data.related,
1606
1616
  onlyOn = _ref$block.only_on,
1607
- trackClick = _ref.trackClick,
1608
1617
  styleContext = _ref.styleContext;
1609
1618
  var classNames = [[styles$q.root, true], [styles$q[onlyOn], true]];
1610
1619
 
@@ -1612,12 +1621,6 @@ var RelatedBlock = function RelatedBlock(_ref) {
1612
1621
  classNames = makeStyleContext(classNames, styleContext, styles$q);
1613
1622
  }
1614
1623
 
1615
- var handleClick = function handleClick(url) {
1616
- if (trackClick) {
1617
- postMessage('simpleRelated', url, 'click');
1618
- }
1619
- };
1620
-
1621
1624
  return React__default.createElement("div", {
1622
1625
  "data-testid": "related-block",
1623
1626
  className: makeClassName(classNames)
@@ -1632,10 +1635,7 @@ var RelatedBlock = function RelatedBlock(_ref) {
1632
1635
  }, React__default.createElement("a", {
1633
1636
  href: item.full_url || "/" + item.url,
1634
1637
  target: "_blank",
1635
- rel: "noopener noreferrer",
1636
- onClick: function onClick() {
1637
- return handleClick(item.full_url || item.url);
1638
- }
1638
+ rel: "noopener noreferrer"
1639
1639
  }, React__default.createElement("span", {
1640
1640
  className: styles$q.first
1641
1641
  }, item.title), item.second_title && ' ', item.second_title && React__default.createElement("span", null, item.second_title)));
@@ -1679,126 +1679,68 @@ var SourceBlock = function SourceBlock(_ref) {
1679
1679
  }, origin))));
1680
1680
  };
1681
1681
 
1682
- var styles$s = {"root":"RelatedRichBlock-module_root__3NYmj","wrapper":"RelatedRichBlock-module_wrapper__1eLIQ","overlay":"RelatedRichBlock-module_overlay__3XSg_","overlayHeader":"RelatedRichBlock-module_overlayHeader__2Nmbv","body":"RelatedRichBlock-module_body__1ZHZS","isRich":"RelatedRichBlock-module_isRich__1LnA4","hasGradient":"RelatedRichBlock-module_hasGradient__27LOk","picture":"RelatedRichBlock-module_picture__128HJ","isCard":"RelatedRichBlock-module_isCard__2naDz","cover":"RelatedRichBlock-module_cover__3yygp","tag":"RelatedRichBlock-module_tag__3OLyG","center":"RelatedRichBlock-module_center__197sx","dark":"RelatedRichBlock-module_dark__3Y1fE","light":"RelatedRichBlock-module_light__2mUxL","mobile":"RelatedRichBlock-module_mobile__JpCS4","desktop":"RelatedRichBlock-module_desktop__trL0D"};
1682
+ var styles$s = {"root":"SensitiveBlock-module_root__2iJbD","container":"SensitiveBlock-module_container__1Wtix","overlay":"SensitiveBlock-module_overlay__hfDVS","content":"SensitiveBlock-module_content__sNpxZ","button":"SensitiveBlock-module_button__3BGZK","default":"SensitiveBlock-module_default__2HgmZ","full":"SensitiveBlock-module_full__3Hph9","media":"SensitiveBlock-module_media__3wnlo","super_full":"SensitiveBlock-module_super_full__14UOv","visible":"SensitiveBlock-module_visible__1B-NV","isInCard":"SensitiveBlock-module_isInCard__1L-lu","isInSlide":"SensitiveBlock-module_isInSlide__f_Ql2"};
1683
1683
 
1684
- /* eslint-disable react/jsx-no-target-blank */
1685
- var RelatedRichBlock = function RelatedRichBlock(_ref) {
1686
- var _ref$block = _ref.block,
1687
- onlyOn = _ref$block.only_on,
1688
- _ref$block$data = _ref$block.data,
1689
- blocks = _ref$block$data.blocks,
1690
- fallback = _ref$block$data.fallback,
1691
- url = _ref$block$data.url,
1692
- _ref$block$data$cover = _ref$block$data.cover,
1693
- urls = _ref$block$data$cover.urls,
1694
- gradients = _ref$block$data$cover.gradients,
1695
- tag = _ref$block$data$cover.tag,
1696
- layout = _ref$block$data$cover.layout,
1697
- ratio = _ref$block$data$cover.ratio,
1684
+ var SensitiveBlock = function SensitiveBlock(_ref) {
1685
+ var block = _ref.block,
1686
+ _ref$block = _ref.block,
1687
+ cc = _ref$block.cc,
1688
+ caption = _ref$block.caption,
1689
+ credit = _ref$block.credit,
1690
+ blurredImage = _ref$block.blurred_image,
1691
+ display = _ref.block.item.data.display,
1698
1692
  styleContext = _ref.styleContext;
1699
- var style = {};
1700
- var styleHeader = {};
1701
-
1702
- var _useState = React.useState('unset'),
1703
- type = _useState[0],
1704
- setType = _useState[1];
1705
-
1706
- var cardType = "is" + toCapitalize(layout);
1707
- React.useEffect(function () {
1708
- setType(Math.random() >= 0.5 ? 'simpleRelated' : 'richRelated');
1709
- }, []);
1710
-
1711
- var _useInView = reactIntersectionObserver.useInView({
1712
- threshold: 0,
1713
- triggerOnce: true
1714
- }),
1715
- ref = _useInView[0],
1716
- inView = _useInView[1];
1717
1693
 
1718
- React.useEffect(function () {
1719
- if (inView) {
1720
- if (onlyOn === 'mobile' && window.innerWidth <= 511 || onlyOn === 'desktop' && window.innerWidth >= 512 || !onlyOn) {
1721
- postMessage(type, url, 'view');
1722
- }
1723
- }
1724
- }, [inView]);
1694
+ var _useState = React.useState(false),
1695
+ visible = _useState[0],
1696
+ isVisible = _useState[1];
1725
1697
 
1726
1698
  var handleClick = function handleClick() {
1727
- postMessage(type, url, 'click');
1699
+ isVisible(true);
1728
1700
  };
1729
1701
 
1730
- var classNames = [[styles$s.root, true], [styles$s[cardType], !!layout && !!styles$s[cardType]], [styles$s.hasGradient, !!gradients], [styles$s[onlyOn], !!onlyOn && !!styles$s[onlyOn]]];
1731
- var context = ['isInMediaBlock'];
1702
+ var classNames = [[styles$s.root, true], [styles$s.visible, visible], [styles$s[display], display && styles$s[display]]];
1703
+ var context = ['isInSensitiveBlock'];
1732
1704
 
1733
1705
  if (styleContext) {
1734
1706
  classNames = makeStyleContext(classNames, styleContext, styles$s);
1735
- context = [].concat(styleContext, ['isInMediaBlock']);
1707
+ context = [].concat(styleContext, ['isInSensitiveBlock']);
1736
1708
  }
1737
1709
 
1738
- if (gradients) {
1739
- styleHeader.backgroundImage = generateGradient(gradients.bg_rgb, 'mediaBlockTop');
1740
- var theme = [gradients.text_rgb === '0,0,0' ? 'dark' : 'light'];
1741
- classNames = makeStyleContext(classNames, theme, styles$s);
1742
-
1743
- if (onlyOn === 'desktop') {
1744
- style.backgroundImage = generateGradient(gradients.bg_rgb, 'mediaBlockBottom');
1710
+ return React__default.createElement("div", {
1711
+ "data-testid": "sensitive-block",
1712
+ className: makeClassName(classNames)
1713
+ }, React__default.createElement("div", {
1714
+ className: styles$s.container
1715
+ }, React__default.createElement("div", {
1716
+ className: styles$s.overlay,
1717
+ style: {
1718
+ backgroundImage: "url(" + blurredImage + ")"
1745
1719
  }
1746
- }
1747
-
1748
- if (type === 'unset') {
1749
- return React__default.createElement("div", {
1750
- className: styles$s.wrapper
1751
- });
1752
- }
1753
-
1754
- if (type === 'simpleRelated') {
1755
- return React__default.createElement("div", {
1756
- ref: ref,
1757
- className: styles$s.wrapper
1758
- }, React__default.createElement(RelatedBlock, {
1759
- block: fallback,
1760
- trackClick: true,
1761
- styleContext: styleContext
1762
- }));
1763
- }
1764
-
1765
- return React__default.createElement("a", {
1766
- "data-testid": "related-rich-block",
1767
- className: makeClassName(classNames),
1768
- href: "/" + url,
1769
- target: "_blank",
1720
+ }, React__default.createElement("div", {
1721
+ className: styles$s.content
1722
+ }, React__default.createElement("p", {
1723
+ dangerouslySetInnerHTML: {
1724
+ __html: block.title
1725
+ }
1726
+ }), React__default.createElement("div", {
1727
+ className: styles$s.button
1728
+ }, React__default.createElement(Button, {
1770
1729
  onClick: function onClick() {
1771
1730
  return handleClick();
1772
1731
  },
1773
- ref: ref
1774
- }, layout === 'rich' && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
1775
- className: styles$s.overlay,
1776
- style: style
1777
- }), React__default.createElement("div", {
1778
- className: styles$s.overlayHeader,
1779
- style: styleHeader
1780
- })), React__default.createElement("div", {
1781
- className: styles$s.tag
1782
- }, React__default.createElement(Tag, {
1783
- size: "small",
1784
- theme: "inherit",
1785
- styleContext: "richRelated"
1786
- }, tag)), React__default.createElement("div", {
1787
- className: styles$s.cover
1788
- }, React__default.createElement("div", {
1789
- className: styles$s.picture
1790
- }, React__default.createElement(Image, {
1791
- optimized: urls,
1792
- ratio: ratio,
1793
- display: "narrow"
1794
- }))), React__default.createElement("div", {
1795
- className: styles$s.body
1796
- }, blocks.map(function (item) {
1797
- return React__default.createElement(RenderBlocks, {
1798
- key: item.id,
1799
- block: item,
1800
- styleContext: context
1801
- });
1732
+ theme: "light"
1733
+ }, block.button.text)))), React__default.createElement("div", {
1734
+ className: styles$s.media
1735
+ }, React__default.createElement(EmbedBlockContainer, {
1736
+ block: block.item,
1737
+ styleContext: context
1738
+ }))), cc && React__default.createElement("figcaption", {
1739
+ className: styles$s.figcaption
1740
+ }, React__default.createElement(MediaCaption, {
1741
+ credit: credit,
1742
+ caption: caption,
1743
+ styleContext: styleContext
1802
1744
  })));
1803
1745
  };
1804
1746
 
@@ -1809,10 +1751,12 @@ var GroupedBlock = function GroupedBlock(_ref) {
1809
1751
  onlyOn = _ref.block.only_on,
1810
1752
  styleContext = _ref.styleContext;
1811
1753
  var maxHeight = Math.min.apply(Math, block.data.map(function (item) {
1812
- return item.data.height;
1754
+ return item.data && item.data.height || item.item.data.height;
1813
1755
  }));
1814
1756
  var normalizedBoxesWidth = block.data.map(function (item) {
1815
- return item.data.width / (item.data.height / maxHeight);
1757
+ var width = item.data && item.data.width || item.item.data.heigh;
1758
+ var height = item.data && item.data.height || item.item.data.heigh;
1759
+ return width / (height / maxHeight);
1816
1760
  });
1817
1761
  var sumWidth = normalizedBoxesWidth.reduce(function (sum, x) {
1818
1762
  return sum + x;
@@ -1836,7 +1780,10 @@ var GroupedBlock = function GroupedBlock(_ref) {
1836
1780
  style: {
1837
1781
  width: percentWidth + "%"
1838
1782
  }
1839
- }, React__default.createElement(EmbedBlockContainer, {
1783
+ }, item.type === 'sensitive' ? React__default.createElement(SensitiveBlock, {
1784
+ block: item,
1785
+ styleContext: ['isInGroupedBlock']
1786
+ }) : React__default.createElement(EmbedBlockContainer, {
1840
1787
  block: item,
1841
1788
  styleContext: ['isInGroupedBlock']
1842
1789
  }));
@@ -2150,14 +2097,6 @@ var RenderBlocks = function RenderBlocks(_ref) {
2150
2097
  });
2151
2098
  }
2152
2099
 
2153
- case 'related_rich':
2154
- {
2155
- return React__default.createElement(RelatedRichBlock, {
2156
- block: block,
2157
- styleContext: styleContext
2158
- });
2159
- }
2160
-
2161
2100
  case 'chapter-subtitle':
2162
2101
  {
2163
2102
  return React__default.createElement(ChapterBlock, {
@@ -2194,6 +2133,12 @@ var RenderBlocks = function RenderBlocks(_ref) {
2194
2133
  styleContext: styleContext
2195
2134
  });
2196
2135
 
2136
+ case 'sensitive':
2137
+ return React__default.createElement(SensitiveBlock, {
2138
+ block: block,
2139
+ styleContext: styleContext
2140
+ });
2141
+
2197
2142
  case 'embed':
2198
2143
  case 'embed_code':
2199
2144
  case 'game_embed':
@@ -2405,7 +2350,7 @@ var Spoiler = function Spoiler(_ref) {
2405
2350
  };
2406
2351
 
2407
2352
  var classNames = [[styles$A.root, true], [styles$A[onlyOn], !!onlyOn], [styles$A[display], !!display && styles$A[display]], [[styles$A.spoiled], !!spoiled]];
2408
- var context = ['center'].concat(styleContext);
2353
+ var context = ['center'];
2409
2354
 
2410
2355
  if (styleContext) {
2411
2356
  classNames = makeStyleContext(classNames, styleContext, styles$A);
@@ -2441,6 +2386,103 @@ var Spoiler = function Spoiler(_ref) {
2441
2386
  }))));
2442
2387
  };
2443
2388
 
2389
+ var styles$B = {"root":"RelatedRichBlock-module_root__3NYmj","wrapper":"RelatedRichBlock-module_wrapper__1eLIQ","overlay":"RelatedRichBlock-module_overlay__3XSg_","overlayHeader":"RelatedRichBlock-module_overlayHeader__2Nmbv","body":"RelatedRichBlock-module_body__1ZHZS","isRich":"RelatedRichBlock-module_isRich__1LnA4","hasGradient":"RelatedRichBlock-module_hasGradient__27LOk","picture":"RelatedRichBlock-module_picture__128HJ","isCard":"RelatedRichBlock-module_isCard__2naDz","cover":"RelatedRichBlock-module_cover__3yygp","tag":"RelatedRichBlock-module_tag__3OLyG","center":"RelatedRichBlock-module_center__197sx","dark":"RelatedRichBlock-module_dark__3Y1fE","light":"RelatedRichBlock-module_light__2mUxL","mobile":"RelatedRichBlock-module_mobile__JpCS4","desktop":"RelatedRichBlock-module_desktop__trL0D"};
2390
+
2391
+ /* eslint-disable react/jsx-no-target-blank */
2392
+ var RelatedRichBlock = function RelatedRichBlock(_ref) {
2393
+ var _ref$block = _ref.block,
2394
+ onlyOn = _ref$block.only_on,
2395
+ _ref$block$data = _ref$block.data,
2396
+ blocks = _ref$block$data.blocks,
2397
+ url = _ref$block$data.url,
2398
+ _ref$block$data$cover = _ref$block$data.cover,
2399
+ urls = _ref$block$data$cover.urls,
2400
+ gradients = _ref$block$data$cover.gradients,
2401
+ tag = _ref$block$data$cover.tag,
2402
+ layout = _ref$block$data$cover.layout,
2403
+ ratio = _ref$block$data$cover.ratio,
2404
+ styleContext = _ref.styleContext;
2405
+ var style = {};
2406
+ var styleHeader = {};
2407
+ var cardType = "is" + toCapitalize(layout);
2408
+
2409
+ var _useInView = reactIntersectionObserver.useInView({
2410
+ threshold: 0,
2411
+ triggerOnce: true
2412
+ }),
2413
+ ref = _useInView[0],
2414
+ inView = _useInView[1];
2415
+
2416
+ React.useEffect(function () {
2417
+ if (inView) {
2418
+ if (onlyOn === 'mobile' && window.innerWidth <= 511 || onlyOn === 'desktop' && window.innerWidth >= 512 || !onlyOn) {
2419
+ postMessage('richRelated', url, 'view');
2420
+ }
2421
+ }
2422
+ }, [inView]);
2423
+
2424
+ var handleClick = function handleClick() {
2425
+ postMessage('richRelated', url, 'click');
2426
+ };
2427
+
2428
+ var classNames = [[styles$B.root, true], [styles$B[cardType], !!layout && !!styles$B[cardType]], [styles$B.hasGradient, !!gradients], [styles$B[onlyOn], !!onlyOn && !!styles$B[onlyOn]]];
2429
+ var context = ['isInMediaBlock'];
2430
+
2431
+ if (styleContext) {
2432
+ classNames = makeStyleContext(classNames, styleContext, styles$B);
2433
+ context = [].concat(styleContext, ['isInMediaBlock']);
2434
+ }
2435
+
2436
+ if (gradients) {
2437
+ styleHeader.backgroundImage = generateGradient(gradients.bg_rgb, 'mediaBlockTop');
2438
+ var theme = [gradients.text_rgb === '0,0,0' ? 'dark' : 'light'];
2439
+ classNames = makeStyleContext(classNames, theme, styles$B);
2440
+
2441
+ if (onlyOn === 'desktop') {
2442
+ style.backgroundImage = generateGradient(gradients.bg_rgb, 'mediaBlockBottom');
2443
+ }
2444
+ }
2445
+
2446
+ return React__default.createElement("a", {
2447
+ "data-testid": "related-rich-block",
2448
+ className: makeClassName(classNames),
2449
+ href: "/" + url,
2450
+ target: "_blank",
2451
+ onClick: function onClick() {
2452
+ return handleClick();
2453
+ },
2454
+ ref: ref
2455
+ }, layout === 'rich' && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
2456
+ className: styles$B.overlay,
2457
+ style: style
2458
+ }), React__default.createElement("div", {
2459
+ className: styles$B.overlayHeader,
2460
+ style: styleHeader
2461
+ })), React__default.createElement("div", {
2462
+ className: styles$B.tag
2463
+ }, React__default.createElement(Tag, {
2464
+ size: "small",
2465
+ theme: "inherit",
2466
+ styleContext: "richRelated"
2467
+ }, tag)), React__default.createElement("div", {
2468
+ className: styles$B.cover
2469
+ }, React__default.createElement("div", {
2470
+ className: styles$B.picture
2471
+ }, React__default.createElement(Image, {
2472
+ optimized: urls,
2473
+ ratio: ratio,
2474
+ display: "narrow"
2475
+ }))), React__default.createElement("div", {
2476
+ className: styles$B.body
2477
+ }, blocks.map(function (item) {
2478
+ return React__default.createElement(RenderBlocks, {
2479
+ key: item.id,
2480
+ block: item,
2481
+ styleContext: context
2482
+ });
2483
+ })));
2484
+ };
2485
+
2444
2486
  var RawHtmlBlock = function RawHtmlBlock(_ref) {
2445
2487
  var block = _ref.block,
2446
2488
  styleContext = _ref.styleContext,
@@ -2488,6 +2530,14 @@ var RawHtmlBlock = function RawHtmlBlock(_ref) {
2488
2530
  });
2489
2531
  }
2490
2532
 
2533
+ case 'related_rich':
2534
+ {
2535
+ return React__default.createElement(RelatedRichBlock, {
2536
+ block: block,
2537
+ styleContext: styleContext
2538
+ });
2539
+ }
2540
+
2491
2541
  default:
2492
2542
  {
2493
2543
  return React__default.createElement(BlockProvider, {
@@ -2504,7 +2554,7 @@ var RawHtmlBlock = function RawHtmlBlock(_ref) {
2504
2554
  }
2505
2555
  };
2506
2556
 
2507
- var styles$B = {"root":"ToolbarButton-module_root__xN-fq","dark":"ToolbarButton-module_dark__GrIOr","bookmark":"ToolbarButton-module_bookmark__3369b","isActive":"ToolbarButton-module_isActive__3NLAE","text":"ToolbarButton-module_text__32m6s"};
2557
+ var styles$C = {"root":"ToolbarButton-module_root__xN-fq","dark":"ToolbarButton-module_dark__GrIOr","bookmark":"ToolbarButton-module_bookmark__3369b","isActive":"ToolbarButton-module_isActive__3NLAE","text":"ToolbarButton-module_text__32m6s"};
2508
2558
 
2509
2559
  var ToolbarButton = function ToolbarButton(_ref) {
2510
2560
  var children = _ref.children,
@@ -2512,7 +2562,7 @@ var ToolbarButton = function ToolbarButton(_ref) {
2512
2562
  theme = _ref.theme,
2513
2563
  isActive = _ref.isActive,
2514
2564
  _onClick = _ref.onClick;
2515
- var classNames = [[styles$B.root, true], [styles$B[type], !!styles$B[type]], [styles$B[theme], !!styles$B[theme] && !!theme], [styles$B.isActive, !!isActive]];
2565
+ var classNames = [[styles$C.root, true], [styles$C[type], !!styles$C[type]], [styles$C[theme], !!styles$C[theme] && !!theme], [styles$C.isActive, !!isActive]];
2516
2566
  return React__default.createElement("button", {
2517
2567
  "data-testid": "toolbar-button",
2518
2568
  className: makeClassName(classNames),
@@ -2525,7 +2575,7 @@ var ToolbarButton = function ToolbarButton(_ref) {
2525
2575
  icon: type,
2526
2576
  styleContext: "isInToolbar"
2527
2577
  }), children && React__default.createElement("span", {
2528
- className: styles$B.text
2578
+ className: styles$C.text
2529
2579
  }, children));
2530
2580
  };
2531
2581
 
@@ -2561,6 +2611,7 @@ exports.RelatedRichBlock = RelatedRichBlock;
2561
2611
  exports.RenderBlocks = RenderBlocks;
2562
2612
  exports.RichTitle = RichTitle;
2563
2613
  exports.Secondary = Secondary;
2614
+ exports.SensitiveBlock = SensitiveBlock;
2564
2615
  exports.SimpleBlock = SimpleBlock;
2565
2616
  exports.SimpleTitle = SimpleTitle;
2566
2617
  exports.SourceBlock = SourceBlock;