@graphcommerce/framer-scroller 2.1.13 → 2.1.16
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 +34 -0
- package/components/ScrollerButton.tsx +30 -24
- package/components/ScrollerDots.tsx +2 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 2.1.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1511](https://github.com/graphcommerce-org/graphcommerce/pull/1511) [`ddb6d6329`](https://github.com/graphcommerce-org/graphcommerce/commit/ddb6d6329bfad361b2fbe96402ca2bfc0ab3d98c) Thanks [@paales](https://github.com/paales)! - make sure the header is clickable when no forward/prev buttons are shown
|
|
8
|
+
|
|
9
|
+
* [#1490](https://github.com/graphcommerce-org/graphcommerce/pull/1490) [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb) Thanks [@paales](https://github.com/paales)! - upgraded packages
|
|
10
|
+
|
|
11
|
+
* Updated dependencies [[`a9213f1f5`](https://github.com/graphcommerce-org/graphcommerce/commit/a9213f1f5a410d217768386ccb6d9b5ce7bd5782), [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb)]:
|
|
12
|
+
- @graphcommerce/next-ui@4.9.0
|
|
13
|
+
- @graphcommerce/framer-utils@3.1.4
|
|
14
|
+
- @graphcommerce/image@3.1.7
|
|
15
|
+
|
|
16
|
+
## 2.1.15
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#1509](https://github.com/graphcommerce-org/graphcommerce/pull/1509) [`0ab7c5465`](https://github.com/graphcommerce-org/graphcommerce/commit/0ab7c5465441cba9bf8cd185a6790ce2f443f4ed) Thanks [@paales](https://github.com/paales)! - SidebarGallery improvements (product page):
|
|
21
|
+
|
|
22
|
+
- Prevent vertical scrolling
|
|
23
|
+
- Disable zoom fab when there are no images
|
|
24
|
+
- Hide scroller dots when there in only one image
|
|
25
|
+
- Make sure the prev/next buttons are shown as expected
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [[`0ab7c5465`](https://github.com/graphcommerce-org/graphcommerce/commit/0ab7c5465441cba9bf8cd185a6790ce2f443f4ed)]:
|
|
28
|
+
- @graphcommerce/next-ui@4.8.4
|
|
29
|
+
|
|
30
|
+
## 2.1.14
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [[`afc67103d`](https://github.com/graphcommerce-org/graphcommerce/commit/afc67103d0e00583e274465036fd287537f95e79)]:
|
|
35
|
+
- @graphcommerce/next-ui@4.8.3
|
|
36
|
+
|
|
3
37
|
## 2.1.13
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { useElementScroll } from '@graphcommerce/framer-utils'
|
|
2
|
-
import { Fab, FabProps } from '@mui/material'
|
|
3
|
-
import { m,
|
|
1
|
+
import { useElementScroll, useMotionValueValue } from '@graphcommerce/framer-utils'
|
|
2
|
+
import { Fab, FabProps, styled, SxProps, Theme } from '@mui/material'
|
|
3
|
+
import { m, useTransform } from 'framer-motion'
|
|
4
4
|
import React from 'react'
|
|
5
5
|
import { useScrollTo } from '../hooks/useScrollTo'
|
|
6
6
|
import { useScrollerContext } from '../hooks/useScrollerContext'
|
|
7
7
|
import { SnapPositionDirection } from '../types'
|
|
8
8
|
|
|
9
|
+
const MotionDiv = styled(m.div)({})
|
|
10
|
+
|
|
9
11
|
export type ScrollerButtonProps = {
|
|
10
12
|
direction: SnapPositionDirection
|
|
13
|
+
layout?: boolean
|
|
14
|
+
sxContainer?: SxProps<Theme>
|
|
11
15
|
} & FabProps
|
|
12
16
|
|
|
13
17
|
export const ScrollerButton = m(
|
|
14
18
|
React.forwardRef<HTMLDivElement, ScrollerButtonProps>((props, ref) => {
|
|
15
|
-
const { direction, sx = [], ...buttonProps } = props
|
|
19
|
+
const { direction, sx = [], layout, className, sxContainer, ...buttonProps } = props
|
|
16
20
|
|
|
17
21
|
const { getSnapPosition, scrollerRef } = useScrollerContext()
|
|
18
22
|
const scrollTo = useScrollTo()
|
|
@@ -20,39 +24,41 @@ export const ScrollerButton = m(
|
|
|
20
24
|
|
|
21
25
|
const { xProgress, yProgress, xMax, yMax } = useElementScroll(scrollerRef)
|
|
22
26
|
|
|
23
|
-
const
|
|
24
|
-
[xProgress, yProgress, xMax, yMax],
|
|
25
|
-
([x, y, xM, yM]) => {
|
|
27
|
+
const visibility = useMotionValueValue(
|
|
28
|
+
useTransform<number, number>([xProgress, yProgress, xMax, yMax], ([x, y, xM, yM]) => {
|
|
26
29
|
if (xM === 0 && yM === 0) return 0
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return y > 0.9 ? 0 : 1
|
|
37
|
-
default:
|
|
38
|
-
return 0
|
|
39
|
-
}
|
|
40
|
-
},
|
|
31
|
+
if (direction === 'left') return x < 0.1 ? 0 : 1
|
|
32
|
+
if (direction === 'right') return x > 0.9 ? 0 : 1
|
|
33
|
+
if (direction === 'up') return y < 0.1 ? 0 : 1
|
|
34
|
+
if (direction === 'down') return y > 0.9 ? 0 : 1
|
|
35
|
+
|
|
36
|
+
return 0
|
|
37
|
+
}),
|
|
38
|
+
(v) => v,
|
|
41
39
|
)
|
|
42
|
-
const scale = useSpring(progress)
|
|
43
40
|
|
|
44
41
|
return (
|
|
45
|
-
<
|
|
42
|
+
<MotionDiv ref={ref} layout={layout} sx={sxContainer} className={className}>
|
|
46
43
|
<Fab
|
|
47
44
|
type='button'
|
|
48
45
|
size='small'
|
|
49
46
|
{...buttonProps}
|
|
50
47
|
onClick={handleClick}
|
|
51
48
|
aria-label={direction}
|
|
52
|
-
sx={[
|
|
49
|
+
sx={[
|
|
50
|
+
{
|
|
51
|
+
display: { xs: 'none', md: 'flex' },
|
|
52
|
+
transition: 'all 250ms',
|
|
53
|
+
opacity: visibility,
|
|
54
|
+
transform: `scale(${visibility})`,
|
|
55
|
+
},
|
|
56
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
57
|
+
]}
|
|
53
58
|
/>
|
|
54
|
-
</
|
|
59
|
+
</MotionDiv>
|
|
55
60
|
)
|
|
56
61
|
}),
|
|
57
62
|
)
|
|
63
|
+
|
|
58
64
|
ScrollerButton.displayName = 'ScrollerButton'
|
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": "2.1.
|
|
5
|
+
"version": "2.1.16",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "tsc -W"
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@graphcommerce/framer-utils": "3.1.
|
|
19
|
-
"@graphcommerce/image": "3.1.
|
|
20
|
-
"@graphcommerce/next-ui": "4.
|
|
18
|
+
"@graphcommerce/framer-utils": "3.1.4",
|
|
19
|
+
"@graphcommerce/image": "3.1.7",
|
|
20
|
+
"@graphcommerce/next-ui": "4.9.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@graphcommerce/eslint-config-pwa": "^4.1.
|
|
23
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.8",
|
|
24
24
|
"@graphcommerce/prettier-config-pwa": "^4.0.6",
|
|
25
25
|
"@graphcommerce/typescript-config-pwa": "^4.0.3",
|
|
26
26
|
"@playwright/test": "^1.21.1"
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"@lingui/react": "^3.13.2",
|
|
31
31
|
"@lingui/core": "^3.13.2",
|
|
32
32
|
"framer-motion": "^6.2.4",
|
|
33
|
-
"next": "12.1.2",
|
|
33
|
+
"next": "^12.1.2",
|
|
34
34
|
"popmotion": "11.0.3",
|
|
35
|
-
"react": "^
|
|
36
|
-
"react-dom": "^
|
|
35
|
+
"react": "^18.0.0",
|
|
36
|
+
"react-dom": "^18.0.0"
|
|
37
37
|
}
|
|
38
38
|
}
|