@meduza/ui-kit-2 1.4.7 → 1.4.9

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.
@@ -1674,8 +1674,8 @@ const GroupedBlock = ({
1674
1674
  }) => {
1675
1675
  const maxHeight = Math.min(...block.data.map(item => item.data && item.data.height || item.item && item.item.data.height));
1676
1676
  const normalizedBoxesWidth = block.data.map(item => {
1677
- const width = item.data && item.data.width || item.item && item.item.data.heigh;
1678
- const height = item.data && item.data.height || item.item && item.item.data.heigh;
1677
+ const width = item.data && item.data.width || item.item && item.item.data.width;
1678
+ const height = item.data && item.data.height || item.item && item.item.data.height;
1679
1679
  return width / (height / maxHeight);
1680
1680
  });
1681
1681
  const sumWidth = normalizedBoxesWidth.reduce((sum, x) => sum + x);
@@ -2192,7 +2192,7 @@ const RenderBlocks = ({
2192
2192
  }
2193
2193
  };
2194
2194
 
2195
- var styles$a = {"root":"Cover-module_root__3pscq","body":"Cover-module_body__eJpUI","image":"Cover-module_image__frrrH","rich":"Cover-module_rich__YcxWa","dark":"Cover-module_dark__cRucL","light":"Cover-module_light__la-sk","control":"Cover-module_control__WP0G3","isInDynamicBlock":"Cover-module_isInDynamicBlock__qO-yt","mobile":"Cover-module_mobile__aotep","desktop":"Cover-module_desktop__dfbC-"};
2195
+ var styles$a = {"root":"Cover-module_root__3pscq","body":"Cover-module_body__eJpUI","image":"Cover-module_image__frrrH","rich":"Cover-module_rich__YcxWa","dark":"Cover-module_dark__cRucL","light":"Cover-module_light__la-sk","isOnImage":"Cover-module_isOnImage__J296p","control":"Cover-module_control__WP0G3","isInDynamicBlock":"Cover-module_isInDynamicBlock__qO-yt","mobile":"Cover-module_mobile__aotep","desktop":"Cover-module_desktop__dfbC-"};
2196
2196
 
2197
2197
  const Cover = ({
2198
2198
  block: {
@@ -2209,15 +2209,19 @@ const Cover = ({
2209
2209
  }
2210
2210
  }
2211
2211
  },
2212
- styleContext
2212
+ styleContext,
2213
+ titleStyle
2213
2214
  }) => {
2214
2215
  const [isPopoverShown, setIsPopoverShown] = useState(false);
2215
2216
  const style = {};
2216
- let classNames = [[styles$a.root, true], [styles$a[onlyOn], !!onlyOn && !!styles$a[onlyOn]]];
2217
+ const isOnImage = !!titleStyle;
2218
+ const contexts = Array.isArray(styleContext) ? styleContext : [styleContext].filter(Boolean);
2219
+ const blockStyleContext = isOnImage ? [...contexts, 'overlay'] : styleContext;
2220
+ let classNames = [[styles$a.root, true], [styles$a[onlyOn], !!onlyOn && !!styles$a[onlyOn]], [styles$a.isOnImage, isOnImage]];
2217
2221
  if (styleContext) {
2218
2222
  classNames = makeStyleContext(classNames, styleContext, styles$a);
2219
2223
  }
2220
- if (gradients) {
2224
+ if (gradients && !isOnImage) {
2221
2225
  const theme = [gradients.text_rgb === '0,0,0' ? 'dark' : 'light'];
2222
2226
  classNames = makeStyleContext(classNames, theme, styles$a);
2223
2227
  style.backgroundImage = generateGradient(gradients.bg_rgb, 'mediaBlockBottom');
@@ -2229,7 +2233,8 @@ const Cover = ({
2229
2233
  }));
2230
2234
  return /*#__PURE__*/React.createElement("div", {
2231
2235
  "data-testid": "cover",
2232
- className: makeClassName(classNames)
2236
+ className: makeClassName(classNames),
2237
+ style: titleStyle
2233
2238
  }, /*#__PURE__*/React.createElement("div", {
2234
2239
  className: styles$a.image
2235
2240
  }, /*#__PURE__*/React.createElement(Image, {
@@ -2242,7 +2247,7 @@ const Cover = ({
2242
2247
  }, blocks.map(item => (/*#__PURE__*/React.createElement(RenderBlocks, {
2243
2248
  key: item.id,
2244
2249
  block: item,
2245
- styleContext: styleContext
2250
+ styleContext: blockStyleContext
2246
2251
  })))), cc === 'button' && (/*#__PURE__*/React.createElement("button", {
2247
2252
  className: styles$a.control,
2248
2253
  type: "button",