@meduza/ui-kit-2 0.1.41 → 0.1.42

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.
@@ -19,6 +19,7 @@ export interface ImageProps {
19
19
  desktop: boolean;
20
20
  };
21
21
  ratio?: number;
22
+ styleContext?: string[] | string;
22
23
  }
23
24
  export interface PictureProps {
24
25
  source?: string[];
@@ -289,6 +289,15 @@ var Switcher = function Switcher(_ref) {
289
289
  }, children));
290
290
  };
291
291
 
292
+ var makeStyleContext = function makeStyleContext(classNames, styleContext, styles) {
293
+ var context = Array.isArray(styleContext) ? styleContext.filter(function (ctx) {
294
+ return styles[ctx];
295
+ }).map(function (ctx) {
296
+ return [[styles[ctx]], true];
297
+ }) : [[styles[styleContext], !!styleContext && !!styles[styleContext]]];
298
+ return classNames.concat(context);
299
+ };
300
+
292
301
  var BlockContext = /*#__PURE__*/React__default.createContext({
293
302
  lightBox: null
294
303
  });
@@ -431,7 +440,7 @@ var RenderPicture = function RenderPicture(_ref) {
431
440
  }));
432
441
  };
433
442
 
434
- var styles$4 = {"root":"Image-module_root__1vsA_","isLoaded":"Image-module_isLoaded__3XhU5","wrapper":"Image-module_wrapper__3fLjs","fullscreen":"Image-module_fullscreen__29apx"};
443
+ var styles$4 = {"root":"Image-module_root__1vsA_","isLoaded":"Image-module_isLoaded__3XhU5","wrapper":"Image-module_wrapper__3fLjs","fullscreen":"Image-module_fullscreen__29apx","dark":"Image-module_dark__3o0nU"};
435
444
 
436
445
  var Image = function Image(_ref) {
437
446
  var alt = _ref.alt,
@@ -442,7 +451,8 @@ var Image = function Image(_ref) {
442
451
  source = _ref.source,
443
452
  lazy = _ref.lazy,
444
453
  fullscreen = _ref.fullscreen,
445
- ratio = _ref.ratio;
454
+ ratio = _ref.ratio,
455
+ styleContext = _ref.styleContext;
446
456
 
447
457
  var _useContext = React.useContext(BlockContext),
448
458
  lightBox = _useContext.lightBox;
@@ -479,8 +489,14 @@ var Image = function Image(_ref) {
479
489
  /* fallback w325 url until w6 was released */
480
490
 
481
491
  var fallbackSource = source && source[0] || optimized.w325 && optimized.w325['1x'] || optimized.original;
492
+ var classNames = [[styles$4.root, true], [styles$4.isLoaded, isLoaded], [styles$4.fullscreen, fullscreen && fullscreen.desktop]];
493
+
494
+ if (styleContext) {
495
+ classNames = makeStyleContext(classNames, styleContext, styles$4);
496
+ }
497
+
482
498
  return React__default.createElement("div", {
483
- className: makeClassName([[styles$4.root, true], [styles$4.isLoaded, isLoaded], [styles$4.fullscreen, fullscreen && fullscreen.desktop]]),
499
+ className: makeClassName(classNames),
484
500
  style: blockStyles,
485
501
  "data-testid": "image"
486
502
  }, React__default.createElement("div", {
@@ -800,15 +816,6 @@ var DotsOnImage = function DotsOnImage(_ref) {
800
816
  })))));
801
817
  };
802
818
 
803
- var makeStyleContext = function makeStyleContext(classNames, styleContext, styles) {
804
- var context = Array.isArray(styleContext) ? styleContext.filter(function (ctx) {
805
- return styles[ctx];
806
- }).map(function (ctx) {
807
- return [[styles[ctx]], true];
808
- }) : [[styles[styleContext], !!styleContext && !!styles[styleContext]]];
809
- return classNames.concat(context);
810
- };
811
-
812
819
  var styles$8 = {"root":"Tag-module_root__3IqWC","small":"Tag-module_small__2IAb7","large":"Tag-module_large__22z_o","dark":"Tag-module_dark__sgnt1","light":"Tag-module_light__1zUhp","gold":"Tag-module_gold__2ksA7","gray":"Tag-module_gray__mGAO_","inherit":"Tag-module_inherit__2QB5U","is1to1":"Tag-module_is1to1__3EDbC","is1to2":"Tag-module_is1to2__3xbC6","isInSuperBlock":"Tag-module_isInSuperBlock__38JE0","is1to3":"Tag-module_is1to3__3j5K-","is1to4":"Tag-module_is1to4__2vq4r","slide":"Tag-module_slide__2nMDw","game":"Tag-module_game__3j5yG","richRelated":"Tag-module_richRelated__2vbQQ","card":"Tag-module_card__1EAeF","live":"Tag-module_live__rwXuR","episode":"Tag-module_episode__3o6gg","podcast":"Tag-module_podcast__VPoll","rich":"Tag-module_rich__2URd9","isInDynamicBlock":"Tag-module_isInDynamicBlock__1YM9I","mobile":"Tag-module_mobile__QQxuv","desktop":"Tag-module_desktop__1Bjsy"};
813
820
 
814
821
  var Tag = function Tag(_ref) {
@@ -1282,7 +1289,8 @@ var EmbedBlock = function EmbedBlock(_ref) {
1282
1289
  height: block.data.height,
1283
1290
  alt: block.data.caption,
1284
1291
  display: block.data.display,
1285
- lazy: block.data.lazy
1292
+ lazy: block.data.lazy,
1293
+ styleContext: styleContext
1286
1294
  }));
1287
1295
  }
1288
1296