@meduza/ui-kit-2 0.1.40 → 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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.40",
2
+ "version": "0.1.42",
3
3
  "license": "MIT",
4
4
  "description": "UIKit for Meduza",
5
5
  "repository": "https://github.com/meduza-corp/ui-kit-2.git",
@@ -71,6 +71,7 @@ export const EmbedBlock: React.FC<EmbedBlockProps> = ({
71
71
  alt={block.data.caption}
72
72
  display={block.data.display}
73
73
  lazy={block.data.lazy}
74
+ styleContext={styleContext}
74
75
  />
75
76
  </div>
76
77
  )
@@ -25,7 +25,7 @@
25
25
  }
26
26
 
27
27
  .isLoaded {
28
- background-color: transparent
28
+ background-color: transparent;
29
29
  }
30
30
 
31
31
  .wrapper {
@@ -72,3 +72,7 @@
72
72
  [data-input='mouse'] .wrapper {
73
73
  outline: none;
74
74
  }
75
+
76
+ .dark {
77
+ background-color: transparent;
78
+ }
@@ -20,6 +20,7 @@ export interface ImageProps {
20
20
  desktop: boolean
21
21
  }
22
22
  ratio?: number
23
+ styleContext?: string[] | string
23
24
  }
24
25
 
25
26
  export interface PictureProps {
@@ -1,6 +1,7 @@
1
1
  import React, { useContext, useState } from 'react'
2
2
  import { ImageProps } from './Image.types'
3
- import { makeClassName } from '../utils/makeClassName'
3
+ import { makeClassName, ClassNames } from '../utils/makeClassName'
4
+ import makeStyleContext from '../utils/makeStyleContext'
4
5
  import BlockContext from '../utils/BlockContext'
5
6
  import viewportSize from '../utils/viewportSize'
6
7
  import postMessage from '../utils/postMessage'
@@ -19,7 +20,8 @@ export const Image: React.FC<ImageProps> = ({
19
20
  source,
20
21
  lazy,
21
22
  fullscreen,
22
- ratio
23
+ ratio,
24
+ styleContext
23
25
  }) => {
24
26
  const { lightBox } = useContext(BlockContext)
25
27
  const [isLoaded, setIsLoaded] = useState(false)
@@ -59,13 +61,19 @@ export const Image: React.FC<ImageProps> = ({
59
61
  (optimized.w325 && optimized.w325['1x']) ||
60
62
  optimized.original
61
63
 
64
+ let classNames: ClassNames = [
65
+ [styles.root, true],
66
+ [styles.isLoaded, isLoaded],
67
+ [styles.fullscreen, fullscreen && fullscreen.desktop]
68
+ ]
69
+
70
+ if (styleContext) {
71
+ classNames = makeStyleContext(classNames, styleContext, styles)
72
+ }
73
+
62
74
  return (
63
75
  <div
64
- className={makeClassName([
65
- [styles.root, true],
66
- [styles.isLoaded, isLoaded],
67
- [styles.fullscreen, fullscreen && fullscreen.desktop]
68
- ])}
76
+ className={makeClassName(classNames)}
69
77
  style={blockStyles}
70
78
  data-testid="image"
71
79
  >
@@ -22,10 +22,14 @@ export const Popover: React.FC<PopoverProps> = ({ children, onClose }) => {
22
22
  }
23
23
 
24
24
  useEffect(() => {
25
+ document.body.dataset.popover = 'true'
26
+
25
27
  window.addEventListener('keydown', escFunction, false)
26
28
  window.addEventListener('scroll', handleScroll, false)
27
29
 
28
30
  return () => {
31
+ document.body.removeAttribute('data-popover')
32
+
29
33
  window.removeEventListener('keydown', escFunction, false)
30
34
  window.removeEventListener('scroll', handleScroll, false)
31
35
  }