@meduza/ui-kit-2 1.4.7 → 1.4.8

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.
@@ -21,4 +21,5 @@ export interface CoverProps {
21
21
  };
22
22
  };
23
23
  styleContext?: string[] | string;
24
+ titleStyle?: Record<string, string>;
24
25
  }
@@ -1678,8 +1678,8 @@ const GroupedBlock = ({
1678
1678
  }) => {
1679
1679
  const maxHeight = Math.min(...block.data.map(item => item.data && item.data.height || item.item && item.item.data.height));
1680
1680
  const normalizedBoxesWidth = block.data.map(item => {
1681
- const width = item.data && item.data.width || item.item && item.item.data.heigh;
1682
- const height = item.data && item.data.height || item.item && item.item.data.heigh;
1681
+ const width = item.data && item.data.width || item.item && item.item.data.width;
1682
+ const height = item.data && item.data.height || item.item && item.item.data.height;
1683
1683
  return width / (height / maxHeight);
1684
1684
  });
1685
1685
  const sumWidth = normalizedBoxesWidth.reduce((sum, x) => sum + x);
@@ -2196,7 +2196,7 @@ const RenderBlocks = ({
2196
2196
  }
2197
2197
  };
2198
2198
 
2199
- 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-"};
2199
+ 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-"};
2200
2200
 
2201
2201
  const Cover = ({
2202
2202
  block: {
@@ -2213,15 +2213,19 @@ const Cover = ({
2213
2213
  }
2214
2214
  }
2215
2215
  },
2216
- styleContext
2216
+ styleContext,
2217
+ titleStyle
2217
2218
  }) => {
2218
2219
  const [isPopoverShown, setIsPopoverShown] = React.useState(false);
2219
2220
  const style = {};
2220
- let classNames = [[styles$a.root, true], [styles$a[onlyOn], !!onlyOn && !!styles$a[onlyOn]]];
2221
+ const isOnImage = !!titleStyle;
2222
+ const contexts = Array.isArray(styleContext) ? styleContext : [styleContext].filter(Boolean);
2223
+ const blockStyleContext = isOnImage ? [...contexts, 'overlay'] : styleContext;
2224
+ let classNames = [[styles$a.root, true], [styles$a[onlyOn], !!onlyOn && !!styles$a[onlyOn]], [styles$a.isOnImage, isOnImage]];
2221
2225
  if (styleContext) {
2222
2226
  classNames = makeStyleContext(classNames, styleContext, styles$a);
2223
2227
  }
2224
- if (gradients) {
2228
+ if (gradients && !isOnImage) {
2225
2229
  const theme = [gradients.text_rgb === '0,0,0' ? 'dark' : 'light'];
2226
2230
  classNames = makeStyleContext(classNames, theme, styles$a);
2227
2231
  style.backgroundImage = generateGradient(gradients.bg_rgb, 'mediaBlockBottom');
@@ -2233,7 +2237,8 @@ const Cover = ({
2233
2237
  }));
2234
2238
  return /*#__PURE__*/React.createElement("div", {
2235
2239
  "data-testid": "cover",
2236
- className: makeClassName(classNames)
2240
+ className: makeClassName(classNames),
2241
+ style: titleStyle
2237
2242
  }, /*#__PURE__*/React.createElement("div", {
2238
2243
  className: styles$a.image
2239
2244
  }, /*#__PURE__*/React.createElement(Image, {
@@ -2246,7 +2251,7 @@ const Cover = ({
2246
2251
  }, blocks.map(item => (/*#__PURE__*/React.createElement(RenderBlocks, {
2247
2252
  key: item.id,
2248
2253
  block: item,
2249
- styleContext: styleContext
2254
+ styleContext: blockStyleContext
2250
2255
  })))), cc === 'button' && (/*#__PURE__*/React.createElement("button", {
2251
2256
  className: styles$a.control,
2252
2257
  type: "button",