@graphcommerce/framer-scroller 1.1.16 → 1.1.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 +23 -0
- package/components/MotionImageAspect.tsx +26 -16
- package/hooks/useScrollTo.ts +1 -1
- package/hooks/useScroller.ts +8 -2
- package/index.ts +0 -1
- package/package.json +3 -3
- package/components/CenterSlide.tsx +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
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.20](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-scroller@1.1.19...@graphcommerce/framer-scroller@1.1.20) (2021-12-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **framer-scroller:** gallery didn't align images in the center ([0cf6066](https://github.com/ho-nl/m2-pwa/commit/0cf60669b2547d2c421eb07c1ba23d7718df74aa))
|
|
12
|
+
* **framer-scroller:** offaxis scroll was allowed on safari ([4ece409](https://github.com/ho-nl/m2-pwa/commit/4ece409fabad7e686d491cc6bc1682c4507f2d3b))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [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)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **framer-scroller:** apply will change only when animating ([77fee92](https://github.com/ho-nl/m2-pwa/commit/77fee92c0eb70691b699e1f6ba378ec16c534975))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
## [1.1.14](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-scroller@1.1.13...@graphcommerce/framer-scroller@1.1.14) (2021-12-20)
|
|
7
30
|
|
|
8
31
|
|
|
@@ -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: '
|
|
13
|
-
maxHeight: '
|
|
14
|
-
width: 'auto
|
|
15
|
-
height: 'auto
|
|
15
|
+
maxWidth: '99.6%',
|
|
16
|
+
maxHeight: '99.6%',
|
|
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,24 @@ 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} ref={ref}>
|
|
60
|
+
<Image
|
|
61
|
+
{...props}
|
|
62
|
+
layout='fill'
|
|
63
|
+
className={clsx(classes.image, props.className)}
|
|
64
|
+
pictureProps={{
|
|
65
|
+
className: clsx(classes.picture, props.pictureProps?.className),
|
|
66
|
+
style: { ...props.style, aspectRatio: `${props.width} / ${props.height}` },
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
60
70
|
)
|
|
61
71
|
}),
|
|
62
72
|
)
|
package/hooks/useScrollTo.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useElementScroll } from '@graphcommerce/framer-utils'
|
|
2
2
|
import { Point } from 'framer-motion'
|
|
3
|
-
import { animate
|
|
3
|
+
import { animate } from 'popmotion'
|
|
4
4
|
import { useScrollerContext } from './useScrollerContext'
|
|
5
5
|
|
|
6
6
|
export function useScrollTo() {
|
package/hooks/useScroller.ts
CHANGED
|
@@ -20,13 +20,11 @@ import { useVelocitySnapTo } from './useVelocitySnapTo'
|
|
|
20
20
|
const useStyles = makeStyles(
|
|
21
21
|
(theme: Theme) => ({
|
|
22
22
|
root: {
|
|
23
|
-
willChange: 'scroll-position',
|
|
24
23
|
'& *': {
|
|
25
24
|
userSelect: 'none',
|
|
26
25
|
userDrag: 'none',
|
|
27
26
|
},
|
|
28
27
|
},
|
|
29
|
-
|
|
30
28
|
rootSmSnapDirNone: {
|
|
31
29
|
[theme.breakpoints.down('sm')]: {
|
|
32
30
|
overflow: 'hidden',
|
|
@@ -42,24 +40,28 @@ const useStyles = makeStyles(
|
|
|
42
40
|
rootSmSnapDirBlock: {
|
|
43
41
|
[theme.breakpoints.down('sm')]: {
|
|
44
42
|
overflowY: 'auto',
|
|
43
|
+
overflowX: 'hidden',
|
|
45
44
|
overscrollBehaviorBlock: 'contain',
|
|
46
45
|
},
|
|
47
46
|
},
|
|
48
47
|
rootMdSnapDirBlock: {
|
|
49
48
|
[theme.breakpoints.up('md')]: {
|
|
50
49
|
overflowY: 'auto',
|
|
50
|
+
overflowX: 'hidden',
|
|
51
51
|
overscrollBehaviorBlock: 'contain',
|
|
52
52
|
},
|
|
53
53
|
},
|
|
54
54
|
rootSmSnapDirInline: {
|
|
55
55
|
[theme.breakpoints.down('sm')]: {
|
|
56
56
|
overflowX: 'auto',
|
|
57
|
+
overflowY: 'hidden',
|
|
57
58
|
overscrollBehaviorInline: 'contain',
|
|
58
59
|
},
|
|
59
60
|
},
|
|
60
61
|
rootMdSnapDirInline: {
|
|
61
62
|
[theme.breakpoints.up('md')]: {
|
|
62
63
|
overflowX: 'auto',
|
|
64
|
+
overflowY: 'hidden',
|
|
63
65
|
overscrollBehaviorInline: 'contain',
|
|
64
66
|
},
|
|
65
67
|
},
|
|
@@ -106,6 +108,9 @@ const useStyles = makeStyles(
|
|
|
106
108
|
scrollSnapType: scrollSnapTypeMd,
|
|
107
109
|
},
|
|
108
110
|
}),
|
|
111
|
+
rootNoSnap: {
|
|
112
|
+
willChange: 'scroll-position',
|
|
113
|
+
},
|
|
109
114
|
rootIsPanning: {
|
|
110
115
|
cursor: 'grabbing !important',
|
|
111
116
|
'& > *': {
|
|
@@ -217,6 +222,7 @@ export function useScroller<TagName extends keyof ReactHTML = 'div'>(
|
|
|
217
222
|
mdSnapDir,
|
|
218
223
|
mdGridDir,
|
|
219
224
|
isSnap,
|
|
225
|
+
noSnap: !isSnap,
|
|
220
226
|
isPanning,
|
|
221
227
|
hideScrollbar,
|
|
222
228
|
canGrab,
|
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.20",
|
|
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.10",
|
|
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": "c8ce20cffa0bf8fe47fa75d98c97d8c5d684c485"
|
|
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
|