@graphcommerce/next-ui 4.1.0 → 4.1.1
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/CHANGELOG.md +46 -0
- package/Form/Form.tsx +3 -1
- package/LayoutDefault/components/LayoutDefault.tsx +4 -1
- package/Page/types.ts +2 -1
- package/index.ts +0 -1
- package/package.json +21 -27
- package/ApolloError/ApolloErrorAlert.tsx +0 -58
- package/ApolloError/ApolloErrorFullPage.tsx +0 -31
- package/ApolloError/ApolloErrorSnackbar.tsx +0 -35
- package/ApolloError/index.ts +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1274](https://github.com/ho-nl/m2-pwa/pull/1274)
|
|
8
|
+
[`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7)
|
|
9
|
+
Thanks [@paales](https://github.com/paales)! - Moved `ApolloErrorAlert`, `ApolloErrorFullPage` and
|
|
10
|
+
`ApolloErrorSnackbar` to the ecommerce-ui package.
|
|
11
|
+
|
|
12
|
+
Created `ComposedSubmitButton` and `ComposedSubmitLinkOrButton` to reduce complexity from
|
|
13
|
+
`magento-graphcms` example.
|
|
14
|
+
|
|
15
|
+
Removed dependency an `@graphcommerce/react-hook-form` from `magento-graphcms` example.
|
|
16
|
+
|
|
17
|
+
Added dependency `@graphcommerce/ecommerce-ui` from `magento-graphcms` example.
|
|
18
|
+
|
|
19
|
+
* [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
|
|
20
|
+
[`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2)
|
|
21
|
+
Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from
|
|
22
|
+
`dependencies` to `peerDependencies`. The result of this is that there will be significantly less
|
|
23
|
+
duplicate packages in the node_modules folders.
|
|
24
|
+
|
|
25
|
+
- [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
|
|
26
|
+
[`e7c8e2756`](https://github.com/ho-nl/m2-pwa/commit/e7c8e2756d637cbcd2e793d62ef5721d35d9fa7b)
|
|
27
|
+
Thanks [@paales](https://github.com/paales)! - CartFab positioning was incorrect
|
|
28
|
+
|
|
29
|
+
* [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
|
|
30
|
+
[`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d)
|
|
31
|
+
Thanks [@paales](https://github.com/paales)! - Upgraded to
|
|
32
|
+
[NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be
|
|
33
|
+
implementing
|
|
34
|
+
[On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta)
|
|
35
|
+
soon.
|
|
36
|
+
|
|
37
|
+
This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the
|
|
38
|
+
frontend to be able to revalidate pages manually.
|
|
39
|
+
|
|
40
|
+
* Updated dependencies
|
|
41
|
+
[[`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7),
|
|
42
|
+
[`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2),
|
|
43
|
+
[`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d)]:
|
|
44
|
+
- @graphcommerce/framer-next-pages@3.0.2
|
|
45
|
+
- @graphcommerce/framer-scroller@2.0.2
|
|
46
|
+
- @graphcommerce/framer-utils@3.0.2
|
|
47
|
+
- @graphcommerce/image@3.0.2
|
|
48
|
+
|
|
3
49
|
## 4.1.0
|
|
4
50
|
|
|
5
51
|
### Minor Changes
|
package/Form/Form.tsx
CHANGED
|
@@ -30,6 +30,8 @@ const styles = ({ theme, contained = false, background }: { theme: Theme } & For
|
|
|
30
30
|
},
|
|
31
31
|
])
|
|
32
32
|
|
|
33
|
-
export const Form = styled('form'
|
|
33
|
+
export const Form = styled('form', {
|
|
34
|
+
shouldForwardProp: (prop) => prop !== 'contained',
|
|
35
|
+
})<FormStyleProps>(styles)
|
|
34
36
|
|
|
35
37
|
export const FormDiv = styled('div')<FormStyleProps>(styles)
|
|
@@ -97,7 +97,10 @@ export function LayoutDefault(props: LayoutDefaultProps) {
|
|
|
97
97
|
padding: `0 ${theme.page.horizontal}`,
|
|
98
98
|
position: 'sticky',
|
|
99
99
|
marginTop: `calc(${theme.appShell.headerHeightMd} * -1 + calc(${fabIconSize} / 2))`,
|
|
100
|
-
top: `calc(${theme.appShell.headerHeightMd} / 2 -
|
|
100
|
+
top: `calc(${theme.appShell.headerHeightMd} / 2 - ${responsiveVal(
|
|
101
|
+
42 / 2,
|
|
102
|
+
56 / 2,
|
|
103
|
+
)})`,
|
|
101
104
|
},
|
|
102
105
|
[theme.breakpoints.down('md')]: {
|
|
103
106
|
position: 'fixed',
|
package/Page/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ParsedUrlQuery } from 'querystring'
|
|
2
|
-
import { NormalizedCacheObject } from '@graphcommerce/graphql'
|
|
3
2
|
import { UpPage } from '@graphcommerce/framer-next-pages/types'
|
|
3
|
+
// todo: remove references to GraphQL
|
|
4
|
+
import { NormalizedCacheObject } from '@graphcommerce/graphql'
|
|
4
5
|
import { GetStaticProps as GetStaticPropsNext } from 'next'
|
|
5
6
|
|
|
6
7
|
type AnyObj = Record<string, unknown>
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
"name": "@graphcommerce/next-ui",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "4.1.
|
|
5
|
+
"version": "4.1.1",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
10
|
+
"eslintConfig": {
|
|
11
|
+
"extends": "@graphcommerce/eslint-config-pwa",
|
|
12
|
+
"parserOptions": {
|
|
13
|
+
"project": "./tsconfig.json"
|
|
14
|
+
}
|
|
12
15
|
},
|
|
13
16
|
"dependencies": {
|
|
14
17
|
"@emotion/babel-preset-css-prop": "^11.2.0",
|
|
@@ -16,40 +19,31 @@
|
|
|
16
19
|
"@emotion/react": "^11.7.1",
|
|
17
20
|
"@emotion/server": "^11.4.0",
|
|
18
21
|
"@emotion/styled": "^11.6.0",
|
|
19
|
-
"@graphcommerce/framer-next-pages": "^3.0.
|
|
20
|
-
"@graphcommerce/framer-scroller": "^2.0.
|
|
21
|
-
"@graphcommerce/framer-utils": "^3.0.
|
|
22
|
-
"@graphcommerce/
|
|
23
|
-
"
|
|
22
|
+
"@graphcommerce/framer-next-pages": "^3.0.2",
|
|
23
|
+
"@graphcommerce/framer-scroller": "^2.0.2",
|
|
24
|
+
"@graphcommerce/framer-utils": "^3.0.2",
|
|
25
|
+
"@graphcommerce/image": "^3.0.2",
|
|
26
|
+
"react-is": "^17.0.2",
|
|
27
|
+
"react-schemaorg": "^2.0.0",
|
|
28
|
+
"schema-dts": "^1.0.0",
|
|
29
|
+
"type-fest": "^2.11.2"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
24
32
|
"@lingui/macro": "^3.13.2",
|
|
25
33
|
"@mui/base": "^5.0.0-alpha.68",
|
|
26
34
|
"@mui/lab": "^5.0.0-alpha.68",
|
|
27
35
|
"@mui/material": "^5.4.1",
|
|
28
36
|
"framer-motion": "^6.2.4",
|
|
29
|
-
"graphql": "^16.3.0",
|
|
30
37
|
"next": "^12.0.10",
|
|
31
38
|
"react": "^17.0.2",
|
|
32
|
-
"react-dom": "^17.0.2"
|
|
33
|
-
"react-is": "^17.0.2",
|
|
34
|
-
"react-schemaorg": "^2.0.0",
|
|
35
|
-
"schema-dts": "^1.0.0",
|
|
36
|
-
"type-fest": "^2.11.2"
|
|
39
|
+
"react-dom": "^17.0.2"
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
|
-
"@graphcommerce/eslint-config-pwa": "^4.0.
|
|
42
|
+
"@graphcommerce/eslint-config-pwa": "^4.0.2",
|
|
40
43
|
"@graphcommerce/prettier-config-pwa": "^4.0.1",
|
|
41
44
|
"@graphcommerce/typescript-config-pwa": "^4.0.1",
|
|
42
|
-
"@playwright/test": "^1.
|
|
45
|
+
"@playwright/test": "^1.19.1",
|
|
43
46
|
"@types/react-is": "^17.0.3",
|
|
44
|
-
"graphql-tag": "2.12.6",
|
|
45
47
|
"typescript": "^4.5.5"
|
|
46
|
-
},
|
|
47
|
-
"sideEffects": false,
|
|
48
|
-
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
49
|
-
"eslintConfig": {
|
|
50
|
-
"extends": "@graphcommerce/eslint-config-pwa",
|
|
51
|
-
"parserOptions": {
|
|
52
|
-
"project": "./tsconfig.json"
|
|
53
|
-
}
|
|
54
48
|
}
|
|
55
49
|
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { ApolloError } from '@graphcommerce/graphql'
|
|
2
|
-
import { AlertProps, Alert, Box, SxProps, Theme } from '@mui/material'
|
|
3
|
-
import { AnimatePresence } from 'framer-motion'
|
|
4
|
-
import { AnimatedRow } from '../AnimatedRow'
|
|
5
|
-
import { extendableComponent } from '../Styles/extendableComponent'
|
|
6
|
-
|
|
7
|
-
const { classes, selectors } = extendableComponent('ApolloErrorAlert', ['root', 'alert'] as const)
|
|
8
|
-
|
|
9
|
-
export type ApolloErrorAlertProps = {
|
|
10
|
-
error?: ApolloError
|
|
11
|
-
graphqlErrorAlertProps?: Omit<AlertProps, 'severity'>
|
|
12
|
-
networkErrorAlertProps?: Omit<AlertProps, 'severity'>
|
|
13
|
-
sx?: SxProps<Theme>
|
|
14
|
-
}
|
|
15
|
-
export default function ApolloErrorAlert(props: ApolloErrorAlertProps) {
|
|
16
|
-
const { error, graphqlErrorAlertProps, networkErrorAlertProps, sx } = props
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<AnimatePresence initial={false}>
|
|
20
|
-
{error && (
|
|
21
|
-
<AnimatedRow key='alerts'>
|
|
22
|
-
<Box sx={sx} className={classes.root}>
|
|
23
|
-
<AnimatePresence initial={false}>
|
|
24
|
-
{error.graphQLErrors.map((e, index) => (
|
|
25
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
26
|
-
<AnimatedRow key={index}>
|
|
27
|
-
<div className={classes.alert}>
|
|
28
|
-
<Alert severity='error' {...graphqlErrorAlertProps}>
|
|
29
|
-
{e.message}
|
|
30
|
-
</Alert>
|
|
31
|
-
</div>
|
|
32
|
-
</AnimatedRow>
|
|
33
|
-
))}
|
|
34
|
-
{error.networkError && (
|
|
35
|
-
<AnimatedRow key='networkError'>
|
|
36
|
-
<Box
|
|
37
|
-
sx={(theme) => ({
|
|
38
|
-
paddingTop: theme.spacings.xxs,
|
|
39
|
-
paddingBottom: theme.spacings.xxs,
|
|
40
|
-
})}
|
|
41
|
-
className={classes.alert}
|
|
42
|
-
key='networkError'
|
|
43
|
-
>
|
|
44
|
-
<Alert severity='error' {...networkErrorAlertProps}>
|
|
45
|
-
Network Error: {error.networkError.message}
|
|
46
|
-
</Alert>
|
|
47
|
-
</Box>
|
|
48
|
-
</AnimatedRow>
|
|
49
|
-
)}
|
|
50
|
-
</AnimatePresence>
|
|
51
|
-
</Box>
|
|
52
|
-
</AnimatedRow>
|
|
53
|
-
)}
|
|
54
|
-
</AnimatePresence>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
ApolloErrorAlert.selectors = selectors
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ApolloError } from '@graphcommerce/graphql'
|
|
2
|
-
import { AlertProps } from '@mui/material'
|
|
3
|
-
import { FullPageMessage, FullPageMessageProps } from '../FullPageMessage'
|
|
4
|
-
import ApolloErrorAlert from './ApolloErrorAlert'
|
|
5
|
-
|
|
6
|
-
export type ApolloErrorFullPageProps = {
|
|
7
|
-
error?: ApolloError
|
|
8
|
-
graphqlErrorAlertProps?: Omit<AlertProps, 'severity'>
|
|
9
|
-
networkErrorAlertProps?: Omit<AlertProps, 'severity'>
|
|
10
|
-
} & Omit<FullPageMessageProps, 'title' | 'description'>
|
|
11
|
-
|
|
12
|
-
export default function ApolloErrorFullPage(props: ApolloErrorFullPageProps) {
|
|
13
|
-
const {
|
|
14
|
-
error,
|
|
15
|
-
graphqlErrorAlertProps,
|
|
16
|
-
networkErrorAlertProps,
|
|
17
|
-
children,
|
|
18
|
-
...fullPageMessageProps
|
|
19
|
-
} = props
|
|
20
|
-
|
|
21
|
-
const singleError = error?.graphQLErrors.length === 1
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<FullPageMessage
|
|
25
|
-
title={singleError ? error?.graphQLErrors[0].message : 'Several errors occured'}
|
|
26
|
-
{...fullPageMessageProps}
|
|
27
|
-
>
|
|
28
|
-
{singleError ? children : <ApolloErrorAlert error={error} />}
|
|
29
|
-
</FullPageMessage>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ApolloError } from '@graphcommerce/graphql'
|
|
2
|
-
import { Trans } from '@lingui/macro'
|
|
3
|
-
import { Button } from '@mui/material'
|
|
4
|
-
import { MessageSnackbar } from '../Snackbar/MessageSnackbar'
|
|
5
|
-
import { MessageSnackbarImplProps } from '../Snackbar/MessageSnackbarImpl'
|
|
6
|
-
|
|
7
|
-
export type ApolloErrorSnackbarProps = {
|
|
8
|
-
error?: ApolloError
|
|
9
|
-
} & Pick<MessageSnackbarImplProps, 'action' | 'onClose'>
|
|
10
|
-
|
|
11
|
-
export default function ApolloErrorSnackbar(props: ApolloErrorSnackbarProps) {
|
|
12
|
-
const { error, action, ...passedProps } = props
|
|
13
|
-
|
|
14
|
-
if (!error) return null
|
|
15
|
-
return (
|
|
16
|
-
<MessageSnackbar
|
|
17
|
-
variant='pill'
|
|
18
|
-
severity='error'
|
|
19
|
-
{...passedProps}
|
|
20
|
-
open={!!error}
|
|
21
|
-
action={
|
|
22
|
-
action ?? (
|
|
23
|
-
<Button size='medium' variant='pill' color='secondary'>
|
|
24
|
-
<Trans>Ok</Trans>
|
|
25
|
-
</Button>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
>
|
|
29
|
-
<>
|
|
30
|
-
{error.graphQLErrors.map((e) => e.message)}
|
|
31
|
-
{error.networkError && <>Network Error: {error.networkError.message}</>}
|
|
32
|
-
</>
|
|
33
|
-
</MessageSnackbar>
|
|
34
|
-
)
|
|
35
|
-
}
|
package/ApolloError/index.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from './ApolloErrorAlert'
|
|
2
|
-
export { default as ApolloErrorAlert } from './ApolloErrorAlert'
|
|
3
|
-
export * from './ApolloErrorFullPage'
|
|
4
|
-
export { default as ApolloErrorFullPage } from './ApolloErrorFullPage'
|
|
5
|
-
export * from './ApolloErrorSnackbar'
|
|
6
|
-
export { default as ApolloErrorSnackbar } from './ApolloErrorSnackbar'
|