@graphcommerce/magento-product 9.0.0-canary.109 → 9.0.0-canary.111
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
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { LazyHydrate, RenderType,
|
1
|
+
import { extendableComponent, LazyHydrate, RenderType, responsiveVal } from '@graphcommerce/next-ui'
|
2
2
|
import type { BoxProps, Breakpoint, Theme } from '@mui/material'
|
3
3
|
import { Box, useTheme } from '@mui/material'
|
4
4
|
import { AddProductsToCartForm } from '../AddProductsToCart'
|
@@ -10,26 +10,25 @@ type ComponentState = {
|
|
10
10
|
size?: 'normal' | 'small'
|
11
11
|
}
|
12
12
|
|
13
|
-
type ColumnConfig = {
|
13
|
+
export type ColumnConfig = {
|
14
14
|
/**
|
15
|
-
* The total width of the grid, this is used to provde the correct values to the image sizes prop
|
15
|
+
* The total width of the grid, this is used to provde the correct values to the image sizes prop
|
16
|
+
* so the right image size is loaded.
|
16
17
|
*
|
17
|
-
* @default
|
18
|
+
* @default 'calc(100vw - ${theme.page.horizontal} * 2)'
|
18
19
|
*/
|
19
|
-
|
20
|
+
maxWidth?: string
|
20
21
|
/**
|
21
22
|
* Gap between the columns/rows
|
22
23
|
*
|
23
24
|
* @default theme.spacings.md
|
24
25
|
*/
|
25
26
|
gap?: string
|
26
|
-
/**
|
27
|
-
* Number of columns
|
28
|
-
*/
|
27
|
+
/** Number of columns */
|
29
28
|
count: number
|
30
29
|
}
|
31
30
|
|
32
|
-
type ColumnsConfig = Partial<Record<Breakpoint, ColumnConfig>>
|
31
|
+
export type ColumnsConfig = Partial<Record<Breakpoint, ColumnConfig>>
|
33
32
|
|
34
33
|
export type ProductItemsGridProps = ProductListItemsFragment & {
|
35
34
|
renderers: ProductListItemRenderer
|
@@ -39,6 +38,7 @@ export type ProductItemsGridProps = ProductListItemsFragment & {
|
|
39
38
|
columns?: ((theme: Theme) => ColumnsConfig) | ColumnsConfig
|
40
39
|
containerRef?: React.Ref<HTMLDivElement>
|
41
40
|
children?: React.ReactNode
|
41
|
+
maxWidth?: string
|
42
42
|
} & Pick<ProductListItemProps, 'onClick' | 'titleComponent'> &
|
43
43
|
ComponentState
|
44
44
|
|
@@ -59,11 +59,13 @@ export function ProductListItemsBase(props: ProductItemsGridProps) {
|
|
59
59
|
onClick,
|
60
60
|
columns,
|
61
61
|
children,
|
62
|
+
maxWidth: maxWidthProp,
|
62
63
|
} = props
|
63
64
|
|
64
65
|
const theme = useTheme()
|
65
66
|
|
66
|
-
const
|
67
|
+
const maxWidth = maxWidthProp ?? `calc(100vw - ${theme.page.horizontal} * 2)`
|
68
|
+
|
67
69
|
const gap = theme.spacings.md
|
68
70
|
|
69
71
|
let columnConfig = typeof columns === 'function' ? columns(theme) : columns
|
@@ -72,7 +74,7 @@ export function ProductListItemsBase(props: ProductItemsGridProps) {
|
|
72
74
|
columnConfig = {
|
73
75
|
xs: { count: 2 },
|
74
76
|
md: { count: 3 },
|
75
|
-
lg: { count: 4,
|
77
|
+
lg: { count: 4, maxWidth: `${theme.breakpoints.values.xl}px` },
|
76
78
|
}
|
77
79
|
}
|
78
80
|
|
@@ -91,7 +93,7 @@ export function ProductListItemsBase(props: ProductItemsGridProps) {
|
|
91
93
|
...Object.entries(columnConfig).map(([key, column]) => ({
|
92
94
|
[theme.breakpoints.up(key as Breakpoint)]: {
|
93
95
|
gap: column.gap ?? gap,
|
94
|
-
//
|
96
|
+
// maxWidth: column.maxWidth ?? maxWidth,
|
95
97
|
gridTemplateColumns: `repeat(${column.count}, 1fr)`,
|
96
98
|
},
|
97
99
|
})),
|
@@ -109,8 +111,8 @@ export function ProductListItemsBase(props: ProductItemsGridProps) {
|
|
109
111
|
<RenderType
|
110
112
|
renderer={renderers}
|
111
113
|
sizes={Object.fromEntries(
|
112
|
-
Object.entries(columnConfig
|
113
|
-
const totalW = column.
|
114
|
+
Object.entries(columnConfig).map(([key, column]) => {
|
115
|
+
const totalW = column.maxWidth ?? maxWidth
|
114
116
|
const columnGap = column.gap ?? gap
|
115
117
|
return [
|
116
118
|
theme.breakpoints.values[key as Breakpoint],
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@graphcommerce/magento-product",
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
5
|
-
"version": "9.0.0-canary.
|
5
|
+
"version": "9.0.0-canary.111",
|
6
6
|
"sideEffects": false,
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
8
8
|
"eslintConfig": {
|
@@ -18,18 +18,18 @@
|
|
18
18
|
"typescript": "5.7.2"
|
19
19
|
},
|
20
20
|
"peerDependencies": {
|
21
|
-
"@graphcommerce/ecommerce-ui": "^9.0.0-canary.
|
22
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.
|
23
|
-
"@graphcommerce/framer-next-pages": "^9.0.0-canary.
|
24
|
-
"@graphcommerce/framer-scroller": "^9.0.0-canary.
|
25
|
-
"@graphcommerce/graphql": "^9.0.0-canary.
|
26
|
-
"@graphcommerce/graphql-mesh": "^9.0.0-canary.
|
27
|
-
"@graphcommerce/image": "^9.0.0-canary.
|
28
|
-
"@graphcommerce/magento-cart": "^9.0.0-canary.
|
29
|
-
"@graphcommerce/magento-store": "^9.0.0-canary.
|
30
|
-
"@graphcommerce/next-ui": "^9.0.0-canary.
|
31
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.
|
32
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.
|
21
|
+
"@graphcommerce/ecommerce-ui": "^9.0.0-canary.111",
|
22
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.111",
|
23
|
+
"@graphcommerce/framer-next-pages": "^9.0.0-canary.111",
|
24
|
+
"@graphcommerce/framer-scroller": "^9.0.0-canary.111",
|
25
|
+
"@graphcommerce/graphql": "^9.0.0-canary.111",
|
26
|
+
"@graphcommerce/graphql-mesh": "^9.0.0-canary.111",
|
27
|
+
"@graphcommerce/image": "^9.0.0-canary.111",
|
28
|
+
"@graphcommerce/magento-cart": "^9.0.0-canary.111",
|
29
|
+
"@graphcommerce/magento-store": "^9.0.0-canary.111",
|
30
|
+
"@graphcommerce/next-ui": "^9.0.0-canary.111",
|
31
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.111",
|
32
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.111",
|
33
33
|
"@lingui/core": "^4.2.1",
|
34
34
|
"@lingui/macro": "^4.2.1",
|
35
35
|
"@lingui/react": "^4.2.1",
|