@graphcommerce/next-ui 3.10.1 → 3.10.2
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/index.ts +0 -2
- package/package.json +11 -11
- package/useIntersectionObserver/index.tsx +0 -31
package/index.ts
CHANGED
|
@@ -153,8 +153,6 @@ export { default as ToggleButton } from './ToggleButton'
|
|
|
153
153
|
export type { ToggleButtonProps } from './ToggleButton'
|
|
154
154
|
export { default as ToggleButtonGroup } from './ToggleButtonGroup'
|
|
155
155
|
export type { ToggleButtonPropsBase } from './ToggleButtonGroup'
|
|
156
|
-
export * from './useIntersectionObserver'
|
|
157
|
-
export { default as useIntersectionObserver } from './useIntersectionObserver'
|
|
158
156
|
export * from './UspList'
|
|
159
157
|
export { default as UspList } from './UspList'
|
|
160
158
|
export * from './UspList/UspListItem'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphcommerce/next-ui",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.2",
|
|
4
4
|
"author": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@apollo/client": "^3.4.16",
|
|
13
|
-
"@graphcommerce/framer-next-pages": "^2.107.
|
|
14
|
-
"@graphcommerce/framer-scroller": "^0.4.
|
|
15
|
-
"@graphcommerce/framer-sheet": "^2.105.
|
|
16
|
-
"@graphcommerce/framer-utils": "^2.103.
|
|
17
|
-
"@graphcommerce/graphql": "^2.105.
|
|
18
|
-
"@graphcommerce/image": "^2.105.
|
|
13
|
+
"@graphcommerce/framer-next-pages": "^2.107.1",
|
|
14
|
+
"@graphcommerce/framer-scroller": "^0.4.1",
|
|
15
|
+
"@graphcommerce/framer-sheet": "^2.105.13",
|
|
16
|
+
"@graphcommerce/framer-utils": "^2.103.12",
|
|
17
|
+
"@graphcommerce/graphql": "^2.105.1",
|
|
18
|
+
"@graphcommerce/image": "^2.105.1",
|
|
19
19
|
"@graphql-typed-document-node/core": "^3.1.0",
|
|
20
20
|
"@material-ui/core": "^4.12.3",
|
|
21
21
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"clsx": "^1.1.1",
|
|
24
24
|
"framer-motion": "^4.1.17",
|
|
25
25
|
"graphql": "^15.6.1",
|
|
26
|
-
"next": "^12.0.
|
|
26
|
+
"next": "^12.0.1",
|
|
27
27
|
"react": "^17.0.2",
|
|
28
28
|
"react-dom": "^17.0.2",
|
|
29
29
|
"react-focus-lock": "^2.5.2",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@graphcommerce/browserslist-config-pwa": "^3.0.2",
|
|
37
|
-
"@graphcommerce/eslint-config-pwa": "^3.1.
|
|
37
|
+
"@graphcommerce/eslint-config-pwa": "^3.1.2",
|
|
38
38
|
"@graphcommerce/prettier-config-pwa": "^3.0.3",
|
|
39
39
|
"@graphcommerce/typescript-config-pwa": "^3.1.1",
|
|
40
|
-
"@playwright/test": "^1.
|
|
40
|
+
"@playwright/test": "^1.16.2",
|
|
41
41
|
"@types/react-is": "^17.0.3",
|
|
42
42
|
"graphql-tag": "2.12.5",
|
|
43
43
|
"typescript": "^4.4.4"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"project": "./tsconfig.json"
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "7f5e13261ccb398f5a7e6bac70d3f4d5f757fa5f"
|
|
57
57
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useState, RefObject, useEffect } from 'react'
|
|
2
|
-
|
|
3
|
-
export type UseIntersectionObserverOptions = {
|
|
4
|
-
ref: RefObject<Element> | null
|
|
5
|
-
rootRef?: RefObject<Element> | null
|
|
6
|
-
} & Pick<IntersectionObserverInit, 'rootMargin' | 'threshold'>
|
|
7
|
-
|
|
8
|
-
export default function useIntersectionObserver({
|
|
9
|
-
ref,
|
|
10
|
-
rootRef,
|
|
11
|
-
rootMargin,
|
|
12
|
-
threshold,
|
|
13
|
-
}: UseIntersectionObserverOptions) {
|
|
14
|
-
const [entry, setEntry] = useState<IntersectionObserverEntry | undefined>()
|
|
15
|
-
|
|
16
|
-
const tresholdJson = JSON.stringify(threshold)
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
if (typeof window === 'undefined' || !ref?.current) return () => {}
|
|
19
|
-
|
|
20
|
-
const observer = new IntersectionObserver((entries) => setEntry(entries[entries.length - 1]), {
|
|
21
|
-
root: rootRef?.current,
|
|
22
|
-
rootMargin,
|
|
23
|
-
threshold: JSON.parse(tresholdJson) as IntersectionObserverInit['threshold'],
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
observer.observe(ref.current)
|
|
27
|
-
return () => observer.disconnect()
|
|
28
|
-
}, [ref, rootMargin, rootRef, tresholdJson])
|
|
29
|
-
|
|
30
|
-
return entry
|
|
31
|
-
}
|