@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.
@@ -482,8 +482,9 @@ const Image = ({
482
482
  lightBox
483
483
  } = React.useContext(BlockContext);
484
484
  const [isLoaded, setIsLoaded] = React.useState(lazy ? false : true);
485
+ const isFullscreenEnabled = Boolean(lightBox && optimized?.original && fullscreen);
485
486
  const handleClick = () => {
486
- if (!lightBox || !fullscreen || optimized && !optimized.original) {
487
+ if (!isFullscreenEnabled) {
487
488
  return;
488
489
  }
489
490
  postMessage('', 'fullscreen_click', 'click');
@@ -497,10 +498,16 @@ const Image = ({
497
498
  };
498
499
  /* fallback w325 url until w6 was released */
499
500
  const fallbackSource = source && source[0] || optimized.w325 && optimized.w325['1x'] || optimized.original;
500
- let classNames = [[styles$F.root, true], [styles$F.isLoaded, isLoaded], [styles$F.fullscreen, lightBox && optimized && optimized.original && fullscreen], [styles$F.fullRatio, ratio === null]];
501
+ let classNames = [[styles$F.root, true], [styles$F.isLoaded, isLoaded], [styles$F.fullscreen, isFullscreenEnabled], [styles$F.fullRatio, ratio === null]];
501
502
  if (styleContext) {
502
503
  classNames = makeStyleContext(classNames, styleContext, styles$F);
503
504
  }
505
+ const wrapperProps = isFullscreenEnabled ? {
506
+ onClick: handleClick,
507
+ onKeyPress: handleClick,
508
+ role: 'button',
509
+ tabIndex: 0
510
+ } : {};
504
511
  return /*#__PURE__*/React.createElement("div", {
505
512
  className: makeClassName(classNames),
506
513
  style: blockStyles,
@@ -508,10 +515,7 @@ const Image = ({
508
515
  }, /*#__PURE__*/React.createElement("div", {
509
516
  className: styles$F.wrapper,
510
517
  style: pictureStyles,
511
- onClick: () => handleClick(),
512
- onKeyPress: () => handleClick(),
513
- role: "button",
514
- tabIndex: 0
518
+ ...wrapperProps
515
519
  }, lazy ? (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Lazy, {
516
520
  threshold: 0.25
517
521
  }, /*#__PURE__*/React.createElement(RenderPicture, {
@@ -1217,6 +1221,7 @@ const EmbedBlock = ({
1217
1221
  alt: block.data.caption,
1218
1222
  display: block.data.display,
1219
1223
  lazy: block.data.lazy,
1224
+ fullscreen: block.data.fullscreen,
1220
1225
  styleContext: styleContext
1221
1226
  }));
1222
1227
  }