@graphcommerce/framer-scroller 0.2.8 → 0.3.0

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
@@ -3,6 +3,28 @@
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
+ # [0.3.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-scroller@0.2.11...@graphcommerce/framer-scroller@0.3.0) (2021-10-19)
7
+
8
+
9
+ ### Features
10
+
11
+ * **framer-scroller:** better defaults so the Scroller doesn't look broken when providing no props ([b177ce9](https://github.com/ho-nl/m2-pwa/commit/b177ce9570abb9ccfd4eb5cc34e43d157bb4e81a))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.2.9](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-scroller@0.2.8...@graphcommerce/framer-scroller@0.2.9) (2021-10-11)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **framer-scroller:** dots should have a background ([8f2e1a1](https://github.com/ho-nl/m2-pwa/commit/8f2e1a1ffc9de3369938fe2f9e9f25f592739d8d))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [0.2.8](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/framer-scroller@0.2.7...@graphcommerce/framer-scroller@0.2.8) (2021-10-09)
7
29
 
8
30
 
package/README.md CHANGED
@@ -37,22 +37,14 @@ import {
37
37
  function MyScroller() {
38
38
  return (
39
39
  <ScrollerProvider>
40
- <Scroller
41
- style={{
42
- display: `grid`,
43
- gridAutoFlow: `column`,
44
- gridTemplateColumns: `repeat(100, 100%)`,
45
- gridTemplateRows: `100%`,
46
- height: 400,
47
- }}
48
- >
49
- <div>item1</div>
50
- <div>item2</div>
51
- <div>item3</div>
52
- <div>item4</div>
53
- <div>item5</div>
54
- <div>item6</div>
55
- <div>item7</div>
40
+ <Scroller>
41
+ <div style={{ height: 400 }}>item1</div>
42
+ <div style={{ height: 400 }}>item2</div>
43
+ <div style={{ height: 400 }}>item3</div>
44
+ <div style={{ height: 400 }}>item4</div>
45
+ <div style={{ height: 400 }}>item5</div>
46
+ <div style={{ height: 400 }}>item6</div>
47
+ <div style={{ height: 400 }}>item7</div>
56
48
  </Scroller>
57
49
  <ScrollerButton>Next</ScrollerButton>
58
50
  </ScrollerProvider>
@@ -1,4 +1,5 @@
1
1
  import { useMotionValueValue } from '@graphcommerce/framer-utils'
2
+ import { UseStyles } from '@graphcommerce/next-ui'
2
3
  import { Fab, FabProps, makeStyles, Theme } from '@material-ui/core'
3
4
  import clsx from 'clsx'
4
5
  import { HTMLMotionProps, m } from 'framer-motion'
@@ -6,11 +7,6 @@ import React from 'react'
6
7
  import { useScrollTo } from '../hooks/useScrollTo'
7
8
  import { useScrollerContext } from '../hooks/useScrollerContext'
8
9
 
9
- export type DotsProps = {
10
- classes?: Record<'dots' | 'dot' | 'circle', string>
11
- fabProps?: Omit<FabProps, 'onClick' | 'children'>
12
- } & HTMLMotionProps<'div'>
13
-
14
10
  const useStyles = makeStyles(
15
11
  (theme: Theme) => ({
16
12
  dots: {
@@ -18,6 +14,7 @@ const useStyles = makeStyles(
18
14
  display: 'grid',
19
15
  gridAutoFlow: 'column',
20
16
  padding: `0 7px`,
17
+ borderRadius: '20px',
21
18
  },
22
19
  dot: {
23
20
  boxShadow: 'none',
@@ -34,8 +31,13 @@ const useStyles = makeStyles(
34
31
  { name: 'ScrollerDots' },
35
32
  )
36
33
 
34
+ export type DotsProps = {
35
+ fabProps?: Omit<FabProps, 'onClick' | 'children'>
36
+ } & HTMLMotionProps<'div'> &
37
+ UseStyles<typeof useStyles>
38
+
37
39
  const ScrollerDots = m(
38
- React.forwardRef<any, DotsProps>((props, ref) => {
40
+ React.forwardRef<HTMLDivElement, DotsProps>((props, ref) => {
39
41
  const { fabProps, ...containerProps } = props
40
42
  const { dots, dot, circle, ...classes } = useStyles(props)
41
43
  const { items, getScrollSnapPositions } = useScrollerContext()
@@ -19,6 +19,9 @@ import { useVelocitySnapTo } from './useVelocitySnapTo'
19
19
  const useStyles = makeStyles(
20
20
  {
21
21
  root: ({ scrollSnapAlign, scrollSnapStop }: ScrollSnapProps) => ({
22
+ display: 'grid',
23
+ gridAutoFlow: 'column',
24
+ gridAutoColumns: `40%`,
22
25
  overflow: `auto`,
23
26
  overscrollBehaviorInline: `contain`,
24
27
  '& > *': {
@@ -49,7 +52,7 @@ const useStyles = makeStyles(
49
52
  },
50
53
  },
51
54
  },
52
- { name: 'Scrollable' },
55
+ { name: 'Scroller' },
53
56
  )
54
57
 
55
58
  export type ScrollableProps<TagName extends keyof ReactHTML = 'div'> = HTMLMotionProps<TagName> & {
@@ -71,7 +74,7 @@ export function useScroller<TagName extends keyof ReactHTML = 'div'>(
71
74
 
72
75
  const canGrab = useMotionValueValue(
73
76
  useTransform(
74
- [scroll.xMax, scroll.yMax] as MotionValue[],
77
+ [scroll.xMax, scroll.yMax] as MotionValue<string | number>[],
75
78
  ([xMax, yMax]: number[]) => xMax || yMax,
76
79
  ),
77
80
  (v) => v,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphcommerce/framer-scroller",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "dev": "tsc -W"
@@ -16,17 +16,17 @@
16
16
  }
17
17
  },
18
18
  "dependencies": {
19
- "@graphcommerce/framer-utils": "^2.103.6",
20
- "@graphcommerce/image": "^2.104.7",
19
+ "@graphcommerce/framer-utils": "^2.103.8",
20
+ "@graphcommerce/image": "^2.104.10",
21
21
  "@material-ui/core": "^4.12.3",
22
22
  "popmotion": "9.3.6"
23
23
  },
24
24
  "devDependencies": {
25
- "@graphcommerce/browserslist-config-pwa": "^3.0.1",
26
- "@graphcommerce/eslint-config-pwa": "^3.0.5",
27
- "@graphcommerce/prettier-config-pwa": "^3.0.2",
28
- "@graphcommerce/typescript-config-pwa": "^3.1.0",
29
- "@playwright/test": "^1.15.0"
25
+ "@graphcommerce/browserslist-config-pwa": "^3.0.2",
26
+ "@graphcommerce/eslint-config-pwa": "^3.0.7",
27
+ "@graphcommerce/prettier-config-pwa": "^3.0.3",
28
+ "@graphcommerce/typescript-config-pwa": "^3.1.1",
29
+ "@playwright/test": "^1.15.2"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "clsx": "^1.1.1",
@@ -35,5 +35,5 @@
35
35
  "react-dom": "^17.0.2",
36
36
  "type-fest": "^1.0.1"
37
37
  },
38
- "gitHead": "b3dd4c996ac571874bb03d0a5c16b2c37f41abcb"
38
+ "gitHead": "a7749d81f482a77bc6bcbf237aca551ed3b7a835"
39
39
  }