@meduza/ui-kit-2 0.1.50 → 0.1.51

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.
@@ -15,6 +15,7 @@ export interface ImageProps {
15
15
  source?: string[];
16
16
  lazy?: boolean;
17
17
  ratio?: number;
18
+ fullscreen?: boolean | undefined;
18
19
  styleContext?: string[] | string;
19
20
  }
20
21
  export interface PictureProps {
@@ -318,6 +318,36 @@ var postMessage = function postMessage(category, element, action) {
318
318
  }
319
319
  };
320
320
 
321
+ var viewportSize = (function () {
322
+ return {
323
+ width: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
324
+ height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
325
+ };
326
+ });
327
+
328
+ var MediaQuerySizes = {
329
+ MOBILE: 512,
330
+ PORTRAIT_TABLET: 768,
331
+ LANDSCAPE_TABLET: 1024,
332
+ DESKTOP: 1010,
333
+ WIDE_DESKTOP: 1200
334
+ };
335
+ var imageBreakpoints = {
336
+ 325: '(min-width: 0)',
337
+ 520: '(min-width: 325px)',
338
+ 600: '(min-width: 600px)',
339
+ 650: '(min-width: 650px)',
340
+ 980: '(min-width: 1000px)',
341
+ 1335: '(min-width: 1000px)'
342
+ };
343
+ var imageConditionalKeys = {
344
+ xs: [325],
345
+ superFull: [1335, 650, 520, 325],
346
+ full: [980, 650, 520, 325],
347
+ "default": [650, 520, 325],
348
+ narrow: [600, 325]
349
+ };
350
+
321
351
  var styles$3 = {"root":"Lazy-module_root__2Z72l"};
322
352
 
323
353
  var Lazy = function Lazy(_ref) {
@@ -352,29 +382,6 @@ var Lazy = function Lazy(_ref) {
352
382
  }, visible && children);
353
383
  };
354
384
 
355
- var MediaQuerySizes = {
356
- MOBILE: 512,
357
- PORTRAIT_TABLET: 768,
358
- LANDSCAPE_TABLET: 1024,
359
- DESKTOP: 1010,
360
- WIDE_DESKTOP: 1200
361
- };
362
- var imageBreakpoints = {
363
- 325: '(min-width: 0)',
364
- 520: '(min-width: 325px)',
365
- 600: '(min-width: 600px)',
366
- 650: '(min-width: 650px)',
367
- 980: '(min-width: 1000px)',
368
- 1335: '(min-width: 1000px)'
369
- };
370
- var imageConditionalKeys = {
371
- xs: [325],
372
- superFull: [1335, 650, 520, 325],
373
- full: [980, 650, 520, 325],
374
- "default": [650, 520, 325],
375
- narrow: [600, 325]
376
- };
377
-
378
385
  var toCamel = function toCamel(s) {
379
386
  return s.replace(/([_][a-z])/gi, function (str) {
380
387
  return str.toUpperCase().replace('_', '');
@@ -444,17 +451,23 @@ var Image = function Image(_ref) {
444
451
  source = _ref.source,
445
452
  lazy = _ref.lazy,
446
453
  ratio = _ref.ratio,
447
- styleContext = _ref.styleContext;
454
+ styleContext = _ref.styleContext,
455
+ fullscreen = _ref.fullscreen;
448
456
 
449
457
  var _useContext = React.useContext(BlockContext),
450
458
  lightBox = _useContext.lightBox;
451
459
 
452
- var _useState = React.useState(false),
460
+ var _useState = React.useState(lazy ? false : true),
453
461
  isLoaded = _useState[0],
454
462
  setIsLoaded = _useState[1];
455
463
 
456
464
  var handleClick = function handleClick() {
457
- if (!lightBox || optimized && !optimized.original) {
465
+ var _viewportSize = viewportSize(),
466
+ viewportWidth = _viewportSize.width;
467
+
468
+ var disableFullscreenDesktop = viewportWidth >= MediaQuerySizes.LANDSCAPE_TABLET && !fullscreen;
469
+
470
+ if (disableFullscreenDesktop || !lightBox || optimized && !optimized.original) {
458
471
  return;
459
472
  }
460
473
 
@@ -471,7 +484,7 @@ var Image = function Image(_ref) {
471
484
  /* fallback w325 url until w6 was released */
472
485
 
473
486
  var fallbackSource = source && source[0] || optimized.w325 && optimized.w325['1x'] || optimized.original;
474
- var classNames = [[styles$4.root, true], [styles$4.isLoaded, isLoaded], [styles$4.fullscreen, lightBox && optimized && optimized.original]];
487
+ var classNames = [[styles$4.root, true], [styles$4.isLoaded, isLoaded], [styles$4.fullscreen, fullscreen && lightBox && optimized && optimized.original]];
475
488
 
476
489
  if (styleContext) {
477
490
  classNames = makeStyleContext(classNames, styleContext, styles$4);
@@ -625,13 +638,6 @@ var Footnote = function Footnote(_ref) {
625
638
  }, children));
626
639
  };
627
640
 
628
- var viewportSize = (function () {
629
- return {
630
- width: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
631
- height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
632
- };
633
- });
634
-
635
641
  var styles$7 = {"root":"DotsOnImage-module_root__2XP3Q","isVisible":"DotsOnImage-module_isVisible__Wqqqt","marker":"DotsOnImage-module_marker__lH5cP","show":"DotsOnImage-module_show__2TMBv","dot":"DotsOnImage-module_dot__H1wua","isActive":"DotsOnImage-module_isActive__3hh31","popover":"DotsOnImage-module_popover__35Cpj","isRight":"DotsOnImage-module_isRight__2RsJe","isTop":"DotsOnImage-module_isTop__3zmSK","isLeft":"DotsOnImage-module_isLeft__3quc9","isBottom":"DotsOnImage-module_isBottom__3Nk1T"};
636
642
 
637
643
  var DotsOnImage = function DotsOnImage(_ref) {
@@ -1271,6 +1277,7 @@ var EmbedBlock = function EmbedBlock(_ref) {
1271
1277
  alt: block.data.caption,
1272
1278
  display: block.data.display,
1273
1279
  lazy: block.data.lazy,
1280
+ fullscreen: block.data.fullscreen,
1274
1281
  styleContext: styleContext
1275
1282
  }));
1276
1283
  }
@@ -2358,7 +2365,7 @@ var Spoiler = function Spoiler(_ref) {
2358
2365
  }, title && React__default.createElement("h3", null, title)), React__default.createElement("div", {
2359
2366
  className: styles$A.body
2360
2367
  }, blocks.map(function (item) {
2361
- return React__default.createElement(RenderBlocks, {
2368
+ return React__default.createElement(RawHtmlBlock, {
2362
2369
  key: item.id,
2363
2370
  block: item,
2364
2371
  styleContext: context