@graphcommerce/next-ui 4.8.4 → 4.9.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/ActionCard/ActionCard.tsx +20 -2
- package/CHANGELOG.md +16 -0
- package/FramerScroller/SidebarGallery.tsx +3 -5
- package/LayoutOverlay/components/LayoutOverlayBase.tsx +1 -0
- package/LayoutParts/DesktopHeaderBadge.tsx +1 -0
- package/LayoutParts/DesktopNavActions.tsx +2 -2
- package/LayoutParts/DesktopNavBar.tsx +36 -44
- package/LayoutParts/MenuFab.tsx +4 -3
- package/Page/CssAndFramerMotionProvider.tsx +1 -2
- package/PageMeta/PageMeta.tsx +1 -1
- package/package.json +12 -12
|
@@ -14,6 +14,7 @@ export type ActionCardProps = {
|
|
|
14
14
|
hidden?: boolean | (() => boolean)
|
|
15
15
|
value: string | number
|
|
16
16
|
reset?: React.ReactNode
|
|
17
|
+
disabled?: boolean
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
const actionButtonStyles: SxProps = {
|
|
@@ -41,6 +42,7 @@ export function ActionCard(props: ActionCardProps) {
|
|
|
41
42
|
selected,
|
|
42
43
|
hidden,
|
|
43
44
|
reset,
|
|
45
|
+
disabled,
|
|
44
46
|
} = props
|
|
45
47
|
|
|
46
48
|
const handleClick = (event: FormEvent<HTMLElement>) => onClick?.(event, value)
|
|
@@ -50,6 +52,7 @@ export function ActionCard(props: ActionCardProps) {
|
|
|
50
52
|
component='div'
|
|
51
53
|
className='ActionCard-root'
|
|
52
54
|
onClick={handleClick}
|
|
55
|
+
disabled={disabled}
|
|
53
56
|
sx={[
|
|
54
57
|
(theme) => ({
|
|
55
58
|
display: 'grid',
|
|
@@ -93,11 +96,20 @@ export function ActionCard(props: ActionCardProps) {
|
|
|
93
96
|
borderBottomRightRadius: theme.shape.borderRadius,
|
|
94
97
|
padding: `${theme.spacings.xxs} ${theme.spacings.xs}`,
|
|
95
98
|
})),
|
|
99
|
+
!!disabled &&
|
|
100
|
+
((theme) => ({
|
|
101
|
+
background: theme.palette.background.default,
|
|
102
|
+
})),
|
|
103
|
+
|
|
96
104
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
97
105
|
]}
|
|
98
106
|
>
|
|
99
107
|
{image && <Box sx={{ gridArea: 'image', justifySelf: 'center', padding: 1 }}>{image}</Box>}
|
|
100
|
-
{title &&
|
|
108
|
+
{title && (
|
|
109
|
+
<Box sx={{ gridArea: 'title', fontWeight: 'bold', marginLeft: !image ? -2 : undefined }}>
|
|
110
|
+
{title}
|
|
111
|
+
</Box>
|
|
112
|
+
)}
|
|
101
113
|
{action && (
|
|
102
114
|
<Box
|
|
103
115
|
sx={{
|
|
@@ -109,7 +121,13 @@ export function ActionCard(props: ActionCardProps) {
|
|
|
109
121
|
{!selected ? action : reset}
|
|
110
122
|
</Box>
|
|
111
123
|
)}
|
|
112
|
-
{details &&
|
|
124
|
+
{details && (
|
|
125
|
+
<Box
|
|
126
|
+
sx={{ gridArea: 'details', color: 'text.secondary', marginLeft: !image ? -2 : undefined }}
|
|
127
|
+
>
|
|
128
|
+
{details}
|
|
129
|
+
</Box>
|
|
130
|
+
)}
|
|
113
131
|
{secondaryAction && (
|
|
114
132
|
<Box sx={{ gridArea: 'secondaryAction', ...actionButtonStyles }}>{secondaryAction}</Box>
|
|
115
133
|
)}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1503](https://github.com/graphcommerce-org/graphcommerce/pull/1503) [`a9213f1f5`](https://github.com/graphcommerce-org/graphcommerce/commit/a9213f1f5a410d217768386ccb6d9b5ce7bd5782) Thanks [@mikekeehnen](https://github.com/mikekeehnen)! - Bug fixes for shipping methods in /checkout
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#1490](https://github.com/graphcommerce-org/graphcommerce/pull/1490) [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb) Thanks [@paales](https://github.com/paales)! - upgraded packages
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`ddb6d6329`](https://github.com/graphcommerce-org/graphcommerce/commit/ddb6d6329bfad361b2fbe96402ca2bfc0ab3d98c), [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb)]:
|
|
14
|
+
- @graphcommerce/framer-scroller@2.1.16
|
|
15
|
+
- @graphcommerce/framer-next-pages@3.2.3
|
|
16
|
+
- @graphcommerce/framer-utils@3.1.4
|
|
17
|
+
- @graphcommerce/image@3.1.7
|
|
18
|
+
|
|
3
19
|
## 4.8.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -7,8 +7,7 @@ import {
|
|
|
7
7
|
ScrollerDots,
|
|
8
8
|
ScrollerProvider,
|
|
9
9
|
} from '@graphcommerce/framer-scroller'
|
|
10
|
-
import {
|
|
11
|
-
import { Fab, useTheme, alpha, Box, styled, SxProps, Theme } from '@mui/material'
|
|
10
|
+
import { Fab, useTheme, Box, styled, SxProps, Theme } from '@mui/material'
|
|
12
11
|
import { m, useDomEvent, useMotionValue } from 'framer-motion'
|
|
13
12
|
import { useRouter } from 'next/router'
|
|
14
13
|
import React, { useEffect, useRef } from 'react'
|
|
@@ -61,7 +60,6 @@ export function SidebarGallery(props: SidebarGalleryProps) {
|
|
|
61
60
|
|
|
62
61
|
const router = useRouter()
|
|
63
62
|
const prevRoute = usePrevPageRouter()
|
|
64
|
-
const clientHeight = useMotionValueValue(clientSize.y, (y) => y)
|
|
65
63
|
// const classes = useMergedClasses(useStyles({ clientHeight, aspectRatio }).classes, props.classes)
|
|
66
64
|
|
|
67
65
|
const route = `#${routeHash}`
|
|
@@ -162,7 +160,7 @@ export function SidebarGallery(props: SidebarGalleryProps) {
|
|
|
162
160
|
},
|
|
163
161
|
},
|
|
164
162
|
zoomed && {
|
|
165
|
-
paddingTop:
|
|
163
|
+
paddingTop: `var(--client-size-y)`,
|
|
166
164
|
},
|
|
167
165
|
]}
|
|
168
166
|
onLayoutAnimationComplete={() => {
|
|
@@ -186,7 +184,7 @@ export function SidebarGallery(props: SidebarGalleryProps) {
|
|
|
186
184
|
cursor: 'zoom-in',
|
|
187
185
|
},
|
|
188
186
|
zoomed && {
|
|
189
|
-
height:
|
|
187
|
+
height: `var(--client-size-y)`,
|
|
190
188
|
cursor: 'inherit',
|
|
191
189
|
},
|
|
192
190
|
]}
|
|
@@ -151,6 +151,7 @@ export function LayoutOverlayBase(incommingProps: LayoutOverlayBaseProps) {
|
|
|
151
151
|
if (isPresent) return
|
|
152
152
|
position.set(OverlayPosition.CLOSED)
|
|
153
153
|
clearScrollLock()
|
|
154
|
+
|
|
154
155
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
155
156
|
scrollTo({
|
|
156
157
|
x: positions.closed.x.get(),
|
|
@@ -3,6 +3,7 @@ import { Badge, BadgeProps } from '@mui/material'
|
|
|
3
3
|
/** Note: This should _only_ be used on the Desktop, use a standard Badge for other usecases. */
|
|
4
4
|
export function DesktopHeaderBadge(props: BadgeProps) {
|
|
5
5
|
const { sx = false } = props
|
|
6
|
+
|
|
6
7
|
return (
|
|
7
8
|
<Badge
|
|
8
9
|
{...props}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { styled } from '@mui/material'
|
|
2
2
|
|
|
3
|
-
export const DesktopNavActions = styled(
|
|
3
|
+
export const DesktopNavActions = styled('div', { name: 'DesktopNavActions' })(({ theme }) => ({
|
|
4
4
|
display: 'none',
|
|
5
5
|
[theme.breakpoints.up('md')]: {
|
|
6
6
|
display: 'grid',
|
|
@@ -14,8 +14,7 @@ export type MenuTabsProps = {
|
|
|
14
14
|
const { classes, selectors } = extendableComponent('DesktopNavBar', [
|
|
15
15
|
'root',
|
|
16
16
|
'scroller',
|
|
17
|
-
'
|
|
18
|
-
'rightWrapper',
|
|
17
|
+
'button',
|
|
19
18
|
'left',
|
|
20
19
|
'right',
|
|
21
20
|
] as const)
|
|
@@ -34,6 +33,7 @@ export function DesktopNavBar(props: MenuTabsProps) {
|
|
|
34
33
|
alignItems: 'center',
|
|
35
34
|
position: 'relative',
|
|
36
35
|
pointerEvents: 'all',
|
|
36
|
+
gridTemplateColumns: `auto 1fr auto`,
|
|
37
37
|
},
|
|
38
38
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
39
39
|
]}
|
|
@@ -51,61 +51,53 @@ export function DesktopNavBar(props: MenuTabsProps) {
|
|
|
51
51
|
{children}
|
|
52
52
|
</Scroller>
|
|
53
53
|
|
|
54
|
-
<
|
|
55
|
-
|
|
54
|
+
<ScrollerButton
|
|
55
|
+
sxContainer={{
|
|
56
56
|
gridArea: `1 / 1 / 1 / 2`,
|
|
57
57
|
pointerEvents: 'none',
|
|
58
58
|
'& > *': { pointerEvents: 'all' },
|
|
59
59
|
}}
|
|
60
|
-
|
|
60
|
+
sx={{
|
|
61
|
+
pointerEvents: 'all',
|
|
62
|
+
boxShadow: 'none',
|
|
63
|
+
height: 48,
|
|
64
|
+
borderTopLeftRadius: 0,
|
|
65
|
+
borderBottomLeftRadius: 0,
|
|
66
|
+
backgroundColor: 'transparent',
|
|
67
|
+
backgroundImage: (theme) =>
|
|
68
|
+
`linear-gradient(to left, rgba(255,255,255,0) 0%, ${theme.palette.background.default} 35%)`,
|
|
69
|
+
}}
|
|
70
|
+
direction='left'
|
|
71
|
+
size='small'
|
|
72
|
+
className={`${classes.left} ${classes.button}`}
|
|
61
73
|
>
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
pointerEvents: 'all',
|
|
65
|
-
boxShadow: 'none',
|
|
66
|
-
height: 48,
|
|
67
|
-
borderTopLeftRadius: 0,
|
|
68
|
-
borderBottomLeftRadius: 0,
|
|
69
|
-
backgroundColor: 'transparent',
|
|
70
|
-
backgroundImage: (theme) =>
|
|
71
|
-
`linear-gradient(to left, rgba(255,255,255,0) 0%, ${theme.palette.background.default} 35%)`,
|
|
72
|
-
}}
|
|
73
|
-
direction='left'
|
|
74
|
-
size='small'
|
|
75
|
-
className={classes.left}
|
|
76
|
-
>
|
|
77
|
-
<IconSvg src={iconLeft ?? iconChevronLeft} />
|
|
78
|
-
</ScrollerButton>
|
|
79
|
-
</Box>
|
|
74
|
+
<IconSvg src={iconLeft ?? iconChevronLeft} />
|
|
75
|
+
</ScrollerButton>
|
|
80
76
|
|
|
81
|
-
<
|
|
82
|
-
|
|
77
|
+
<ScrollerButton
|
|
78
|
+
sxContainer={{
|
|
83
79
|
gridArea: `1 / 3 / 1 / 4`,
|
|
84
80
|
pointerEvents: 'none',
|
|
85
81
|
'& > *': {
|
|
86
82
|
pointerEvents: 'all',
|
|
87
83
|
},
|
|
88
84
|
}}
|
|
89
|
-
|
|
85
|
+
sx={{
|
|
86
|
+
pointerEvents: 'all',
|
|
87
|
+
boxShadow: 'none',
|
|
88
|
+
height: 48,
|
|
89
|
+
borderTopRightRadius: 0,
|
|
90
|
+
borderBottomRightRadius: 0,
|
|
91
|
+
backgroundColor: 'transparent',
|
|
92
|
+
backgroundImage: (theme) =>
|
|
93
|
+
`linear-gradient(to right, rgba(255,255,255,0) 0%, ${theme.palette.background.default} 35%)`,
|
|
94
|
+
}}
|
|
95
|
+
direction='right'
|
|
96
|
+
size='small'
|
|
97
|
+
className={`${classes.right} ${classes.button}`}
|
|
90
98
|
>
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
pointerEvents: 'all',
|
|
94
|
-
boxShadow: 'none',
|
|
95
|
-
height: 48,
|
|
96
|
-
borderTopRightRadius: 0,
|
|
97
|
-
borderBottomRightRadius: 0,
|
|
98
|
-
backgroundColor: 'transparent',
|
|
99
|
-
backgroundImage: (theme) =>
|
|
100
|
-
`linear-gradient(to right, rgba(255,255,255,0) 0%, ${theme.palette.background.default} 35%)`,
|
|
101
|
-
}}
|
|
102
|
-
direction='right'
|
|
103
|
-
size='small'
|
|
104
|
-
className={classes.right}
|
|
105
|
-
>
|
|
106
|
-
<IconSvg src={iconRight ?? iconChevronRight} />
|
|
107
|
-
</ScrollerButton>
|
|
108
|
-
</Box>
|
|
99
|
+
<IconSvg src={iconRight ?? iconChevronRight} />
|
|
100
|
+
</ScrollerButton>
|
|
109
101
|
</Box>
|
|
110
102
|
</ScrollerProvider>
|
|
111
103
|
)
|
package/LayoutParts/MenuFab.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMotionValueValue } from '@graphcommerce/framer-utils'
|
|
1
|
+
import { useIsomorphicLayoutEffect, 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 } from 'react'
|
|
16
|
+
import React, { useEffect, useCallback, useRef } from 'react'
|
|
17
17
|
import { IconSvg } from '../IconSvg'
|
|
18
18
|
import { useScrollY } from '../Layout/hooks/useScrollY'
|
|
19
19
|
import { extendableComponent } from '../Styles/extendableComponent'
|
|
@@ -64,7 +64,8 @@ export function MenuFab(props: MenuFabProps) {
|
|
|
64
64
|
const clear = () => setOpenEl(null)
|
|
65
65
|
router.events.on('routeChangeStart', clear)
|
|
66
66
|
return () => router.events.off('routeChangeStart', clear)
|
|
67
|
-
}, [router])
|
|
67
|
+
}, [router.events])
|
|
68
|
+
|
|
68
69
|
const fabIconSize = useFabSize('responsive')
|
|
69
70
|
|
|
70
71
|
const classes = withState({ scrolled })
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LazyMotion } from 'framer-motion'
|
|
2
|
-
import { EmotionProvider } from '../Styles'
|
|
3
2
|
|
|
4
3
|
export type GraphCommerceProviderProps = {
|
|
5
4
|
children: React.ReactNode
|
|
@@ -15,7 +14,7 @@ export type GraphCommerceProviderProps = {
|
|
|
15
14
|
export function CssAndFramerMotionProvider({ children }: GraphCommerceProviderProps) {
|
|
16
15
|
return (
|
|
17
16
|
<LazyMotion features={async () => (await import('./framerFeatures')).default} strict>
|
|
18
|
-
|
|
17
|
+
{children}
|
|
19
18
|
</LazyMotion>
|
|
20
19
|
)
|
|
21
20
|
}
|
package/PageMeta/PageMeta.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { usePageContext } from '@graphcommerce/framer-next-pages'
|
|
2
2
|
import {
|
|
3
3
|
resolveHref,
|
|
4
|
-
getDomainLocale,
|
|
5
4
|
addBasePath,
|
|
6
5
|
addLocale,
|
|
6
|
+
getDomainLocale,
|
|
7
7
|
} from 'next/dist/shared/lib/router/router'
|
|
8
8
|
import Head from 'next/head'
|
|
9
9
|
import { useRouter } from 'next/router'
|
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.
|
|
5
|
+
"version": "4.9.0",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -19,31 +19,31 @@
|
|
|
19
19
|
"@emotion/react": "^11.9.0",
|
|
20
20
|
"@emotion/server": "^11.4.0",
|
|
21
21
|
"@emotion/styled": "^11.6.0",
|
|
22
|
-
"@graphcommerce/framer-next-pages": "3.2.
|
|
23
|
-
"@graphcommerce/framer-scroller": "2.1.
|
|
24
|
-
"@graphcommerce/framer-utils": "3.1.
|
|
25
|
-
"@graphcommerce/image": "3.1.
|
|
26
|
-
"react-is": "^
|
|
22
|
+
"@graphcommerce/framer-next-pages": "3.2.3",
|
|
23
|
+
"@graphcommerce/framer-scroller": "2.1.16",
|
|
24
|
+
"@graphcommerce/framer-utils": "3.1.4",
|
|
25
|
+
"@graphcommerce/image": "3.1.7",
|
|
26
|
+
"react-is": "^18.1.0",
|
|
27
27
|
"react-schemaorg": "^2.0.0",
|
|
28
28
|
"schema-dts": "^1.1.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@lingui/react": "^3.13.2",
|
|
32
31
|
"@lingui/core": "^3.13.2",
|
|
32
|
+
"@lingui/react": "^3.13.2",
|
|
33
33
|
"@mui/lab": "^5.0.0-alpha.68",
|
|
34
34
|
"@mui/material": "5.5.3",
|
|
35
35
|
"framer-motion": "^6.2.4",
|
|
36
|
-
"next": "12.1.2",
|
|
37
|
-
"react": "^
|
|
38
|
-
"react-dom": "^
|
|
36
|
+
"next": "^12.1.2",
|
|
37
|
+
"react": "^18.0.0",
|
|
38
|
+
"react-dom": "^18.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@graphcommerce/eslint-config-pwa": "^4.1.
|
|
41
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.8",
|
|
42
42
|
"@graphcommerce/prettier-config-pwa": "^4.0.6",
|
|
43
43
|
"@graphcommerce/typescript-config-pwa": "^4.0.3",
|
|
44
44
|
"@playwright/test": "^1.21.1",
|
|
45
45
|
"@types/react-is": "^17.0.3",
|
|
46
46
|
"type-fest": "^2.12.2",
|
|
47
|
-
"typescript": "4.
|
|
47
|
+
"typescript": "4.7.3"
|
|
48
48
|
}
|
|
49
49
|
}
|