@graphcommerce/next-ui 3.25.3 → 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 +490 -651
- 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 -32
- 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,78 +1,8 @@
|
|
|
1
1
|
import { useScrollOffset } from '@graphcommerce/framer-next-pages'
|
|
2
|
-
import {
|
|
3
|
-
import clsx from 'clsx'
|
|
2
|
+
import { Box, SxProps, Theme } from '@mui/material'
|
|
4
3
|
import { useTransform, useViewportScroll } from 'framer-motion'
|
|
5
|
-
import React from 'react'
|
|
6
4
|
import LayoutProvider from '../../Layout/components/LayoutProvider'
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const useStyles = makeStyles(
|
|
10
|
-
(theme: Theme) => ({
|
|
11
|
-
root: {
|
|
12
|
-
minHeight: '100vh',
|
|
13
|
-
'@supports (-webkit-touch-callout: none)': {
|
|
14
|
-
minHeight: '-webkit-fill-available',
|
|
15
|
-
},
|
|
16
|
-
display: 'grid',
|
|
17
|
-
gridTemplateRows: `auto 1fr auto`,
|
|
18
|
-
gridTemplateColumns: '100%',
|
|
19
|
-
background: theme.palette.background.default,
|
|
20
|
-
},
|
|
21
|
-
hideFabsOnVirtualKeyboardOpen: {
|
|
22
|
-
display: 'flex',
|
|
23
|
-
justifyContent: 'space-between',
|
|
24
|
-
width: '100%',
|
|
25
|
-
height: 0,
|
|
26
|
-
zIndex: 2,
|
|
27
|
-
[theme.breakpoints.up('sm')]: {
|
|
28
|
-
padding: `0 ${theme.page.horizontal}`,
|
|
29
|
-
position: 'sticky',
|
|
30
|
-
marginTop: `calc(${theme.appShell.headerHeightMd} * -1 + calc(${responsiveVal(
|
|
31
|
-
42,
|
|
32
|
-
56,
|
|
33
|
-
)} / 2))`,
|
|
34
|
-
top: `calc(${theme.appShell.headerHeightMd} / 2 - 28px)`,
|
|
35
|
-
},
|
|
36
|
-
[theme.breakpoints.down('sm')]: {
|
|
37
|
-
position: 'fixed',
|
|
38
|
-
top: 'unset',
|
|
39
|
-
bottom: `calc(20px + ${responsiveVal(42, 56)})`,
|
|
40
|
-
padding: `0 20px`,
|
|
41
|
-
'@media (max-height: 530px)': {
|
|
42
|
-
display: 'none',
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
header: {
|
|
48
|
-
zIndex: theme.zIndex.appBar - 1,
|
|
49
|
-
display: 'flex',
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
justifyContent: 'center',
|
|
52
|
-
height: theme.appShell.headerHeightSm,
|
|
53
|
-
pointerEvents: 'none',
|
|
54
|
-
'& > *': {
|
|
55
|
-
pointerEvents: 'all',
|
|
56
|
-
},
|
|
57
|
-
[theme.breakpoints.up('md')]: {
|
|
58
|
-
height: theme.appShell.headerHeightMd,
|
|
59
|
-
padding: `0 ${theme.page.horizontal} 0`,
|
|
60
|
-
top: 0,
|
|
61
|
-
display: 'flex',
|
|
62
|
-
justifyContent: 'left',
|
|
63
|
-
width: '100%',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
headerSticky: {
|
|
68
|
-
[theme.breakpoints.down('sm')]: {
|
|
69
|
-
position: 'sticky',
|
|
70
|
-
top: 0,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
}),
|
|
74
|
-
{ name: 'LayoutDefault' },
|
|
75
|
-
)
|
|
5
|
+
import { extendableComponent, responsiveVal } from '../../Styles'
|
|
76
6
|
|
|
77
7
|
export type LayoutDefaultProps = {
|
|
78
8
|
className?: string
|
|
@@ -83,29 +13,110 @@ export type LayoutDefaultProps = {
|
|
|
83
13
|
cartFab?: React.ReactNode
|
|
84
14
|
children?: React.ReactNode
|
|
85
15
|
noSticky?: boolean
|
|
86
|
-
|
|
16
|
+
sx?: SxProps<Theme>
|
|
17
|
+
} & OwnerState
|
|
18
|
+
|
|
19
|
+
type OwnerState = {
|
|
20
|
+
noSticky?: boolean
|
|
21
|
+
}
|
|
22
|
+
const parts = ['root', 'fabs', 'header', 'children', 'footer'] as const
|
|
23
|
+
const { withState } = extendableComponent<OwnerState, 'LayoutDefault', typeof parts>(
|
|
24
|
+
'LayoutDefault',
|
|
25
|
+
parts,
|
|
26
|
+
)
|
|
87
27
|
|
|
88
28
|
export function LayoutDefault(props: LayoutDefaultProps) {
|
|
89
|
-
const { children, header, beforeHeader, footer, menuFab, cartFab, noSticky,
|
|
90
|
-
const classes = useStyles(props)
|
|
29
|
+
const { children, header, beforeHeader, footer, menuFab, cartFab, noSticky, sx = [] } = props
|
|
91
30
|
|
|
92
31
|
const offset = useScrollOffset().y
|
|
93
32
|
const scrollWithOffset = useTransform(useViewportScroll().scrollY, (y) => y + offset)
|
|
94
33
|
|
|
34
|
+
const classes = withState({ noSticky })
|
|
35
|
+
const fabIconSize = responsiveVal(42, 56) // @todo generalize this
|
|
36
|
+
|
|
95
37
|
return (
|
|
96
|
-
<
|
|
38
|
+
<Box
|
|
39
|
+
className={classes.root}
|
|
40
|
+
sx={[
|
|
41
|
+
(theme) => ({
|
|
42
|
+
minHeight: '100vh',
|
|
43
|
+
'@supports (-webkit-touch-callout: none)': {
|
|
44
|
+
minHeight: '-webkit-fill-available',
|
|
45
|
+
},
|
|
46
|
+
display: 'grid',
|
|
47
|
+
gridTemplateRows: `auto auto 1fr auto`,
|
|
48
|
+
gridTemplateColumns: '100%',
|
|
49
|
+
background: theme.palette.background.default,
|
|
50
|
+
}),
|
|
51
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
52
|
+
]}
|
|
53
|
+
>
|
|
97
54
|
<LayoutProvider scroll={scrollWithOffset}>
|
|
98
55
|
{beforeHeader}
|
|
99
|
-
<
|
|
56
|
+
<Box
|
|
57
|
+
component='header'
|
|
58
|
+
className={classes.header}
|
|
59
|
+
sx={(theme) => ({
|
|
60
|
+
zIndex: theme.zIndex.appBar - 1,
|
|
61
|
+
display: 'flex',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
height: theme.appShell.headerHeightSm,
|
|
65
|
+
pointerEvents: 'none',
|
|
66
|
+
'& > *': {
|
|
67
|
+
pointerEvents: 'all',
|
|
68
|
+
},
|
|
69
|
+
[theme.breakpoints.up('md')]: {
|
|
70
|
+
height: theme.appShell.headerHeightMd,
|
|
71
|
+
padding: `0 ${theme.page.horizontal} 0`,
|
|
72
|
+
top: 0,
|
|
73
|
+
display: 'flex',
|
|
74
|
+
justifyContent: 'left',
|
|
75
|
+
width: '100%',
|
|
76
|
+
},
|
|
77
|
+
'&.sticky': {
|
|
78
|
+
[theme.breakpoints.down('md')]: {
|
|
79
|
+
position: 'sticky',
|
|
80
|
+
top: 0,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
})}
|
|
84
|
+
>
|
|
100
85
|
{header}
|
|
101
|
-
</
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
86
|
+
</Box>
|
|
87
|
+
{(menuFab || cartFab) && (
|
|
88
|
+
<Box
|
|
89
|
+
className={classes.fabs}
|
|
90
|
+
sx={(theme) => ({
|
|
91
|
+
display: 'flex',
|
|
92
|
+
justifyContent: 'space-between',
|
|
93
|
+
width: '100%',
|
|
94
|
+
height: 0,
|
|
95
|
+
zIndex: 2,
|
|
96
|
+
[theme.breakpoints.up('sm')]: {
|
|
97
|
+
padding: `0 ${theme.page.horizontal}`,
|
|
98
|
+
position: 'sticky',
|
|
99
|
+
marginTop: `calc(${theme.appShell.headerHeightMd} * -1 + calc(${fabIconSize} / 2))`,
|
|
100
|
+
top: `calc(${theme.appShell.headerHeightMd} / 2 - 28px)`,
|
|
101
|
+
},
|
|
102
|
+
[theme.breakpoints.down('md')]: {
|
|
103
|
+
position: 'fixed',
|
|
104
|
+
top: 'unset',
|
|
105
|
+
bottom: `calc(20px + ${fabIconSize})`,
|
|
106
|
+
padding: `0 20px`,
|
|
107
|
+
'@media (max-height: 530px)': {
|
|
108
|
+
display: 'none',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
})}
|
|
112
|
+
>
|
|
113
|
+
{menuFab}
|
|
114
|
+
{cartFab}
|
|
115
|
+
</Box>
|
|
116
|
+
)}
|
|
117
|
+
<div className={classes.children}>{children}</div>
|
|
118
|
+
<div className={classes.footer}>{footer}</div>
|
|
108
119
|
</LayoutProvider>
|
|
109
|
-
</
|
|
120
|
+
</Box>
|
|
110
121
|
)
|
|
111
122
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ScrollerProvider, ScrollSnapType } from '@graphcommerce/framer-scroller'
|
|
2
|
-
import React from 'react'
|
|
3
2
|
import { SetOptional } from 'type-fest'
|
|
4
3
|
import { LayoutOverlayBase, LayoutOverlayBaseProps } from './LayoutOverlayBase'
|
|
5
4
|
|
|
@@ -8,7 +7,7 @@ export type { LayoutOverlayVariant } from './LayoutOverlayBase'
|
|
|
8
7
|
export type LayoutOverlayProps = SetOptional<LayoutOverlayBaseProps, 'variantSm' | 'variantMd'>
|
|
9
8
|
|
|
10
9
|
export function LayoutOverlay(props: LayoutOverlayProps) {
|
|
11
|
-
const { children, variantSm = 'bottom', variantMd = 'right',
|
|
10
|
+
const { children, variantSm = 'bottom', variantMd = 'right', ...otherProps } = props
|
|
12
11
|
|
|
13
12
|
const scrollSnapTypeSm: ScrollSnapType =
|
|
14
13
|
variantSm === 'left' || variantSm === 'right' ? 'inline mandatory' : 'block proximity'
|
|
@@ -17,12 +16,7 @@ export function LayoutOverlay(props: LayoutOverlayProps) {
|
|
|
17
16
|
|
|
18
17
|
return (
|
|
19
18
|
<ScrollerProvider scrollSnapTypeSm={scrollSnapTypeSm} scrollSnapTypeMd={scrollSnapTypeMd}>
|
|
20
|
-
<LayoutOverlayBase
|
|
21
|
-
variantMd={variantMd}
|
|
22
|
-
variantSm={variantSm}
|
|
23
|
-
classes={classes}
|
|
24
|
-
{...otherProps}
|
|
25
|
-
>
|
|
19
|
+
<LayoutOverlayBase variantMd={variantMd} variantSm={variantSm} {...otherProps}>
|
|
26
20
|
{children}
|
|
27
21
|
</LayoutOverlayBase>
|
|
28
22
|
</ScrollerProvider>
|