@graphcommerce/next-ui 6.0.0-canary.45 → 6.0.0-canary.47

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.
@@ -1,4 +1,13 @@
1
- import { alpha, Box, BoxProps, ButtonBase, ButtonProps, SxProps, Theme } from '@mui/material'
1
+ import {
2
+ alpha,
3
+ Box,
4
+ BoxProps,
5
+ ButtonBase,
6
+ ButtonProps,
7
+ lighten,
8
+ SxProps,
9
+ Theme,
10
+ } from '@mui/material'
2
11
  import React from 'react'
3
12
  import { extendableComponent, responsiveVal } from '../Styles'
4
13
  import { breakpointVal } from '../Styles/breakpointVal'
@@ -143,10 +152,10 @@ export function ActionCard(props: ActionCardProps) {
143
152
  borderBottom: `1px solid ${theme.palette.divider}`,
144
153
  },
145
154
  '&.selected': {
146
- backgroundColor: `${alpha(
147
- theme.palette[color].main,
148
- theme.palette.action.hoverOpacity,
149
- )}`,
155
+ backgroundColor:
156
+ theme.palette.mode === 'light'
157
+ ? alpha(theme.palette[color].main, theme.palette.action.hoverOpacity)
158
+ : lighten(theme.palette.background.default, theme.palette.action.hoverOpacity),
150
159
  },
151
160
  '&.error': {
152
161
  backgroundColor: `${alpha(
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.0.0-canary.47
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1832](https://github.com/graphcommerce-org/graphcommerce/pull/1832) [`26d4243d5`](https://github.com/graphcommerce-org/graphcommerce/commit/26d4243d5b63d604e5a36386d9b01914db5f2918) - - Introduce RowLink component with variants (inline, logoswiper etc.)
8
+ - Add new ImageLabelSwiper component to homepage
9
+ - Multiple darkmode fixes (layered navition, logo invert filter) ([@ErwinOtten](https://github.com/ErwinOtten))
10
+
11
+ ## 6.0.0-canary.46
12
+
3
13
  ## 6.0.0-canary.45
4
14
 
5
15
  ### Patch Changes
@@ -86,17 +86,26 @@ export function ChipOverlayOrPopper(props: ChipOverlayOrPopperProps) {
86
86
  },
87
87
  ...(selected
88
88
  ? {
89
- background: lighten(
90
- theme.palette.primary.main,
91
- 1 - theme.palette.action.hoverOpacity,
92
- ),
93
- border: `1px solid transparent`,
89
+ background:
90
+ theme.palette.mode === 'light'
91
+ ? lighten(theme.palette.primary.main, 1 - theme.palette.action.hoverOpacity)
92
+ : lighten(
93
+ theme.palette.background.default,
94
+ theme.palette.action.hoverOpacity,
95
+ ),
96
+ border: '1px solid transparent',
94
97
  '&.MuiChip-clickable:hover': {
95
- background: lighten(
96
- theme.palette.primary.main,
97
- 1 - theme.palette.action.hoverOpacity * 2,
98
- ),
99
- border: `1px solid transparent`,
98
+ background:
99
+ theme.palette.mode === 'light'
100
+ ? lighten(
101
+ theme.palette.primary.main,
102
+ 1 - theme.palette.action.hoverOpacity * 2,
103
+ )
104
+ : lighten(
105
+ theme.palette.background.default,
106
+ theme.palette.action.hoverOpacity * 2,
107
+ ),
108
+ border: '1px solid transparent',
100
109
  },
101
110
  }
102
111
  : {}),
@@ -1,68 +1,58 @@
1
- import { ContainerProps, useTheme, useMediaQuery, Box, styled } from '@mui/material'
1
+ import { clientSize } from '@graphcommerce/framer-utils'
2
+ import { ContainerProps, Box, styled, Theme, SxProps } from '@mui/material'
2
3
  import { m, useTransform } from 'framer-motion'
3
4
  import React from 'react'
4
5
  import { useScrollY } from '../../Layout/hooks/useScrollY'
5
- import { extendableComponent } from '../../Styles'
6
- import { breakpointVal } from '../../Styles/breakpointVal'
7
- import { responsiveVal } from '../../Styles/responsiveVal'
6
+ import { extendableComponent, responsiveVal } from '../../Styles'
8
7
  import { Row } from '../Row'
9
8
 
10
9
  export type HeroBannerProps = ContainerProps & {
11
10
  pageLinks: React.ReactNode
12
11
  videoSrc: string
13
12
  children: React.ReactNode
13
+ sx?: SxProps<Theme>
14
14
  }
15
15
 
16
16
  const compName = 'HeroBanner' as const
17
17
  const parts = ['root', 'wrapper', 'copy', 'asset', 'animated', 'video'] as const
18
18
  const { classes } = extendableComponent(compName, parts)
19
19
 
20
- const MotionDiv = styled(m.div)({})
20
+ const MotionVideo = styled(m.video)({})
21
21
 
22
22
  export function HeroBanner(props: HeroBannerProps) {
23
- const { pageLinks, videoSrc, children, ...containerProps } = props
24
- const t = useTheme()
23
+ const { pageLinks, videoSrc, children, sx = [], ...containerProps } = props
25
24
  const scrollY = useScrollY()
26
- const width = useTransform(
27
- scrollY,
28
- [10, 150],
29
- [`calc(100% - ${responsiveVal(20, 60)}))`, `calc(100% - ${responsiveVal(0, 0)})`],
30
- )
31
- const matches = useMediaQuery(t.breakpoints.down('md'))
32
- const borderRadius = useTransform(
33
- scrollY,
34
- [10, 150],
35
- [`${responsiveVal(8, 12)}`, `${responsiveVal(0, 0)}`],
25
+ const scale = useTransform([scrollY, clientSize.y], ([scrollYCurr, clientSizeYCurr]: number[]) =>
26
+ clientSizeYCurr ? (scrollYCurr / clientSizeYCurr) * 1.7 + 1 : 1,
36
27
  )
37
28
 
38
29
  return (
39
- <Row maxWidth={false} {...containerProps} disableGutters className={classes.root}>
40
- <Box className={classes.wrapper} sx={{ position: 'relative' }}>
30
+ <Row
31
+ maxWidth={false}
32
+ {...containerProps}
33
+ className={classes.root}
34
+ sx={[{}, ...(Array.isArray(sx) ? sx : [sx])]}
35
+ >
36
+ <Box
37
+ className={classes.wrapper}
38
+ sx={(theme) => ({
39
+ display: 'grid',
40
+ overflow: 'hidden',
41
+ borderRadius: responsiveVal(theme.shape.borderRadius * 2, theme.shape.borderRadius * 3),
42
+ isolation: 'isolate',
43
+ })}
44
+ >
41
45
  <Box
42
46
  className={classes.copy}
43
47
  sx={(theme) => ({
48
+ gridArea: '1 / 1',
44
49
  zIndex: 1,
45
- color: theme.palette.secondary.contrastText,
46
- position: 'relative',
47
50
  display: 'grid',
48
51
  justifyItems: 'center',
49
52
  alignContent: 'center',
50
- padding: `${theme.spacings.lg} ${theme.spacings.md}`,
51
- paddingTop: `calc(${theme.spacings.lg} - ${theme.spacings.md})`,
52
- minHeight: `calc(100vh - ${theme.appShell.headerHeightSm})`,
53
- '& > *': {
54
- zIndex: 1,
55
- maxWidth: 'max-content',
56
- },
57
- [theme.breakpoints.up('md')]: {
58
- width: '70%',
59
- minHeight: `calc(100vh - ${theme.appShell.headerHeightMd})`,
60
- },
61
- [theme.breakpoints.up('lg')]: {
62
- padding: `${theme.spacings.lg} ${theme.spacings.lg}`,
63
- paddingTop: `calc(${theme.spacings.lg} - ${theme.spacings.md})`,
64
- width: '50%',
65
- },
53
+ textAlign: 'center',
54
+ p: theme.spacings.md,
55
+ color: theme.palette.secondary.contrastText,
66
56
  })}
67
57
  >
68
58
  {children}
@@ -70,58 +60,28 @@ export function HeroBanner(props: HeroBannerProps) {
70
60
  </Box>
71
61
  <Box
72
62
  className={classes.asset}
73
- sx={(theme) => ({
74
- position: 'absolute',
75
- top: '0',
76
- zIndex: 0,
77
- width: '100%',
78
- height: '100%',
79
- display: 'grid',
80
- justifyItems: 'center',
81
- overflow: 'hidden',
82
- paddingBottom: theme.page.horizontal,
83
- '& video': {
63
+ sx={{
64
+ gridArea: '1 / 1',
65
+ position: 'relative',
66
+ }}
67
+ >
68
+ <MotionVideo
69
+ src={videoSrc}
70
+ autoPlay
71
+ muted
72
+ loop
73
+ playsInline
74
+ disableRemotePlayback
75
+ className={classes.video}
76
+ style={{ scale }}
77
+ sx={{
78
+ position: 'absolute',
79
+ transition: 'transform 0.5s cubic-bezier(0.33, 1, 0.68, 1)',
84
80
  objectFit: 'cover',
85
81
  width: '100%',
86
82
  height: '100%',
87
- [theme.breakpoints.down('md')]: {
88
- ...breakpointVal(
89
- 'borderRadius',
90
- theme.shape.borderRadius * 2,
91
- theme.shape.borderRadius * 3,
92
- theme.breakpoints.values,
93
- ),
94
- },
95
- },
96
- [theme.breakpoints.up('md')]: {
97
- height: '100%',
98
- },
99
- })}
100
- >
101
- <MotionDiv
102
- style={{ width: !matches ? width : 0, borderRadius }}
103
- className={classes.animated}
104
- sx={(theme) => ({
105
- ...breakpointVal(
106
- 'borderRadius',
107
- theme.shape.borderRadius * 2,
108
- theme.shape.borderRadius * 3,
109
- theme.breakpoints.values,
110
- ),
111
- overflow: 'hidden',
112
- transform: 'translateZ(0)',
113
- })}
114
- >
115
- <video
116
- src={videoSrc}
117
- autoPlay
118
- muted
119
- loop
120
- playsInline
121
- disableRemotePlayback
122
- className={classes.video}
123
- />
124
- </MotionDiv>
83
+ }}
84
+ />
125
85
  </Box>
126
86
  </Box>
127
87
  </Row>
@@ -0,0 +1,160 @@
1
+ import { Scroller, ScrollerButton, ScrollerProvider } from '@graphcommerce/framer-scroller'
2
+ import { Box, ContainerProps, SxProps, Theme, Typography } from '@mui/material'
3
+ import React from 'react'
4
+ import { IconSvg } from '../../IconSvg'
5
+ import { extendableComponent } from '../../Styles'
6
+ import { useFabSize } from '../../Theme'
7
+ import { iconChevronLeft, iconChevronRight } from '../../icons'
8
+ import { Row } from '../Row'
9
+
10
+ export type RowLinksProps = {
11
+ title: string
12
+ copy?: React.ReactNode
13
+ children: React.ReactNode
14
+ sx?: SxProps<Theme>
15
+ inlineTitle?: boolean
16
+ showButtons?: 'auto' | 'desktopAuto' | 'always' | 'desktopAlways'
17
+ } & Pick<ContainerProps, 'maxWidth'>
18
+
19
+ const compName = 'RowLinks' as const
20
+ const parts = [
21
+ 'root',
22
+ 'scroller',
23
+ 'title',
24
+ 'copy',
25
+ 'swipperButton',
26
+ 'centerRight',
27
+ 'centerLeft',
28
+ ] as const
29
+ const { classes } = extendableComponent(compName, parts)
30
+
31
+ export function RowLinks(props: RowLinksProps) {
32
+ const {
33
+ title,
34
+ copy,
35
+ children,
36
+ sx = [],
37
+ inlineTitle,
38
+ showButtons = 'desktopAuto',
39
+ maxWidth,
40
+ } = props
41
+
42
+ const mode = {
43
+ ...(showButtons === 'auto' && {
44
+ '&.MuiFab-root': {
45
+ display: 'inline-flex',
46
+ },
47
+ }),
48
+ ...(showButtons === 'always' && {
49
+ opacity: 1,
50
+ transform: 'scale(1)',
51
+ '&.MuiFab-root': {
52
+ display: 'inline-flex',
53
+ },
54
+ }),
55
+ ...(showButtons === 'desktopAlways' && {
56
+ opacity: { md: 1 },
57
+ transform: { md: 'scale(1)' },
58
+ '&.MuiFab-root': {
59
+ display: { md: 'inline-flex' },
60
+ },
61
+ }),
62
+ }
63
+
64
+ const fabSize = useFabSize('responsive')
65
+
66
+ return (
67
+ <Row
68
+ className={classes.root}
69
+ sx={[{ position: 'relative' }, ...(Array.isArray(sx) ? sx : [sx])]}
70
+ maxWidth={maxWidth}
71
+ >
72
+ {!inlineTitle && (
73
+ <Typography
74
+ variant='subtitle1'
75
+ component='h2'
76
+ className={classes.title}
77
+ sx={(theme) => ({ mb: theme.spacings.md })}
78
+ >
79
+ {title}
80
+ </Typography>
81
+ )}
82
+ {copy && (
83
+ <Box className={classes.copy} sx={(theme) => ({ my: theme.spacings.md })}>
84
+ {copy}
85
+ </Box>
86
+ )}
87
+ <ScrollerProvider scrollSnapAlign='end'>
88
+ <Scroller
89
+ className={classes.scroller}
90
+ hideScrollbar
91
+ sx={(theme) => ({
92
+ justifyContent: 'start',
93
+ gap: `${theme.spacings.md}`,
94
+ gridAutoColumns: `max-content`,
95
+ alignItems: 'center',
96
+ '&.smGridDirInline > *': {
97
+ scrollSnapAlign: {
98
+ xs: 'center',
99
+ md: 'end',
100
+ },
101
+ },
102
+ })}
103
+ >
104
+ {inlineTitle && (
105
+ <Typography variant='subtitle1' component='h2' className={classes.title}>
106
+ {title}
107
+ </Typography>
108
+ )}
109
+ {children}
110
+ </Scroller>
111
+ <Box
112
+ className={classes.centerLeft}
113
+ sx={(theme) => ({
114
+ display: 'grid',
115
+ gridAutoFlow: 'row',
116
+ gap: theme.spacings.xxs,
117
+ position: 'absolute',
118
+ left: theme.spacings.sm,
119
+ top: `calc(50% - calc(${fabSize} / 2))`,
120
+ })}
121
+ >
122
+ <ScrollerButton
123
+ direction='left'
124
+ className={classes.swipperButton}
125
+ sx={{
126
+ display: 'flex',
127
+ zIndex: 'inherit',
128
+ ...mode,
129
+ }}
130
+ size='responsive'
131
+ >
132
+ <IconSvg src={iconChevronLeft} />
133
+ </ScrollerButton>
134
+ </Box>
135
+ <Box
136
+ className={classes.centerRight}
137
+ sx={(theme) => ({
138
+ display: 'grid',
139
+ gap: theme.spacings.xxs,
140
+ position: 'absolute',
141
+ right: theme.spacings.sm,
142
+ top: `calc(50% - calc(${fabSize} / 2))`,
143
+ })}
144
+ >
145
+ <ScrollerButton
146
+ direction='right'
147
+ className={classes.swipperButton}
148
+ sx={{
149
+ display: 'flex',
150
+ ...mode,
151
+ }}
152
+ size='responsive'
153
+ >
154
+ <IconSvg src={iconChevronRight} />
155
+ </ScrollerButton>
156
+ </Box>
157
+ </ScrollerProvider>
158
+ </Row>
159
+ )
160
+ }
@@ -0,0 +1,25 @@
1
+ import { RowLinks, RowLinksProps } from '../RowLinks'
2
+
3
+ export function VariantImageLabelSwiper(props: RowLinksProps) {
4
+ const { title, copy, children, sx = [], maxWidth, showButtons } = props
5
+
6
+ return (
7
+ <RowLinks
8
+ maxWidth={maxWidth}
9
+ showButtons={showButtons}
10
+ title={title}
11
+ copy={copy}
12
+ sx={[
13
+ {
14
+ '& .RowLinks-title': {
15
+ typography: 'h5',
16
+ textTransform: 'uppercase',
17
+ },
18
+ },
19
+ ...(Array.isArray(sx) ? sx : [sx]),
20
+ ]}
21
+ >
22
+ {children}
23
+ </RowLinks>
24
+ )
25
+ }
@@ -0,0 +1,17 @@
1
+ import { RowLinks, RowLinksProps } from '../RowLinks'
2
+
3
+ export function VariantInline(props: RowLinksProps) {
4
+ const { title, children, sx = [], maxWidth, showButtons } = props
5
+
6
+ return (
7
+ <RowLinks
8
+ title={title}
9
+ showButtons={showButtons}
10
+ maxWidth={maxWidth}
11
+ inlineTitle
12
+ sx={[{}, ...(Array.isArray(sx) ? sx : [sx])]}
13
+ >
14
+ {children}
15
+ </RowLinks>
16
+ )
17
+ }
@@ -0,0 +1,29 @@
1
+ import { RowLinks, RowLinksProps } from '../RowLinks'
2
+
3
+ export function VariantLogoSwiper(props: RowLinksProps) {
4
+ const { title, children, sx = [], maxWidth, showButtons } = props
5
+
6
+ return (
7
+ <RowLinks
8
+ showButtons={showButtons}
9
+ maxWidth={maxWidth}
10
+ title={title}
11
+ sx={[
12
+ (theme) => ({
13
+ '& .RowLinks-title': {
14
+ display: 'none',
15
+ },
16
+ '& .Scroller-root': {
17
+ margin: '0 auto',
18
+ width: 'auto',
19
+ maxWidth: 'fit-content',
20
+ gap: theme.spacings.xxl,
21
+ },
22
+ }),
23
+ ...(Array.isArray(sx) ? sx : [sx]),
24
+ ]}
25
+ >
26
+ {children}
27
+ </RowLinks>
28
+ )
29
+ }
@@ -0,0 +1,30 @@
1
+ import { RowLinks, RowLinksProps } from '../RowLinks'
2
+
3
+ export function VariantUsps(props: RowLinksProps) {
4
+ const { title, children, sx = [], maxWidth, showButtons } = props
5
+
6
+ return (
7
+ <RowLinks
8
+ title={title}
9
+ showButtons={showButtons}
10
+ maxWidth={maxWidth}
11
+ inlineTitle
12
+ sx={[
13
+ (theme) => ({
14
+ '& .RowLinks-title': {
15
+ display: 'none',
16
+ },
17
+ '& .Scroller-root': {
18
+ margin: '0 auto',
19
+ width: 'auto',
20
+ maxWidth: 'fit-content',
21
+ gap: theme.spacings.lg,
22
+ },
23
+ }),
24
+ ...(Array.isArray(sx) ? sx : [sx]),
25
+ ]}
26
+ >
27
+ {children}
28
+ </RowLinks>
29
+ )
30
+ }
@@ -0,0 +1,4 @@
1
+ export * from './VariantLogoSwiper'
2
+ export * from './VariantImageLabelSwiper'
3
+ export * from './VariantInline'
4
+ export * from './VariantUsps'
package/Row/index.ts CHANGED
@@ -16,3 +16,5 @@ export * from './ImageTextBoxed/ImageTextBoxed'
16
16
  export * from './ParagraphWithSidebarSlide/ParagraphWithSidebarSlide'
17
17
  export * from './Quote/Quote'
18
18
  export * from './SpecialBanner/SpecialBanner'
19
+ export * from './RowLinks/RowLinks'
20
+ export * from './RowLinks/variant'
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": "6.0.0-canary.45",
5
+ "version": "6.0.0-canary.47",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "sideEffects": false,
@@ -18,18 +18,18 @@
18
18
  "@emotion/react": "^11.10.6",
19
19
  "@emotion/server": "^11.4.0",
20
20
  "@emotion/styled": "^11.10.6",
21
- "@graphcommerce/framer-next-pages": "6.0.0-canary.45",
22
- "@graphcommerce/framer-scroller": "6.0.0-canary.45",
23
- "@graphcommerce/framer-utils": "6.0.0-canary.45",
24
- "@graphcommerce/image": "6.0.0-canary.45",
21
+ "@graphcommerce/framer-next-pages": "6.0.0-canary.47",
22
+ "@graphcommerce/framer-scroller": "6.0.0-canary.47",
23
+ "@graphcommerce/framer-utils": "6.0.0-canary.47",
24
+ "@graphcommerce/image": "6.0.0-canary.47",
25
25
  "cookie": "^0.5.0",
26
26
  "react-is": "^18.2.0",
27
27
  "schema-dts": "^1.1.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@graphcommerce/eslint-config-pwa": "6.0.0-canary.45",
31
- "@graphcommerce/prettier-config-pwa": "6.0.0-canary.45",
32
- "@graphcommerce/typescript-config-pwa": "6.0.0-canary.45",
30
+ "@graphcommerce/eslint-config-pwa": "6.0.0-canary.47",
31
+ "@graphcommerce/prettier-config-pwa": "6.0.0-canary.47",
32
+ "@graphcommerce/typescript-config-pwa": "6.0.0-canary.47",
33
33
  "@types/cookie": "^0.5.1",
34
34
  "@types/react-is": "^17.0.3",
35
35
  "typescript": "4.9.5"