@graphcommerce/framer-scroller 1.1.18 → 1.1.22
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 +36 -0
- package/components/MotionImageAspect.tsx +26 -15
- package/components/ScrollerDots.tsx +1 -1
- package/components/ScrollerProvider.tsx +3 -3
- package/hooks/useScroller.ts +4 -0
- package/index.ts +0 -1
- package/package.json +3 -3
- package/components/CenterSlide.tsx +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,42 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.22](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-scroller@1.1.21...@graphcommerce/framer-scroller@1.1.22) (2021-12-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **framer-scroller:** make sure the first gallery dot is selected initially ([a2ed37b](https://github.com/ho-nl/m2-pwa/commit/a2ed37bd2c17eef46c0ee4cf8219a141b2e054b4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.1.21](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-scroller@1.1.20...@graphcommerce/framer-scroller@1.1.21) (2021-12-22)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **framer-scroller:** height of the gallery item isn't high enough ([0e84ba3](https://github.com/ho-nl/m2-pwa/commit/0e84ba3ecb8928870fdc0459a1c6c30fde372d91))
|
|
23
|
+
* **framer-scroller:** make sure the actual image will scale instead of the container ([8d55630](https://github.com/ho-nl/m2-pwa/commit/8d55630a93cff91ac37e426bbe9f1b25b001556c))
|
|
24
|
+
* **framer-scroller:** would throw ssr warning ([a3db078](https://github.com/ho-nl/m2-pwa/commit/a3db0781d2433809c0bd4cb6ba37af79b611f3c4))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [1.1.20](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-scroller@1.1.19...@graphcommerce/framer-scroller@1.1.20) (2021-12-22)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* **framer-scroller:** gallery didn't align images in the center ([0cf6066](https://github.com/ho-nl/m2-pwa/commit/0cf60669b2547d2c421eb07c1ba23d7718df74aa))
|
|
36
|
+
* **framer-scroller:** offaxis scroll was allowed on safari ([4ece409](https://github.com/ho-nl/m2-pwa/commit/4ece409fabad7e686d491cc6bc1682c4507f2d3b))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
6
42
|
## [1.1.17](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-scroller@1.1.16...@graphcommerce/framer-scroller@1.1.17) (2021-12-21)
|
|
7
43
|
|
|
8
44
|
|
|
@@ -6,13 +6,22 @@ import React, { forwardRef } from 'react'
|
|
|
6
6
|
|
|
7
7
|
const useStyles = makeStyles(
|
|
8
8
|
{
|
|
9
|
+
root: {
|
|
10
|
+
position: 'relative',
|
|
11
|
+
},
|
|
9
12
|
picture: {
|
|
10
13
|
display: 'block',
|
|
11
14
|
'@supports (aspect-ratio: 1 / 1)': {
|
|
12
|
-
maxWidth: '
|
|
15
|
+
maxWidth: '99.6%',
|
|
13
16
|
maxHeight: '100%',
|
|
14
|
-
width: 'auto
|
|
15
|
-
height: 'auto
|
|
17
|
+
width: 'auto',
|
|
18
|
+
height: 'auto',
|
|
19
|
+
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
top: '50%',
|
|
22
|
+
left: '50%',
|
|
23
|
+
transform: 'translate(-50%, -50%)',
|
|
24
|
+
|
|
16
25
|
'&:after': {
|
|
17
26
|
display: 'block',
|
|
18
27
|
content: '""',
|
|
@@ -40,23 +49,25 @@ export type MotionImageAspectProps = Omit<ImageProps, 'layout' | 'unoptimized'>
|
|
|
40
49
|
* - Renders an image with the given aspect ratio
|
|
41
50
|
* - Supports framer motion layout transitions
|
|
42
51
|
*
|
|
43
|
-
* Note: We have a fallback for Safari which doesn't yet support aspect-ratio, this causes a
|
|
44
|
-
* when the layout is animated. Should be fixed in Safari 15
|
|
52
|
+
* Note: We have a fallback for Safari 14 which doesn't yet support aspect-ratio, this causes a
|
|
53
|
+
* problem when the layout is animated. Should be fixed in Safari 15
|
|
45
54
|
*/
|
|
46
55
|
const MotionImageAspect = m(
|
|
47
56
|
forwardRef<HTMLImageElement, MotionImageAspectProps>((props, ref) => {
|
|
48
57
|
const classes = useStyles()
|
|
49
58
|
return (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
<div className={classes.root}>
|
|
60
|
+
<Image
|
|
61
|
+
{...props}
|
|
62
|
+
layout='fill'
|
|
63
|
+
ref={ref}
|
|
64
|
+
className={clsx(classes.image, props.className)}
|
|
65
|
+
pictureProps={{
|
|
66
|
+
className: clsx(classes.picture, props.pictureProps?.className),
|
|
67
|
+
style: { ...props.style, aspectRatio: `${props.width} / ${props.height}` },
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
60
71
|
)
|
|
61
72
|
}),
|
|
62
73
|
)
|
|
@@ -37,7 +37,7 @@ export type DotsProps = {
|
|
|
37
37
|
|
|
38
38
|
const ScrollerDots = m(
|
|
39
39
|
React.forwardRef<HTMLDivElement, DotsProps>((props, ref) => {
|
|
40
|
-
const { fabProps, ...containerProps } = props
|
|
40
|
+
const { fabProps, classes: _classes, ...containerProps } = props
|
|
41
41
|
const { dots, dot, circle, ...classes } = useStyles(props)
|
|
42
42
|
const { items, getScrollSnapPositions } = useScrollerContext()
|
|
43
43
|
const itemsArr = useMotionValueValue(items, (v) => v)
|
|
@@ -126,9 +126,9 @@ export default function ScrollerProvider(props: ScrollerProviderProps) {
|
|
|
126
126
|
itemsArr.length = count
|
|
127
127
|
|
|
128
128
|
items.set(
|
|
129
|
-
itemsArr.fill(undefined).map<ItemState>(() => ({
|
|
130
|
-
visibility: motionValue(0),
|
|
131
|
-
opacity: motionValue(0.2),
|
|
129
|
+
itemsArr.fill(undefined).map<ItemState>((_, i) => ({
|
|
130
|
+
visibility: motionValue(i === 0 ? 1 : 0),
|
|
131
|
+
opacity: motionValue(i === 0 ? 1 : 0.2),
|
|
132
132
|
})),
|
|
133
133
|
)
|
|
134
134
|
},
|
package/hooks/useScroller.ts
CHANGED
|
@@ -40,24 +40,28 @@ const useStyles = makeStyles(
|
|
|
40
40
|
rootSmSnapDirBlock: {
|
|
41
41
|
[theme.breakpoints.down('sm')]: {
|
|
42
42
|
overflowY: 'auto',
|
|
43
|
+
overflowX: 'hidden',
|
|
43
44
|
overscrollBehaviorBlock: 'contain',
|
|
44
45
|
},
|
|
45
46
|
},
|
|
46
47
|
rootMdSnapDirBlock: {
|
|
47
48
|
[theme.breakpoints.up('md')]: {
|
|
48
49
|
overflowY: 'auto',
|
|
50
|
+
overflowX: 'hidden',
|
|
49
51
|
overscrollBehaviorBlock: 'contain',
|
|
50
52
|
},
|
|
51
53
|
},
|
|
52
54
|
rootSmSnapDirInline: {
|
|
53
55
|
[theme.breakpoints.down('sm')]: {
|
|
54
56
|
overflowX: 'auto',
|
|
57
|
+
overflowY: 'hidden',
|
|
55
58
|
overscrollBehaviorInline: 'contain',
|
|
56
59
|
},
|
|
57
60
|
},
|
|
58
61
|
rootMdSnapDirInline: {
|
|
59
62
|
[theme.breakpoints.up('md')]: {
|
|
60
63
|
overflowX: 'auto',
|
|
64
|
+
overflowY: 'hidden',
|
|
61
65
|
overscrollBehaviorInline: 'contain',
|
|
62
66
|
},
|
|
63
67
|
},
|
package/index.ts
CHANGED
|
@@ -4,7 +4,6 @@ export * from './components/MotionImageAspect'
|
|
|
4
4
|
export { default as MotionImageAspect } from './components/MotionImageAspect'
|
|
5
5
|
|
|
6
6
|
export { default as Scroller } from './components/Scroller'
|
|
7
|
-
export { default as CenterSlide } from './components/CenterSlide'
|
|
8
7
|
|
|
9
8
|
export * from './components/ScrollerButton'
|
|
10
9
|
export { default as ScrollerButton } from './components/ScrollerButton'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphcommerce/framer-scroller",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "tsc -W"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@graphcommerce/framer-utils": "^2.103.20",
|
|
20
20
|
"@graphcommerce/image": "^2.105.11",
|
|
21
|
-
"@graphcommerce/next-ui": "^3.21.
|
|
21
|
+
"@graphcommerce/next-ui": "^3.21.12",
|
|
22
22
|
"@material-ui/core": "^4.12.3",
|
|
23
23
|
"popmotion": "11.0.3"
|
|
24
24
|
},
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"react-dom": "^17.0.2",
|
|
37
37
|
"type-fest": "^2.8.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "55abd5ec0f5821dc4bba8d0a82fd265ff1d6a024"
|
|
40
40
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { styled } from '@material-ui/core'
|
|
2
|
-
|
|
3
|
-
const CenterSlide = styled('div')(
|
|
4
|
-
{
|
|
5
|
-
display: 'flex',
|
|
6
|
-
alignItems: 'center',
|
|
7
|
-
justifyContent: 'center',
|
|
8
|
-
},
|
|
9
|
-
{ name: 'CenterSlide' },
|
|
10
|
-
)
|
|
11
|
-
CenterSlide.displayName = 'CenterSlide'
|
|
12
|
-
|
|
13
|
-
export default CenterSlide
|