@graphcommerce/next-ui 4.8.4 → 4.11.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 +106 -35
- package/ActionCard/ActionCardListForm.tsx +8 -5
- package/Blog/BlogAuthor/BlogAuthor.tsx +2 -7
- package/Blog/BlogListItem/BlogListItem.tsx +3 -7
- package/CHANGELOG.md +41 -0
- package/FramerScroller/SidebarGallery.tsx +3 -5
- package/LayoutOverlay/components/LayoutOverlayBase.tsx +1 -0
- package/LayoutOverlay/test/LayoutOverlayDemo.tsx +1 -1
- 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/MuiButton.ts +62 -0
- package/hooks/index.ts +3 -0
- package/hooks/useDateTimeFormat.ts +10 -0
- package/hooks/useNumberFormat.ts +10 -0
- package/{useUrlQuery/useUrlQuery.tsx → hooks/useUrlQuery.ts} +0 -0
- package/index.ts +1 -1
- package/package.json +12 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Theme } from '@
|
|
2
|
-
import { SxProps, ButtonBase, Box } from '@mui/material'
|
|
1
|
+
import { SxProps, ButtonBase, Box, Theme } from '@mui/material'
|
|
3
2
|
import React, { FormEvent } from 'react'
|
|
3
|
+
import { extendableComponent } from '../Styles'
|
|
4
4
|
|
|
5
5
|
export type ActionCardProps = {
|
|
6
6
|
sx?: SxProps<Theme>
|
|
@@ -8,61 +8,83 @@ export type ActionCardProps = {
|
|
|
8
8
|
image?: React.ReactNode
|
|
9
9
|
action?: React.ReactNode
|
|
10
10
|
details?: React.ReactNode
|
|
11
|
+
price?: React.ReactNode
|
|
12
|
+
after?: React.ReactNode
|
|
11
13
|
secondaryAction?: React.ReactNode
|
|
12
14
|
onClick?: (e: FormEvent<HTMLElement>, v: string | number) => void
|
|
13
15
|
selected?: boolean
|
|
14
|
-
hidden?: boolean
|
|
16
|
+
hidden?: boolean
|
|
15
17
|
value: string | number
|
|
16
18
|
reset?: React.ReactNode
|
|
19
|
+
disabled?: boolean
|
|
17
20
|
}
|
|
18
21
|
|
|
19
|
-
const
|
|
20
|
-
'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const parts = [
|
|
23
|
+
'root',
|
|
24
|
+
'image',
|
|
25
|
+
'title',
|
|
26
|
+
'action',
|
|
27
|
+
'details',
|
|
28
|
+
'price',
|
|
29
|
+
'after',
|
|
30
|
+
'secondaryAction',
|
|
31
|
+
'reset',
|
|
32
|
+
] as const
|
|
33
|
+
const name = 'ActionCard'
|
|
34
|
+
|
|
35
|
+
type StateProps = {
|
|
36
|
+
selected?: boolean
|
|
37
|
+
hidden?: boolean
|
|
38
|
+
disabled?: boolean
|
|
39
|
+
image?: boolean
|
|
29
40
|
}
|
|
30
41
|
|
|
42
|
+
const { withState, selectors } = extendableComponent<StateProps, typeof name, typeof parts>(
|
|
43
|
+
name,
|
|
44
|
+
parts,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
export const actionCardSelectors = selectors
|
|
48
|
+
|
|
31
49
|
export function ActionCard(props: ActionCardProps) {
|
|
32
50
|
const {
|
|
33
51
|
title,
|
|
34
52
|
image,
|
|
35
53
|
action,
|
|
36
54
|
details,
|
|
55
|
+
price,
|
|
56
|
+
after,
|
|
37
57
|
secondaryAction,
|
|
38
58
|
sx = [],
|
|
39
59
|
onClick,
|
|
40
60
|
value,
|
|
41
|
-
selected,
|
|
42
|
-
hidden,
|
|
61
|
+
selected = false,
|
|
62
|
+
hidden = false,
|
|
43
63
|
reset,
|
|
64
|
+
disabled = false,
|
|
44
65
|
} = props
|
|
45
66
|
|
|
67
|
+
const classes = withState({ hidden, disabled, selected, image: Boolean(image) })
|
|
68
|
+
|
|
46
69
|
const handleClick = (event: FormEvent<HTMLElement>) => onClick?.(event, value)
|
|
47
70
|
|
|
48
71
|
return (
|
|
49
72
|
<ButtonBase
|
|
50
73
|
component='div'
|
|
51
|
-
className=
|
|
74
|
+
className={classes.root}
|
|
52
75
|
onClick={handleClick}
|
|
76
|
+
disabled={disabled}
|
|
53
77
|
sx={[
|
|
54
78
|
(theme) => ({
|
|
55
79
|
display: 'grid',
|
|
56
80
|
width: '100%',
|
|
57
|
-
gridTemplateColumns: 'min-content',
|
|
58
|
-
gridTemplateAreas:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
`,
|
|
65
|
-
},
|
|
81
|
+
gridTemplateColumns: 'min-content auto auto',
|
|
82
|
+
gridTemplateAreas: `
|
|
83
|
+
"image title action"
|
|
84
|
+
"image details ${price ? 'price' : 'details'}"
|
|
85
|
+
"image secondaryActio additionalDetails"
|
|
86
|
+
"after after after"
|
|
87
|
+
`,
|
|
66
88
|
justifyContent: 'unset',
|
|
67
89
|
typography: 'body1',
|
|
68
90
|
// textAlign: 'left',
|
|
@@ -81,10 +103,19 @@ export function ActionCard(props: ActionCardProps) {
|
|
|
81
103
|
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
82
104
|
},
|
|
83
105
|
}),
|
|
84
|
-
|
|
106
|
+
!image && {
|
|
107
|
+
gridTemplateColumns: 'auto auto',
|
|
108
|
+
gridTemplateAreas: `
|
|
109
|
+
"title action"
|
|
110
|
+
"details ${price ? 'price' : 'details'}"
|
|
111
|
+
"secondaryAction additionalDetails"
|
|
112
|
+
"after after"
|
|
113
|
+
`,
|
|
114
|
+
},
|
|
115
|
+
hidden && {
|
|
85
116
|
display: 'none',
|
|
86
117
|
},
|
|
87
|
-
|
|
118
|
+
selected &&
|
|
88
119
|
((theme) => ({
|
|
89
120
|
border: `2px solid ${theme.palette.secondary.main} !important`,
|
|
90
121
|
borderTopLeftRadius: theme.shape.borderRadius,
|
|
@@ -93,25 +124,65 @@ export function ActionCard(props: ActionCardProps) {
|
|
|
93
124
|
borderBottomRightRadius: theme.shape.borderRadius,
|
|
94
125
|
padding: `${theme.spacings.xxs} ${theme.spacings.xs}`,
|
|
95
126
|
})),
|
|
127
|
+
disabled &&
|
|
128
|
+
((theme) => ({
|
|
129
|
+
background: theme.palette.background.default,
|
|
130
|
+
})),
|
|
131
|
+
|
|
96
132
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
97
133
|
]}
|
|
98
134
|
>
|
|
99
|
-
{image &&
|
|
100
|
-
{title && <Box sx={{ gridArea: 'title', fontWeight: 'bold' }}>{title}</Box>}
|
|
101
|
-
{action && (
|
|
135
|
+
{image && (
|
|
102
136
|
<Box
|
|
137
|
+
className={classes.image}
|
|
103
138
|
sx={{
|
|
104
|
-
gridArea: '
|
|
105
|
-
|
|
106
|
-
...actionButtonStyles,
|
|
139
|
+
gridArea: 'image',
|
|
140
|
+
display: 'flex',
|
|
107
141
|
}}
|
|
108
142
|
>
|
|
143
|
+
{image}
|
|
144
|
+
</Box>
|
|
145
|
+
)}
|
|
146
|
+
{title && (
|
|
147
|
+
<Box className={classes.title} sx={{ gridArea: 'title', display: 'flex' }}>
|
|
148
|
+
{title}
|
|
149
|
+
</Box>
|
|
150
|
+
)}
|
|
151
|
+
{action && (
|
|
152
|
+
<Box className={classes.action} sx={{ gridArea: 'action', textAlign: 'right' }}>
|
|
109
153
|
{!selected ? action : reset}
|
|
110
154
|
</Box>
|
|
111
155
|
)}
|
|
112
|
-
{details &&
|
|
156
|
+
{details && (
|
|
157
|
+
<Box
|
|
158
|
+
className={classes.details}
|
|
159
|
+
sx={{
|
|
160
|
+
gridArea: 'details',
|
|
161
|
+
color: 'text.secondary',
|
|
162
|
+
}}
|
|
163
|
+
>
|
|
164
|
+
{details}
|
|
165
|
+
</Box>
|
|
166
|
+
)}
|
|
167
|
+
|
|
168
|
+
{price && !disabled && (
|
|
169
|
+
<Box
|
|
170
|
+
className={classes.price}
|
|
171
|
+
sx={{ gridArea: 'price', textAlign: 'right', typography: 'h5' }}
|
|
172
|
+
>
|
|
173
|
+
{price}
|
|
174
|
+
</Box>
|
|
175
|
+
)}
|
|
176
|
+
|
|
113
177
|
{secondaryAction && (
|
|
114
|
-
<Box sx={{ gridArea: 'secondaryAction'
|
|
178
|
+
<Box className={classes.secondaryAction} sx={{ gridArea: 'secondaryAction' }}>
|
|
179
|
+
{secondaryAction}
|
|
180
|
+
</Box>
|
|
181
|
+
)}
|
|
182
|
+
{after && (
|
|
183
|
+
<Box className={classes.after} sx={{ gridArea: 'after' }}>
|
|
184
|
+
{after}
|
|
185
|
+
</Box>
|
|
115
186
|
)}
|
|
116
187
|
</ButtonBase>
|
|
117
188
|
)
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
2
|
import { Controller, ControllerProps } from '@graphcommerce/react-hook-form'
|
|
3
|
-
import React from 'react'
|
|
3
|
+
import React, { MouseEventHandler } from 'react'
|
|
4
4
|
import { ActionCardProps } from './ActionCard'
|
|
5
5
|
import { ActionCardList, ActionCardListProps } from './ActionCardList'
|
|
6
6
|
|
|
7
7
|
export type ActionCardItemBase = Pick<ActionCardProps, 'value'>
|
|
8
8
|
|
|
9
|
-
export type
|
|
10
|
-
|
|
9
|
+
export type ActionCardItemRenderProps<T> = Pick<
|
|
10
|
+
ActionCardProps,
|
|
11
|
+
'selected' | 'hidden' | 'value'
|
|
12
|
+
> & {
|
|
13
|
+
onReset: MouseEventHandler<HTMLAnchorElement> & MouseEventHandler<HTMLSpanElement>
|
|
11
14
|
} & T
|
|
12
15
|
|
|
13
16
|
export type ActionCardListFormProps<T extends ActionCardItemBase> = Omit<
|
|
@@ -16,14 +19,14 @@ export type ActionCardListFormProps<T extends ActionCardItemBase> = Omit<
|
|
|
16
19
|
> &
|
|
17
20
|
Omit<ControllerProps<any>, 'render'> & {
|
|
18
21
|
items: T[]
|
|
19
|
-
render: React.VFC<
|
|
22
|
+
render: React.VFC<ActionCardItemRenderProps<T>>
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
export function ActionCardListForm<T extends ActionCardItemBase>(
|
|
23
26
|
props: ActionCardListFormProps<T>,
|
|
24
27
|
) {
|
|
25
28
|
const { required, rules, items, render, control, name, errorMessage } = props
|
|
26
|
-
const RenderItem = render as React.VFC<
|
|
29
|
+
const RenderItem = render as React.VFC<ActionCardItemRenderProps<ActionCardItemBase>>
|
|
27
30
|
|
|
28
31
|
return (
|
|
29
32
|
<Controller
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Avatar, Box, Chip, SxProps, Theme } from '@mui/material'
|
|
2
|
-
import { useRouter } from 'next/router'
|
|
3
|
-
import { useMemo } from 'react'
|
|
4
2
|
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
3
|
+
import { useDateTimeFormat } from '../../hooks'
|
|
5
4
|
|
|
6
5
|
export type BlogAuthorProps = {
|
|
7
6
|
author: string
|
|
@@ -12,11 +11,7 @@ export type BlogAuthorProps = {
|
|
|
12
11
|
export function BlogAuthor(props: BlogAuthorProps) {
|
|
13
12
|
const { author, date, sx = [] } = props
|
|
14
13
|
|
|
15
|
-
const {
|
|
16
|
-
const formatter = useMemo(
|
|
17
|
-
() => new Intl.DateTimeFormat(locale, { month: 'long', day: 'numeric' }),
|
|
18
|
-
[locale],
|
|
19
|
-
)
|
|
14
|
+
const formatter = useDateTimeFormat({ month: 'long', day: 'numeric' })
|
|
20
15
|
|
|
21
16
|
return (
|
|
22
17
|
<Box
|
|
@@ -3,12 +3,12 @@ import PageLink from 'next/link'
|
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { extendableComponent } from '../../Styles'
|
|
5
5
|
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
6
|
+
import { useDateTimeFormat } from '../../hooks'
|
|
6
7
|
|
|
7
8
|
export type BlogListItemProps = {
|
|
8
9
|
asset: React.ReactNode
|
|
9
10
|
url: string
|
|
10
11
|
date: string
|
|
11
|
-
locale: string
|
|
12
12
|
title: string
|
|
13
13
|
sx?: SxProps<Theme>
|
|
14
14
|
}
|
|
@@ -18,13 +18,9 @@ const parts = ['item', 'date', 'asset', 'title'] as const
|
|
|
18
18
|
const { classes } = extendableComponent(name, parts)
|
|
19
19
|
|
|
20
20
|
export function BlogListItem(props: BlogListItemProps) {
|
|
21
|
-
const { asset, url, date,
|
|
21
|
+
const { asset, url, date, title, sx = [] } = props
|
|
22
22
|
|
|
23
|
-
const formatter =
|
|
24
|
-
year: 'numeric',
|
|
25
|
-
month: 'long',
|
|
26
|
-
day: 'numeric',
|
|
27
|
-
})
|
|
23
|
+
const formatter = useDateTimeFormat({ year: 'numeric', month: 'long', day: 'numeric' })
|
|
28
24
|
|
|
29
25
|
return (
|
|
30
26
|
<Box
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1524](https://github.com/graphcommerce-org/graphcommerce/pull/1524) [`9ec0338df`](https://github.com/graphcommerce-org/graphcommerce/commit/9ec0338dfe34d37b0f2c24e36ffa6ed13ea1145e) Thanks [@paales](https://github.com/paales)! - feat: Added useDateTimeFormat and useNumberFormat which automatically use the locales from nextjs.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies []:
|
|
12
|
+
- @graphcommerce/framer-scroller@2.1.18
|
|
13
|
+
|
|
14
|
+
## 4.10.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- [#1515](https://github.com/graphcommerce-org/graphcommerce/pull/1515) [`371e6cf52`](https://github.com/graphcommerce-org/graphcommerce/commit/371e6cf52916a3b6c44192bd40cc8271bd608832) Thanks [@mikekeehnen](https://github.com/mikekeehnen)! - - Shipping method UI improvements in checkout, like working ripple effect, auto select and other styling changes.
|
|
19
|
+
- Added new inline button variant
|
|
20
|
+
|
|
21
|
+
* [#1518](https://github.com/graphcommerce-org/graphcommerce/pull/1518) [`4143483f3`](https://github.com/graphcommerce-org/graphcommerce/commit/4143483f37c038d2bbf218be2685e27a31a35745) Thanks [@mikekeehnen](https://github.com/mikekeehnen)! - New ActionCardListForm implementation for Payment Methods
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies []:
|
|
26
|
+
- @graphcommerce/framer-scroller@2.1.17
|
|
27
|
+
|
|
28
|
+
## 4.9.0
|
|
29
|
+
|
|
30
|
+
### Minor Changes
|
|
31
|
+
|
|
32
|
+
- [#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
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- [#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
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [[`ddb6d6329`](https://github.com/graphcommerce-org/graphcommerce/commit/ddb6d6329bfad361b2fbe96402ca2bfc0ab3d98c), [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb)]:
|
|
39
|
+
- @graphcommerce/framer-scroller@2.1.16
|
|
40
|
+
- @graphcommerce/framer-next-pages@3.2.3
|
|
41
|
+
- @graphcommerce/framer-utils@3.1.4
|
|
42
|
+
- @graphcommerce/image@3.1.7
|
|
43
|
+
|
|
3
44
|
## 4.8.4
|
|
4
45
|
|
|
5
46
|
### 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/Theme/MuiButton.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { responsiveVal } from '../Styles/responsiveVal'
|
|
|
4
4
|
declare module '@mui/material/Button/Button' {
|
|
5
5
|
interface ButtonPropsVariantOverrides {
|
|
6
6
|
pill: true
|
|
7
|
+
inline: true
|
|
7
8
|
}
|
|
8
9
|
}
|
|
9
10
|
|
|
@@ -126,3 +127,64 @@ export const MuiButtonPill: ButtonVariants = [
|
|
|
126
127
|
}),
|
|
127
128
|
},
|
|
128
129
|
]
|
|
130
|
+
|
|
131
|
+
export const MuiButtonInline: ButtonVariants = [
|
|
132
|
+
{
|
|
133
|
+
props: { variant: 'inline', color: 'primary' },
|
|
134
|
+
style: ({ theme }) => ({
|
|
135
|
+
color: theme.palette.primary.main,
|
|
136
|
+
'&:hover:not(.Mui-disabled)': { backgroundColor: `${theme.palette.primary.main}30` },
|
|
137
|
+
}),
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
props: { variant: 'inline', color: 'secondary' },
|
|
141
|
+
style: ({ theme }) => ({
|
|
142
|
+
color: theme.palette.secondary.main,
|
|
143
|
+
'&:hover:not(.Mui-disabled)': {
|
|
144
|
+
backgroundColor: theme.palette.secondary.light,
|
|
145
|
+
},
|
|
146
|
+
}),
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
props: { variant: 'inline' },
|
|
150
|
+
style: { textTransform: 'none', fontWeight: 500 },
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
props: { variant: 'inline', size: 'small' },
|
|
154
|
+
style: ({ theme }) => ({
|
|
155
|
+
margin: `calc(${theme.spacings.xxs} / 2 * -1 )`,
|
|
156
|
+
padding: '3px 9px',
|
|
157
|
+
|
|
158
|
+
'& .MuiLoadingButton-loadingIndicatorEnd': { right: 3 },
|
|
159
|
+
'& .MuiLoadingButton-loadingIndicatorStart': { left: 9 },
|
|
160
|
+
}),
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
props: { variant: 'inline', size: 'medium' },
|
|
164
|
+
style: ({ theme }) => ({
|
|
165
|
+
margin: `calc(${theme.spacings.xxs} * -1 )`,
|
|
166
|
+
padding: `${responsiveVal(3, 5)} ${responsiveVal(9, 15)}`,
|
|
167
|
+
|
|
168
|
+
'& .MuiLoadingButton-loadingIndicatorEnd': { right: responsiveVal(9, 15) },
|
|
169
|
+
'& .MuiLoadingButton-loadingIndicatorStart': { left: responsiveVal(9, 15) },
|
|
170
|
+
}),
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
props: { variant: 'inline', size: 'large' },
|
|
174
|
+
style: ({ theme }) => ({
|
|
175
|
+
margin: `calc(${theme.spacings.xs} * -1)`,
|
|
176
|
+
padding: `${responsiveVal(8, 10)} ${responsiveVal(12, 22)}`,
|
|
177
|
+
|
|
178
|
+
'& .MuiLoadingButton-loadingIndicatorEnd': { right: responsiveVal(16, 24) },
|
|
179
|
+
'& .MuiLoadingButton-loadingIndicatorStart': { left: responsiveVal(16, 24) },
|
|
180
|
+
}),
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
props: { variant: 'inline', disableRipple: true },
|
|
184
|
+
style: {
|
|
185
|
+
'&:hover:not(.Mui-disabled)': {
|
|
186
|
+
backgroundColor: 'transparent',
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
]
|
package/hooks/index.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useRouter } from 'next/router'
|
|
2
|
+
import { useMemo } from 'react'
|
|
3
|
+
|
|
4
|
+
export type DateTimeFormatProps = Intl.DateTimeFormatOptions
|
|
5
|
+
|
|
6
|
+
export function useDateTimeFormat(props?: DateTimeFormatProps) {
|
|
7
|
+
const { locale } = useRouter()
|
|
8
|
+
const formatter = useMemo(() => new Intl.DateTimeFormat(locale, props), [locale, props])
|
|
9
|
+
return formatter
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useRouter } from 'next/router'
|
|
2
|
+
import { useMemo } from 'react'
|
|
3
|
+
|
|
4
|
+
export type NumberFormatProps = Intl.NumberFormatOptions
|
|
5
|
+
|
|
6
|
+
export function useNumberFormat(props?: NumberFormatProps) {
|
|
7
|
+
const { locale } = useRouter()
|
|
8
|
+
const formatter = useMemo(() => new Intl.NumberFormat(locale, props), [locale, props])
|
|
9
|
+
return formatter
|
|
10
|
+
}
|
|
File without changes
|
package/index.ts
CHANGED
|
@@ -50,6 +50,6 @@ export * from './Theme'
|
|
|
50
50
|
export * from './TimeAgo/TimeAgo'
|
|
51
51
|
export * from './ToggleButton/ToggleButton'
|
|
52
52
|
export * from './ToggleButtonGroup/ToggleButtonGroup'
|
|
53
|
-
export * from './
|
|
53
|
+
export * from './hooks'
|
|
54
54
|
export * from './UspList/UspList'
|
|
55
55
|
export * from './UspList/UspListItem'
|
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.11.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.18",
|
|
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
|
}
|