@graphcommerce/framer-scroller 2.1.14 → 2.1.15

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,19 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.1.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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):
8
+
9
+ - Prevent vertical scrolling
10
+ - Disable zoom fab when there are no images
11
+ - Hide scroller dots when there in only one image
12
+ - Make sure the prev/next buttons are shown as expected
13
+
14
+ - Updated dependencies [[`0ab7c5465`](https://github.com/graphcommerce-org/graphcommerce/commit/0ab7c5465441cba9bf8cd185a6790ce2f443f4ed)]:
15
+ - @graphcommerce/next-ui@4.8.4
16
+
3
17
  ## 2.1.14
4
18
 
5
19
  ### Patch Changes
@@ -1,6 +1,6 @@
1
- import { useElementScroll } from '@graphcommerce/framer-utils'
1
+ import { useElementScroll, useMotionValueValue } from '@graphcommerce/framer-utils'
2
2
  import { Fab, FabProps } from '@mui/material'
3
- import { m, useSpring, useTransform } from 'framer-motion'
3
+ import { m, useMotionTemplate, useSpring, useTransform } from 'framer-motion'
4
4
  import React from 'react'
5
5
  import { useScrollTo } from '../hooks/useScrollTo'
6
6
  import { useScrollerContext } from '../hooks/useScrollerContext'
@@ -8,11 +8,12 @@ import { SnapPositionDirection } from '../types'
8
8
 
9
9
  export type ScrollerButtonProps = {
10
10
  direction: SnapPositionDirection
11
+ layout?: boolean
11
12
  } & FabProps
12
13
 
13
14
  export const ScrollerButton = m(
14
15
  React.forwardRef<HTMLDivElement, ScrollerButtonProps>((props, ref) => {
15
- const { direction, sx = [], ...buttonProps } = props
16
+ const { direction, sx = [], layout, ...buttonProps } = props
16
17
 
17
18
  const { getSnapPosition, scrollerRef } = useScrollerContext()
18
19
  const scrollTo = useScrollTo()
@@ -39,20 +40,30 @@ export const ScrollerButton = m(
39
40
  }
40
41
  },
41
42
  )
42
- const scale = useSpring(progress)
43
+
44
+ const scale = useMotionValueValue(progress, (v) => v)
43
45
 
44
46
  return (
45
- <m.div ref={ref} style={{ scale, opacity: scale, willChange: 'scale, opacity', zIndex: 1 }}>
47
+ <m.div ref={ref} layout={layout}>
46
48
  <Fab
47
49
  type='button'
48
50
  size='small'
49
51
  {...buttonProps}
50
52
  onClick={handleClick}
51
53
  aria-label={direction}
52
- sx={[{ display: { xs: 'none', md: 'flex' } }, ...(Array.isArray(sx) ? sx : [sx])]}
54
+ sx={[
55
+ {
56
+ display: { xs: 'none', md: 'flex' },
57
+ transition: 'all 250ms',
58
+ opacity: scale,
59
+ transform: `scale(${scale})`,
60
+ },
61
+ ...(Array.isArray(sx) ? sx : [sx]),
62
+ ]}
53
63
  />
54
64
  </m.div>
55
65
  )
56
66
  }),
57
67
  )
68
+
58
69
  ScrollerButton.displayName = 'ScrollerButton'
@@ -23,6 +23,8 @@ export const ScrollerDots = m(
23
23
  const { items } = useScrollerContext()
24
24
  const itemsArr = useMotionValueValue(items, (v) => v)
25
25
 
26
+ if (itemsArr.length <= 1) return null
27
+
26
28
  return (
27
29
  <MotionBox
28
30
  {...containerProps}
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.14",
5
+ "version": "2.1.15",
6
6
  "sideEffects": false,
7
7
  "scripts": {
8
8
  "dev": "tsc -W"
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "@graphcommerce/framer-utils": "3.1.3",
19
19
  "@graphcommerce/image": "3.1.6",
20
- "@graphcommerce/next-ui": "4.8.3"
20
+ "@graphcommerce/next-ui": "4.8.4"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@graphcommerce/eslint-config-pwa": "^4.1.7",