@meduza/ui-kit-2 0.1.5 → 0.1.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.
@@ -301,6 +301,20 @@ var viewportSize = (function () {
301
301
  };
302
302
  });
303
303
 
304
+ var POST_MESSAGE_PREFIX = 'mdzKitMsg';
305
+
306
+ var postMessage = function postMessage(element, action) {
307
+ var target = window.top;
308
+ var msg = POST_MESSAGE_PREFIX + "=" + JSON.stringify({
309
+ element: element,
310
+ action: action
311
+ });
312
+
313
+ if (typeof target !== 'undefined') {
314
+ target.postMessage(msg, '*');
315
+ }
316
+ };
317
+
304
318
  var MediaQuerySizes = {
305
319
  MOBILE: 512,
306
320
  PORTRAIT_TABLET: 768,
@@ -425,6 +439,8 @@ var Image = function Image(_ref) {
425
439
  var _useContext = React.useContext(BlockContext),
426
440
  lightBox = _useContext.lightBox;
427
441
 
442
+ console.log(React.useContext(BlockContext));
443
+
428
444
  var handleClick = function handleClick() {
429
445
  var _viewportSize = viewportSize(),
430
446
  viewportWidth = _viewportSize.width;
@@ -1168,26 +1184,24 @@ var EmbedBlock = function EmbedBlock(_ref) {
1168
1184
  })));
1169
1185
  }
1170
1186
  }
1171
- }; // Убираем из контекста все, что не начинается с приставки isIn,
1172
- // чтобы не применились лишние модификаторы
1173
- // TODO: в w6 модификаторы должны передаваться явно
1174
-
1175
-
1176
- var filteredContext = Object.keys(styleContext).filter(function (key) {
1177
- return key.startsWith('isIn') && styles$h[key];
1178
- }).reduce(function (acc, key) {
1179
- acc.push([styles$h[key], true]);
1180
- return acc;
1181
- }, []);
1187
+ };
1182
1188
 
1183
1189
  if (isProportional) {
1184
1190
  style.paddingBottom = block.data.height / block.data.width * 100 + "%";
1185
1191
  style.height = 0;
1186
1192
  }
1187
1193
 
1188
- var classNames = [[styles$h.root, true], [styles$h.cc, cc], [styles$h[display], !!display && styles$h[display]], [styles$h[provider], !!provider && !!styles$h[provider]], [styles$h[onlyOn], !!onlyOn && styles$h[onlyOn]], [styles$h.mobileFullwidth, mobileFullwidth], [styles$h.proportional, isProportional]];
1194
+ var classNames = [[styles$h.root, true], [styles$h.cc, cc], [styles$h[display], !!display && styles$h[display]], [styles$h[provider], !!provider && !!styles$h[provider]], [styles$h[onlyOn], !!onlyOn && styles$h[onlyOn]], [styles$h.mobileFullwidth, mobileFullwidth], [styles$h.proportional, isProportional]]; // Убираем из контекста все, что не начинается с приставки isIn,
1195
+ // чтобы не применились лишние модификаторы
1196
+ // TODO: в w6 модификаторы должны передаваться явно
1189
1197
 
1190
1198
  if (styleContext) {
1199
+ var filteredContext = Object.keys(styleContext).filter(function (key) {
1200
+ return key.startsWith('isIn') && styles$h[key];
1201
+ }).reduce(function (acc, key) {
1202
+ acc.push([styles$h[key], true]);
1203
+ return acc;
1204
+ }, []);
1191
1205
  classNames = makeStyleContext(classNames, filteredContext, styles$h);
1192
1206
  }
1193
1207
 
@@ -2069,20 +2083,6 @@ var ImportantLead = function ImportantLead(_ref) {
2069
2083
  }));
2070
2084
  };
2071
2085
 
2072
- var POST_MESSAGE_PREFIX = 'mdzKitMsg';
2073
-
2074
- var postMessage$1 = function postMessage(element, action) {
2075
- var target = window.top;
2076
- var msg = POST_MESSAGE_PREFIX + "=" + JSON.stringify({
2077
- element: element,
2078
- action: action
2079
- });
2080
-
2081
- if (typeof target !== 'undefined') {
2082
- target.postMessage(msg, '*');
2083
- }
2084
- };
2085
-
2086
2086
  var styles$y = {"root":"Spoiler-module_root__1OfSR","header":"Spoiler-module_header__1rZUs","body":"Spoiler-module_body__Q1e_c","spoiled":"Spoiler-module_spoiled__1A5r4","footer":"Spoiler-module_footer__23mh7","spoilerSticky":"Spoiler-module_spoilerSticky__3Kd30","center":"Spoiler-module_center__tq1m0","full":"Spoiler-module_full__1QFqR","default":"Spoiler-module_default__2Kjx8","mobile":"Spoiler-module_mobile__2BPt8","desktop":"Spoiler-module_desktop__1BIFJ"};
2087
2087
 
2088
2088
  var Spoiler = function Spoiler(_ref) {
@@ -2105,7 +2105,7 @@ var Spoiler = function Spoiler(_ref) {
2105
2105
  setSpoiled(!spoiled);
2106
2106
 
2107
2107
  if (spoiled) {
2108
- postMessage$1('closeSpoiler', 'click');
2108
+ postMessage('closeSpoiler', 'click');
2109
2109
  var rect = ref.current.getBoundingClientRect();
2110
2110
 
2111
2111
  if (rect.top < 0) {
@@ -2114,7 +2114,7 @@ var Spoiler = function Spoiler(_ref) {
2114
2114
  });
2115
2115
  }
2116
2116
  } else {
2117
- postMessage$1('openSpoiler', 'click');
2117
+ postMessage('openSpoiler', 'click');
2118
2118
  }
2119
2119
  };
2120
2120
 
@@ -2177,10 +2177,12 @@ var RawHtmlBlock = function RawHtmlBlock(_ref) {
2177
2177
 
2178
2178
  case 'spoiler':
2179
2179
  {
2180
- return React__default.createElement(Spoiler, {
2180
+ return React__default.createElement(BlockProvider, {
2181
+ value: context
2182
+ }, React__default.createElement(Spoiler, {
2181
2183
  block: block,
2182
2184
  styleContext: styleContext
2183
- });
2185
+ }));
2184
2186
  }
2185
2187
 
2186
2188
  case 'cover':