@graphcommerce/hygraph-ui 10.0.0-canary.67 → 10.0.0-canary.68

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
+ ## 10.0.0-canary.68
4
+
3
5
  ## 10.0.0-canary.67
4
6
 
5
7
  ## 10.0.0-canary.66
@@ -1,5 +1,6 @@
1
1
  import type { ImageProps } from '@graphcommerce/image'
2
2
  import { Image } from '@graphcommerce/image'
3
+ import { sxx } from '@graphcommerce/next-ui'
3
4
  import type { SxProps, Theme } from '@mui/material'
4
5
  import { styled } from '@mui/material'
5
6
  import { memo } from 'react'
@@ -35,27 +36,14 @@ export const Asset = memo<AssetProps>((props) => {
35
36
  {...imgProps}
36
37
  {...assetProps}
37
38
  unoptimized={typeof unoptimized === 'boolean' ? unoptimized : mimeType === 'image/svg+xml'}
38
- sx={[...(Array.isArray(sx) ? sx : [sx])]}
39
+ sx={sx}
39
40
  />
40
41
  )
41
42
  }
42
-
43
43
  if (asset.mimeType === 'video/mp4') {
44
44
  const Video = styled('video')({})
45
-
46
- return (
47
- <Video
48
- src={asset.url}
49
- autoPlay
50
- muted
51
- loop
52
- playsInline
53
- disableRemotePlayback
54
- sx={[...(Array.isArray(sx) ? sx : [sx])]}
55
- />
56
- )
45
+ return <Video src={asset.url} autoPlay muted loop playsInline disableRemotePlayback sx={sx} />
57
46
  }
58
-
59
47
  if (process.env.NODE_ENV !== 'production') return <div>{asset.mimeType} not supported</div>
60
48
  return null
61
49
  })
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-use-before-define */
2
+ import { sxx } from '@graphcommerce/next-ui'
2
3
  import type { SxProps, Theme } from '@mui/material'
3
4
  import React from 'react'
4
5
  import { defaultRenderers } from './defaultRenderers'
@@ -150,15 +151,7 @@ function mergeSxRenderer(base: SxRenderer, sxRenderer?: SxRenderer) {
150
151
  Object.entries<SxProps<Theme>>(base).map(([key, sx]) => {
151
152
  const sxOverride: SxProps<Theme> = sxRenderer?.[key]
152
153
 
153
- return sxOverride
154
- ? [
155
- key,
156
- [
157
- ...(Array.isArray(sx) ? sx : [sx]),
158
- ...(Array.isArray(sxOverride) ? sxOverride : [sxOverride]),
159
- ],
160
- ]
161
- : [key, sx]
154
+ return sxOverride ? [key, [sx, sxOverride]] : [key, sx]
162
155
  }),
163
156
  ) as SxRenderer
164
157
  }
@@ -1,3 +1,4 @@
1
+ import { sxx } from '@graphcommerce/next-ui'
1
2
  import { Box, Link, Typography } from '@mui/material'
2
3
  import { Asset } from '../Asset/Asset'
3
4
  import type { Renderers } from './types'
@@ -24,10 +25,7 @@ export const defaultRenderers: Renderers = {
24
25
  component='iframe'
25
26
  src={url}
26
27
  loading='lazy'
27
- sx={[
28
- { aspectRatio: `${width} / ${height}`, width: '100%' },
29
- ...(Array.isArray(sx) ? sx : [sx]),
30
- ]}
28
+ sx={sxx({ aspectRatio: `${width} / ${height}`, width: '100%' }, sx)}
31
29
  />
32
30
  )
33
31
  },
@@ -51,8 +49,8 @@ export const defaultRenderers: Renderers = {
51
49
  table_row: (props) => <Box component='tr' {...props} />,
52
50
  table_cell: (props) => <Box component='td' {...props} />,
53
51
  code: (props) => <Box component='code' {...props} />,
54
- bold: (props) => <Box component='strong' fontWeight='bold' {...props} />,
55
- italic: (props) => <Box component='em' fontStyle='italic' {...props} />,
52
+ bold: (props) => <Box component='strong' {...props} sx={sxx({ fontWeight: 'bold' }, props.sx)} />,
53
+ italic: (props) => <Box component='em' {...props} sx={sxx({ fontStyle: 'italic' }, props.sx)} />,
56
54
  underlined: (props) => <Box component='span' {...props} />,
57
55
  class: (props) => <Box component='div' {...props} />,
58
56
  'code-block': (props) => (
@@ -87,7 +87,7 @@ export const defaultSxRenderer: SxRenderer = {
87
87
  borderColor: 'inherit',
88
88
  '& tr': {
89
89
  '&:nth-of-type(odd)': {
90
- background: theme.palette.background.paper,
90
+ background: theme.vars.palette.background.paper,
91
91
  },
92
92
  },
93
93
  '& td': {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/hygraph-ui",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "10.0.0-canary.67",
5
+ "version": "10.0.0-canary.68",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,14 +12,14 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/ecommerce-ui": "^10.0.0-canary.67",
16
- "@graphcommerce/eslint-config-pwa": "^10.0.0-canary.67",
17
- "@graphcommerce/graphql": "^10.0.0-canary.67",
18
- "@graphcommerce/image": "^10.0.0-canary.67",
19
- "@graphcommerce/next-ui": "^10.0.0-canary.67",
20
- "@graphcommerce/prettier-config-pwa": "^10.0.0-canary.67",
21
- "@graphcommerce/typescript-config-pwa": "^10.0.0-canary.67",
22
- "@mui/material": "^5.10.16",
15
+ "@graphcommerce/ecommerce-ui": "^10.0.0-canary.68",
16
+ "@graphcommerce/eslint-config-pwa": "^10.0.0-canary.68",
17
+ "@graphcommerce/graphql": "^10.0.0-canary.68",
18
+ "@graphcommerce/image": "^10.0.0-canary.68",
19
+ "@graphcommerce/next-ui": "^10.0.0-canary.68",
20
+ "@graphcommerce/prettier-config-pwa": "^10.0.0-canary.68",
21
+ "@graphcommerce/typescript-config-pwa": "^10.0.0-canary.68",
22
+ "@mui/material": "^7.0.0",
23
23
  "next": "*",
24
24
  "react": "^19.2.0",
25
25
  "react-dom": "^19.2.0"