@graphcommerce/framer-scroller 9.1.0-canary.18 → 9.1.0-canary.20

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,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.1.0-canary.20
4
+
5
+ ## 9.1.0-canary.19
6
+
7
+ ### Patch Changes
8
+
9
+ - [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`e9da6a9`](https://github.com/graphcommerce-org/graphcommerce/commit/e9da6a9e55a9344a1f8ef8f1f20060af2bb38ee9) - Added support for video's on the product page. ([@paales](https://github.com/paales))
10
+
3
11
  ## 9.1.0-canary.18
4
12
 
5
13
  ## 9.1.0-canary.17
@@ -1,10 +1,21 @@
1
1
  import type { ImageProps } from '@graphcommerce/image'
2
2
  import { Image } from '@graphcommerce/image'
3
- import { Box } from '@mui/material'
4
- import { m } from 'framer-motion'
3
+ import { Box, type BoxProps } from '@mui/material'
4
+ import { m, type MotionProps } from 'framer-motion'
5
5
  import { forwardRef } from 'react'
6
6
 
7
- export type MotionImageAspectProps = Omit<ImageProps, 'layout' | 'unoptimized'>
7
+ export type MotionImageAspectPropsAdditional = MotionProps
8
+
9
+ export type MotionImageAspectProps<
10
+ P extends MotionImageAspectPropsAdditional = MotionImageAspectPropsAdditional,
11
+ > = Omit<ImageProps, 'layout' | 'unoptimized'> &
12
+ MotionProps & {
13
+ slotProps?: {
14
+ box?: BoxProps
15
+ additional?: P
16
+ }
17
+ Additional?: (props: P) => React.ReactNode
18
+ }
8
19
 
9
20
  /**
10
21
  * - Renders an image with the given aspect ratio
@@ -14,57 +25,67 @@ export type MotionImageAspectProps = Omit<ImageProps, 'layout' | 'unoptimized'>
14
25
  * problem when the layout is animated. Should be fixed in Safari 15
15
26
  */
16
27
  export const MotionImageAspect = m.create(
17
- forwardRef<HTMLImageElement, MotionImageAspectProps>((props, ref) => (
18
- <Box
19
- className='MotionImageAspect'
20
- sx={{
21
- position: 'relative',
28
+ forwardRef<HTMLImageElement, MotionImageAspectProps>((props, ref) => {
29
+ const { Additional, slotProps, ...rest } = props
30
+
31
+ return (
32
+ <Box
33
+ className='MotionImageAspect'
34
+ sx={[
35
+ {
36
+ position: 'relative',
22
37
 
23
- '& > picture': {
24
- display: 'block',
25
- '@supports (aspect-ratio: 1 / 1)': {
26
- maxWidth: '99.6%',
27
- maxHeight: '100%',
28
- width: 'auto',
29
- height: 'auto',
38
+ '& > picture': {
39
+ display: 'block',
40
+ '@supports (aspect-ratio: 1 / 1)': {
41
+ maxWidth: '99.6%',
42
+ maxHeight: '100%',
43
+ width: 'auto',
44
+ height: 'auto',
30
45
 
31
- position: 'absolute',
32
- top: '50%',
33
- left: '50%',
34
- transform: 'translate(-50%, -50%)',
46
+ position: 'absolute',
47
+ top: '50%',
48
+ left: '50%',
49
+ transform: 'translate(-50%, -50%)',
35
50
 
36
- '&:after': {
51
+ '&:after': {
52
+ display: 'block',
53
+ content: '""',
54
+ minWidth: '100vw',
55
+ },
56
+ },
57
+ '@supports not (aspect-ratio: 1 / 1)': {
58
+ width: '100% !important',
59
+ height: '100% !important',
60
+ },
61
+ },
62
+ '& > img': {
37
63
  display: 'block',
38
- content: '""',
39
- minWidth: '100vw',
64
+ '@supports not (aspect-ratio: 1 / 1)': {
65
+ objectFit: 'contain',
66
+ },
40
67
  },
41
68
  },
42
- '@supports not (aspect-ratio: 1 / 1)': {
43
- width: '100% !important',
44
- height: '100% !important',
45
- },
46
- },
47
- '& > img': {
48
- display: 'block',
49
- '@supports not (aspect-ratio: 1 / 1)': {
50
- objectFit: 'contain',
51
- },
52
- },
53
- }}
54
- >
55
- <Image
56
- {...props}
57
- layout='fill'
58
- ref={ref}
59
- className={props.className}
60
- pictureProps={{
61
- ...props.pictureProps,
62
- className: props.pictureProps?.className,
63
- style: { ...props.style, aspectRatio: `${props.width} / ${props.height}` },
64
- }}
65
- />
66
- </Box>
67
- )),
69
+ ...(Array.isArray(slotProps?.box?.sx) ? slotProps.box.sx : [slotProps?.box?.sx]),
70
+ ]}
71
+ {...slotProps?.box}
72
+ >
73
+ <Image
74
+ {...rest}
75
+ layout='fill'
76
+ ref={ref}
77
+ className={props.className}
78
+ pictureProps={{
79
+ ...props.pictureProps,
80
+ className: props.pictureProps?.className,
81
+ style: { ...props.style, aspectRatio: `${props.width} / ${props.height}` },
82
+ }}
83
+ />
84
+ {Additional && <Additional {...slotProps?.additional} {...rest} />}
85
+ {slotProps?.box?.children}
86
+ </Box>
87
+ )
88
+ }),
68
89
  )
69
90
 
70
91
  MotionImageAspect.displayName = 'MotionImageAspect'
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/framer-scroller",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "9.1.0-canary.18",
5
+ "version": "9.1.0-canary.20",
6
6
  "sideEffects": false,
7
7
  "scripts": {
8
8
  "dev": "tsc -W"
@@ -18,11 +18,11 @@
18
18
  "popmotion": "11.0.5"
19
19
  },
20
20
  "peerDependencies": {
21
- "@graphcommerce/eslint-config-pwa": "^9.1.0-canary.18",
22
- "@graphcommerce/framer-utils": "^9.1.0-canary.18",
23
- "@graphcommerce/image": "^9.1.0-canary.18",
24
- "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.18",
25
- "@graphcommerce/typescript-config-pwa": "^9.1.0-canary.18",
21
+ "@graphcommerce/eslint-config-pwa": "^9.1.0-canary.20",
22
+ "@graphcommerce/framer-utils": "^9.1.0-canary.20",
23
+ "@graphcommerce/image": "^9.1.0-canary.20",
24
+ "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.20",
25
+ "@graphcommerce/typescript-config-pwa": "^9.1.0-canary.20",
26
26
  "@lingui/core": "^4.2.1",
27
27
  "@lingui/react": "^4.2.1",
28
28
  "@mui/material": "^5.10.16",