@graphcommerce/graphcms-ui 6.0.0-canary.46 → 6.0.0-canary.47

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/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.0.0-canary.47
4
+
3
5
  ## 6.0.0-canary.46
4
6
 
5
7
  ## 6.0.0-canary.45
@@ -1,4 +1,5 @@
1
1
  import { Image, ImageProps } from '@graphcommerce/image'
2
+ import { styled, SxProps, Theme } from '@mui/material'
2
3
  import { AssetFragment } from './Asset.gql'
3
4
 
4
5
  export type { AssetFragment } from './Asset.gql'
@@ -14,10 +15,11 @@ function isImage(asset: AssetFragment): asset is ImageAsset {
14
15
 
15
16
  type AssetProps = {
16
17
  asset: AssetFragment
17
- } & Omit<ImageProps, 'src' | 'width' | 'height' | 'alt'>
18
+ sx?: SxProps<Theme>
19
+ } & Omit<ImageProps, 'src' | 'width' | 'height' | 'alt' | 'sx'>
18
20
 
19
21
  export function Asset(props: AssetProps) {
20
- const { asset, ...imgProps } = props
22
+ const { asset, sx = [], ...imgProps } = props
21
23
 
22
24
  if (isImage(asset)) {
23
25
  const { url, height, mimeType, size, width, alt, ...assetProps } = asset
@@ -30,12 +32,25 @@ export function Asset(props: AssetProps) {
30
32
  {...imgProps}
31
33
  {...assetProps}
32
34
  unoptimized={mimeType === 'image/svg+xml'}
35
+ sx={[...(Array.isArray(sx) ? sx : [sx])]}
33
36
  />
34
37
  )
35
38
  }
36
39
 
37
40
  if (asset.mimeType === 'video/mp4') {
38
- return <video src={asset.url} autoPlay muted loop playsInline disableRemotePlayback />
41
+ const Video = styled('video')()
42
+
43
+ return (
44
+ <Video
45
+ src={asset.url}
46
+ autoPlay
47
+ muted
48
+ loop
49
+ playsInline
50
+ disableRemotePlayback
51
+ sx={[...(Array.isArray(sx) ? sx : [sx])]}
52
+ />
53
+ )
39
54
  }
40
55
 
41
56
  if (process.env.NODE_ENV !== 'production') return <div>{asset.mimeType} not supported</div>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/graphcms-ui",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "6.0.0-canary.46",
5
+ "version": "6.0.0-canary.47",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,14 +12,14 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "6.0.0-canary.46",
16
- "@graphcommerce/prettier-config-pwa": "6.0.0-canary.46",
17
- "@graphcommerce/typescript-config-pwa": "6.0.0-canary.46"
15
+ "@graphcommerce/eslint-config-pwa": "6.0.0-canary.47",
16
+ "@graphcommerce/prettier-config-pwa": "6.0.0-canary.47",
17
+ "@graphcommerce/typescript-config-pwa": "6.0.0-canary.47"
18
18
  },
19
19
  "dependencies": {
20
- "@graphcommerce/graphql": "6.0.0-canary.46",
21
- "@graphcommerce/image": "6.0.0-canary.46",
22
- "@graphcommerce/next-ui": "6.0.0-canary.46"
20
+ "@graphcommerce/graphql": "6.0.0-canary.47",
21
+ "@graphcommerce/image": "6.0.0-canary.47",
22
+ "@graphcommerce/next-ui": "6.0.0-canary.47"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@mui/material": "^5.10.16",