@graphcommerce/next-ui 4.31.0-canary.5 → 4.31.0-canary.6

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,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.31.0-canary.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`243d0dad2`](https://github.com/graphcommerce-org/graphcommerce/commit/243d0dad263f7b886a3d68e82729818c7df265bc) - Solve issue where the gallery of the product page would scroll obsessively ([@paales](https://github.com/paales))
8
+
9
+ - [`0623f8ce7`](https://github.com/graphcommerce-org/graphcommerce/commit/0623f8ce738ace69aa44e55cf6a6ddb33cf0617a) - When clicking on a navigationlink it would animate on mobile ([@paales](https://github.com/paales))
10
+
3
11
  ## 4.31.0-canary.5
4
12
 
5
13
  ## 4.31.0-canary.4
@@ -7,6 +7,7 @@ import {
7
7
  ScrollerDots,
8
8
  ScrollerProvider,
9
9
  } from '@graphcommerce/framer-scroller'
10
+ import { clientSizeCssVar } from '@graphcommerce/framer-utils'
10
11
  import { Fab, useTheme, Box, styled, SxProps, Theme } from '@mui/material'
11
12
  import { m, useDomEvent, useMotionValue } from 'framer-motion'
12
13
  import { useRouter } from 'next/router'
@@ -113,21 +114,6 @@ export function SidebarGallery(props: SidebarGalleryProps) {
113
114
 
114
115
  const hasImages = images.length > 0
115
116
 
116
- // sx={(theme) => ({
117
- // [SidebarGallery.selectors.scrollerContainer]: {
118
- // minHeight: 0,
119
- // [theme.breakpoints.up('md')]: {
120
- // position: 'sticky',
121
- // top: 0,
122
- // },
123
- // '&.zoomed': {
124
- // position: 'relative',
125
- // top: 0,
126
- // marginTop: 0,
127
- // },
128
- // },
129
- // })}
130
-
131
117
  return (
132
118
  <ScrollerProvider scrollSnapAlign='center'>
133
119
  <Row maxWidth={false} disableGutters className={classes.row} sx={sx}>
@@ -173,17 +159,17 @@ export function SidebarGallery(props: SidebarGalleryProps) {
173
159
  [theme.breakpoints.down('md')]: {
174
160
  width: '100vw',
175
161
  },
176
- minHeight: 0,
177
162
  [theme.breakpoints.up('md')]: {
163
+ height: `calc(${clientSizeCssVar.y} - ${theme.appShell.headerHeightMd} - ${theme.spacings.lg})`,
178
164
  position: 'sticky',
179
- top: 0,
165
+ top: theme.appShell.headerHeightMd,
180
166
  },
181
167
  },
182
168
  zoomed && {
183
169
  position: 'relative',
184
170
  top: 0,
185
171
  marginTop: 0,
186
- paddingTop: `var(--client-size-y)`,
172
+ paddingTop: clientSizeCssVar.y,
187
173
  },
188
174
  ]}
189
175
  onLayoutAnimationComplete={() => {
@@ -1,4 +1,9 @@
1
- import { useMotionValueValue, useMotionSelector } from '@graphcommerce/framer-utils'
1
+ import { useTheme } from '@emotion/react'
2
+ import {
3
+ useMotionValueValue,
4
+ useMotionSelector,
5
+ clientSizeCssVar,
6
+ } from '@graphcommerce/framer-utils'
2
7
  import { i18n } from '@lingui/core'
3
8
  import { Box, Fab, SxProps, Theme, useEventCallback, styled } from '@mui/material'
4
9
  import { m } from 'framer-motion'
@@ -42,7 +47,7 @@ const componentName = 'Navigation'
42
47
  const parts = ['root', 'navigation', 'header', 'column'] as const
43
48
  const { classes } = extendableComponent(componentName, parts)
44
49
 
45
- export const NavigationOverlay = React.memo<NavigationOverlayProps>((props) => {
50
+ export const NavigationOverlay = React.memo((props: NavigationOverlayProps) => {
46
51
  const {
47
52
  sx,
48
53
  stretchColumns,
@@ -52,16 +57,15 @@ export const NavigationOverlay = React.memo<NavigationOverlayProps>((props) => {
52
57
  justifySm,
53
58
  sizeMd,
54
59
  sizeSm,
55
- itemWidthSm,
60
+ itemWidthSm = clientSizeCssVar.x,
56
61
  itemWidthMd,
57
62
  mouseEvent,
58
63
  itemPadding = 'md',
59
64
  } = props
60
65
  const { selection, items, animating, closing, serverRenderDepth } = useNavigation()
61
66
 
62
- const fabSize = useFabSize('responsive')
63
- const svgSize = useIconSvgSize('large')
64
-
67
+ const fabMarginY = `calc((${useFabSize('responsive')} - ${useIconSvgSize('large')}) * -0.5)`
68
+ const itemPad = useTheme().spacings[itemPadding] ?? itemPadding
65
69
  const matchMedia = useMatchMedia()
66
70
 
67
71
  const handleOnBack = useEventCallback(() => {
@@ -143,11 +147,7 @@ export const NavigationOverlay = React.memo<NavigationOverlayProps>((props) => {
143
147
  <Fab
144
148
  color='inherit'
145
149
  onClick={handleOnBack}
146
- sx={{
147
- boxShadow: 'none',
148
- marginLeft: `calc((${fabSize} - ${svgSize}) * -0.5)`,
149
- marginRight: `calc((${fabSize} - ${svgSize}) * -0.5)`,
150
- }}
150
+ sx={{ boxShadow: 'none', my: fabMarginY }}
151
151
  size='responsive'
152
152
  aria-label={i18n._(/* i18n */ 'Back')}
153
153
  >
@@ -159,11 +159,7 @@ export const NavigationOverlay = React.memo<NavigationOverlayProps>((props) => {
159
159
  <Fab
160
160
  color='inherit'
161
161
  onClick={handleClose}
162
- sx={{
163
- boxShadow: 'none',
164
- marginLeft: `calc((${fabSize} - ${svgSize}) * -0.5)`,
165
- marginRight: `calc((${fabSize} - ${svgSize}) * -0.5)`,
166
- }}
162
+ sx={{ boxShadow: 'none', my: fabMarginY }}
167
163
  size='responsive'
168
164
  aria-label={i18n._(/* i18n */ 'Close')}
169
165
  >
@@ -177,59 +173,46 @@ export const NavigationOverlay = React.memo<NavigationOverlayProps>((props) => {
177
173
  </LayoutHeaderContent>
178
174
  </Box>
179
175
  </MotionDiv>
180
-
181
176
  <MotionDiv layout='position' sx={{ display: 'grid' }}>
182
177
  <Box
183
178
  sx={[
184
179
  (theme) => ({
185
180
  display: 'grid',
186
181
  alignItems: !stretchColumns ? 'start' : undefined,
187
- '& .NavigationItem-item': {
188
- // eslint-disable-next-line no-nested-ternary
189
- width: itemWidthMd
190
- ? selectedLevel >= 1
191
- ? `calc(${itemWidthMd} + 1px)`
192
- : itemWidthMd
193
- : 'stretch',
182
+ [theme.breakpoints.down('md')]: {
183
+ width:
184
+ sizeSm !== 'floating'
185
+ ? `calc(${itemWidthSm} + ${selectedLevel}px)`
186
+ : `calc(${itemWidthSm} - (${theme.page.horizontal} * 2))`,
187
+ minWidth: 200,
188
+ overflow: 'hidden',
189
+ scrollSnapType: 'x mandatory',
190
+ '& .NavigationItem-item': {
191
+ width:
192
+ sizeSm !== 'floating'
193
+ ? `calc(${itemWidthSm} - (${itemPad} * 2) + ${selectedLevel}px)`
194
+ : `calc(${itemWidthSm} - (${itemPad} * 2) - (${theme.page.horizontal} * 2))`,
195
+ minWidth: `calc(200px - (${itemPad} * 2))`,
196
+ },
197
+ },
198
+ [theme.breakpoints.up('md')]: {
199
+ '& .NavigationItem-item': {
200
+ // eslint-disable-next-line no-nested-ternary
201
+ width: itemWidthMd
202
+ ? selectedLevel >= 1
203
+ ? `calc(${itemWidthMd} + 1px)`
204
+ : itemWidthMd
205
+ : 'stretch',
206
+ },
194
207
  },
195
208
  }),
196
- activeAndNotClosing
197
- ? (theme) => ({
198
- [theme.breakpoints.down('md')]: {
199
- width:
200
- sizeSm !== 'floating'
201
- ? `calc(${itemWidthSm || '100vw'} + ${selectedLevel}px)`
202
- : `calc(${itemWidthSm || '100vw'} - ${theme.page.horizontal} - ${
203
- theme.page.horizontal
204
- })`,
205
- minWidth: 200,
206
- overflow: 'hidden',
207
- scrollSnapType: 'x mandatory',
208
- '& .NavigationItem-item': {
209
- width:
210
- sizeSm !== 'floating'
211
- ? `calc(${itemWidthSm || '100vw'} - ${
212
- theme.spacings[itemPadding] ?? itemPadding
213
- } - ${theme.spacings[itemPadding] ?? itemPadding} + ${selectedLevel}px)`
214
- : `calc(${itemWidthSm || '100vw'} - ${
215
- theme.spacings[itemPadding] ?? itemPadding
216
- } - ${theme.spacings[itemPadding] ?? itemPadding} - ${
217
- theme.page.horizontal
218
- } - ${theme.page.horizontal})`,
219
- minWidth: `calc(${200}px - ${theme.spacings[itemPadding] ?? itemPadding} - ${
220
- theme.spacings[itemPadding] ?? itemPadding
221
- })`,
222
- },
223
- },
224
- })
225
- : {},
226
209
  ]}
227
210
  >
228
211
  <Box
229
212
  className={classes.navigation}
230
213
  sx={[
231
- (theme) => ({
232
- py: theme.spacings[itemPadding] ?? itemPadding,
214
+ {
215
+ py: itemPad,
233
216
  display: 'grid',
234
217
  gridAutoFlow: 'column',
235
218
  scrollSnapAlign: 'end',
@@ -241,7 +224,7 @@ export const NavigationOverlay = React.memo<NavigationOverlayProps>((props) => {
241
224
  },
242
225
  '& .Navigation-column': {},
243
226
  '& .NavigationItem-item': {
244
- mx: theme.spacings[itemPadding] ?? itemPadding,
227
+ mx: itemPad,
245
228
  whiteSpace: 'nowrap',
246
229
  },
247
230
  '& .NavigationItem-item.first': {
@@ -250,7 +233,7 @@ export const NavigationOverlay = React.memo<NavigationOverlayProps>((props) => {
250
233
  '& .Navigation-column:first-of-type': {
251
234
  boxShadow: 'none',
252
235
  },
253
- }),
236
+ },
254
237
  ...(Array.isArray(sx) ? sx : [sx]),
255
238
  ]}
256
239
  >
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": "4.31.0-canary.5",
5
+ "version": "4.31.0-canary.6",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "sideEffects": false,
@@ -19,10 +19,10 @@
19
19
  "@emotion/react": "^11.9.3",
20
20
  "@emotion/server": "^11.4.0",
21
21
  "@emotion/styled": "^11.9.3",
22
- "@graphcommerce/framer-next-pages": "4.31.0-canary.5",
23
- "@graphcommerce/framer-scroller": "4.31.0-canary.5",
24
- "@graphcommerce/framer-utils": "4.31.0-canary.5",
25
- "@graphcommerce/image": "4.31.0-canary.5",
22
+ "@graphcommerce/framer-next-pages": "4.31.0-canary.6",
23
+ "@graphcommerce/framer-scroller": "4.31.0-canary.6",
24
+ "@graphcommerce/framer-utils": "4.31.0-canary.6",
25
+ "@graphcommerce/image": "4.31.0-canary.6",
26
26
  "cookie": "^0.5.0",
27
27
  "react-is": "^18.2.0",
28
28
  "schema-dts": "^1.1.0"