@graphcommerce/next-ui 9.0.0-canary.78 → 9.0.0-canary.79
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 +6 -0
- package/Overlay/components/OverlayBase.tsx +31 -6
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.0.0-canary.79
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2356](https://github.com/graphcommerce-org/graphcommerce/pull/2356) [`d283901`](https://github.com/graphcommerce-org/graphcommerce/commit/d283901cb537c3e7bf6f5500e9f52f47f452cf10) - Loading an overlay page directly would animate in the overlay instead of directly showing it. ([@paales](https://github.com/paales))
|
|
8
|
+
|
|
3
9
|
## 9.0.0-canary.78
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Direction } from '@graphcommerce/framer-next-pages'
|
|
1
2
|
import { Scroller, useScrollerContext, useScrollTo } from '@graphcommerce/framer-scroller'
|
|
2
3
|
import {
|
|
3
4
|
dvh,
|
|
@@ -46,7 +47,7 @@ export type LayoutOverlayBaseProps = {
|
|
|
46
47
|
sx?: SxProps<Theme>
|
|
47
48
|
sxBackdrop?: SxProps<Theme>
|
|
48
49
|
active: boolean
|
|
49
|
-
direction?:
|
|
50
|
+
direction?: Direction
|
|
50
51
|
onClosed: () => void
|
|
51
52
|
offsetPageY?: number
|
|
52
53
|
isPresent: boolean
|
|
@@ -123,7 +124,8 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
|
|
|
123
124
|
props.smSpacingTop ?? ((theme) => `calc(${theme.appShell.headerHeightSm} * 0.5)`)
|
|
124
125
|
)(th)
|
|
125
126
|
|
|
126
|
-
const { scrollerRef, snap, scroll, getScrollSnapPositions, disableSnap } =
|
|
127
|
+
const { scrollerRef, snap, scroll, getScrollSnapPositions, disableSnap, enableSnap } =
|
|
128
|
+
useScrollerContext()
|
|
127
129
|
const scrollTo = useScrollTo()
|
|
128
130
|
|
|
129
131
|
const beforeRef = useRef<HTMLDivElement>(null)
|
|
@@ -137,7 +139,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
|
|
|
137
139
|
|
|
138
140
|
const match = useMatchMedia()
|
|
139
141
|
const positions = useConstant(() => ({
|
|
140
|
-
open: { x: motionValue(0), y: motionValue(0), visible: motionValue(0) },
|
|
142
|
+
open: { x: motionValue(0), y: motionValue(0), visible: motionValue(direction === 0 ? 1 : 0) },
|
|
141
143
|
closed: { x: motionValue(0), y: motionValue(0) },
|
|
142
144
|
}))
|
|
143
145
|
|
|
@@ -277,17 +279,40 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
|
|
|
277
279
|
useIsomorphicLayoutEffect(() => {
|
|
278
280
|
const scroller = scrollerRef.current
|
|
279
281
|
|
|
280
|
-
if (!scroller || !isPresent) return
|
|
282
|
+
if (!scroller || !isPresent || position.get() === OverlayPosition.OPENED) return
|
|
281
283
|
|
|
282
284
|
if (variant() === 'right') document.body.style.overflow = 'hidden'
|
|
283
285
|
|
|
284
|
-
if (
|
|
286
|
+
if (direction === 0) {
|
|
287
|
+
disableSnap()
|
|
288
|
+
scroller.scrollTop = positions.open.y.get()
|
|
289
|
+
scroller.scrollLeft = positions.open.x.get()
|
|
290
|
+
scroll.y.set(positions.open.y.get())
|
|
291
|
+
scroll.x.set(positions.open.x.get())
|
|
292
|
+
position.set(OverlayPosition.OPENED)
|
|
293
|
+
enableSnap()
|
|
294
|
+
} else if (!scroll.animating.get()) {
|
|
285
295
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
286
296
|
scrollTo(openClosePositions().open, { stopAnimationOnScroll: false }).then(() =>
|
|
287
297
|
position.set(OverlayPosition.OPENED),
|
|
288
298
|
)
|
|
289
299
|
}
|
|
290
|
-
}, [
|
|
300
|
+
}, [
|
|
301
|
+
direction,
|
|
302
|
+
disableSnap,
|
|
303
|
+
enableSnap,
|
|
304
|
+
isPresent,
|
|
305
|
+
openClosePositions,
|
|
306
|
+
position,
|
|
307
|
+
positions.open.x,
|
|
308
|
+
positions.open.y,
|
|
309
|
+
scroll.animating,
|
|
310
|
+
scroll.x,
|
|
311
|
+
scroll.y,
|
|
312
|
+
scrollTo,
|
|
313
|
+
scrollerRef,
|
|
314
|
+
variant,
|
|
315
|
+
])
|
|
291
316
|
|
|
292
317
|
// When the overlay is closed by navigating away, we're closing the overlay.
|
|
293
318
|
useEffect(() => {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/next-ui",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "9.0.0-canary.
|
|
5
|
+
"version": "9.0.0-canary.79",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"typescript": "5.5.3"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.
|
|
30
|
-
"@graphcommerce/framer-next-pages": "^9.0.0-canary.
|
|
31
|
-
"@graphcommerce/framer-scroller": "^9.0.0-canary.
|
|
32
|
-
"@graphcommerce/framer-utils": "^9.0.0-canary.
|
|
33
|
-
"@graphcommerce/image": "^9.0.0-canary.
|
|
34
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.
|
|
35
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.
|
|
29
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.79",
|
|
30
|
+
"@graphcommerce/framer-next-pages": "^9.0.0-canary.79",
|
|
31
|
+
"@graphcommerce/framer-scroller": "^9.0.0-canary.79",
|
|
32
|
+
"@graphcommerce/framer-utils": "^9.0.0-canary.79",
|
|
33
|
+
"@graphcommerce/image": "^9.0.0-canary.79",
|
|
34
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.79",
|
|
35
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.79",
|
|
36
36
|
"@lingui/core": "^4.2.1",
|
|
37
37
|
"@lingui/macro": "^4.2.1",
|
|
38
38
|
"@lingui/react": "^4.2.1",
|