@graphcommerce/next-ui 10.0.4-canary.1 → 10.1.0-canary.5
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 +22 -0
- package/Row/ButtonLinkList/ButtonLinkList.tsx +4 -3
- package/Row/IconBlocks/IconBlocks.tsx +3 -3
- package/SkipLink/SkipLink.tsx +1 -0
- package/Theme/MuiButton.ts +4 -4
- package/UspList/UspListItem.tsx +4 -2
- package/copy/proxy.ts +12 -0
- package/package.json +10 -9
- package/proxy.ts +11 -0
- package/utils/cssFlags.tsx +16 -7
- package/utils/getCssFlagInitScript.tsx +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.1.0-canary.5
|
|
4
|
+
|
|
5
|
+
## 10.1.0-canary.4
|
|
6
|
+
|
|
7
|
+
## 10.1.0-canary.3
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#2603](https://github.com/graphcommerce-org/graphcommerce/pull/2603) [`b59420f`](https://github.com/graphcommerce-org/graphcommerce/commit/b59420fe1e50b311ed2840af5774bb2fdbf19337) - Cast theme.typography spreads to CSSObject in MuiButton variants to satisfy MUI v7 typing ([@bramvanderholst](https://github.com/bramvanderholst))
|
|
12
|
+
|
|
13
|
+
- [#2603](https://github.com/graphcommerce-org/graphcommerce/pull/2603) [`cb33760`](https://github.com/graphcommerce-org/graphcommerce/commit/cb337603284004033702cf4536561ee7d743a603) - Allow passing HTML attributes to UspListItem, ButtonLinkList & IconBlocks root element ([@bramvanderholst](https://github.com/bramvanderholst))
|
|
14
|
+
|
|
15
|
+
## 10.0.4-canary.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#2598](https://github.com/graphcommerce-org/graphcommerce/pull/2598) [`ac652cc`](https://github.com/graphcommerce-org/graphcommerce/commit/ac652cc7b1358cebe9047733afccc87b5b89dae4) - Added generic proxy handling to graphcommerce that can be used for plugins. Disabledby default. ([@paales](https://github.com/paales))
|
|
20
|
+
|
|
21
|
+
- [#2598](https://github.com/graphcommerce-org/graphcommerce/pull/2598) [`8d1c48c`](https://github.com/graphcommerce-org/graphcommerce/commit/8d1c48cdbdcf30d4f1e55cf16a02028d19703382) - Store the css flags as a cookie, so we are able to retrieve the flags in the middleware as well. ([@paales](https://github.com/paales))
|
|
22
|
+
|
|
23
|
+
- [#2598](https://github.com/graphcommerce-org/graphcommerce/pull/2598) [`5957a2b`](https://github.com/graphcommerce-org/graphcommerce/commit/5957a2b90520574a0d72c5850858464092cdf7c0) - Fix hydration erorr with SkipLink when there are query params. ([@paales](https://github.com/paales))
|
|
24
|
+
|
|
3
25
|
## 10.0.4-canary.1
|
|
4
26
|
|
|
5
27
|
## 10.0.4-canary.0
|
|
@@ -11,7 +11,8 @@ export type ButtonLinkListProps = {
|
|
|
11
11
|
children: React.ReactNode
|
|
12
12
|
component?: React.ElementType
|
|
13
13
|
sx?: SxProps<Theme>
|
|
14
|
-
} & OwnerState
|
|
14
|
+
} & OwnerState &
|
|
15
|
+
Omit<React.HTMLAttributes<HTMLDivElement>, 'title' | 'children'>
|
|
15
16
|
|
|
16
17
|
type OwnerState = { containsBigLinks: boolean }
|
|
17
18
|
|
|
@@ -23,12 +24,12 @@ const { withState } = extendableComponent<OwnerState, typeof compName, typeof pa
|
|
|
23
24
|
)
|
|
24
25
|
|
|
25
26
|
export function ButtonLinkList(props: ButtonLinkListProps) {
|
|
26
|
-
const { title, children, component = 'span', containsBigLinks, sx = [] } = props
|
|
27
|
+
const { title, children, component = 'span', containsBigLinks, sx = [], ...rest } = props
|
|
27
28
|
|
|
28
29
|
const classes = withState({ containsBigLinks })
|
|
29
30
|
|
|
30
31
|
return (
|
|
31
|
-
<Row maxWidth='820px' className={classes.root} sx={sx}>
|
|
32
|
+
<Row maxWidth='820px' className={classes.root} sx={sx} {...rest}>
|
|
32
33
|
<Box
|
|
33
34
|
sx={sxx((theme) => ({
|
|
34
35
|
position: 'relative',
|
|
@@ -10,17 +10,17 @@ export type IconBlocksProps = {
|
|
|
10
10
|
title: string
|
|
11
11
|
children: React.ReactNode
|
|
12
12
|
sx?: SxProps<Theme>
|
|
13
|
-
}
|
|
13
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, 'title' | 'children'>
|
|
14
14
|
|
|
15
15
|
const compName = 'IconBlocks'
|
|
16
16
|
const parts = ['container', 'title', 'optionsWrapper', 'block', 'wrapper'] as const
|
|
17
17
|
const { classes } = extendableComponent(compName, parts)
|
|
18
18
|
|
|
19
19
|
export function IconBlocks(props: IconBlocksProps) {
|
|
20
|
-
const { title, children, sx = [] } = props
|
|
20
|
+
const { title, children, sx = [], ...rest } = props
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<Row maxWidth='md' className={classes.container} sx={sxx({ maxWidth: 820 }, sx)}>
|
|
23
|
+
<Row maxWidth='md' className={classes.container} sx={sxx({ maxWidth: 820 }, sx)} {...rest}>
|
|
24
24
|
<Box className={classes.wrapper} sx={(theme) => ({ paddingTop: `${theme.spacings.lg}` })}>
|
|
25
25
|
<Box
|
|
26
26
|
className={classes.title}
|
package/SkipLink/SkipLink.tsx
CHANGED
package/Theme/MuiButton.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentsVariants, Theme } from '@mui/material'
|
|
1
|
+
import type { ComponentsVariants, CSSObject, Theme } from '@mui/material'
|
|
2
2
|
import { responsiveVal } from '../Styles/responsiveVal'
|
|
3
3
|
|
|
4
4
|
declare module '@mui/material/Button' {
|
|
@@ -21,7 +21,7 @@ export const MuiButtonResponsive: ButtonVariants = [
|
|
|
21
21
|
{
|
|
22
22
|
props: { size: 'small' },
|
|
23
23
|
style: ({ theme }) => ({
|
|
24
|
-
...theme.typography.body2,
|
|
24
|
+
...(theme.typography.body2 as CSSObject),
|
|
25
25
|
padding: `${responsiveVal(3, 5)} ${responsiveVal(8, 15)}`,
|
|
26
26
|
'&.MuiLoadingButton-loading:hover': {
|
|
27
27
|
backgroundColor: theme.vars.palette.action.disabledBackground,
|
|
@@ -33,7 +33,7 @@ export const MuiButtonResponsive: ButtonVariants = [
|
|
|
33
33
|
{
|
|
34
34
|
props: { size: 'medium' },
|
|
35
35
|
style: ({ theme }) => ({
|
|
36
|
-
...theme.typography.body1,
|
|
36
|
+
...(theme.typography.body1 as CSSObject),
|
|
37
37
|
padding: `${responsiveVal(7, 9)} ${responsiveVal(15, 22)}`,
|
|
38
38
|
'&.MuiLoadingButton-loading:hover': {
|
|
39
39
|
backgroundColor: theme.vars.palette.action.disabledBackground,
|
|
@@ -45,7 +45,7 @@ export const MuiButtonResponsive: ButtonVariants = [
|
|
|
45
45
|
{
|
|
46
46
|
props: { size: 'large' },
|
|
47
47
|
style: ({ theme }) => ({
|
|
48
|
-
...theme.typography.subtitle1,
|
|
48
|
+
...(theme.typography.subtitle1 as CSSObject),
|
|
49
49
|
fontWeight: theme.typography.fontWeightBold,
|
|
50
50
|
padding: `${responsiveVal(10, 15)} ${responsiveVal(28, 58)}`,
|
|
51
51
|
'&.MuiLoadingButton-loading:hover': {
|
package/UspList/UspListItem.tsx
CHANGED
|
@@ -8,7 +8,8 @@ export type UspListItemProps = {
|
|
|
8
8
|
text: React.ReactNode
|
|
9
9
|
icon?: React.ReactNode
|
|
10
10
|
sx?: SxProps<Theme>
|
|
11
|
-
} & OwnerState
|
|
11
|
+
} & OwnerState &
|
|
12
|
+
Omit<React.HTMLAttributes<HTMLLIElement>, 'children'>
|
|
12
13
|
|
|
13
14
|
type OwnerState = { size?: 'small' | 'medium' }
|
|
14
15
|
const name = 'UspListItem'
|
|
@@ -16,13 +17,14 @@ const parts = ['root', 'icon', 'text'] as const
|
|
|
16
17
|
const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
|
|
17
18
|
|
|
18
19
|
export function UspListItem(props: UspListItemProps) {
|
|
19
|
-
const { text, icon, size = 'medium', sx = [] } = props
|
|
20
|
+
const { text, icon, size = 'medium', sx = [], ...rest } = props
|
|
20
21
|
const classes = withState({ size })
|
|
21
22
|
|
|
22
23
|
return (
|
|
23
24
|
<Box
|
|
24
25
|
component='li'
|
|
25
26
|
className={classes.root}
|
|
27
|
+
{...rest}
|
|
26
28
|
sx={sxx(
|
|
27
29
|
(theme) => ({
|
|
28
30
|
display: 'grid',
|
package/copy/proxy.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { proxy } from '@graphcommerce/next-ui/proxy'
|
|
2
|
+
|
|
3
|
+
export const config = {
|
|
4
|
+
matcher: [
|
|
5
|
+
/*
|
|
6
|
+
* Match all request paths except static assets (_next/static, _next/image,
|
|
7
|
+
* api routes, and files with extensions like .png, .js, .css, etc.).
|
|
8
|
+
* Further filtering is handled by proxy plugins.
|
|
9
|
+
*/
|
|
10
|
+
'/((?!api|_next/static|_next/image|.*\\..*).*)',
|
|
11
|
+
],
|
|
12
|
+
}
|
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": "10.0
|
|
5
|
+
"version": "10.1.0-canary.5",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"./Intl/DateTimeFormat/toDate": "./Intl/DateTimeFormat/toDate.ts",
|
|
28
28
|
"./Breadcrumbs/BreadcrumbsJsonLd": "./Breadcrumbs/BreadcrumbsJsonLd.tsx",
|
|
29
29
|
"./Breadcrumbs/jsonLdBreadcrumb": "./Breadcrumbs/jsonLdBreadcrumb.tsx",
|
|
30
|
-
"./RenderType/filterNonNullableKeys": "./RenderType/filterNonNullableKeys.ts"
|
|
30
|
+
"./RenderType/filterNonNullableKeys": "./RenderType/filterNonNullableKeys.ts",
|
|
31
|
+
"./proxy": "./proxy.ts"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"cookie": "^1.1.1",
|
|
@@ -42,13 +43,13 @@
|
|
|
42
43
|
"@emotion/react": "^11.14.0",
|
|
43
44
|
"@emotion/server": "^11.11.0",
|
|
44
45
|
"@emotion/styled": "^11.14.1",
|
|
45
|
-
"@graphcommerce/eslint-config-pwa": "^10.0
|
|
46
|
-
"@graphcommerce/framer-next-pages": "^10.0
|
|
47
|
-
"@graphcommerce/framer-scroller": "^10.0
|
|
48
|
-
"@graphcommerce/framer-utils": "^10.0
|
|
49
|
-
"@graphcommerce/image": "^10.0
|
|
50
|
-
"@graphcommerce/prettier-config-pwa": "^10.0
|
|
51
|
-
"@graphcommerce/typescript-config-pwa": "^10.0
|
|
46
|
+
"@graphcommerce/eslint-config-pwa": "^10.1.0-canary.5",
|
|
47
|
+
"@graphcommerce/framer-next-pages": "^10.1.0-canary.5",
|
|
48
|
+
"@graphcommerce/framer-scroller": "^10.1.0-canary.5",
|
|
49
|
+
"@graphcommerce/framer-utils": "^10.1.0-canary.5",
|
|
50
|
+
"@graphcommerce/image": "^10.1.0-canary.5",
|
|
51
|
+
"@graphcommerce/prettier-config-pwa": "^10.1.0-canary.5",
|
|
52
|
+
"@graphcommerce/typescript-config-pwa": "^10.1.0-canary.5",
|
|
52
53
|
"@lingui/core": "^5",
|
|
53
54
|
"@lingui/macro": "^5",
|
|
54
55
|
"@lingui/react": "^5",
|
package/proxy.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NextRequest } from 'next/server'
|
|
2
|
+
import { NextResponse } from 'next/server'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Base proxy handler for GraphCommerce. Returns NextResponse.next() by default.
|
|
6
|
+
*
|
|
7
|
+
* Extend this via function plugins to add authentication checks, redirects, etc.
|
|
8
|
+
*/
|
|
9
|
+
export function proxy(request: NextRequest): Response | NextResponse {
|
|
10
|
+
return NextResponse.next()
|
|
11
|
+
}
|
package/utils/cssFlags.tsx
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { cookie } from './cookie'
|
|
2
|
+
import { FLAGS_COOKIE_KEY } from './getCssFlagInitScript'
|
|
3
|
+
|
|
4
|
+
function loadFlags(): Record<string, true | string> {
|
|
5
|
+
try {
|
|
6
|
+
const raw = cookie(FLAGS_COOKIE_KEY)
|
|
7
|
+
if (!raw) return {}
|
|
8
|
+
const flags = JSON.parse(raw)
|
|
9
|
+
if (typeof flags !== 'object' || flags === null) return {}
|
|
10
|
+
return flags as Record<string, true | string>
|
|
11
|
+
} catch {
|
|
12
|
+
return {}
|
|
13
|
+
}
|
|
7
14
|
}
|
|
8
15
|
|
|
9
16
|
function saveFlags(flags: Record<string, true | string>) {
|
|
10
|
-
|
|
17
|
+
const json = JSON.stringify(flags)
|
|
18
|
+
if (json === '{}') cookie(FLAGS_COOKIE_KEY, null)
|
|
19
|
+
else cookie(FLAGS_COOKIE_KEY, json)
|
|
11
20
|
}
|
|
12
21
|
|
|
13
22
|
export function removeCssFlag(flagName: string) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const FLAGS_COOKIE_KEY = 'gc-flags'
|
|
2
2
|
|
|
3
3
|
export function getCssFlagsInitScript() {
|
|
4
4
|
return (
|
|
@@ -9,7 +9,9 @@ export function getCssFlagsInitScript() {
|
|
|
9
9
|
dangerouslySetInnerHTML={{
|
|
10
10
|
__html: `(function() {
|
|
11
11
|
try {
|
|
12
|
-
|
|
12
|
+
var m = document.cookie.match(/(^|; )${FLAGS_COOKIE_KEY}=([^;]*)/)
|
|
13
|
+
if (!m) return
|
|
14
|
+
var flags = JSON.parse(decodeURIComponent(m[2]))
|
|
13
15
|
Object.entries(flags).forEach(([key, val]) => {
|
|
14
16
|
document.documentElement.setAttribute('data-' +key, typeof val === 'boolean' ? '' : val)
|
|
15
17
|
})
|