@graphcommerce/next-ui 4.22.0 → 4.24.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.
@@ -1,5 +1,5 @@
1
1
  import { SxProps, ButtonBase, Box, Theme, alpha } from '@mui/material'
2
- import React, { FormEvent } from 'react'
2
+ import React from 'react'
3
3
  import { extendableComponent } from '../Styles'
4
4
  import { breakpointVal } from '../Styles/breakpointVal'
5
5
 
@@ -104,23 +104,22 @@ export const ActionCardList = React.forwardRef<HTMLDivElement, ActionCardListPro
104
104
  <Box
105
105
  ref={ref}
106
106
  sx={[
107
- error &&
108
- ((theme) => ({
109
- '& .ActionCard-root': {
110
- borderLeft: 2,
111
- borderRight: 2,
112
- borderLeftColor: 'error.main',
113
- borderRightColor: 'error.main',
114
- },
115
- '& > div:first-of-type.ActionCard-root': {
116
- borderTop: 2,
117
- borderTopColor: 'error.main',
118
- },
119
- '& > div:last-of-type.ActionCard-root': {
120
- borderBottom: 2,
121
- borderBottomColor: 'error.main',
122
- },
123
- })),
107
+ error && {
108
+ '& .ActionCard-root': {
109
+ borderLeft: 2,
110
+ borderRight: 2,
111
+ borderLeftColor: 'error.main',
112
+ borderRightColor: 'error.main',
113
+ },
114
+ '& > div:first-of-type.ActionCard-root': {
115
+ borderTop: 2,
116
+ borderTopColor: 'error.main',
117
+ },
118
+ '& > div:last-of-type.ActionCard-root': {
119
+ borderBottom: 2,
120
+ borderBottomColor: 'error.main',
121
+ },
122
+ },
124
123
  ]}
125
124
  >
126
125
  {childReactNodes.map((child) =>
@@ -2,7 +2,6 @@ import { Box, SxProps, Theme } from '@mui/material'
2
2
  import React from 'react'
3
3
  import { extendableComponent } from '../../Styles'
4
4
  import { breakpointVal } from '../../Styles/breakpointVal'
5
- import { responsiveVal } from '../../Styles/responsiveVal'
6
5
 
7
6
  export type BlogHeaderProps = {
8
7
  sx?: SxProps<Theme>
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.24.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1638](https://github.com/graphcommerce-org/graphcommerce/pull/1638) [`104103bc2`](https://github.com/graphcommerce-org/graphcommerce/commit/104103bc2a0fbaa510af2e26b6b00ddc63e8495b) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Fix navigation overlay visibility bug
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies []:
12
+ - @graphcommerce/framer-scroller@2.1.36
13
+
14
+ ## 4.23.1
15
+
16
+ ### Patch Changes
17
+
18
+ - [#1624](https://github.com/graphcommerce-org/graphcommerce/pull/1624) [`9b84a68a1`](https://github.com/graphcommerce-org/graphcommerce/commit/9b84a68a1e7311a79eb687c7dcee905d3000facf) Thanks [@paales](https://github.com/paales)! - Create a GetServerSideProps
19
+
20
+ - Updated dependencies []:
21
+ - @graphcommerce/framer-scroller@2.1.35
22
+
23
+ ## 4.23.0
24
+
25
+ ### Minor Changes
26
+
27
+ - [#1620](https://github.com/graphcommerce-org/graphcommerce/pull/1620) [`755d2cf83`](https://github.com/graphcommerce-org/graphcommerce/commit/755d2cf83343a5ad3d61063eff595d821de360aa) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Add spacing feature to navItems
28
+
29
+ * [#1618](https://github.com/graphcommerce-org/graphcommerce/pull/1618) [`dc7f2dda4`](https://github.com/graphcommerce-org/graphcommerce/commit/dc7f2dda40ff8572fc11161de6eb62ca13e720dd) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Remove prefetch from navigation links
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies []:
34
+ - @graphcommerce/framer-scroller@2.1.34
35
+
3
36
  ## 4.22.0
4
37
 
5
38
  ### Minor Changes
package/Form/Form.tsx CHANGED
@@ -1,6 +1,5 @@
1
1
  import { darken, lighten, styled, Theme } from '@mui/material'
2
2
  import { breakpointVal } from '../Styles/breakpointVal'
3
- import { responsiveVal } from '../Styles/responsiveVal'
4
3
  import { sx } from '../Theme/themeDefaults'
5
4
 
6
5
  type FormStyleProps = {
@@ -1,4 +1,4 @@
1
- import { useIsomorphicLayoutEffect, useMotionValueValue } from '@graphcommerce/framer-utils'
1
+ import { useMotionValueValue } from '@graphcommerce/framer-utils'
2
2
  import {
3
3
  Divider,
4
4
  Fab,
@@ -13,7 +13,7 @@ import {
13
13
  } from '@mui/material'
14
14
  import { m } from 'framer-motion'
15
15
  import { useRouter } from 'next/router'
16
- import React, { useEffect, useCallback, useRef } from 'react'
16
+ import React, { useEffect } from 'react'
17
17
  import { IconSvg } from '../IconSvg'
18
18
  import { useScrollY } from '../Layout/hooks/useScrollY'
19
19
  import { extendableComponent } from '../Styles/extendableComponent'
@@ -70,7 +70,7 @@ export const NavigationItem = React.memo<NavigationItemProps>((props) => {
70
70
  const column = hidingRoot ? itemPath.length - 1 : itemPath.length
71
71
  const classes = withState({ first, last, column: itemPath.length })
72
72
 
73
- const onCloseHandler: React.MouseEventHandler<HTMLAnchorElement> = useEventCallback((e) => {
73
+ const onCloseHandler: React.MouseEventHandler<HTMLAnchorElement> = useEventCallback(() => {
74
74
  if (!isNavigationHref(props)) return
75
75
  closing.set(true)
76
76
  })
@@ -151,7 +151,7 @@ export const NavigationItem = React.memo<NavigationItemProps>((props) => {
151
151
  const { name, href } = props
152
152
  return (
153
153
  <NavigationLI sx={[hideItem && { display: 'none' }]} className={classes.li}>
154
- <PageLink href={href} passHref>
154
+ <PageLink href={href} passHref prefetch={false}>
155
155
  <ListItemButton
156
156
  className={classes.item}
157
157
  component='a'
@@ -3,8 +3,9 @@ import { useMotionValueValue, useMotionSelector } from '@graphcommerce/framer-ut
3
3
  import { i18n } from '@lingui/core'
4
4
  import { Trans } from '@lingui/react'
5
5
  import { Box, Fab, SxProps, Theme, useEventCallback, useMediaQuery } from '@mui/material'
6
- import { m, useMotionValue } from 'framer-motion'
7
- import React, { startTransition, useEffect, useRef, useState } from 'react'
6
+ import { m } from 'framer-motion'
7
+ import React, { useEffect } from 'react'
8
+ import type { LiteralUnion } from 'type-fest'
8
9
  import { IconSvg, useIconSvgSize } from '../../IconSvg'
9
10
  import { LayoutHeaderContent } from '../../Layout/components/LayoutHeaderContent'
10
11
  import { LayoutTitle } from '../../Layout/components/LayoutTitle'
@@ -27,6 +28,7 @@ import { NavigationList } from './NavigationList'
27
28
  type LayoutOverlayVariant = 'left' | 'bottom' | 'right'
28
29
  type LayoutOverlaySize = 'floating' | 'minimal' | 'full'
29
30
  type LayoutOverlayAlign = 'start' | 'end' | 'center' | 'stretch'
31
+ type ItemPadding = LiteralUnion<keyof Theme['spacings'], string | number>
30
32
 
31
33
  type NavigationOverlayProps = {
32
34
  sx?: SxProps<Theme>
@@ -39,6 +41,7 @@ type NavigationOverlayProps = {
39
41
  justifyMd?: LayoutOverlayAlign
40
42
  itemWidthSm?: string
41
43
  itemWidthMd?: string
44
+ itemPadding?: ItemPadding
42
45
  } & mouseEventPref
43
46
 
44
47
  function findCurrent(
@@ -82,6 +85,7 @@ export const NavigationOverlay = React.memo<NavigationOverlayProps>((props) => {
82
85
  itemWidthSm,
83
86
  itemWidthMd,
84
87
  mouseEvent,
88
+ itemPadding = 'md',
85
89
  } = props
86
90
  const { selection, items, animating, closing } = useNavigation()
87
91
 
@@ -203,46 +207,56 @@ export const NavigationOverlay = React.memo<NavigationOverlayProps>((props) => {
203
207
 
204
208
  <MotionDiv layout='position' style={{ display: 'grid' }}>
205
209
  <Box
206
- sx={(theme) => ({
207
- display: 'grid',
208
- alignItems: !stretchColumns ? 'start' : undefined,
209
- '& .NavigationItem-item': {
210
- // eslint-disable-next-line no-nested-ternary
211
- width: itemWidthMd
212
- ? selectedLevel >= 1
213
- ? `calc(${itemWidthMd} + 1px)`
214
- : itemWidthMd
215
- : 'stretch',
216
- },
217
- [theme.breakpoints.down('md')]: {
218
- width:
219
- sizeSm !== 'floating'
220
- ? `calc(${itemWidthSm || '100vw'} + ${selectedLevel}px)`
221
- : `calc(${itemWidthSm || '100vw'} - ${theme.page.horizontal} - ${
222
- theme.page.horizontal
223
- })`,
224
- minWidth: 200,
225
- overflow: 'hidden',
226
- scrollSnapType: 'x mandatory',
210
+ sx={[
211
+ (theme) => ({
212
+ display: 'grid',
213
+ alignItems: !stretchColumns ? 'start' : undefined,
227
214
  '& .NavigationItem-item': {
228
- width:
229
- sizeSm !== 'floating'
230
- ? `calc(${itemWidthSm || '100vw'} - ${theme.spacings.md} - ${
231
- theme.spacings.md
232
- } + ${selectedLevel}px)`
233
- : `calc(${itemWidthSm || '100vw'} - ${theme.spacings.md} - ${
234
- theme.spacings.md
235
- } - ${theme.page.horizontal} - ${theme.page.horizontal})`,
236
- minWidth: `calc(${200}px - ${theme.spacings.md} - ${theme.spacings.md})`,
215
+ // eslint-disable-next-line no-nested-ternary
216
+ width: itemWidthMd
217
+ ? selectedLevel >= 1
218
+ ? `calc(${itemWidthMd} + 1px)`
219
+ : itemWidthMd
220
+ : 'stretch',
237
221
  },
238
- },
239
- })}
222
+ }),
223
+ activeAndNotClosing
224
+ ? (theme) => ({
225
+ [theme.breakpoints.down('md')]: {
226
+ width:
227
+ sizeSm !== 'floating'
228
+ ? `calc(${itemWidthSm || '100vw'} + ${selectedLevel}px)`
229
+ : `calc(${itemWidthSm || '100vw'} - ${theme.page.horizontal} - ${
230
+ theme.page.horizontal
231
+ })`,
232
+ minWidth: 200,
233
+ overflow: 'hidden',
234
+ scrollSnapType: 'x mandatory',
235
+ '& .NavigationItem-item': {
236
+ width:
237
+ sizeSm !== 'floating'
238
+ ? `calc(${itemWidthSm || '100vw'} - ${
239
+ theme.spacings[itemPadding] ?? itemPadding
240
+ } - ${theme.spacings[itemPadding] ?? itemPadding} + ${selectedLevel}px)`
241
+ : `calc(${itemWidthSm || '100vw'} - ${
242
+ theme.spacings[itemPadding] ?? itemPadding
243
+ } - ${theme.spacings[itemPadding] ?? itemPadding} - ${
244
+ theme.page.horizontal
245
+ } - ${theme.page.horizontal})`,
246
+ minWidth: `calc(${200}px - ${theme.spacings[itemPadding] ?? itemPadding} - ${
247
+ theme.spacings[itemPadding] ?? itemPadding
248
+ })`,
249
+ },
250
+ },
251
+ })
252
+ : {},
253
+ ]}
240
254
  >
241
255
  <Box
242
256
  className={classes.navigation}
243
257
  sx={[
244
258
  (theme) => ({
245
- py: theme.spacings.md,
259
+ py: theme.spacings[itemPadding] ?? itemPadding,
246
260
  display: 'grid',
247
261
  gridAutoFlow: 'column',
248
262
  scrollSnapAlign: 'end',
@@ -254,11 +268,11 @@ export const NavigationOverlay = React.memo<NavigationOverlayProps>((props) => {
254
268
  },
255
269
  '& .Navigation-column': {},
256
270
  '& .NavigationItem-item': {
257
- mx: theme.spacings.md,
271
+ mx: theme.spacings[itemPadding] ?? itemPadding,
258
272
  whiteSpace: 'nowrap',
259
273
  },
260
274
  '& .NavigationItem-item.first': {
261
- // mt: theme.spacings.md,
275
+ // mt: paddingMd,
262
276
  },
263
277
  '& .Navigation-column:first-of-type': {
264
278
  boxShadow: 'none',
@@ -1,5 +1,5 @@
1
1
  import { MotionConfig, useMotionValue } from 'framer-motion'
2
- import React, { useMemo, useRef } from 'react'
2
+ import React, { useMemo } from 'react'
3
3
  import { isElement } from 'react-is'
4
4
  import {
5
5
  NavigationNode,
package/Page/types.ts CHANGED
@@ -3,7 +3,10 @@ import { UpPage } from '@graphcommerce/framer-next-pages/types'
3
3
  // todo: remove references to GraphQL
4
4
  // eslint-disable-next-line import/no-extraneous-dependencies
5
5
  import { NormalizedCacheObject } from '@graphcommerce/graphql'
6
- import { GetStaticProps as GetStaticPropsNext } from 'next'
6
+ import {
7
+ GetStaticProps as GetStaticPropsNext,
8
+ GetServerSideProps as GetServerSidePropsNext,
9
+ } from 'next'
7
10
 
8
11
  type AnyObj = Record<string, unknown>
9
12
 
@@ -14,3 +17,9 @@ export type GetStaticProps<
14
17
  P extends AnyObj = AnyObj,
15
18
  Q extends ParsedUrlQuery = ParsedUrlQuery,
16
19
  > = GetStaticPropsNext<P & Omit<PL, 'children'> & ApolloStateProps, Q>
20
+
21
+ export type GetServerSideProps<
22
+ PL extends AnyObj,
23
+ P extends AnyObj = AnyObj,
24
+ Q extends ParsedUrlQuery = ParsedUrlQuery,
25
+ > = GetServerSidePropsNext<P & Omit<PL, 'children'> & ApolloStateProps, Q>
@@ -1,6 +1,5 @@
1
1
  import { Box, SxProps, Theme } from '@mui/material'
2
2
  import { extendableComponent } from '../Styles'
3
- import { responsiveVal } from '../Styles/responsiveVal'
4
3
 
5
4
  export type StepperProps = {
6
5
  steps: number
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.22.0",
5
+ "version": "4.24.0",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "sideEffects": false,
@@ -20,7 +20,7 @@
20
20
  "@emotion/server": "^11.4.0",
21
21
  "@emotion/styled": "^11.9.3",
22
22
  "@graphcommerce/framer-next-pages": "3.3.0",
23
- "@graphcommerce/framer-scroller": "2.1.33",
23
+ "@graphcommerce/framer-scroller": "2.1.36",
24
24
  "@graphcommerce/framer-utils": "3.2.0",
25
25
  "@graphcommerce/image": "3.1.9",
26
26
  "cookie": "^0.5.0",