@graphcommerce/next-ui 9.1.0-canary.17 → 9.1.0-canary.19
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/ActionCard/ActionCard.tsx +6 -6
- package/CHANGELOG.md +10 -0
- package/FindAndReplace/FindAndReplace.tsx +35 -0
- package/Intl/DateTimeFormat/index.ts +1 -0
- package/LayoutParts/GlobalHead.tsx +7 -4
- package/PageMeta/PageMeta.tsx +4 -1
- package/Styles/extendableComponent.ts +14 -3
- package/index.ts +1 -0
- package/package.json +8 -8
@@ -117,7 +117,6 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
117
117
|
layout = 'list',
|
118
118
|
error = false,
|
119
119
|
slotProps = {},
|
120
|
-
...other
|
121
120
|
} = props
|
122
121
|
|
123
122
|
const classes = withState({
|
@@ -254,22 +253,23 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
254
253
|
},
|
255
254
|
}),
|
256
255
|
sx,
|
257
|
-
slotProps.root?.sx
|
256
|
+
slotProps.root?.sx as SxProps<Theme>,
|
258
257
|
)}
|
259
258
|
{...slotProps.root}
|
260
|
-
{...other}
|
259
|
+
// {...other}
|
261
260
|
>
|
262
261
|
<Box
|
263
262
|
className={classes.rootInner}
|
264
263
|
sx={sxx(
|
265
|
-
{
|
264
|
+
(theme) => ({
|
266
265
|
display: 'flex',
|
267
266
|
flexDirection: 'row',
|
268
267
|
width: '100%',
|
269
268
|
justifyContent: 'space-between',
|
270
269
|
alignContent: 'stretch',
|
271
270
|
alignItems: 'center',
|
272
|
-
|
271
|
+
columnGap: theme.spacings.xxs,
|
272
|
+
}),
|
273
273
|
slotProps.rootInner?.sx,
|
274
274
|
)}
|
275
275
|
{...slotProps.rootInner}
|
@@ -307,7 +307,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
|
|
307
307
|
'&.sizeSmall': { typography: 'body1' },
|
308
308
|
'&.sizeMedium': { typography: 'body1' },
|
309
309
|
'&.sizeLarge': { typography: 'h6' },
|
310
|
-
'&.sizeResponsive': { typography: { xs: 'body1', md: '
|
310
|
+
'&.sizeResponsive': { typography: { xs: 'body1', md: 'subtitle1', lg: 'h6' } },
|
311
311
|
},
|
312
312
|
slotProps.title?.sx,
|
313
313
|
)}
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 9.1.0-canary.19
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`1e38811`](https://github.com/graphcommerce-org/graphcommerce/commit/1e3881177065548165b7141a29cff8ab27692b25) - Added support for meta_keyword for products and categories ([@paales](https://github.com/paales))
|
8
|
+
|
9
|
+
- [#2499](https://github.com/graphcommerce-org/graphcommerce/pull/2499) [`340c8ef`](https://github.com/graphcommerce-org/graphcommerce/commit/340c8ef93248a120cc4b92a6cd91f775ae662a1f) - Solve issue where ActionCard would crash the whole app because it forwarded components to string attributes ([@paales](https://github.com/paales))
|
10
|
+
|
11
|
+
## 9.1.0-canary.18
|
12
|
+
|
3
13
|
## 9.1.0-canary.17
|
4
14
|
|
5
15
|
## 9.1.0-canary.16
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
export type FindAndReplacerProps = { part: string }
|
4
|
+
|
5
|
+
type FindAndReplaceTuple = [string, React.FC<FindAndReplacerProps> | React.ReactNode]
|
6
|
+
|
7
|
+
export type FindAndReplaceProps = {
|
8
|
+
source: string
|
9
|
+
findAndReplace: [FindAndReplaceTuple, ...FindAndReplaceTuple[]]
|
10
|
+
}
|
11
|
+
|
12
|
+
export function FindAndReplace(props: FindAndReplaceProps) {
|
13
|
+
const { source, findAndReplace } = props
|
14
|
+
|
15
|
+
// Create a regex pattern that matches any of the strings to be replaced
|
16
|
+
const pattern = new RegExp(
|
17
|
+
`(${findAndReplace.map(([find]) => find.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')})`,
|
18
|
+
'g',
|
19
|
+
)
|
20
|
+
|
21
|
+
// Split the string and map parts to either original string or replaced content
|
22
|
+
const parts = source.split(pattern)
|
23
|
+
|
24
|
+
return parts.map((part, index) => {
|
25
|
+
const key = `${part}-${index}`
|
26
|
+
// Check if this part matches any of our replacement keys
|
27
|
+
const Replacement = findAndReplace.find(([find]) => find === part)?.[1]
|
28
|
+
|
29
|
+
if (!Replacement) return <React.Fragment key={key}>{part}</React.Fragment>
|
30
|
+
if (typeof Replacement === 'function') {
|
31
|
+
return <Replacement part={part} key={key} />
|
32
|
+
}
|
33
|
+
return <React.Fragment key={key}>{Replacement}</React.Fragment>
|
34
|
+
})
|
35
|
+
}
|
@@ -1,10 +1,14 @@
|
|
1
1
|
import { useTheme } from '@mui/material'
|
2
2
|
import Head from 'next/head'
|
3
|
+
import type React from 'react'
|
3
4
|
|
4
|
-
export type GlobalHeadProps = {
|
5
|
+
export type GlobalHeadProps = {
|
6
|
+
name: string
|
7
|
+
children?: React.ReactNode
|
8
|
+
}
|
5
9
|
|
6
10
|
export function GlobalHead(props: GlobalHeadProps) {
|
7
|
-
const { name } = props
|
11
|
+
const { name, children } = props
|
8
12
|
const theme = useTheme()
|
9
13
|
|
10
14
|
return (
|
@@ -25,10 +29,9 @@ export function GlobalHead(props: GlobalHeadProps) {
|
|
25
29
|
<meta name='apple-mobile-web-app-title' content={name} key='apple-mobile-web-app-title' />
|
26
30
|
<meta name='format-detection' content='telephone=no' key='format-detection' />
|
27
31
|
<meta name='mobile-web-app-capable' content='yes' key='mobile-web-app-capable' />
|
28
|
-
<link rel='icon' href='/favicon.ico' sizes='any' />
|
29
|
-
<link rel='icon' href='/favicon.svg' type='image/svg+xml' />
|
30
32
|
<link rel='apple-touch-icon' href='/apple-touch-icon.png' />
|
31
33
|
<link rel='manifest' href='/manifest.webmanifest' key='manifest' />
|
34
|
+
{children}
|
32
35
|
</Head>
|
33
36
|
)
|
34
37
|
}
|
package/PageMeta/PageMeta.tsx
CHANGED
@@ -21,8 +21,9 @@ type MetaRobotsAll = ['all' | 'none']
|
|
21
21
|
export type PageMetaProps = {
|
22
22
|
title: string
|
23
23
|
canonical?: Canonical
|
24
|
-
metaDescription?: string
|
24
|
+
metaDescription?: string | null
|
25
25
|
metaRobots?: MetaRobotsAll | MetaRobots[]
|
26
|
+
metaKeywords?: string | null
|
26
27
|
children?: React.ReactNode
|
27
28
|
ogImage?: string | null
|
28
29
|
ogImageUseFallback?: boolean
|
@@ -36,6 +37,7 @@ export function PageMeta(props: PageMetaProps) {
|
|
36
37
|
title,
|
37
38
|
canonical: canonicalBare,
|
38
39
|
metaDescription,
|
40
|
+
metaKeywords,
|
39
41
|
ogImage,
|
40
42
|
ogType,
|
41
43
|
ogImageUseFallback = false,
|
@@ -56,6 +58,7 @@ export function PageMeta(props: PageMetaProps) {
|
|
56
58
|
)}
|
57
59
|
<meta name='robots' content={metaRobots.join(',')} key='meta-robots' />
|
58
60
|
{canonical && <link rel='canonical' href={canonical} key='canonical' />}
|
61
|
+
{metaKeywords && <meta name='keywords' content={metaKeywords.trim()} key='meta-keywords' />}
|
59
62
|
<meta property='og:title' content={title.trim()} key='og-title' />
|
60
63
|
<meta property='og:type' content={ogType ?? 'website'} key='og-type' />
|
61
64
|
<meta property='og:url' content={canonical} key='og-url' />
|
@@ -35,6 +35,14 @@ const partselectorsMap = <O extends Record<string, string>>(
|
|
35
35
|
return Object.fromEntries(mapped)
|
36
36
|
}
|
37
37
|
|
38
|
+
export type ExtendableComponentProps<
|
39
|
+
ClassNames extends ReadonlyArray<string> = ReadonlyArray<string>,
|
40
|
+
> = {
|
41
|
+
classes?: {
|
42
|
+
[P in ClassNames[number]]?: string | undefined
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
38
46
|
/**
|
39
47
|
* Utility function to:
|
40
48
|
*
|
@@ -42,14 +50,17 @@ const partselectorsMap = <O extends Record<string, string>>(
|
|
42
50
|
* - Generate state css classes.
|
43
51
|
*/
|
44
52
|
export function extendableComponent<
|
45
|
-
ComponentStyleProps extends Record<string, boolean | string | number | undefined
|
53
|
+
ComponentStyleProps extends Record<string, boolean | string | number | undefined> = Record<
|
54
|
+
string,
|
55
|
+
any
|
56
|
+
>,
|
46
57
|
Name extends string = string,
|
47
58
|
ClassNames extends ReadonlyArray<string> = ReadonlyArray<string>,
|
48
59
|
>(componentName: Name, slotNames: ClassNames) {
|
49
60
|
const classes = slotClasses(componentName, slotNames)
|
50
61
|
const partselectors = partselectorsMap(classes)
|
51
62
|
|
52
|
-
const withState = (state: ComponentStyleProps) => {
|
63
|
+
const withState = (state: ComponentStyleProps & ExtendableComponentProps<ClassNames>) => {
|
53
64
|
const stateClas = Object.fromEntries(
|
54
65
|
Object.entries<string>(classes).map(([slot, className]) => {
|
55
66
|
const mapped = Object.entries(state).map(([key, value]) => {
|
@@ -58,7 +69,7 @@ export function extendableComponent<
|
|
58
69
|
if (typeof value === 'number' && value > 0) return `${key}${value}`
|
59
70
|
return ''
|
60
71
|
})
|
61
|
-
|
72
|
+
if (state.classes?.[slot]) mapped.push(state.classes[slot] as string)
|
62
73
|
if (className) mapped.unshift(className)
|
63
74
|
return [slot, mapped.filter(Boolean).join(' ')]
|
64
75
|
}),
|
package/index.ts
CHANGED
@@ -9,6 +9,7 @@ export * from './Blog/BlogTitle/BlogTitle'
|
|
9
9
|
export * from './Breadcrumbs'
|
10
10
|
export * from './Button'
|
11
11
|
export * from './ChipMenu/ChipMenu'
|
12
|
+
export * from './FindAndReplace/FindAndReplace'
|
12
13
|
export * from './ContainerWithHeader/ContainerWithHeader'
|
13
14
|
export * from './Fab'
|
14
15
|
export * from './FlagAvatar/FlagAvatar'
|
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": "9.1.0-canary.
|
5
|
+
"version": "9.1.0-canary.19",
|
6
6
|
"sideEffects": false,
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
8
8
|
"eslintConfig": {
|
@@ -24,13 +24,13 @@
|
|
24
24
|
"@emotion/react": "^11",
|
25
25
|
"@emotion/server": "^11",
|
26
26
|
"@emotion/styled": "^11",
|
27
|
-
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.
|
28
|
-
"@graphcommerce/framer-next-pages": "^9.1.0-canary.
|
29
|
-
"@graphcommerce/framer-scroller": "^9.1.0-canary.
|
30
|
-
"@graphcommerce/framer-utils": "^9.1.0-canary.
|
31
|
-
"@graphcommerce/image": "^9.1.0-canary.
|
32
|
-
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.
|
33
|
-
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.
|
27
|
+
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.19",
|
28
|
+
"@graphcommerce/framer-next-pages": "^9.1.0-canary.19",
|
29
|
+
"@graphcommerce/framer-scroller": "^9.1.0-canary.19",
|
30
|
+
"@graphcommerce/framer-utils": "^9.1.0-canary.19",
|
31
|
+
"@graphcommerce/image": "^9.1.0-canary.19",
|
32
|
+
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.19",
|
33
|
+
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.19",
|
34
34
|
"@lingui/core": "^4.2.1",
|
35
35
|
"@lingui/macro": "^4.2.1",
|
36
36
|
"@lingui/react": "^4.2.1",
|