@graphcommerce/next-ui 3.22.1 → 3.24.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/AppShell/GlobalHead.tsx +3 -2
- package/CHANGELOG.md +51 -0
- package/Layout/components/LayoutHeader.tsx +1 -1
- package/Layout/components/LayoutHeaderClose.tsx +15 -1
- package/LayoutDefault/components/LayoutDefault.tsx +3 -2
- package/LayoutOverlay/components/LayoutOverlayBase.tsx +10 -8
- package/Styles/index.tsx +5 -0
- package/Styles/withTheme.tsx +51 -0
- package/index.ts +0 -3
- package/package.json +4 -4
package/AppShell/GlobalHead.tsx
CHANGED
|
@@ -26,9 +26,10 @@ export function GlobalHead(props: GlobalHeadProps) {
|
|
|
26
26
|
<meta name='apple-mobile-web-app-title' content={name} key='apple-mobile-web-app-title' />
|
|
27
27
|
<meta name='format-detection' content='telephone=no' key='format-detection' />
|
|
28
28
|
<meta name='mobile-web-app-capable' content='yes' key='mobile-web-app-capable' />
|
|
29
|
-
<link rel='
|
|
29
|
+
<link rel='icon' href='/manifest/favicon.ico' sizes='any' />
|
|
30
|
+
<link rel='icon' href='/manifest/favicon.svg' type='image/svg+xml' />
|
|
31
|
+
<link rel='apple-touch-icon' href='/manifest/favicon-512.png' />
|
|
30
32
|
<link rel='manifest' href='/manifest.webmanifest' key='manifest' />
|
|
31
|
-
<link rel='icon' href='/manifest/favicon.ico' key='icon' />
|
|
32
33
|
</Head>
|
|
33
34
|
)
|
|
34
35
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,57 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.24.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.23.1...@graphcommerce/next-ui@3.24.0) (2022-01-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* manifest and favicon ([a82202c](https://github.com/ho-nl/m2-pwa/commit/a82202c0e572f005cbcfca815936af9356eb2767))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.23.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.23.0...@graphcommerce/next-ui@3.23.1) (2022-01-04)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* close button on mobile ([a0c6c07](https://github.com/ho-nl/m2-pwa/commit/a0c6c075a1ee2541c864a561cd5318ed5fb5760c))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# [3.23.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.22.2...@graphcommerce/next-ui@3.23.0) (2022-01-04)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* backbutton wasn't translated ([5f841c0](https://github.com/ho-nl/m2-pwa/commit/5f841c052b454c0d565a68829f78492c5a3b6dab))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* introduced a withTheme hoc to allow theming per route ([55e3fc1](https://github.com/ho-nl/m2-pwa/commit/55e3fc178b385d0ccdc19a5c09a7887be5db14dc))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## [3.22.2](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.22.1...@graphcommerce/next-ui@3.22.2) (2022-01-04)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Bug Fixes
|
|
48
|
+
|
|
49
|
+
* broder radius of drawer was too small on desktop ([f8b3962](https://github.com/ho-nl/m2-pwa/commit/f8b3962825972e6bc232387e0a2e801289fcc492))
|
|
50
|
+
* close button of bottom sheet spacing ([be33c20](https://github.com/ho-nl/m2-pwa/commit/be33c20fc8f41ad85d90bff15842738bc370b81e))
|
|
51
|
+
* regression where primary action wasn't visible ([66f8ed2](https://github.com/ho-nl/m2-pwa/commit/66f8ed20ea0728881be81994d49bd6c399f2e914))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
6
57
|
## [3.22.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.22.0...@graphcommerce/next-ui@3.22.1) (2022-01-04)
|
|
7
58
|
|
|
8
59
|
|
|
@@ -3,15 +3,28 @@ import React from 'react'
|
|
|
3
3
|
import Button from '../../Button'
|
|
4
4
|
import SvgImageSimple from '../../SvgImage/SvgImageSimple'
|
|
5
5
|
import { iconClose } from '../../icons'
|
|
6
|
+
import { makeStyles, Theme } from '@material-ui/core'
|
|
7
|
+
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
8
|
+
import { Trans } from '@lingui/macro'
|
|
6
9
|
|
|
7
10
|
export function useShowClose() {
|
|
8
11
|
const { overlayGroup } = usePageContext()
|
|
9
12
|
return !!overlayGroup
|
|
10
13
|
}
|
|
11
14
|
|
|
15
|
+
const useStyles = makeStyles((theme: Theme) => ({
|
|
16
|
+
close: {
|
|
17
|
+
[theme.breakpoints.up('md')]: {
|
|
18
|
+
marginLeft: `calc(${responsiveVal(12, 22)} * -1)`,
|
|
19
|
+
marginRight: `calc(${responsiveVal(12, 22)} * -1)`,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}))
|
|
23
|
+
|
|
12
24
|
export default function LayoutHeaderClose() {
|
|
13
25
|
const { closeSteps } = usePageContext()
|
|
14
26
|
const onClick = useGo(closeSteps * -1)
|
|
27
|
+
const classes = useStyles()
|
|
15
28
|
|
|
16
29
|
return (
|
|
17
30
|
<Button
|
|
@@ -20,8 +33,9 @@ export default function LayoutHeaderClose() {
|
|
|
20
33
|
aria-label='Close'
|
|
21
34
|
variant='text'
|
|
22
35
|
startIcon={<SvgImageSimple src={iconClose} />}
|
|
36
|
+
className={classes.close}
|
|
23
37
|
>
|
|
24
|
-
Close
|
|
38
|
+
<Trans>Close</Trans>
|
|
25
39
|
</Button>
|
|
26
40
|
)
|
|
27
41
|
}
|
|
@@ -55,6 +55,7 @@ const useStyles = makeStyles(
|
|
|
55
55
|
)
|
|
56
56
|
|
|
57
57
|
export type LayoutDefaultProps = {
|
|
58
|
+
className?: string
|
|
58
59
|
header: React.ReactNode
|
|
59
60
|
footer: React.ReactNode
|
|
60
61
|
menuFab?: React.ReactNode
|
|
@@ -64,14 +65,14 @@ export type LayoutDefaultProps = {
|
|
|
64
65
|
} & UseStyles<typeof useStyles>
|
|
65
66
|
|
|
66
67
|
export function LayoutDefault(props: LayoutDefaultProps) {
|
|
67
|
-
const { children, header, footer, menuFab, cartFab, noSticky } = props
|
|
68
|
+
const { children, header, footer, menuFab, cartFab, noSticky, className } = props
|
|
68
69
|
const classes = useStyles(props)
|
|
69
70
|
|
|
70
71
|
const offset = useScrollOffset().y
|
|
71
72
|
const scrollWithOffset = useTransform(useViewportScroll().scrollY, (y) => y + offset)
|
|
72
73
|
|
|
73
74
|
return (
|
|
74
|
-
<div className={classes.root}>
|
|
75
|
+
<div className={clsx(classes.root, className)}>
|
|
75
76
|
<LayoutProvider scroll={scrollWithOffset}>
|
|
76
77
|
<header className={clsx(classes.header, !noSticky && classes.headerSticky)}>
|
|
77
78
|
{header}
|
|
@@ -94,8 +94,8 @@ const useStyles = makeStyles(
|
|
|
94
94
|
},
|
|
95
95
|
overlayPaneVariantMdBottom: {
|
|
96
96
|
[theme.breakpoints.up('md')]: {
|
|
97
|
-
borderTopLeftRadius: theme.shape.borderRadius *
|
|
98
|
-
borderTopRightRadius: theme.shape.borderRadius *
|
|
97
|
+
borderTopLeftRadius: theme.shape.borderRadius * 4,
|
|
98
|
+
borderTopRightRadius: theme.shape.borderRadius * 4,
|
|
99
99
|
},
|
|
100
100
|
},
|
|
101
101
|
overlayPaneSizeSmFloating: {
|
|
@@ -105,7 +105,7 @@ const useStyles = makeStyles(
|
|
|
105
105
|
},
|
|
106
106
|
overlayPaneSizeMdFloating: {
|
|
107
107
|
[theme.breakpoints.up('md')]: {
|
|
108
|
-
borderRadius: theme.shape.borderRadius *
|
|
108
|
+
borderRadius: theme.shape.borderRadius * 4,
|
|
109
109
|
},
|
|
110
110
|
},
|
|
111
111
|
overlayPaneSmVariantSizeLeftFull: {
|
|
@@ -178,6 +178,7 @@ type StyleProps = {
|
|
|
178
178
|
|
|
179
179
|
export type LayoutOverlayBaseProps = {
|
|
180
180
|
children?: React.ReactNode
|
|
181
|
+
className?: string
|
|
181
182
|
} & StyleProps &
|
|
182
183
|
UseStyles<typeof useStyles>
|
|
183
184
|
|
|
@@ -193,6 +194,7 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
|
|
|
193
194
|
variantSm,
|
|
194
195
|
variantMd,
|
|
195
196
|
classes: _classes,
|
|
197
|
+
className,
|
|
196
198
|
sizeSm = 'full',
|
|
197
199
|
sizeMd = 'full',
|
|
198
200
|
justifySm = 'stretch',
|
|
@@ -211,7 +213,7 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
|
|
|
211
213
|
const position = useMotionValue<OverlayPosition>(OverlayPosition.UNOPENED)
|
|
212
214
|
|
|
213
215
|
const classes = useStyles({ classes: _classes, sizeSm, sizeMd, justifySm, justifyMd })
|
|
214
|
-
const
|
|
216
|
+
const clsName = classesPicker(classes, {
|
|
215
217
|
variantSm,
|
|
216
218
|
variantMd,
|
|
217
219
|
sizeSm,
|
|
@@ -390,11 +392,11 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
|
|
|
390
392
|
|
|
391
393
|
return (
|
|
392
394
|
<>
|
|
393
|
-
<m.div {...
|
|
394
|
-
<Scroller {...
|
|
395
|
+
<m.div {...clsName('backdrop')} style={{ opacity: positions.open.visible }} />
|
|
396
|
+
<Scroller {...clsName('root')} grid={false} hideScrollbar onClick={onClickAway}>
|
|
395
397
|
<BeforeOverlay onClick={onClickAway} ref={beforeRef} />
|
|
396
|
-
<Overlay {...
|
|
397
|
-
<OverlayPane {...
|
|
398
|
+
<Overlay {...clsName('overlay')} ref={overlayRef}>
|
|
399
|
+
<OverlayPane {...clsName('overlayPane', className)}>
|
|
398
400
|
<LayoutProvider scroll={scrollWithoffset}>{children}</LayoutProvider>
|
|
399
401
|
</OverlayPane>
|
|
400
402
|
</Overlay>
|
package/Styles/index.tsx
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { makeStyles, Theme, ThemeProvider } from '@material-ui/core'
|
|
2
|
+
|
|
3
|
+
const useStyles = makeStyles(
|
|
4
|
+
{
|
|
5
|
+
// These theme specific styles are copied from
|
|
6
|
+
// https://github.com/mui-org/material-ui/blob/master/packages/mui-material/src/CssBaseline/CssBaseline.js#L18-L24
|
|
7
|
+
root: (theme: Theme) => ({
|
|
8
|
+
color: theme.palette.text.primary,
|
|
9
|
+
...theme.typography.body1,
|
|
10
|
+
backgroundColor: theme.palette.background.default,
|
|
11
|
+
}),
|
|
12
|
+
},
|
|
13
|
+
{ name: 'Theme' },
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* It will provide a theme for the underlying tree and will set the color/font and backgroundColor
|
|
18
|
+
* for the child.
|
|
19
|
+
*
|
|
20
|
+
* To use it, wrap your component with it.
|
|
21
|
+
*
|
|
22
|
+
* Example:
|
|
23
|
+
*
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const MyPage = () => {
|
|
26
|
+
* return <div>Your regular page content</div>
|
|
27
|
+
* }
|
|
28
|
+
* export default MyPage
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* Becomes:
|
|
32
|
+
*
|
|
33
|
+
* ```tsx
|
|
34
|
+
* const MyPage = () => {
|
|
35
|
+
* return <div>Your regular page content, but now in darkMode</div>
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* export default withTheme(MyPage, darkTheme)
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function withTheme<P extends { className?: string }>(Component: React.FC<P>, theme: Theme) {
|
|
42
|
+
return (props: P) => {
|
|
43
|
+
const classes = useStyles(theme)
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<ThemeProvider theme={theme}>
|
|
47
|
+
<Component {...props} className={classes.root} />
|
|
48
|
+
</ThemeProvider>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
}
|
package/index.ts
CHANGED
|
@@ -106,9 +106,6 @@ export * from './Stepper/Stepper'
|
|
|
106
106
|
export { default as Stepper } from './Stepper/Stepper'
|
|
107
107
|
export { default as StyledBadge } from './StyledBadge'
|
|
108
108
|
export * from './Styles'
|
|
109
|
-
export * from './Styles/breakpointVal'
|
|
110
|
-
export * from './Styles/responsiveVal'
|
|
111
|
-
export * from './Styles/classesPicker'
|
|
112
109
|
export * from './SvgImage'
|
|
113
110
|
export { default as SvgImage } from './SvgImage'
|
|
114
111
|
export { default as SvgImageSimple } from './SvgImage/SvgImageSimple'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphcommerce/next-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.24.0",
|
|
4
4
|
"author": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@apollo/client": "^3.5.6",
|
|
13
|
-
"@graphcommerce/framer-next-pages": "^2.109.
|
|
14
|
-
"@graphcommerce/framer-scroller": "^1.2.
|
|
13
|
+
"@graphcommerce/framer-next-pages": "^2.109.2",
|
|
14
|
+
"@graphcommerce/framer-scroller": "^1.2.5",
|
|
15
15
|
"@graphcommerce/framer-utils": "^2.103.21",
|
|
16
16
|
"@graphcommerce/graphql": "^2.105.13",
|
|
17
17
|
"@graphcommerce/image": "^2.105.13",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"project": "./tsconfig.json"
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "276899f8e64eef100101ad3069eb77315b2108fb"
|
|
55
55
|
}
|