@meduza/ui-kit-2 1.4.11-dark.1 → 1.4.12-analytics.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.
- package/dist/RelatedCarousel/RelatedCarousel.types.d.ts +1 -0
- package/dist/ui-kit-2.cjs.development.js +38 -10
- 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 +38 -10
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/RelatedBlock/index.tsx +24 -9
- package/src/RelatedBook/index.tsx +9 -0
- package/src/RelatedCarousel/RelatedCarousel.types.ts +1 -0
- package/src/RelatedCarousel/index.tsx +6 -2
- package/src/RelatedRichBlock/index.tsx +9 -0
package/dist/ui-kit-2.esm.js
CHANGED
|
@@ -1532,6 +1532,11 @@ const ListBlock = ({
|
|
|
1532
1532
|
|
|
1533
1533
|
var styles$k = {"root":"RelatedBlock-module_root__cr1c-","header":"RelatedBlock-module_header__bfUJD","items":"RelatedBlock-module_items__rzzam","rich":"RelatedBlock-module_rich__1cWdn","first":"RelatedBlock-module_first__ZkcP5","simple":"RelatedBlock-module_simple__m22bj","center":"RelatedBlock-module_center__WVpIJ","isInSlideMaterial":"RelatedBlock-module_isInSlideMaterial__VumDw","mobile":"RelatedBlock-module_mobile__AScBA","desktop":"RelatedBlock-module_desktop__uMXUY"};
|
|
1534
1534
|
|
|
1535
|
+
const handleClick = (event, to) => {
|
|
1536
|
+
if (event.button <= 1) {
|
|
1537
|
+
postMessage('related', to, 'click');
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1535
1540
|
const RelatedBlock = ({
|
|
1536
1541
|
block: {
|
|
1537
1542
|
data: {
|
|
@@ -1553,14 +1558,19 @@ const RelatedBlock = ({
|
|
|
1553
1558
|
className: styles$k.header
|
|
1554
1559
|
}, title), /*#__PURE__*/React.createElement("ul", {
|
|
1555
1560
|
className: styles$k.items
|
|
1556
|
-
}, related.map((item, index) =>
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1561
|
+
}, related.map((item, index) => {
|
|
1562
|
+
const to = item.full_url || `/${item.url}`;
|
|
1563
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
1564
|
+
key: item.id || index,
|
|
1565
|
+
className: styles$k[item.layout]
|
|
1566
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
1567
|
+
to: to,
|
|
1568
|
+
onClick: event => handleClick(event, to),
|
|
1569
|
+
onAuxClick: event => handleClick(event, to)
|
|
1570
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
1571
|
+
className: styles$k.first
|
|
1572
|
+
}, item.title), item.second_title && ' ', item.second_title && /*#__PURE__*/React.createElement("span", null, item.second_title)));
|
|
1573
|
+
})));
|
|
1564
1574
|
};
|
|
1565
1575
|
|
|
1566
1576
|
var styles$j = {"root":"SourceBlock-module_root__9dnI4","text":"SourceBlock-module_text__M5-uy","origin":"SourceBlock-module_origin__fyvxH","center":"SourceBlock-module_center__UOMwy","mobile":"SourceBlock-module_mobile__QVEyg","desktop":"SourceBlock-module_desktop__xdXWm","isDark":"SourceBlock-module_isDark__etwk1"};
|
|
@@ -2419,10 +2429,17 @@ const RelatedRichBlock = ({
|
|
|
2419
2429
|
classNames = makeStyleContext(classNames, styleContext, styles$6);
|
|
2420
2430
|
context = [...styleContext, 'isInMediaBlock', 'richRelated'];
|
|
2421
2431
|
}
|
|
2432
|
+
const handleClick = event => {
|
|
2433
|
+
if (event.button <= 1) {
|
|
2434
|
+
postMessage('related', `/${url}`, 'click');
|
|
2435
|
+
}
|
|
2436
|
+
};
|
|
2422
2437
|
return /*#__PURE__*/React.createElement(Link, {
|
|
2423
2438
|
"data-testid": "related-rich-block",
|
|
2424
2439
|
className: makeClassName(classNames),
|
|
2425
|
-
to: `/${url}
|
|
2440
|
+
to: `/${url}`,
|
|
2441
|
+
onClick: handleClick,
|
|
2442
|
+
onAuxClick: handleClick
|
|
2426
2443
|
}, /*#__PURE__*/React.createElement("div", {
|
|
2427
2444
|
className: styles$6.tag
|
|
2428
2445
|
}, /*#__PURE__*/React.createElement(Tag, {
|
|
@@ -2546,8 +2563,15 @@ const RelatedBook = ({
|
|
|
2546
2563
|
const cssProps = {
|
|
2547
2564
|
'--bgColor': `rgb(${block.data.theme.background_color || '0, 0, 0'})`
|
|
2548
2565
|
};
|
|
2566
|
+
const handleClick = event => {
|
|
2567
|
+
if (event.button <= 1) {
|
|
2568
|
+
postMessage('related', `/${block.data.url}`, 'click');
|
|
2569
|
+
}
|
|
2570
|
+
};
|
|
2549
2571
|
return /*#__PURE__*/React.createElement(Link, {
|
|
2550
2572
|
to: `/${block.data.url}`,
|
|
2573
|
+
onClick: handleClick,
|
|
2574
|
+
onAuxClick: handleClick,
|
|
2551
2575
|
className: makeClassName(classNames),
|
|
2552
2576
|
style: cssProps
|
|
2553
2577
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -2711,7 +2735,8 @@ const getDotScale = (index, start, total) => {
|
|
|
2711
2735
|
};
|
|
2712
2736
|
const RelatedCarousel = ({
|
|
2713
2737
|
children,
|
|
2714
|
-
ariaLabel
|
|
2738
|
+
ariaLabel,
|
|
2739
|
+
onSlideChange
|
|
2715
2740
|
}) => {
|
|
2716
2741
|
const [viewportRef, embla] = useEmblaCarousel({
|
|
2717
2742
|
loop: true,
|
|
@@ -2719,6 +2744,8 @@ const RelatedCarousel = ({
|
|
|
2719
2744
|
containScroll: false
|
|
2720
2745
|
});
|
|
2721
2746
|
const [activeIndex, setActiveIndex] = useState(0);
|
|
2747
|
+
const onSlideChangeRef = useRef(onSlideChange);
|
|
2748
|
+
onSlideChangeRef.current = onSlideChange;
|
|
2722
2749
|
const [dotsStart, setDotsStart] = useState(0);
|
|
2723
2750
|
const slides = React.Children.toArray(children);
|
|
2724
2751
|
const total = slides.length;
|
|
@@ -2728,6 +2755,7 @@ const RelatedCarousel = ({
|
|
|
2728
2755
|
}
|
|
2729
2756
|
const index = embla.selectedScrollSnap();
|
|
2730
2757
|
setActiveIndex(index);
|
|
2758
|
+
onSlideChangeRef.current?.(index);
|
|
2731
2759
|
setDotsStart(start => getDotsStart(index, start, total));
|
|
2732
2760
|
}, [embla, total]);
|
|
2733
2761
|
useEffect(() => {
|