@meduza/ui-kit-2 1.0.6 → 1.0.7
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/ui-kit-2.cjs.development.js +11 -6
- 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 +11 -6
- package/dist/ui-kit-2.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/EmbedBlock/EmbedBlock.tsx +1 -0
- package/src/Image/index.tsx +16 -13
package/dist/ui-kit-2.esm.js
CHANGED
|
@@ -478,8 +478,9 @@ const Image = ({
|
|
|
478
478
|
lightBox
|
|
479
479
|
} = useContext(BlockContext);
|
|
480
480
|
const [isLoaded, setIsLoaded] = useState(lazy ? false : true);
|
|
481
|
+
const isFullscreenEnabled = Boolean(lightBox && optimized?.original && fullscreen);
|
|
481
482
|
const handleClick = () => {
|
|
482
|
-
if (!
|
|
483
|
+
if (!isFullscreenEnabled) {
|
|
483
484
|
return;
|
|
484
485
|
}
|
|
485
486
|
postMessage('', 'fullscreen_click', 'click');
|
|
@@ -493,10 +494,16 @@ const Image = ({
|
|
|
493
494
|
};
|
|
494
495
|
/* fallback w325 url until w6 was released */
|
|
495
496
|
const fallbackSource = source && source[0] || optimized.w325 && optimized.w325['1x'] || optimized.original;
|
|
496
|
-
let classNames = [[styles$F.root, true], [styles$F.isLoaded, isLoaded], [styles$F.fullscreen,
|
|
497
|
+
let classNames = [[styles$F.root, true], [styles$F.isLoaded, isLoaded], [styles$F.fullscreen, isFullscreenEnabled], [styles$F.fullRatio, ratio === null]];
|
|
497
498
|
if (styleContext) {
|
|
498
499
|
classNames = makeStyleContext(classNames, styleContext, styles$F);
|
|
499
500
|
}
|
|
501
|
+
const wrapperProps = isFullscreenEnabled ? {
|
|
502
|
+
onClick: handleClick,
|
|
503
|
+
onKeyPress: handleClick,
|
|
504
|
+
role: 'button',
|
|
505
|
+
tabIndex: 0
|
|
506
|
+
} : {};
|
|
500
507
|
return /*#__PURE__*/React.createElement("div", {
|
|
501
508
|
className: makeClassName(classNames),
|
|
502
509
|
style: blockStyles,
|
|
@@ -504,10 +511,7 @@ const Image = ({
|
|
|
504
511
|
}, /*#__PURE__*/React.createElement("div", {
|
|
505
512
|
className: styles$F.wrapper,
|
|
506
513
|
style: pictureStyles,
|
|
507
|
-
|
|
508
|
-
onKeyPress: () => handleClick(),
|
|
509
|
-
role: "button",
|
|
510
|
-
tabIndex: 0
|
|
514
|
+
...wrapperProps
|
|
511
515
|
}, lazy ? (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Lazy, {
|
|
512
516
|
threshold: 0.25
|
|
513
517
|
}, /*#__PURE__*/React.createElement(RenderPicture, {
|
|
@@ -1213,6 +1217,7 @@ const EmbedBlock = ({
|
|
|
1213
1217
|
alt: block.data.caption,
|
|
1214
1218
|
display: block.data.display,
|
|
1215
1219
|
lazy: block.data.lazy,
|
|
1220
|
+
fullscreen: block.data.fullscreen,
|
|
1216
1221
|
styleContext: styleContext
|
|
1217
1222
|
}));
|
|
1218
1223
|
}
|