@graphcommerce/next-ui 4.8.2 → 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 +47 -40
- package/ActionCard/ActionCardList.tsx +18 -6
- package/ActionCard/ActionCardListForm.tsx +28 -35
- package/CHANGELOG.md +39 -0
- package/FramerScroller/SidebarGallery.tsx +9 -15
- 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/Theme/themeDefaults.ts +2 -3
- package/package.json +12 -12
|
@@ -9,12 +9,24 @@ export type ActionCardProps = {
|
|
|
9
9
|
action?: React.ReactNode
|
|
10
10
|
details?: React.ReactNode
|
|
11
11
|
secondaryAction?: React.ReactNode
|
|
12
|
-
onClick?: (e: FormEvent<
|
|
13
|
-
onChange?: (e: FormEvent<HTMLButtonElement>, v: string | number) => void
|
|
12
|
+
onClick?: (e: FormEvent<HTMLElement>, v: string | number) => void
|
|
14
13
|
selected?: boolean
|
|
15
14
|
hidden?: boolean | (() => boolean)
|
|
16
15
|
value: string | number
|
|
17
16
|
reset?: React.ReactNode
|
|
17
|
+
disabled?: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const actionButtonStyles: SxProps = {
|
|
21
|
+
'& .MuiButton-root': {
|
|
22
|
+
'&.MuiButton-textSecondary': {
|
|
23
|
+
padding: '5px',
|
|
24
|
+
margin: '-5px',
|
|
25
|
+
'&:hover': {
|
|
26
|
+
background: 'none',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
18
30
|
}
|
|
19
31
|
|
|
20
32
|
export function ActionCard(props: ActionCardProps) {
|
|
@@ -25,60 +37,40 @@ export function ActionCard(props: ActionCardProps) {
|
|
|
25
37
|
details,
|
|
26
38
|
secondaryAction,
|
|
27
39
|
sx = [],
|
|
28
|
-
onChange,
|
|
29
40
|
onClick,
|
|
30
41
|
value,
|
|
31
42
|
selected,
|
|
32
43
|
hidden,
|
|
33
44
|
reset,
|
|
45
|
+
disabled,
|
|
34
46
|
} = props
|
|
35
47
|
|
|
36
|
-
const
|
|
37
|
-
const handleClick = (event: FormEvent<HTMLButtonElement>) => {
|
|
38
|
-
if (onClick) {
|
|
39
|
-
onClick(event, value)
|
|
40
|
-
if (event.isDefaultPrevented()) return
|
|
41
|
-
}
|
|
42
|
-
handleChange(event)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const actionButtonStyles: SxProps = {
|
|
46
|
-
'& .MuiButton-root': {
|
|
47
|
-
'&.MuiButton-textSecondary': {
|
|
48
|
-
padding: '5px',
|
|
49
|
-
margin: '-5px',
|
|
50
|
-
'&:hover': {
|
|
51
|
-
background: 'none',
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
}
|
|
48
|
+
const handleClick = (event: FormEvent<HTMLElement>) => onClick?.(event, value)
|
|
56
49
|
|
|
57
50
|
return (
|
|
58
51
|
<ButtonBase
|
|
59
|
-
component='
|
|
52
|
+
component='div'
|
|
60
53
|
className='ActionCard-root'
|
|
61
54
|
onClick={handleClick}
|
|
62
|
-
|
|
63
|
-
value={value}
|
|
55
|
+
disabled={disabled}
|
|
64
56
|
sx={[
|
|
65
|
-
{
|
|
57
|
+
(theme) => ({
|
|
66
58
|
display: 'grid',
|
|
67
59
|
width: '100%',
|
|
68
60
|
gridTemplateColumns: 'min-content',
|
|
69
|
-
gridTemplateAreas:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
gridTemplateAreas: {
|
|
62
|
+
xs: `
|
|
63
|
+
"image title action"
|
|
64
|
+
"image details details"
|
|
65
|
+
"image secondaryAction additionalDetails"
|
|
66
|
+
"additionalContent additionalContent additionalContent"
|
|
67
|
+
`,
|
|
68
|
+
},
|
|
75
69
|
justifyContent: 'unset',
|
|
76
|
-
},
|
|
77
|
-
(theme) => ({
|
|
78
70
|
typography: 'body1',
|
|
79
|
-
textAlign: 'left',
|
|
71
|
+
// textAlign: 'left',
|
|
80
72
|
background: theme.palette.background.paper,
|
|
81
|
-
padding: `calc(${theme.spacings.xs} + 1px)`,
|
|
73
|
+
padding: `calc(${theme.spacings.xxs} + 1px) calc(${theme.spacings.xs} + 1px)`,
|
|
82
74
|
columnGap: theme.spacings.xxs,
|
|
83
75
|
border: `1px solid ${theme.palette.divider}`,
|
|
84
76
|
borderBottomColor: `transparent`,
|
|
@@ -102,13 +94,22 @@ export function ActionCard(props: ActionCardProps) {
|
|
|
102
94
|
borderTopRightRadius: theme.shape.borderRadius,
|
|
103
95
|
borderBottomLeftRadius: theme.shape.borderRadius,
|
|
104
96
|
borderBottomRightRadius: theme.shape.borderRadius,
|
|
105
|
-
padding: theme.spacings.xs
|
|
97
|
+
padding: `${theme.spacings.xxs} ${theme.spacings.xs}`,
|
|
98
|
+
})),
|
|
99
|
+
!!disabled &&
|
|
100
|
+
((theme) => ({
|
|
101
|
+
background: theme.palette.background.default,
|
|
106
102
|
})),
|
|
103
|
+
|
|
107
104
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
108
105
|
]}
|
|
109
106
|
>
|
|
110
107
|
{image && <Box sx={{ gridArea: 'image', justifySelf: 'center', padding: 1 }}>{image}</Box>}
|
|
111
|
-
{title &&
|
|
108
|
+
{title && (
|
|
109
|
+
<Box sx={{ gridArea: 'title', fontWeight: 'bold', marginLeft: !image ? -2 : undefined }}>
|
|
110
|
+
{title}
|
|
111
|
+
</Box>
|
|
112
|
+
)}
|
|
112
113
|
{action && (
|
|
113
114
|
<Box
|
|
114
115
|
sx={{
|
|
@@ -120,7 +121,13 @@ export function ActionCard(props: ActionCardProps) {
|
|
|
120
121
|
{!selected ? action : reset}
|
|
121
122
|
</Box>
|
|
122
123
|
)}
|
|
123
|
-
{details &&
|
|
124
|
+
{details && (
|
|
125
|
+
<Box
|
|
126
|
+
sx={{ gridArea: 'details', color: 'text.secondary', marginLeft: !image ? -2 : undefined }}
|
|
127
|
+
>
|
|
128
|
+
{details}
|
|
129
|
+
</Box>
|
|
130
|
+
)}
|
|
124
131
|
{secondaryAction && (
|
|
125
132
|
<Box sx={{ gridArea: 'secondaryAction', ...actionButtonStyles }}>{secondaryAction}</Box>
|
|
126
133
|
)}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Box } from '@mui/material'
|
|
1
|
+
import { Alert, Box, FormHelperText } from '@mui/material'
|
|
2
|
+
import { AnimatePresence } from 'framer-motion'
|
|
2
3
|
import React from 'react'
|
|
3
4
|
import { isFragment } from 'react-is'
|
|
5
|
+
import { AnimatedRow } from '../AnimatedRow/AnimatedRow'
|
|
4
6
|
|
|
5
7
|
type MultiSelect = {
|
|
6
8
|
multiple: true
|
|
@@ -20,6 +22,7 @@ export type ActionCardListProps<SelectOrMulti = MultiSelect | Select> = {
|
|
|
20
22
|
children?: React.ReactNode
|
|
21
23
|
required?: boolean
|
|
22
24
|
error?: boolean
|
|
25
|
+
errorMessage?: string
|
|
23
26
|
} & SelectOrMulti
|
|
24
27
|
|
|
25
28
|
function isMulti(props: ActionCardListProps): props is ActionCardListProps<MultiSelect> {
|
|
@@ -33,7 +36,7 @@ function isValueSelected(value: string, candidate: string | string[]) {
|
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
export function ActionCardList(props: ActionCardListProps) {
|
|
36
|
-
const { children, required, value, error = false } = props
|
|
39
|
+
const { children, required, value, error = false, errorMessage } = props
|
|
37
40
|
|
|
38
41
|
const handleChange = isMulti(props)
|
|
39
42
|
? (event: React.MouseEvent<HTMLElement, MouseEvent>, buttonValue: string) => {
|
|
@@ -70,15 +73,15 @@ export function ActionCardList(props: ActionCardListProps) {
|
|
|
70
73
|
paddingLeft: theme.spacings.xs,
|
|
71
74
|
paddingRight: theme.spacings.xs,
|
|
72
75
|
},
|
|
73
|
-
'&
|
|
76
|
+
'& > div:first-of-type.ActionCard-root': {
|
|
74
77
|
borderTop: 2,
|
|
75
78
|
borderTopColor: 'error.main',
|
|
76
|
-
paddingTop: theme.spacings.
|
|
79
|
+
paddingTop: theme.spacings.xxs,
|
|
77
80
|
},
|
|
78
|
-
'&
|
|
81
|
+
'& > div:last-of-type.ActionCard-root': {
|
|
79
82
|
borderBottom: 2,
|
|
80
83
|
borderBottomColor: 'error.main',
|
|
81
|
-
paddingBottom: theme.spacings.
|
|
84
|
+
paddingBottom: theme.spacings.xxs,
|
|
82
85
|
},
|
|
83
86
|
})),
|
|
84
87
|
]}
|
|
@@ -105,6 +108,15 @@ export function ActionCardList(props: ActionCardListProps) {
|
|
|
105
108
|
: child.props.selected,
|
|
106
109
|
})
|
|
107
110
|
})}
|
|
111
|
+
{error && (
|
|
112
|
+
<Alert
|
|
113
|
+
severity='error'
|
|
114
|
+
variant='filled'
|
|
115
|
+
sx={{ borderStartStartRadius: 0, borderStartEndRadius: 0 }}
|
|
116
|
+
>
|
|
117
|
+
{errorMessage}
|
|
118
|
+
</Alert>
|
|
119
|
+
)}
|
|
108
120
|
</Box>
|
|
109
121
|
)
|
|
110
122
|
}
|
|
@@ -1,40 +1,47 @@
|
|
|
1
1
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
2
|
import { Controller, ControllerProps } from '@graphcommerce/react-hook-form'
|
|
3
|
-
import { Trans } from '@lingui/react'
|
|
4
|
-
import { Button } from '@mui/material'
|
|
5
3
|
import React from 'react'
|
|
6
|
-
import {
|
|
4
|
+
import { ActionCardProps } from './ActionCard'
|
|
7
5
|
import { ActionCardList, ActionCardListProps } from './ActionCardList'
|
|
8
6
|
|
|
9
|
-
export type
|
|
10
|
-
ActionCardProps,
|
|
11
|
-
'action' | 'reset' | 'selected' | 'hidden' | 'value' | 'onClick' | 'onChange'
|
|
12
|
-
>
|
|
7
|
+
export type ActionCardItemBase = Pick<ActionCardProps, 'value'>
|
|
13
8
|
|
|
14
|
-
export type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
>
|
|
9
|
+
export type ActionCardItemRenderer<T> = Pick<ActionCardProps, 'selected' | 'hidden' | 'value'> & {
|
|
10
|
+
onReset: React.MouseEventHandler<HTMLButtonElement>
|
|
11
|
+
} & T
|
|
18
12
|
|
|
19
|
-
type ActionCardListFormProps = Omit<
|
|
13
|
+
export type ActionCardListFormProps<T extends ActionCardItemBase> = Omit<
|
|
14
|
+
ActionCardListProps,
|
|
15
|
+
'value'
|
|
16
|
+
> &
|
|
20
17
|
Omit<ControllerProps<any>, 'render'> & {
|
|
21
|
-
items:
|
|
22
|
-
render
|
|
18
|
+
items: T[]
|
|
19
|
+
render: React.VFC<ActionCardItemRenderer<T>>
|
|
23
20
|
}
|
|
24
21
|
|
|
25
|
-
export function ActionCardListForm
|
|
26
|
-
|
|
22
|
+
export function ActionCardListForm<T extends ActionCardItemBase>(
|
|
23
|
+
props: ActionCardListFormProps<T>,
|
|
24
|
+
) {
|
|
25
|
+
const { required, rules, items, render, control, name, errorMessage } = props
|
|
26
|
+
const RenderItem = render as React.VFC<ActionCardItemRenderer<ActionCardItemBase>>
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
29
|
<Controller
|
|
30
30
|
{...props}
|
|
31
|
-
|
|
31
|
+
control={control}
|
|
32
|
+
name={name}
|
|
33
|
+
rules={{
|
|
34
|
+
required,
|
|
35
|
+
...rules,
|
|
36
|
+
validate: (v) => (v ? true : 'Please select a shipping address'),
|
|
37
|
+
}}
|
|
32
38
|
render={({ field: { onChange, value }, fieldState, formState }) => (
|
|
33
39
|
<ActionCardList
|
|
34
40
|
required
|
|
35
41
|
value={value}
|
|
36
42
|
onChange={(_, incomming) => onChange(incomming)}
|
|
37
43
|
error={formState.isSubmitted && !!fieldState.error}
|
|
44
|
+
errorMessage={errorMessage}
|
|
38
45
|
>
|
|
39
46
|
{items.map((item) => (
|
|
40
47
|
<RenderItem
|
|
@@ -43,24 +50,10 @@ export function ActionCardListForm(props: ActionCardListFormProps) {
|
|
|
43
50
|
value={item.value}
|
|
44
51
|
selected={value === item.value}
|
|
45
52
|
hidden={!!value && value !== item.value}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
reset={
|
|
52
|
-
<Button
|
|
53
|
-
disableRipple
|
|
54
|
-
variant='text'
|
|
55
|
-
color='secondary'
|
|
56
|
-
onClick={(e) => {
|
|
57
|
-
e.preventDefault()
|
|
58
|
-
onChange(null)
|
|
59
|
-
}}
|
|
60
|
-
>
|
|
61
|
-
<Trans id='Change' />
|
|
62
|
-
</Button>
|
|
63
|
-
}
|
|
53
|
+
onReset={(e) => {
|
|
54
|
+
e.preventDefault()
|
|
55
|
+
onChange(null)
|
|
56
|
+
}}
|
|
64
57
|
/>
|
|
65
58
|
))}
|
|
66
59
|
</ActionCardList>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
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
|
+
|
|
19
|
+
## 4.8.4
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#1509](https://github.com/graphcommerce-org/graphcommerce/pull/1509) [`0ab7c5465`](https://github.com/graphcommerce-org/graphcommerce/commit/0ab7c5465441cba9bf8cd185a6790ce2f443f4ed) Thanks [@paales](https://github.com/paales)! - SidebarGallery improvements (product page):
|
|
24
|
+
|
|
25
|
+
- Prevent vertical scrolling
|
|
26
|
+
- Disable zoom fab when there are no images
|
|
27
|
+
- Hide scroller dots when there in only one image
|
|
28
|
+
- Make sure the prev/next buttons are shown as expected
|
|
29
|
+
|
|
30
|
+
- Updated dependencies [[`0ab7c5465`](https://github.com/graphcommerce-org/graphcommerce/commit/0ab7c5465441cba9bf8cd185a6790ce2f443f4ed)]:
|
|
31
|
+
- @graphcommerce/framer-scroller@2.1.15
|
|
32
|
+
|
|
33
|
+
## 4.8.3
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- [#1487](https://github.com/graphcommerce-org/graphcommerce/pull/1487) [`afc67103d`](https://github.com/graphcommerce-org/graphcommerce/commit/afc67103d0e00583e274465036fd287537f95e79) Thanks [@paales](https://github.com/paales)! - When additing an additional breakpoint it would throw a typescript error
|
|
38
|
+
|
|
39
|
+
- Updated dependencies []:
|
|
40
|
+
- @graphcommerce/framer-scroller@2.1.14
|
|
41
|
+
|
|
3
42
|
## 4.8.2
|
|
4
43
|
|
|
5
44
|
### 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}`
|
|
@@ -114,6 +112,8 @@ export function SidebarGallery(props: SidebarGalleryProps) {
|
|
|
114
112
|
const maxHeight = `calc(100vh - ${headerHeight} - ${galleryMargin} - ${extraSpacing})`
|
|
115
113
|
const ratio = `calc(${height} / ${width} * 100%)`
|
|
116
114
|
|
|
115
|
+
const hasImages = images.length > 0
|
|
116
|
+
|
|
117
117
|
return (
|
|
118
118
|
<ScrollerProvider scrollSnapAlign='center'>
|
|
119
119
|
<Row maxWidth={false} disableGutters className={classes.row} sx={sx}>
|
|
@@ -160,7 +160,7 @@ export function SidebarGallery(props: SidebarGalleryProps) {
|
|
|
160
160
|
},
|
|
161
161
|
},
|
|
162
162
|
zoomed && {
|
|
163
|
-
paddingTop:
|
|
163
|
+
paddingTop: `var(--client-size-y)`,
|
|
164
164
|
},
|
|
165
165
|
]}
|
|
166
166
|
onLayoutAnimationComplete={() => {
|
|
@@ -184,7 +184,7 @@ export function SidebarGallery(props: SidebarGalleryProps) {
|
|
|
184
184
|
cursor: 'zoom-in',
|
|
185
185
|
},
|
|
186
186
|
zoomed && {
|
|
187
|
-
height:
|
|
187
|
+
height: `var(--client-size-y)`,
|
|
188
188
|
cursor: 'inherit',
|
|
189
189
|
},
|
|
190
190
|
]}
|
|
@@ -197,6 +197,7 @@ export function SidebarGallery(props: SidebarGalleryProps) {
|
|
|
197
197
|
width={image.width}
|
|
198
198
|
height={image.height}
|
|
199
199
|
loading={idx === 0 ? 'eager' : 'lazy'}
|
|
200
|
+
sx={{ display: 'block' }}
|
|
200
201
|
sizes={{
|
|
201
202
|
0: '100vw',
|
|
202
203
|
[theme.breakpoints.values.md]: zoomed ? '100vw' : '60vw',
|
|
@@ -221,11 +222,10 @@ export function SidebarGallery(props: SidebarGalleryProps) {
|
|
|
221
222
|
<Fab
|
|
222
223
|
size='small'
|
|
223
224
|
className={classes.toggleIcon}
|
|
225
|
+
disabled={!hasImages}
|
|
224
226
|
onMouseUp={toggle}
|
|
225
227
|
aria-label='Toggle Fullscreen'
|
|
226
|
-
sx={{
|
|
227
|
-
boxShadow: theme.shadows[6],
|
|
228
|
-
}}
|
|
228
|
+
sx={{ boxShadow: 6 }}
|
|
229
229
|
>
|
|
230
230
|
{!zoomed ? <IconSvg src={iconFullscreen} /> : <IconSvg src={iconFullscreenExit} />}
|
|
231
231
|
</Fab>
|
|
@@ -286,13 +286,7 @@ export function SidebarGallery(props: SidebarGalleryProps) {
|
|
|
286
286
|
},
|
|
287
287
|
}}
|
|
288
288
|
>
|
|
289
|
-
<ScrollerDots
|
|
290
|
-
layout
|
|
291
|
-
sx={{
|
|
292
|
-
background: alpha(theme.palette.background.paper, 1),
|
|
293
|
-
boxShadow: theme.shadows[6],
|
|
294
|
-
}}
|
|
295
|
-
/>
|
|
289
|
+
<ScrollerDots layout sx={{ backgroundColor: 'background.paper', boxShadow: 6 }} />
|
|
296
290
|
</Box>
|
|
297
291
|
</MotionBox>
|
|
298
292
|
|
|
@@ -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/Theme/themeDefaults.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { experimental_sx, SxProps, Theme } from '@mui/material'
|
|
2
2
|
import { Shadows } from '@mui/material/styles/shadows'
|
|
3
|
-
import type { SetRequired } from 'type-fest'
|
|
4
3
|
|
|
5
4
|
// https://material.io/design/environment/elevation.html#default-elevations
|
|
6
5
|
|
|
7
|
-
const breakpoints
|
|
6
|
+
const breakpoints = {
|
|
8
7
|
values: {
|
|
9
8
|
xs: 0,
|
|
10
9
|
sm: 600,
|
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
|
}
|