@graphcommerce/next-ui 3.25.1 → 4.0.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/AnimatedRow/index.tsx +6 -3
- package/ApolloError/ApolloErrorAlert.tsx +20 -21
- package/ApolloError/ApolloErrorFullPage.tsx +3 -4
- package/ApolloError/ApolloErrorSnackbar.tsx +3 -3
- package/Blog/BlogAuthor/index.tsx +42 -48
- package/Blog/BlogContent/index.tsx +6 -23
- package/Blog/BlogHeader/index.tsx +26 -23
- package/Blog/BlogList/index.tsx +7 -25
- package/Blog/BlogListItem/index.tsx +63 -52
- package/Blog/BlogTags/BlogTag.tsx +27 -0
- package/Blog/BlogTags/index.tsx +7 -32
- package/Blog/BlogTitle/index.tsx +7 -21
- package/Button/Button.tsx +5 -0
- package/Button/LinkOrButton.tsx +80 -0
- package/Button/index.tsx +2 -177
- package/CHANGELOG.md +497 -636
- package/ChipMenu/index.tsx +71 -77
- package/ContainerWithHeader/index.tsx +33 -30
- package/FlagAvatar/index.tsx +2 -12
- package/Footer/Footer.tsx +105 -88
- package/Footer/index.ts +0 -1
- package/Form/Form.tsx +35 -0
- package/Form/FormActions.tsx +9 -14
- package/Form/FormDivider.tsx +8 -13
- package/Form/FormHeader.tsx +5 -26
- package/Form/FormRow.tsx +8 -13
- package/Form/InputCheckmark.tsx +9 -22
- package/FramerScroller/SidebarGallery.tsx +340 -0
- package/FramerScroller/SidebarSlider.tsx +107 -0
- package/FramerScroller/index.ts +2 -0
- package/FullPageMessage/index.tsx +52 -48
- package/Highlight/index.tsx +1 -1
- package/IconHeader/index.tsx +63 -58
- package/JsonLd/index.tsx +3 -2
- package/Layout/components/LayoutHeader.tsx +75 -82
- package/Layout/components/LayoutHeaderBack.tsx +21 -12
- package/Layout/components/LayoutHeaderClose.tsx +9 -22
- package/Layout/components/LayoutHeaderContent.tsx +190 -154
- package/Layout/components/LayoutHeadertypes.ts +1 -1
- package/Layout/components/LayoutTitle.tsx +60 -55
- package/LayoutDefault/components/LayoutDefault.tsx +96 -85
- package/LayoutOverlay/components/LayoutOverlay.tsx +2 -8
- package/LayoutOverlay/components/LayoutOverlayBase.tsx +233 -239
- package/LayoutOverlay/test/LayoutOverlayDemo.tsx +1 -1
- package/LayoutParts/DesktopHeaderBadge.tsx +28 -0
- package/LayoutParts/DesktopNavActions.tsx +15 -0
- package/LayoutParts/DesktopNavBar.tsx +113 -0
- package/LayoutParts/DesktopNavBarItem.tsx +44 -0
- package/{AppShell → LayoutParts}/GlobalHead.tsx +1 -2
- package/LayoutParts/Logo.tsx +77 -0
- package/LayoutParts/MenuFab.tsx +131 -0
- package/LayoutParts/MenuFabItem.tsx +25 -0
- package/LayoutParts/MenuFabSecondaryItem.tsx +37 -0
- package/{AppShell/PlaceholderFab/index.tsx → LayoutParts/PlaceholderFab.tsx} +1 -1
- package/LayoutParts/StickyBelowHeader.tsx +25 -0
- package/LayoutParts/index.ts +12 -0
- package/{AppShell → LayoutParts}/useFabAnimation.ts +0 -0
- package/Page/CssAndFramerMotionProvider.tsx +21 -0
- package/Page/index.ts +2 -0
- package/Page/types.ts +2 -8
- package/PageLoadIndicator/index.tsx +25 -30
- package/PageMeta/index.tsx +1 -1
- package/Pagination/index.tsx +37 -54
- package/RenderType/index.tsx +1 -1
- package/Row/ButtonLinkList/ButtonLinkList.tsx +35 -37
- package/Row/ButtonLinkList/ButtonLinkListItem.tsx +16 -33
- package/Row/ColumnOne/index.tsx +5 -10
- package/Row/ColumnOneBoxed/index.tsx +18 -19
- package/Row/ColumnOneCentered/index.tsx +3 -4
- package/Row/ColumnThree/index.tsx +62 -57
- package/Row/ColumnTwo/index.tsx +37 -35
- package/Row/ColumnTwoSpread/index.tsx +28 -37
- package/Row/ColumnTwoWithTop/index.tsx +37 -43
- package/Row/ContentLinks/index.tsx +24 -25
- package/Row/HeroBanner/index.tsx +98 -82
- package/Row/IconBlocks/IconBlock/index.tsx +45 -37
- package/Row/IconBlocks/index.tsx +29 -44
- package/Row/ImageText/index.tsx +71 -67
- package/Row/ImageTextBoxed/index.tsx +66 -65
- package/Row/ParagraphWithSidebarSlide/index.tsx +80 -76
- package/Row/Quote/index.tsx +3 -3
- package/Row/SpecialBanner/index.tsx +97 -97
- package/Row/index.tsx +4 -9
- package/SectionContainer/index.tsx +32 -31
- package/SectionHeader/index.tsx +41 -43
- package/Separator/index.tsx +19 -18
- package/Snackbar/MessageSnackbar.tsx +1 -2
- package/Snackbar/MessageSnackbarImpl.tsx +68 -115
- package/StarRatingField/index.tsx +24 -25
- package/Stepper/Stepper.tsx +34 -32
- package/Styles/EmotionProvider.tsx +14 -0
- package/Styles/breakpointVal.tsx +16 -10
- package/Styles/extendableComponent.ts +70 -0
- package/Styles/index.tsx +9 -2
- package/Styles/withEmotionCache.tsx +36 -0
- package/Styles/withTheme.tsx +15 -24
- package/SvgIcon/SvgIcon.tsx +60 -0
- package/TextInputNumber/index.tsx +49 -50
- package/Theme/MuiButton.ts +128 -0
- package/Theme/MuiSlider.ts +28 -0
- package/Theme/MuiSnackbar.ts +31 -0
- package/Theme/{types.ts → createTheme.ts} +8 -2
- package/Theme/index.ts +4 -0
- package/Theme/themeDefaults.ts +51 -0
- package/TimeAgo/index.tsx +1 -1
- package/ToggleButton/index.tsx +43 -49
- package/ToggleButtonGroup/index.tsx +39 -39
- package/UspList/UspListItem.tsx +56 -46
- package/UspList/index.tsx +29 -26
- package/docs/building-components.mdx +3 -0
- package/docs/components/ComponentBasic.tsx +26 -0
- package/docs/components/ComponentChild.tsx +48 -0
- package/docs/components/ComponentChildVariant.tsx +54 -0
- package/docs/components/ComponentChildVariantExtendable.tsx +62 -0
- package/docs/components/ComponentStylable.tsx +32 -0
- package/docs/pages/building-components.tsx +62 -0
- package/index.ts +27 -81
- package/package.json +25 -27
- package/types.d.ts +1 -1
- package/AppShell/AppShellSticky/index.tsx +0 -38
- package/AppShell/DesktopNavActions.tsx +0 -32
- package/AppShell/DesktopNavBar.tsx +0 -158
- package/AppShell/Logo.tsx +0 -46
- package/AppShell/Menu.tsx +0 -7
- package/AppShell/MenuFab.tsx +0 -162
- package/AppShell/MenuFabSecondaryItem.tsx +0 -32
- package/AppShell/index.ts +0 -15
- package/AspectRatioContainer/index.tsx +0 -27
- package/Footer/SocialIcon.tsx +0 -23
- package/Form/index.tsx +0 -67
- package/FramerScroller/components/SidebarGallery.tsx +0 -317
- package/FramerScroller/components/SidebarSlider.tsx +0 -97
- package/Page/App.tsx +0 -17
- package/Page/Document.tsx +0 -24
- package/StyledBadge/index.tsx +0 -20
- package/Styles/classesPicker.ts +0 -41
- package/SvgImage/SvgImageSimple.tsx +0 -100
- package/SvgImage/index.tsx +0 -74
|
@@ -1,168 +1,13 @@
|
|
|
1
1
|
import { useGo, usePageContext, useScrollOffset } from '@graphcommerce/framer-next-pages'
|
|
2
2
|
import { Scroller, useScrollerContext, useScrollTo } from '@graphcommerce/framer-scroller'
|
|
3
3
|
import { useElementScroll, useIsomorphicLayoutEffect } from '@graphcommerce/framer-utils'
|
|
4
|
-
import {
|
|
4
|
+
import { Box, styled, SxProps, Theme } from '@mui/material'
|
|
5
5
|
import { m, useDomEvent, useMotionValue, usePresence, useTransform } from 'framer-motion'
|
|
6
6
|
import React, { useCallback, useEffect, useRef } from 'react'
|
|
7
7
|
import LayoutProvider from '../../Layout/components/LayoutProvider'
|
|
8
|
-
import {
|
|
9
|
-
import { classesPicker } from '../../Styles/classesPicker'
|
|
8
|
+
import { extendableComponent } from '../../Styles'
|
|
10
9
|
import { useOverlayPosition } from '../hooks/useOverlayPosition'
|
|
11
10
|
|
|
12
|
-
const useStyles = makeStyles(
|
|
13
|
-
(theme: Theme) => ({
|
|
14
|
-
'@global': {
|
|
15
|
-
body: {
|
|
16
|
-
overflow: 'hidden',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
root: {
|
|
20
|
-
display: 'grid',
|
|
21
|
-
cursor: 'default',
|
|
22
|
-
overflow: 'auto',
|
|
23
|
-
height: '100vh',
|
|
24
|
-
'@supports (-webkit-touch-callout: none)': {
|
|
25
|
-
height: '-webkit-fill-available',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
rootVariantSmLeft: {
|
|
29
|
-
[theme.breakpoints.down('sm')]: {
|
|
30
|
-
gridTemplate: `"overlay beforeOverlay"`,
|
|
31
|
-
borderTopRightRadius: theme.shape.borderRadius * 3,
|
|
32
|
-
borderBottomRightRadius: theme.shape.borderRadius * 3,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
rootVariantMdLeft: {
|
|
36
|
-
[theme.breakpoints.up('md')]: {
|
|
37
|
-
gridTemplate: `"overlay beforeOverlay"`,
|
|
38
|
-
borderTopRightRadius: theme.shape.borderRadius * 4,
|
|
39
|
-
borderBottomRightRadius: theme.shape.borderRadius * 4,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
rootVariantSmRight: {
|
|
43
|
-
[theme.breakpoints.down('sm')]: {
|
|
44
|
-
gridTemplate: `"beforeOverlay overlay"`,
|
|
45
|
-
borderTopLeftRadius: theme.shape.borderRadius * 3,
|
|
46
|
-
borderBottomLeftRadius: theme.shape.borderRadius * 3,
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
rootVariantMdRight: {
|
|
50
|
-
[theme.breakpoints.up('md')]: {
|
|
51
|
-
gridTemplate: `"beforeOverlay overlay"`,
|
|
52
|
-
borderTopLeftRadius: theme.shape.borderRadius * 4,
|
|
53
|
-
borderBottomLeftRadius: theme.shape.borderRadius * 4,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
rootVariantSmBottom: {
|
|
57
|
-
[theme.breakpoints.down('sm')]: {
|
|
58
|
-
borderTopLeftRadius: theme.shape.borderRadius * 3,
|
|
59
|
-
borderTopRightRadius: theme.shape.borderRadius * 3,
|
|
60
|
-
gridTemplate: `"beforeOverlay" "overlay"`,
|
|
61
|
-
height: '100vh',
|
|
62
|
-
'@supports (-webkit-touch-callout: none)': {
|
|
63
|
-
height: '-webkit-fill-available',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
rootVariantMdBottom: {
|
|
68
|
-
borderTopLeftRadius: theme.shape.borderRadius * 4,
|
|
69
|
-
borderTopRightRadius: theme.shape.borderRadius * 4,
|
|
70
|
-
[theme.breakpoints.up('md')]: {
|
|
71
|
-
gridTemplate: `"beforeOverlay" "overlay"`,
|
|
72
|
-
height: '100vh',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
// Overlay pane styles
|
|
77
|
-
overlayPane: {},
|
|
78
|
-
|
|
79
|
-
overlaySizeSmFloating: {
|
|
80
|
-
[theme.breakpoints.down('sm')]: {
|
|
81
|
-
padding: `${theme.page.vertical} ${theme.page.horizontal}`,
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
overlaySizeMdFloating: {
|
|
85
|
-
[theme.breakpoints.up('md')]: {
|
|
86
|
-
padding: `${theme.page.vertical} ${theme.page.horizontal}`,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
overlayPaneVariantSmBottom: {
|
|
90
|
-
[theme.breakpoints.down('sm')]: {
|
|
91
|
-
borderTopLeftRadius: theme.shape.borderRadius * 3,
|
|
92
|
-
borderTopRightRadius: theme.shape.borderRadius * 3,
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
overlayPaneVariantMdBottom: {
|
|
96
|
-
[theme.breakpoints.up('md')]: {
|
|
97
|
-
borderTopLeftRadius: theme.shape.borderRadius * 4,
|
|
98
|
-
borderTopRightRadius: theme.shape.borderRadius * 4,
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
overlayPaneSizeSmFloating: {
|
|
102
|
-
[theme.breakpoints.down('sm')]: {
|
|
103
|
-
borderRadius: theme.shape.borderRadius * 3,
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
overlayPaneSizeMdFloating: {
|
|
107
|
-
[theme.breakpoints.up('md')]: {
|
|
108
|
-
borderRadius: theme.shape.borderRadius * 4,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
overlayPaneSmVariantSizeLeftFull: {
|
|
112
|
-
[theme.breakpoints.down('sm')]: {
|
|
113
|
-
paddingBottom: 1,
|
|
114
|
-
minHeight: '100vh',
|
|
115
|
-
'@supports (-webkit-touch-callout: none)': {
|
|
116
|
-
minHeight: '-webkit-fill-available',
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
overlayPaneMdVariantSizeLeftFull: {
|
|
121
|
-
[theme.breakpoints.up('md')]: {
|
|
122
|
-
paddingBottom: 1,
|
|
123
|
-
minHeight: '100vh',
|
|
124
|
-
'@supports (-webkit-touch-callout: none)': {
|
|
125
|
-
minHeight: '-webkit-fill-available',
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
overlayPaneSmVariantSizeRightFull: {
|
|
130
|
-
[theme.breakpoints.down('sm')]: {
|
|
131
|
-
paddingBottom: 1,
|
|
132
|
-
minHeight: '100vh',
|
|
133
|
-
'@supports (-webkit-touch-callout: none)': {
|
|
134
|
-
minHeight: '-webkit-fill-available',
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
overlayPaneMdVariantSizeRightFull: {
|
|
139
|
-
[theme.breakpoints.up('md')]: {
|
|
140
|
-
paddingBottom: 1,
|
|
141
|
-
minHeight: '100vh',
|
|
142
|
-
scrollSnapAlign: 'end',
|
|
143
|
-
'@supports (-webkit-touch-callout: none)': {
|
|
144
|
-
minHeight: '-webkit-fill-available',
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
backdrop: {
|
|
149
|
-
zIndex: -1,
|
|
150
|
-
position: 'fixed',
|
|
151
|
-
display: 'flex',
|
|
152
|
-
alignItems: 'center',
|
|
153
|
-
justifyContent: 'center',
|
|
154
|
-
right: 0,
|
|
155
|
-
bottom: 0,
|
|
156
|
-
top: 0,
|
|
157
|
-
left: 0,
|
|
158
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
159
|
-
WebkitTapHighlightColor: 'transparent',
|
|
160
|
-
willChange: 'opacity',
|
|
161
|
-
},
|
|
162
|
-
}),
|
|
163
|
-
{ name: 'Overlay' },
|
|
164
|
-
)
|
|
165
|
-
|
|
166
11
|
export type LayoutOverlayVariant = 'left' | 'bottom' | 'right'
|
|
167
12
|
export type LayoutOverlaySize = 'floating' | 'minimal' | 'full'
|
|
168
13
|
export type LayoutOverlayAlign = 'start' | 'end' | 'center' | 'stretch'
|
|
@@ -179,8 +24,8 @@ type StyleProps = {
|
|
|
179
24
|
export type LayoutOverlayBaseProps = {
|
|
180
25
|
children?: React.ReactNode
|
|
181
26
|
className?: string
|
|
182
|
-
|
|
183
|
-
|
|
27
|
+
sx?: SxProps<Theme>
|
|
28
|
+
} & StyleProps
|
|
184
29
|
|
|
185
30
|
enum OverlayPosition {
|
|
186
31
|
UNOPENED = -1,
|
|
@@ -188,17 +33,23 @@ enum OverlayPosition {
|
|
|
188
33
|
CLOSED = 0,
|
|
189
34
|
}
|
|
190
35
|
|
|
36
|
+
const name = 'LayoutOverlayBase' as const
|
|
37
|
+
const parts = ['scroller', 'backdrop', 'overlay', 'overlayPane', 'beforeOverlay'] as const
|
|
38
|
+
const { withState } = extendableComponent<StyleProps, typeof name, typeof parts>(name, parts)
|
|
39
|
+
|
|
40
|
+
const MotionDiv = styled(m.div)({})
|
|
41
|
+
|
|
191
42
|
export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
|
|
192
43
|
const {
|
|
193
44
|
children,
|
|
194
45
|
variantSm,
|
|
195
46
|
variantMd,
|
|
196
|
-
classes: _classes,
|
|
197
47
|
className,
|
|
198
48
|
sizeSm = 'full',
|
|
199
49
|
sizeMd = 'full',
|
|
200
50
|
justifySm = 'stretch',
|
|
201
51
|
justifyMd = 'stretch',
|
|
52
|
+
sx = [],
|
|
202
53
|
} = props
|
|
203
54
|
|
|
204
55
|
const { scrollerRef, snap } = useScrollerContext()
|
|
@@ -212,14 +63,13 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
|
|
|
212
63
|
|
|
213
64
|
const position = useMotionValue<OverlayPosition>(OverlayPosition.UNOPENED)
|
|
214
65
|
|
|
215
|
-
const classes =
|
|
216
|
-
const clsName = classesPicker(classes, {
|
|
66
|
+
const classes = withState({
|
|
217
67
|
variantSm,
|
|
218
68
|
variantMd,
|
|
219
69
|
sizeSm,
|
|
220
70
|
sizeMd,
|
|
221
|
-
|
|
222
|
-
|
|
71
|
+
justifySm,
|
|
72
|
+
justifyMd,
|
|
223
73
|
})
|
|
224
74
|
|
|
225
75
|
const overlayRef = useRef<HTMLDivElement>(null)
|
|
@@ -317,89 +167,233 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
|
|
|
317
167
|
[closeOverlay, scrollerRef, snap],
|
|
318
168
|
)
|
|
319
169
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
170
|
+
return (
|
|
171
|
+
<>
|
|
172
|
+
<MotionDiv
|
|
173
|
+
className={classes.backdrop}
|
|
174
|
+
style={{ opacity: positions.open.visible }}
|
|
175
|
+
sx={[
|
|
176
|
+
{
|
|
177
|
+
zIndex: -1,
|
|
178
|
+
position: 'fixed',
|
|
179
|
+
display: 'flex',
|
|
180
|
+
alignItems: 'center',
|
|
181
|
+
justifyContent: 'center',
|
|
182
|
+
right: 0,
|
|
183
|
+
bottom: 0,
|
|
184
|
+
top: 0,
|
|
185
|
+
left: 0,
|
|
186
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
187
|
+
WebkitTapHighlightColor: 'transparent',
|
|
188
|
+
willChange: 'opacity',
|
|
189
|
+
},
|
|
190
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
191
|
+
]}
|
|
192
|
+
/>
|
|
193
|
+
<Scroller
|
|
194
|
+
className={`${classes.scroller} ${className ?? ''}`}
|
|
195
|
+
grid={false}
|
|
196
|
+
hideScrollbar
|
|
197
|
+
onClick={onClickAway}
|
|
198
|
+
sx={(theme) => ({
|
|
343
199
|
display: 'grid',
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
const OverlayPane = styled('div')(
|
|
351
|
-
({ theme }) => ({
|
|
352
|
-
pointerEvents: 'all',
|
|
353
|
-
backgroundColor: theme.palette.background.paper,
|
|
354
|
-
boxShadow: theme.shadows[24],
|
|
355
|
-
// scrollSnapAlign: 'end',
|
|
356
|
-
[theme.breakpoints.down('sm')]: {
|
|
357
|
-
minWidth: '80vw',
|
|
358
|
-
...((sizeSm === 'full' || sizeSm === 'minimal') && { paddingBottom: 56 }),
|
|
359
|
-
...(variantSm === 'bottom' && sizeSm === 'full' && { minHeight: 'calc(100vh - 56px)' }),
|
|
360
|
-
},
|
|
361
|
-
[theme.breakpoints.up('md')]: {
|
|
362
|
-
...(variantMd === 'bottom' && sizeMd === 'full' && { minHeight: '100vh' }),
|
|
363
|
-
...(sizeMd === 'full' && { minWidth: 'max(600px, 50vw)' }),
|
|
364
|
-
},
|
|
365
|
-
}),
|
|
366
|
-
{ name: 'OverlayPane' },
|
|
367
|
-
)
|
|
368
|
-
|
|
369
|
-
const BeforeOverlay = styled('div')(
|
|
370
|
-
({ theme }) => ({
|
|
371
|
-
gridArea: 'beforeOverlay',
|
|
372
|
-
scrollSnapAlign: 'start',
|
|
373
|
-
display: 'grid',
|
|
374
|
-
alignContent: 'end',
|
|
200
|
+
'&.canGrab': {
|
|
201
|
+
cursor: 'default',
|
|
202
|
+
},
|
|
203
|
+
'&.mdSnapDirInline': {
|
|
204
|
+
overflow: 'auto',
|
|
205
|
+
},
|
|
375
206
|
|
|
376
|
-
[theme.breakpoints.down('sm')]: {
|
|
377
|
-
...((variantSm === 'left' || variantSm === 'right') && { width: '100vw' }),
|
|
378
|
-
...(variantSm === 'bottom' && {
|
|
379
207
|
height: '100vh',
|
|
380
208
|
'@supports (-webkit-touch-callout: none)': {
|
|
381
209
|
height: '-webkit-fill-available',
|
|
382
210
|
},
|
|
383
|
-
}),
|
|
384
|
-
},
|
|
385
|
-
[theme.breakpoints.up('md')]: {
|
|
386
|
-
...((variantMd === 'left' || variantMd === 'right') && { width: '100vw' }),
|
|
387
|
-
...(variantSm === 'bottom' && { height: '100vh' }),
|
|
388
|
-
},
|
|
389
|
-
}),
|
|
390
|
-
{ name: 'BeforeOverlay' },
|
|
391
|
-
)
|
|
392
211
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
212
|
+
[theme.breakpoints.down('md')]: {
|
|
213
|
+
'&.variantSmLeft': {
|
|
214
|
+
gridTemplate: `"overlay beforeOverlay"`,
|
|
215
|
+
borderTopRightRadius: theme.shape.borderRadius * 3,
|
|
216
|
+
borderBottomRightRadius: theme.shape.borderRadius * 3,
|
|
217
|
+
},
|
|
218
|
+
'&.variantSmRight': {
|
|
219
|
+
gridTemplate: `"beforeOverlay overlay"`,
|
|
220
|
+
borderTopLeftRadius: theme.shape.borderRadius * 3,
|
|
221
|
+
borderBottomLeftRadius: theme.shape.borderRadius * 3,
|
|
222
|
+
},
|
|
223
|
+
'&.variantSmBottom': {
|
|
224
|
+
borderTopLeftRadius: theme.shape.borderRadius * 3,
|
|
225
|
+
borderTopRightRadius: theme.shape.borderRadius * 3,
|
|
226
|
+
gridTemplate: `"beforeOverlay" "overlay"`,
|
|
227
|
+
height: '100vh',
|
|
228
|
+
'@supports (-webkit-touch-callout: none)': {
|
|
229
|
+
height: '-webkit-fill-available',
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
[theme.breakpoints.up('md')]: {
|
|
234
|
+
'&.variantMdLeft': {
|
|
235
|
+
gridTemplate: `"overlay beforeOverlay"`,
|
|
236
|
+
borderTopRightRadius: theme.shape.borderRadius * 4,
|
|
237
|
+
borderBottomRightRadius: theme.shape.borderRadius * 4,
|
|
238
|
+
},
|
|
239
|
+
'&.variantMdRight': {
|
|
240
|
+
gridTemplate: `"beforeOverlay overlay"`,
|
|
241
|
+
borderTopLeftRadius: theme.shape.borderRadius * 4,
|
|
242
|
+
borderBottomLeftRadius: theme.shape.borderRadius * 4,
|
|
243
|
+
},
|
|
244
|
+
'&.variantMdBottom': {
|
|
245
|
+
borderTopLeftRadius: theme.shape.borderRadius * 4,
|
|
246
|
+
borderTopRightRadius: theme.shape.borderRadius * 4,
|
|
247
|
+
[theme.breakpoints.up('md')]: {
|
|
248
|
+
gridTemplate: `"beforeOverlay" "overlay"`,
|
|
249
|
+
height: '100vh',
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
})}
|
|
254
|
+
>
|
|
255
|
+
<Box
|
|
256
|
+
onClick={onClickAway}
|
|
257
|
+
className={classes.beforeOverlay}
|
|
258
|
+
ref={beforeRef}
|
|
259
|
+
sx={(theme) => ({
|
|
260
|
+
gridArea: 'beforeOverlay',
|
|
261
|
+
scrollSnapAlign: 'start',
|
|
262
|
+
display: 'grid',
|
|
263
|
+
alignContent: 'end',
|
|
264
|
+
|
|
265
|
+
[theme.breakpoints.down('md')]: {
|
|
266
|
+
'&.variantSmLeft, &.variantSmRight': {
|
|
267
|
+
width: '100vw',
|
|
268
|
+
},
|
|
269
|
+
'&.variantSmBottom': {
|
|
270
|
+
height: '100vh',
|
|
271
|
+
'@supports (-webkit-touch-callout: none)': {
|
|
272
|
+
height: '-webkit-fill-available',
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
[theme.breakpoints.up('md')]: {
|
|
277
|
+
'&.variantMdLeft, &.variantMdRight': {
|
|
278
|
+
width: '100vw',
|
|
279
|
+
},
|
|
280
|
+
'&.variantMdBottom': {
|
|
281
|
+
height: '100vh',
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
})}
|
|
285
|
+
/>
|
|
286
|
+
<Box
|
|
287
|
+
className={classes.overlay}
|
|
288
|
+
ref={overlayRef}
|
|
289
|
+
sx={(theme) => ({
|
|
290
|
+
display: 'grid',
|
|
291
|
+
pointerEvents: 'none',
|
|
292
|
+
gridArea: 'overlay',
|
|
293
|
+
scrollSnapAlign: 'start',
|
|
294
|
+
|
|
295
|
+
[theme.breakpoints.down('md')]: {
|
|
296
|
+
justifyContent: justifySm,
|
|
297
|
+
alignItems: justifySm,
|
|
298
|
+
|
|
299
|
+
'&.variantSmBottom': {
|
|
300
|
+
marginTop: `calc(${theme.appShell.headerHeightSm} * 0.5 * -1)`,
|
|
301
|
+
paddingTop: `calc(${theme.appShell.headerHeightSm} * 0.5)`,
|
|
302
|
+
},
|
|
303
|
+
|
|
304
|
+
'&.sizeSmFloating': {
|
|
305
|
+
padding: `${theme.page.vertical} ${theme.page.horizontal}`,
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
[theme.breakpoints.up('md')]: {
|
|
309
|
+
justifyContent: justifyMd,
|
|
310
|
+
alignItems: justifyMd,
|
|
311
|
+
|
|
312
|
+
'&.variantMdBottom': {
|
|
313
|
+
marginTop: `calc(${theme.appShell.headerHeightMd} + (${theme.appShell.appBarHeightMd} - ${theme.appShell.appBarInnerHeightMd}) * 0.5)`,
|
|
314
|
+
paddingTop: `calc(${theme.appShell.headerHeightMd} + (${theme.appShell.appBarHeightMd} - ${theme.appShell.appBarInnerHeightMd}) * -0.5)`,
|
|
315
|
+
display: 'grid',
|
|
316
|
+
},
|
|
317
|
+
'&.sizeMdFloating': {
|
|
318
|
+
padding: `${theme.page.vertical} ${theme.page.horizontal}`,
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
})}
|
|
322
|
+
>
|
|
323
|
+
<Box
|
|
324
|
+
className={classes.overlayPane}
|
|
325
|
+
sx={(theme) => ({
|
|
326
|
+
pointerEvents: 'all',
|
|
327
|
+
backgroundColor: theme.palette.background.paper,
|
|
328
|
+
boxShadow: theme.shadows[24],
|
|
329
|
+
// scrollSnapAlign: 'end',
|
|
330
|
+
[theme.breakpoints.down('md')]: {
|
|
331
|
+
minWidth: '80vw',
|
|
332
|
+
|
|
333
|
+
'&.sizeSmFull, &.sizeSmMinimal': { paddingBottom: 56 },
|
|
334
|
+
|
|
335
|
+
'&.variantSmBottom.sizeSmFull': { minHeight: 'calc(100vh - 56px)' },
|
|
336
|
+
|
|
337
|
+
'&.variantSmBottom': {
|
|
338
|
+
borderTopLeftRadius: `${theme.shape.borderRadius * 4}px`,
|
|
339
|
+
borderTopRightRadius: `${theme.shape.borderRadius * 3}px`,
|
|
340
|
+
},
|
|
341
|
+
'&.sizeSmFloating': {
|
|
342
|
+
borderRadius: `${theme.shape.borderRadius * 3}px`,
|
|
343
|
+
},
|
|
344
|
+
'&.variantSmLeft.sizeSmFull': {
|
|
345
|
+
paddingBottom: '1px',
|
|
346
|
+
minHeight: '100vh',
|
|
347
|
+
'@supports (-webkit-touch-callout: none)': {
|
|
348
|
+
minHeight: '-webkit-fill-available',
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
'&.variantSmRight.sizeSmFull': {
|
|
352
|
+
paddingBottom: '1px',
|
|
353
|
+
minHeight: '100vh',
|
|
354
|
+
scrollSnapAlign: 'end',
|
|
355
|
+
'@supports (-webkit-touch-callout: none)': {
|
|
356
|
+
minHeight: '-webkit-fill-available',
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
[theme.breakpoints.up('md')]: {
|
|
361
|
+
'&.sizeMdFull': {
|
|
362
|
+
minWidth: 'max(600px, 50vw)',
|
|
363
|
+
},
|
|
364
|
+
|
|
365
|
+
'&.sizeMdFull.variantMdBottom': {
|
|
366
|
+
minHeight: `calc(100vh - ${theme.appShell.headerHeightMd})`,
|
|
367
|
+
},
|
|
368
|
+
'&.sizeMdFull.variantMdLeft': {
|
|
369
|
+
paddingBottom: '1px',
|
|
370
|
+
minHeight: '100vh',
|
|
371
|
+
'@supports (-webkit-touch-callout: none)': {
|
|
372
|
+
minHeight: '-webkit-fill-available',
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
'&.sizeMdFull.variantMdRight': {
|
|
376
|
+
paddingBottom: '1px',
|
|
377
|
+
minHeight: '100vh',
|
|
378
|
+
scrollSnapAlign: 'end',
|
|
379
|
+
'@supports (-webkit-touch-callout: none)': {
|
|
380
|
+
minHeight: '-webkit-fill-available',
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
|
|
384
|
+
'&.variantMdBottom': {
|
|
385
|
+
borderTopLeftRadius: `${theme.shape.borderRadius * 4}px`,
|
|
386
|
+
borderTopRightRadius: `${theme.shape.borderRadius * 4}px`,
|
|
387
|
+
},
|
|
388
|
+
'&.sizeMdFloating': {
|
|
389
|
+
borderRadius: `${theme.shape.borderRadius * 4}px`,
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
})}
|
|
393
|
+
>
|
|
400
394
|
<LayoutProvider scroll={scrollWithoffset}>{children}</LayoutProvider>
|
|
401
|
-
</
|
|
402
|
-
</
|
|
395
|
+
</Box>
|
|
396
|
+
</Box>
|
|
403
397
|
</Scroller>
|
|
404
398
|
</>
|
|
405
399
|
)
|
|
@@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
|
|
|
3
3
|
import { useCallback } from 'react'
|
|
4
4
|
import { LayoutOverlay, LayoutOverlayProps } from '../components/LayoutOverlay'
|
|
5
5
|
|
|
6
|
-
export type LayoutOverlayState = Omit<LayoutOverlayProps, 'children' | '
|
|
6
|
+
export type LayoutOverlayState = Omit<LayoutOverlayProps, 'children' | 'sx'>
|
|
7
7
|
|
|
8
8
|
function useQueryState<T extends ParsedUrlQuery>(builder: (query: T) => T) {
|
|
9
9
|
const { query, replace } = useRouter()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Badge, BadgeProps } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
// todo: replace with theming
|
|
4
|
+
export function DesktopHeaderBadge(props: BadgeProps) {
|
|
5
|
+
const { sx = false } = props
|
|
6
|
+
return (
|
|
7
|
+
<Badge
|
|
8
|
+
{...props}
|
|
9
|
+
sx={[
|
|
10
|
+
{
|
|
11
|
+
'& .MuiBadge-colorError': {
|
|
12
|
+
bgcolor: 'text.disabled',
|
|
13
|
+
},
|
|
14
|
+
'& .MuiBadge-anchorOriginTopRightCircular': {
|
|
15
|
+
right: { xs: '3px', md: '8px' },
|
|
16
|
+
top: { xs: '3px', md: '8px' },
|
|
17
|
+
},
|
|
18
|
+
'& .MuiBadge-badge': {
|
|
19
|
+
typography: 'caption',
|
|
20
|
+
borderRadius: '100%',
|
|
21
|
+
padding: { xs: '3px', md: '6px' },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
25
|
+
]}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Box, styled } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
export const DesktopNavActions = styled(Box, { name: 'DesktopNavActions' })(({ theme }) => ({
|
|
4
|
+
display: 'none',
|
|
5
|
+
[theme.breakpoints.up('md')]: {
|
|
6
|
+
display: 'grid',
|
|
7
|
+
pointerEvents: 'none !important' as 'none',
|
|
8
|
+
'& > *': {
|
|
9
|
+
pointerEvents: 'all',
|
|
10
|
+
},
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
gridAutoFlow: 'column',
|
|
13
|
+
columnGap: 6,
|
|
14
|
+
},
|
|
15
|
+
}))
|