@meduza/ui-kit-2 0.1.38 → 0.1.40
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.
- package/dist/Image/Image.types.d.ts +1 -0
- package/dist/RelatedBlock/RelatedBlock.types.d.ts +0 -1
- package/dist/SensitiveBlock/SensitiveBlock.types.d.ts +1 -1
- package/dist/ui-kit-2.cjs.development.js +35 -53
- package/dist/ui-kit-2.cjs.development.js.map +1 -1
- package/dist/ui-kit-2.cjs.production.min.js +1 -1
- package/dist/ui-kit-2.cjs.production.min.js.map +1 -1
- package/dist/ui-kit-2.esm.js +35 -53
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/dist/ui-kit.css +1621 -1585
- package/package.json +1 -1
- package/src/EmbedBlock/EmbedBlock.module.css +11 -4
- package/src/Image/Image.module.css +7 -11
- package/src/Image/Image.types.ts +1 -0
- package/src/Image/RenderPicture.tsx +3 -1
- package/src/Image/index.tsx +9 -5
- package/src/Lazy/Lazy.module.css +0 -4
- package/src/RelatedBlock/RelatedBlock.types.ts +0 -1
- package/src/RelatedBlock/index.tsx +0 -9
- package/src/RelatedRichBlock/index.tsx +3 -28
- package/src/SensitiveBlock/SensitiveBlock.module.css +46 -12
- package/src/SensitiveBlock/SensitiveBlock.types.ts +1 -1
- package/src/SensitiveBlock/index.tsx +17 -13
|
@@ -339,7 +339,7 @@ var imageConditionalKeys = {
|
|
|
339
339
|
narrow: [600, 325]
|
|
340
340
|
};
|
|
341
341
|
|
|
342
|
-
var styles$3 = {"root":"Lazy-module_root__2Z72l"
|
|
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_","
|
|
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","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","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_"};
|
|
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,
|
|
@@ -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,7 +1679,7 @@ var SourceBlock = function SourceBlock(_ref) {
|
|
|
1679
1679
|
}, origin))));
|
|
1680
1680
|
};
|
|
1681
1681
|
|
|
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","super_full":"SensitiveBlock-module_super_full__14UOv","visible":"SensitiveBlock-module_visible__1B-NV"};
|
|
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
1684
|
var SensitiveBlock = function SensitiveBlock(_ref) {
|
|
1685
1685
|
var block = _ref.block,
|
|
@@ -1699,9 +1699,17 @@ var SensitiveBlock = function SensitiveBlock(_ref) {
|
|
|
1699
1699
|
isVisible(true);
|
|
1700
1700
|
};
|
|
1701
1701
|
|
|
1702
|
+
var classNames = [[styles$s.root, true], [styles$s.visible, visible], [styles$s[display], display && styles$s[display]]];
|
|
1703
|
+
var context = ['isInSensitiveBlock'];
|
|
1704
|
+
|
|
1705
|
+
if (styleContext) {
|
|
1706
|
+
classNames = makeStyleContext(classNames, styleContext, styles$s);
|
|
1707
|
+
context = [].concat(styleContext, ['isInSensitiveBlock']);
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1702
1710
|
return React__default.createElement("div", {
|
|
1703
1711
|
"data-testid": "sensitive-block",
|
|
1704
|
-
className: makeClassName(
|
|
1712
|
+
className: makeClassName(classNames)
|
|
1705
1713
|
}, React__default.createElement("div", {
|
|
1706
1714
|
className: styles$s.container
|
|
1707
1715
|
}, React__default.createElement("div", {
|
|
@@ -1726,7 +1734,7 @@ var SensitiveBlock = function SensitiveBlock(_ref) {
|
|
|
1726
1734
|
className: styles$s.media
|
|
1727
1735
|
}, React__default.createElement(EmbedBlockContainer, {
|
|
1728
1736
|
block: block.item,
|
|
1729
|
-
styleContext:
|
|
1737
|
+
styleContext: context
|
|
1730
1738
|
}))), cc && React__default.createElement("figcaption", {
|
|
1731
1739
|
className: styles$s.figcaption
|
|
1732
1740
|
}, React__default.createElement(MediaCaption, {
|
|
@@ -2386,7 +2394,6 @@ var RelatedRichBlock = function RelatedRichBlock(_ref) {
|
|
|
2386
2394
|
onlyOn = _ref$block.only_on,
|
|
2387
2395
|
_ref$block$data = _ref$block.data,
|
|
2388
2396
|
blocks = _ref$block$data.blocks,
|
|
2389
|
-
fallback = _ref$block$data.fallback,
|
|
2390
2397
|
url = _ref$block$data.url,
|
|
2391
2398
|
_ref$block$data$cover = _ref$block$data.cover,
|
|
2392
2399
|
urls = _ref$block$data$cover.urls,
|
|
@@ -2397,15 +2404,7 @@ var RelatedRichBlock = function RelatedRichBlock(_ref) {
|
|
|
2397
2404
|
styleContext = _ref.styleContext;
|
|
2398
2405
|
var style = {};
|
|
2399
2406
|
var styleHeader = {};
|
|
2400
|
-
|
|
2401
|
-
var _useState = React.useState('unset'),
|
|
2402
|
-
type = _useState[0],
|
|
2403
|
-
setType = _useState[1];
|
|
2404
|
-
|
|
2405
2407
|
var cardType = "is" + toCapitalize(layout);
|
|
2406
|
-
React.useEffect(function () {
|
|
2407
|
-
setType(Math.random() >= 0.5 ? 'simpleRelated' : 'richRelated');
|
|
2408
|
-
}, []);
|
|
2409
2408
|
|
|
2410
2409
|
var _useInView = reactIntersectionObserver.useInView({
|
|
2411
2410
|
threshold: 0,
|
|
@@ -2417,13 +2416,13 @@ var RelatedRichBlock = function RelatedRichBlock(_ref) {
|
|
|
2417
2416
|
React.useEffect(function () {
|
|
2418
2417
|
if (inView) {
|
|
2419
2418
|
if (onlyOn === 'mobile' && window.innerWidth <= 511 || onlyOn === 'desktop' && window.innerWidth >= 512 || !onlyOn) {
|
|
2420
|
-
postMessage(
|
|
2419
|
+
postMessage('richRelated', url, 'view');
|
|
2421
2420
|
}
|
|
2422
2421
|
}
|
|
2423
2422
|
}, [inView]);
|
|
2424
2423
|
|
|
2425
2424
|
var handleClick = function handleClick() {
|
|
2426
|
-
postMessage(
|
|
2425
|
+
postMessage('richRelated', url, 'click');
|
|
2427
2426
|
};
|
|
2428
2427
|
|
|
2429
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]]];
|
|
@@ -2444,23 +2443,6 @@ var RelatedRichBlock = function RelatedRichBlock(_ref) {
|
|
|
2444
2443
|
}
|
|
2445
2444
|
}
|
|
2446
2445
|
|
|
2447
|
-
if (type === 'unset') {
|
|
2448
|
-
return React__default.createElement("div", {
|
|
2449
|
-
className: styles$B.wrapper
|
|
2450
|
-
});
|
|
2451
|
-
}
|
|
2452
|
-
|
|
2453
|
-
if (type === 'simpleRelated') {
|
|
2454
|
-
return React__default.createElement("div", {
|
|
2455
|
-
ref: ref,
|
|
2456
|
-
className: styles$B.wrapper
|
|
2457
|
-
}, React__default.createElement(RelatedBlock, {
|
|
2458
|
-
block: fallback,
|
|
2459
|
-
trackClick: true,
|
|
2460
|
-
styleContext: styleContext
|
|
2461
|
-
}));
|
|
2462
|
-
}
|
|
2463
|
-
|
|
2464
2446
|
return React__default.createElement("a", {
|
|
2465
2447
|
"data-testid": "related-rich-block",
|
|
2466
2448
|
className: makeClassName(classNames),
|