@graphcommerce/next-ui 6.0.0-canary.54 → 6.0.1-canary.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
@@ -1,5 +1,87 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.0.1-canary.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1854](https://github.com/graphcommerce-org/graphcommerce/pull/1854) [`f4df162c5`](https://github.com/graphcommerce-org/graphcommerce/commit/f4df162c59d90298f305f51d409974592ab8e680) - Overlay desktop bottom didn't have a box-shadow ([@paales](https://github.com/paales))
8
+
9
+ - [#1854](https://github.com/graphcommerce-org/graphcommerce/pull/1854) [`ba92b3ebe`](https://github.com/graphcommerce-org/graphcommerce/commit/ba92b3ebe9dae16f156f6c0d62bdf25a7df1a2a7) - Allow bottom overlays to resize and animate in position ([@paales](https://github.com/paales))
10
+
11
+ ## 6.0.0
12
+
13
+ ### Major Changes
14
+
15
+ - [#1832](https://github.com/graphcommerce-org/graphcommerce/pull/1832) [`26d4243d5`](https://github.com/graphcommerce-org/graphcommerce/commit/26d4243d5b63d604e5a36386d9b01914db5f2918) - Added a new RowLink component with variants: Inline, ImageLabelSwiper, LogoSwiper and Usps. Updated the demo to show off these new components. ([@ErwinOtten](https://github.com/ErwinOtten))
16
+
17
+ - [#1749](https://github.com/graphcommerce-org/graphcommerce/pull/1749) [`0cc472915`](https://github.com/graphcommerce-org/graphcommerce/commit/0cc4729154d316227a41712b5f0adf514768e91f) - Introducing the new ProductFiltersPro component set with completely new filter and UI behavior. Filters will appear as a popper on the md and up breakpoints and as an overlay on sm and below breakpoints. Filters now have an Apply button instead of applying directly. ([@paales](https://github.com/paales))
18
+
19
+ ### Minor Changes
20
+
21
+ - [#1822](https://github.com/graphcommerce-org/graphcommerce/pull/1822) [`cc02c46e3`](https://github.com/graphcommerce-org/graphcommerce/commit/cc02c46e32c9a44a90789591f43d91ae234dac84) - Added Facebook Open Graph tags to product pages:
22
+
23
+ - og:title
24
+ - og:image
25
+ - og:url
26
+ - type
27
+ - product:retailer_part_no
28
+ - product:price:amount
29
+ - product:sale_price:amount
30
+ - product:price:currency
31
+ - product:category ([@KMalkowski](https://github.com/KMalkowski))
32
+
33
+ - [#1830](https://github.com/graphcommerce-org/graphcommerce/pull/1830) [`fafa76ba9`](https://github.com/graphcommerce-org/graphcommerce/commit/fafa76ba9e655739171abc553d309795c9d8e5c2) - Overlays now use an additional scroll container to handle vertical scroll, fixing:
34
+
35
+ - Scrolling on desktop will not close the overlay when there is content to be scrolled
36
+ - Scrolling will not snap to bottom / top when the content is barely scrollable
37
+ - Dragging will only open or close the drawer, not something inbetween
38
+ - Swiping up on mobile will not close the overlay, first you need to scroll to the top of the overlay.
39
+ - Floating overlays will now scroll inside the floating overlay. ([@paales](https://github.com/paales))
40
+
41
+ - [#1798](https://github.com/graphcommerce-org/graphcommerce/pull/1798) [`3cee17a51`](https://github.com/graphcommerce-org/graphcommerce/commit/3cee17a51ff961f4363d95c9decb8c7d1f9ca319) - Added utility function `filterByTypename` function to filter types based on `__typename` ([@mikekeehnen](https://github.com/mikekeehnen))
42
+
43
+ - [#1814](https://github.com/graphcommerce-org/graphcommerce/pull/1814) [`15aa59049`](https://github.com/graphcommerce-org/graphcommerce/commit/15aa590493bf7639231f3bb3dd623c234ebad7cf) - ActionCard default styling introduced for a more inline and changed the look of selected filters. ([@ErwinOtten](https://github.com/ErwinOtten))
44
+
45
+ - [#1793](https://github.com/graphcommerce-org/graphcommerce/pull/1793) [`5562fa69b`](https://github.com/graphcommerce-org/graphcommerce/commit/5562fa69b1bc260f68555dcfaf30153eda489bed) - Add newsletter subscribe form ([@ErwinOtten](https://github.com/ErwinOtten))
46
+
47
+ ### Patch Changes
48
+
49
+ - [#1830](https://github.com/graphcommerce-org/graphcommerce/pull/1830) [`dbc2ae0d3`](https://github.com/graphcommerce-org/graphcommerce/commit/dbc2ae0d360f645c3eab2a8f38b3d1431eab7d80) - Overlays will only hide the body scrollbar for right overlays so the page doesnt jump when opening. ([@paales](https://github.com/paales))
50
+
51
+ - [#1836](https://github.com/graphcommerce-org/graphcommerce/pull/1836) [`2857229c4`](https://github.com/graphcommerce-org/graphcommerce/commit/2857229c4d1c776540218f5e4cab3be524161502) - Overlays can not be closed as easily by swiping up, it will now always stop at the top over the overlay. ([@bramvanderholst](https://github.com/bramvanderholst))
52
+
53
+ - [#1771](https://github.com/graphcommerce-org/graphcommerce/pull/1771) [`aec07f567`](https://github.com/graphcommerce-org/graphcommerce/commit/aec07f5679472281b8eb71cf6967a1ff775d2a7f) - Navigation became visible when resizing the viewport. ([@paales](https://github.com/paales))
54
+
55
+ - [#1809](https://github.com/graphcommerce-org/graphcommerce/pull/1809) [`2da3c9214`](https://github.com/graphcommerce-org/graphcommerce/commit/2da3c92148aef08813b95e404a25796acf0eefd2) - Google Analytics now supports view_item, view_cart and remove_from_cart ([@mikekeehnen](https://github.com/mikekeehnen))
56
+
57
+ - [#1792](https://github.com/graphcommerce-org/graphcommerce/pull/1792) [`b0b8348b0`](https://github.com/graphcommerce-org/graphcommerce/commit/b0b8348b0d294f98140c2605691d47011add5b01) - Overlay headers with long titles now render correctly ([@bramvanderholst](https://github.com/bramvanderholst))
58
+
59
+ - [#1829](https://github.com/graphcommerce-org/graphcommerce/pull/1829) [`5f5f0dd1e`](https://github.com/graphcommerce-org/graphcommerce/commit/5f5f0dd1e0960b4cad694c5aaddffc7ccfc2bb1a) - Overlay right variant doesn't close automatically in firefox anymore ([@bramvanderholst](https://github.com/bramvanderholst))
60
+
61
+ - [#1749](https://github.com/graphcommerce-org/graphcommerce/pull/1749) [`16e91da42`](https://github.com/graphcommerce-org/graphcommerce/commit/16e91da42dcb454ea4761d1780b9338c88ef1463) - Corrected spelling mistake: incomming to incoming ([@paales](https://github.com/paales))
62
+
63
+ - [#1830](https://github.com/graphcommerce-org/graphcommerce/pull/1830) [`0bac3bdd8`](https://github.com/graphcommerce-org/graphcommerce/commit/0bac3bdd8505ccad8036d13e19559f2b3523fd92) - Navigation layout-animations will now only trigger when the active menu item changes ([@paales](https://github.com/paales))
64
+
65
+ - [#1830](https://github.com/graphcommerce-org/graphcommerce/pull/1830) [`6bffd680b`](https://github.com/graphcommerce-org/graphcommerce/commit/6bffd680b9d6a370048d06842cd3ce73130471dd) - Overlays now can't be closed when dragging beyong the pane (and actually opening them). ([@paales](https://github.com/paales))
66
+
67
+ - [#1834](https://github.com/graphcommerce-org/graphcommerce/pull/1834) [`58f7a63a4`](https://github.com/graphcommerce-org/graphcommerce/commit/58f7a63a4a4ef3bfcaeea75e393902b97138ba54) - Overlays may now be larger than 100% of the viewport without breaking. ([@paales](https://github.com/paales))
68
+
69
+ - [#1831](https://github.com/graphcommerce-org/graphcommerce/pull/1831) [`f4008bae3`](https://github.com/graphcommerce-org/graphcommerce/commit/f4008bae3e3ac8288c731b1dd87e6c6aef8e81fc) - Added a linting rule that disallows `import { Theme } from '@emotion/react'` because that causes huge performance issues. Also added `tsc:trace` to the root project to debug typescript performance issues. ([@paales](https://github.com/paales))
70
+
71
+ - [`bcaf428a3`](https://github.com/graphcommerce-org/graphcommerce/commit/bcaf428a31f2b480d442d347d09c0131a8569155) - Overlay timing issues resolved which would cause overlays to close or flicker. ([@paales](https://github.com/paales))
72
+
73
+ - [#1794](https://github.com/graphcommerce-org/graphcommerce/pull/1794) [`29e15cf63`](https://github.com/graphcommerce-org/graphcommerce/commit/29e15cf63251cf98cf42325322fcf09fb7a6c0b7) - Overlays variant=bottom will now work without jank on Android ([@bramvanderholst](https://github.com/bramvanderholst))
74
+
75
+ - [#1771](https://github.com/graphcommerce-org/graphcommerce/pull/1771) [`55d267ba0`](https://github.com/graphcommerce-org/graphcommerce/commit/55d267ba039f64af2b0248c68a1e1478970c9b31) - Solve issue where overlays would close diring opening when a rerender occured. ([@paales](https://github.com/paales))
76
+
77
+ - [#1829](https://github.com/graphcommerce-org/graphcommerce/pull/1829) [`52ecfc2ad`](https://github.com/graphcommerce-org/graphcommerce/commit/52ecfc2ad25fc6ef92465862fb94c1829bdd7c52) - CSS dvh property is now used when supported by browsers, causing less rerenders with overlays. ([@bramvanderholst](https://github.com/bramvanderholst))
78
+
79
+ - [#1806](https://github.com/graphcommerce-org/graphcommerce/pull/1806) [`597396766`](https://github.com/graphcommerce-org/graphcommerce/commit/597396766940de8c4ab5d8c84a0c6637ed72dba2) - Navigation visibility fixes when browser is resized, or exactly 864px width, and when Navigation is reopened after closing, dragging or navigating. Navigation HTML is now permanently in the DOM. ([@ErwinOtten](https://github.com/ErwinOtten))
80
+
81
+ - [#1825](https://github.com/graphcommerce-org/graphcommerce/pull/1825) [`27302739e`](https://github.com/graphcommerce-org/graphcommerce/commit/27302739e5dcd8791e7a3df06855f6450b0a6d10) - Show mobile footer on tablet to prevent cart fab overlapping footer content ([@bramvanderholst](https://github.com/bramvanderholst))
82
+
83
+ - [#1830](https://github.com/graphcommerce-org/graphcommerce/pull/1830) [`ff0c70e31`](https://github.com/graphcommerce-org/graphcommerce/commit/ff0c70e3165c64ea4f236a15a5820428dbf36e6a) - Overlays now have vertical visible scrollbars when the content is higher than the viewport. ([@paales](https://github.com/paales))
84
+
3
85
  ## 6.0.0-canary.54
4
86
 
5
87
  ## 6.0.0-canary.53
@@ -119,8 +119,9 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
119
119
  props.smSpacingTop ?? ((theme) => `calc(${theme.appShell.headerHeightSm} * 0.5)`)
120
120
  )(th)
121
121
 
122
- const { scrollerRef, snap, scroll, getScrollSnapPositions } = useScrollerContext()
122
+ const { scrollerRef, snap, scroll, getScrollSnapPositions, disableSnap } = useScrollerContext()
123
123
  const scrollTo = useScrollTo()
124
+
124
125
  const beforeRef = useRef<HTMLDivElement>(null)
125
126
  const overlayRef = useRef<HTMLDivElement>(null)
126
127
  const overlayPaneRef = useRef<HTMLDivElement>(null)
@@ -142,6 +143,21 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
142
143
  )
143
144
  const prevVariant = useRef<LayoutOverlayVariant>()
144
145
 
146
+ const openClosePositions = useCallback((): {
147
+ open: [number, number]
148
+ closed: [number, number]
149
+ } => {
150
+ const { x, y } = getScrollSnapPositions()
151
+
152
+ if (variant() === 'left') {
153
+ return { open: [x.length - 2, 0], closed: [x.length - 1, 0] }
154
+ }
155
+ if (variant() === 'right') {
156
+ return { open: [x.length - 1, 0], closed: [0, 0] }
157
+ }
158
+ return { open: [0, y.length - 1], closed: [0, 0] }
159
+ }, [getScrollSnapPositions, variant])
160
+
145
161
  useIsomorphicLayoutEffect(() => {
146
162
  const scroller = scrollerRef.current
147
163
  if (!scroller || !beforeRef.current || !overlayRef.current || !overlayPaneRef.current)
@@ -165,35 +181,44 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
165
181
  }
166
182
 
167
183
  const forceScrollPosition = () => {
184
+ if (scroll.animating.get()) return
168
185
  // Set the initial position of the overlay.
169
186
  // Make sure the overlay stays open when the variant changes.
170
187
  if (position.get() !== OverlayPosition.OPENED) {
171
188
  scroller.scrollLeft = positions.closed.x.get()
172
189
  scroller.scrollTop = positions.closed.y.get()
190
+ scroll.x.set(positions.closed.x.get())
191
+ scroll.y.set(positions.closed.y.get())
173
192
  } else {
174
- scroller.scrollLeft = positions.open.x.get()
175
- scroller.scrollTop = positions.open.y.get()
193
+ disableSnap()
194
+ scroller.scrollLeft = scroll.x.getPrevious()
195
+ scroller.scrollTop = scroll.y.getPrevious()
196
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
197
+ scrollTo(openClosePositions().open)
176
198
  }
177
199
  }
178
200
 
179
201
  const calcVisible = () => {
180
202
  const clampRound = (value: number) => Math.round(Math.max(0, Math.min(1, value)) * 100) / 100
181
203
 
182
- const scrollX = scroll.x.get()
183
- const scrollY = scroll.y.get()
184
-
204
+ let vis = 0
185
205
  if (variant() === 'left') {
186
206
  const closedX = positions.closed.x.get()
187
- positions.open.visible.set(closedX === 0 ? 0 : clampRound((scrollX - closedX) / -closedX))
207
+ vis = closedX === 0 ? 0 : clampRound((scroll.x.get() - closedX) / -closedX)
188
208
  }
189
209
  if (variant() === 'right') {
190
210
  const openedX = positions.open.x.get()
191
- positions.open.visible.set(openedX === 0 ? 0 : clampRound(scrollX / openedX))
211
+ vis = openedX === 0 ? 0 : clampRound(scroll.x.get() / openedX)
192
212
  }
193
213
  if (variant() === 'bottom') {
194
214
  const openedY = positions.open.y.get()
195
- positions.open.visible.set(openedY === 0 ? 0 : clampRound(scrollY / openedY))
215
+ vis = openedY === 0 ? 0 : clampRound(scroll.y.get() / openedY)
196
216
  }
217
+
218
+ // If we're opening, make sure the visbility doesn't got below the current visibility
219
+ if (position.get() === OverlayPosition.UNOPENED && positions.open.visible.get() >= vis) return
220
+
221
+ positions.open.visible.set(vis)
197
222
  }
198
223
 
199
224
  const handleScroll = () => {
@@ -214,27 +239,35 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
214
239
  forceScrollPosition()
215
240
  }
216
241
 
217
- const measureScroll = () => framesync.read(handleScroll)
218
- const measureResize = () => framesync.read(handleResize)
219
242
  handleScroll()
220
243
 
221
- const cancelX = scroll.x.on('change', measureScroll)
222
- const cancelY = scroll.y.on('change', measureScroll)
244
+ const cancelX = scroll.x.on('change', handleScroll)
245
+ const cancelY = scroll.y.on('change', handleScroll)
223
246
 
224
- const ro = new ResizeObserver(measureResize)
247
+ const ro = new ResizeObserver(handleResize)
225
248
  ro.observe(scrollerRef.current)
226
249
  ro.observe(beforeRef.current)
227
250
  ro.observe(overlayPaneRef.current)
228
251
  ro.observe(overlayRef.current)
229
252
 
230
- window.addEventListener('resize', measureResize)
253
+ window.addEventListener('resize', handleResize)
231
254
  return () => {
232
- window.removeEventListener('resize', measureResize)
255
+ window.removeEventListener('resize', handleResize)
233
256
  ro.disconnect()
234
257
  cancelX()
235
258
  cancelY()
236
259
  }
237
- }, [getScrollSnapPositions, position, positions, scroll, scrollerRef, variant])
260
+ }, [
261
+ disableSnap,
262
+ getScrollSnapPositions,
263
+ openClosePositions,
264
+ position,
265
+ positions,
266
+ scroll,
267
+ scrollTo,
268
+ scrollerRef,
269
+ variant,
270
+ ])
238
271
 
239
272
  // When the component is mounted, we need to set the initial position of the overlay.
240
273
  useIsomorphicLayoutEffect(() => {
@@ -242,57 +275,30 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
242
275
 
243
276
  if (!scroller || !isPresent) return
244
277
 
245
- const open = { x: positions.open.x.get(), y: positions.open.y.get() }
246
-
247
278
  if (variant() === 'right') document.body.style.overflow = 'hidden'
248
279
 
249
280
  if (position.get() !== OverlayPosition.OPENED) {
250
- if (direction === 1) {
251
- scroller.scrollLeft = positions.closed.x.get()
252
- scroller.scrollTop = positions.closed.y.get()
253
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
254
- scrollTo(open).then(() => {
255
- scroller.scrollLeft = positions.open.x.get()
256
- scroller.scrollTop = positions.open.y.get()
257
- position.set(OverlayPosition.OPENED)
258
- })
259
- } else {
260
- scroller.scrollLeft = open.x
261
- scroller.scrollTop = open.y
262
- position.set(OverlayPosition.OPENED)
263
- snap.set(true)
264
- }
281
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
282
+ scrollTo(openClosePositions().open).then(() => position.set(OverlayPosition.OPENED))
265
283
  }
266
- }, [direction, isPresent, position, positions, scrollTo, scrollerRef, snap, variant])
284
+ }, [isPresent, openClosePositions, position, scrollTo, scrollerRef, variant])
267
285
 
268
286
  // When the overlay is closed by navigating away, we're closing the overlay.
269
287
  useEffect(() => {
270
288
  const scroller = scrollerRef.current
271
289
  if (isPresent || !scroller) return
272
290
 
273
- if (position.get() === OverlayPosition.UNOPENED) {
274
- position.set(OverlayPosition.CLOSED)
275
- scroller.scrollLeft = positions.closed.x.get()
276
- scroller.scrollTop = positions.closed.y.get()
291
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
292
+ scrollTo(openClosePositions().closed).then(() => {
277
293
  safeToRemove?.()
278
294
  document.body.style.overflow = ''
279
- } else {
280
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
281
- scrollTo({
282
- x: positions.closed.x.get(),
283
- y: positions.closed.y.get(),
284
- }).then(() => {
285
- safeToRemove?.()
286
- document.body.style.overflow = ''
287
- })
288
- }
289
- }, [isPresent, position, positions, safeToRemove, scrollTo, scrollerRef])
295
+ })
296
+ }, [isPresent, openClosePositions, position, positions, safeToRemove, scrollTo, scrollerRef])
290
297
 
291
298
  // Only go back to a previous page if the overlay isn't closed.
292
299
  const closeOverlay = useCallback(() => {
293
300
  if (position.get() !== OverlayPosition.OPENED) return
294
301
  position.set(OverlayPosition.CLOSED)
295
- // document.body.style.overflow = ''
296
302
  onClosed()
297
303
  }, [onClosed, position])
298
304
 
@@ -547,6 +553,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
547
553
  maxHeight: `calc(${dvh(100)} - ${mdSpacingTop})`,
548
554
  paddingTop: mdSpacingTop,
549
555
  boxSizing: 'border-box',
556
+ boxShadow: theme.shadows[24],
550
557
 
551
558
  scrollbarWidth: 'none',
552
559
  '&::-webkit-scrollbar': {
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": "6.0.0-canary.54",
5
+ "version": "6.0.1-canary.0",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "sideEffects": false,
@@ -18,18 +18,18 @@
18
18
  "@emotion/react": "^11.10.6",
19
19
  "@emotion/server": "^11.4.0",
20
20
  "@emotion/styled": "^11.10.6",
21
- "@graphcommerce/framer-next-pages": "6.0.0-canary.54",
22
- "@graphcommerce/framer-scroller": "6.0.0-canary.54",
23
- "@graphcommerce/framer-utils": "6.0.0-canary.54",
24
- "@graphcommerce/image": "6.0.0-canary.54",
21
+ "@graphcommerce/framer-next-pages": "6.0.1-canary.0",
22
+ "@graphcommerce/framer-scroller": "6.0.1-canary.0",
23
+ "@graphcommerce/framer-utils": "6.0.1-canary.0",
24
+ "@graphcommerce/image": "6.0.1-canary.0",
25
25
  "cookie": "^0.5.0",
26
26
  "react-is": "^18.2.0",
27
27
  "schema-dts": "^1.1.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@graphcommerce/eslint-config-pwa": "6.0.0-canary.54",
31
- "@graphcommerce/prettier-config-pwa": "6.0.0-canary.54",
32
- "@graphcommerce/typescript-config-pwa": "6.0.0-canary.54",
30
+ "@graphcommerce/eslint-config-pwa": "6.0.1-canary.0",
31
+ "@graphcommerce/prettier-config-pwa": "6.0.1-canary.0",
32
+ "@graphcommerce/typescript-config-pwa": "6.0.1-canary.0",
33
33
  "@types/cookie": "^0.5.1",
34
34
  "@types/react-is": "^17.0.3",
35
35
  "typescript": "4.9.5"