@graphcommerce/magento-compare 10.0.0-canary.67 → 10.0.0-canary.68

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,5 +1,7 @@
1
1
  # @graphcommerce/magento-compare
2
2
 
3
+ ## 10.0.0-canary.68
4
+
3
5
  ## 10.0.0-canary.67
4
6
 
5
7
  ## 10.0.0-canary.66
@@ -2,6 +2,7 @@ import {
2
2
  extendableComponent,
3
3
  iconCompare,
4
4
  IconSvg,
5
+ sxx,
5
6
  useFabSize,
6
7
  useScrollY,
7
8
  } from '@graphcommerce/next-ui'
@@ -42,10 +43,7 @@ function CompareFabContent(props: CompareFabContentProps) {
42
43
  if (total_quantity === 0) return null
43
44
 
44
45
  return (
45
- <Box
46
- className={classes.root}
47
- sx={[{ position: 'relative', height: fabIconSize }, ...(Array.isArray(sx) ? sx : [sx])]}
48
- >
46
+ <Box className={classes.root} sx={sxx({ position: 'relative', height: fabIconSize }, sx)}>
49
47
  <Badge
50
48
  color='primary'
51
49
  variant='standard'
@@ -60,7 +58,7 @@ function CompareFabContent(props: CompareFabContentProps) {
60
58
  color='inherit'
61
59
  sx={(theme) => ({
62
60
  width: 'unset',
63
- backgroundColor: `${theme.palette.background.paper} !important`,
61
+ backgroundColor: `${theme.vars.palette.background.paper} !important`,
64
62
  [theme.breakpoints.down('md')]: {},
65
63
  })}
66
64
  {...rest}
@@ -1,4 +1,4 @@
1
- import { filterNonNullableKeys } from '@graphcommerce/next-ui'
1
+ import { filterNonNullableKeys, sxx } from '@graphcommerce/next-ui'
2
2
  import type { SxProps, Theme } from '@mui/material'
3
3
  import { Box } from '@mui/material'
4
4
  import { useCompareList } from '../hooks/useCompareList'
@@ -18,9 +18,9 @@ export function CompareListAttributes(props: CompareListAttributesProps) {
18
18
 
19
19
  return (
20
20
  <Box
21
- sx={[
21
+ sx={sxx(
22
22
  (theme) => ({
23
- bgcolor: theme.palette.background.default,
23
+ bgcolor: theme.vars.palette.background.default,
24
24
  '& :first-of-type > div': {
25
25
  mt: 0,
26
26
  },
@@ -33,8 +33,8 @@ export function CompareListAttributes(props: CompareListAttributesProps) {
33
33
  p: theme.spacings.lg,
34
34
  },
35
35
  }),
36
- ...(Array.isArray(sx) ? sx : [sx]),
37
- ]}
36
+ sx,
37
+ )}
38
38
  >
39
39
  {compareListAttributes.map((attribute) => (
40
40
  <CompareListRow compareAbleItems={items} attribute={attribute} key={attribute?.code} />
@@ -11,7 +11,7 @@ export function CompareListIntroText({ children }: CompareListIntroTextProps) {
11
11
  position: 'relative',
12
12
  textAlign: 'center',
13
13
  paddingBottom: 2,
14
- background: theme.palette.background.paper,
14
+ background: theme.vars.palette.background.paper,
15
15
  zIndex: 11,
16
16
  })}
17
17
  >
@@ -1,5 +1,6 @@
1
1
  import type { ProductItemsGridProps } from '@graphcommerce/magento-product'
2
2
  import { AddProductsToCartForm, ProductListItemsBase } from '@graphcommerce/magento-product'
3
+ import { sxx } from '@graphcommerce/next-ui'
3
4
  import { useCompareListStyles } from '../hooks/useCompareListStyles'
4
5
  import { useCompareVisibleItems } from './CompareListForm'
5
6
 
@@ -18,7 +19,7 @@ export function CompareListItems(props: CompareListItemsProps) {
18
19
  title='Compare items'
19
20
  items={items}
20
21
  renderers={renderers}
21
- sx={[compareListStyles, ...(Array.isArray(sx) ? sx : [sx])]}
22
+ sx={sxx(compareListStyles, sx)}
22
23
  />
23
24
  </AddProductsToCartForm>
24
25
  )
@@ -1,4 +1,4 @@
1
- import { SectionContainer } from '@graphcommerce/next-ui'
1
+ import { SectionContainer, sxx } from '@graphcommerce/next-ui'
2
2
  import { Box } from '@mui/material'
3
3
  import type { ComparableItemFragment } from '../graphql'
4
4
  import { useCompareListStyles } from '../hooks/useCompareListStyles'
@@ -21,25 +21,43 @@ export function CompareListRow(props: CompareRowProps) {
21
21
  <Box>
22
22
  <SectionContainer
23
23
  labelLeft={attribute?.label}
24
- sx={(theme) => ({
25
- '& .SectionHeader-root': {
26
- justifyContent: 'center',
27
- borderBottom: 'none',
28
- pb: 0,
29
- '& > .MuiTypography-root': {
30
- pb: theme.spacings.xxs,
31
- borderBottom: `1px solid ${theme.palette.divider}`,
32
- width: `calc(calc(calc(100% / 3) * ${columnCount}) + ${
33
- columnCount > 1 ? theme.spacings.md : '0px'
34
- })`,
35
- [theme.breakpoints.down('md')]: {
36
- width: '100%',
24
+ sx={sxx(
25
+ (theme) => ({
26
+ '& .SectionHeader-root': {
27
+ justifyContent: 'center',
28
+ borderBottom: 'none',
29
+ pb: 0,
30
+ '& > .MuiTypography-root': {
31
+ pb: theme.spacings.xxs,
32
+ borderBottom: `1px solid ${theme.vars.palette.divider}`,
33
+ [theme.breakpoints.down('md')]: {
34
+ width: '100%',
35
+ },
37
36
  },
38
37
  },
39
- },
40
- })}
38
+ }),
39
+ columnCount > 1
40
+ ? (theme) => ({
41
+ '& .SectionHeader-root': {
42
+ '& > .MuiTypography-root': {
43
+ width: {
44
+ width: theme.spacings.md,
45
+ },
46
+ },
47
+ },
48
+ })
49
+ : {
50
+ '& .SectionHeader-root': {
51
+ '& > .MuiTypography-root': {
52
+ width: {
53
+ width: '0px',
54
+ },
55
+ },
56
+ },
57
+ },
58
+ )}
41
59
  >
42
- <Box sx={[compareListStyles, (theme) => ({ mb: theme.spacings.lg })]}>
60
+ <Box sx={sxx(compareListStyles, (theme) => ({ mb: theme.spacings.lg }))}>
43
61
  {compareAbleItems?.map((item, idx) => (
44
62
  <Box
45
63
  // eslint-disable-next-line react/no-array-index-key
@@ -1,5 +1,5 @@
1
1
  import { productLink } from '@graphcommerce/magento-product'
2
- import { Button, iconChevronRight, IconSvg, SectionContainer } from '@graphcommerce/next-ui'
2
+ import { Button, iconChevronRight, IconSvg, SectionContainer, sxx } from '@graphcommerce/next-ui'
3
3
  import { Trans } from '@lingui/react/macro'
4
4
  import { Box } from '@mui/material'
5
5
  import { useCompareListStyles } from '../hooks/useCompareListStyles'
@@ -17,23 +17,41 @@ export function CompareListRowMoreInformation(props: CompareListRowMoreInformati
17
17
  <Box>
18
18
  <SectionContainer
19
19
  labelLeft={<Trans>More information</Trans>}
20
- sx={(theme) => ({
21
- '& .SectionHeader-root': {
22
- justifyContent: 'center',
23
- borderBottom: 'none',
24
- pb: 0,
25
- '& > .MuiTypography-root': {
26
- pb: theme.spacings.xxs,
27
- borderBottom: `1px solid ${theme.palette.divider}`,
28
- width: `calc(calc(calc(100% / 3) * ${columnCount}) + ${
29
- columnCount > 1 ? theme.spacings.md : '0px'
30
- })`,
31
- [theme.breakpoints.down('md')]: {
32
- width: '100%',
20
+ sx={sxx(
21
+ (theme) => ({
22
+ '& .SectionHeader-root': {
23
+ justifyContent: 'center',
24
+ borderBottom: 'none',
25
+ pb: 0,
26
+ '& > .MuiTypography-root': {
27
+ pb: theme.spacings.xxs,
28
+ borderBottom: `1px solid ${theme.vars.palette.divider}`,
29
+ [theme.breakpoints.down('md')]: {
30
+ width: '100%',
31
+ },
33
32
  },
34
33
  },
35
- },
36
- })}
34
+ }),
35
+ columnCount > 1
36
+ ? (theme) => ({
37
+ '& .SectionHeader-root': {
38
+ '& > .MuiTypography-root': {
39
+ width: {
40
+ width: theme.spacings.md,
41
+ },
42
+ },
43
+ },
44
+ })
45
+ : {
46
+ '& .SectionHeader-root': {
47
+ '& > .MuiTypography-root': {
48
+ width: {
49
+ width: '0px',
50
+ },
51
+ },
52
+ },
53
+ },
54
+ )}
37
55
  >
38
56
  <Box sx={compareListStyles}>
39
57
  {compareAbleItems?.map((item) => {
@@ -1,6 +1,6 @@
1
1
  import { SelectElement } from '@graphcommerce/ecommerce-ui'
2
2
  import { useMotionValueValue } from '@graphcommerce/framer-utils'
3
- import { useScrollY } from '@graphcommerce/next-ui'
3
+ import { sxx, useScrollY } from '@graphcommerce/next-ui'
4
4
  import type { SxProps, Theme } from '@mui/material'
5
5
  import { Box, Container, FormControl, useTheme } from '@mui/material'
6
6
  import { useCompareList, useCompareListStyles } from '../hooks'
@@ -34,11 +34,11 @@ export function CompareListSelect(props: CompareListSelectProps) {
34
34
 
35
35
  return (
36
36
  <Box
37
- sx={[
37
+ sx={sxx(
38
38
  (theme) => ({
39
39
  pt: 1,
40
40
  pb: theme.spacings.xxs,
41
- background: theme.palette.background[bgColor],
41
+ background: theme.vars.palette.background[bgColor],
42
42
  position: 'sticky',
43
43
  zIndex: 10,
44
44
  top: {
@@ -50,8 +50,8 @@ export function CompareListSelect(props: CompareListSelectProps) {
50
50
  md: scrolled.md ? theme.shadows[1] : 'none',
51
51
  },
52
52
  }),
53
- ...(Array.isArray(sx) ? sx : [sx]),
54
- ]}
53
+ sx,
54
+ )}
55
55
  >
56
56
  <Container sx={{ ...compareListStyles }}>
57
57
  {[...Array(gridColumns).keys()].map((compareSelectIndex) => (
@@ -1,4 +1,5 @@
1
1
  import { useMutation } from '@graphcommerce/graphql'
2
+ import { sxx } from '@graphcommerce/next-ui'
2
3
  import { Trans } from '@lingui/react/macro'
3
4
  // eslint-disable-next-line @typescript-eslint/no-restricted-imports
4
5
  import type { SxProps, Theme } from '@mui/material'
@@ -34,7 +35,7 @@ export function CompareProductButton(props: CompareProductButtonProps) {
34
35
  }
35
36
 
36
37
  return (
37
- <Box sx={[...(Array.isArray(sx) ? sx : [sx])]}>
38
+ <Box sx={sx}>
38
39
  <Badge badgeContent={compareList.data?.compareList?.item_count} color='primary'>
39
40
  <Button
40
41
  variant='contained'
@@ -45,7 +46,6 @@ export function CompareProductButton(props: CompareProductButtonProps) {
45
46
  {inCompareList ? <Trans>In comparelist</Trans> : <Trans>Compare</Trans>}
46
47
  </Button>
47
48
  </Badge>
48
-
49
49
  {displayMessageBar && (
50
50
  <CompareMessageSnackbar
51
51
  displayMessageBar={displayMessageBar}
@@ -1,11 +1,11 @@
1
1
  import { useMutation } from '@graphcommerce/graphql'
2
2
  import { compareVariant } from '@graphcommerce/next-config/config'
3
3
  import type { FabProps } from '@graphcommerce/next-ui'
4
- import { Button, Fab, iconCompare } from '@graphcommerce/next-ui'
4
+ import { Button, Fab, iconCompare, sxx } from '@graphcommerce/next-ui'
5
5
  import { t } from '@lingui/core/macro'
6
6
  import { Trans } from '@lingui/react/macro'
7
7
  import type { SxProps, Theme } from '@mui/material'
8
- import { alpha, Checkbox, useTheme } from '@mui/material'
8
+ import { Checkbox, useTheme } from '@mui/material'
9
9
  import { useState } from 'react'
10
10
  import type { CompareProductIdInternalFragment } from '../graphql'
11
11
  import { AddProductsToCompareListDocument } from '../graphql/AddProductsToCompareList.gql'
@@ -104,33 +104,34 @@ function CompareProductToggleBase(
104
104
  onTouchStart={preventAnimationBubble}
105
105
  size='responsive'
106
106
  color='inherit'
107
- sx={[
107
+ sx={sxx(
108
108
  (theme) => ({
109
- backgroundColor:
110
- theme.palette.mode === 'light' ? theme.palette.background.paper : 'transparent',
109
+ backgroundColor: 'transparent',
111
110
  flex: '0 0 auto',
112
111
  '& svg': {
113
112
  stroke: strokeColorPlp,
114
113
  },
115
114
  '&:hover': {
116
- backgroundColor: alpha(
117
- theme.palette.text.primary,
118
- theme.palette.action.hoverOpacity,
115
+ backgroundColor: theme.alpha(
116
+ theme.vars.palette.text.primary,
117
+ theme.vars.palette.action.hoverOpacity,
119
118
  ),
120
119
  },
121
120
  '.SidebarGallery-root & svg': {
122
121
  stroke: strokeColorPdp,
123
122
  },
123
+ ...theme.applyStyles('light', {
124
+ backgroundColor: theme.vars.palette.background.paper,
125
+ }),
124
126
  }),
125
- ...(Array.isArray(sx) ? sx : [sx]),
126
- ]}
127
+ sx,
128
+ )}
127
129
  title={label}
128
130
  aria-label={label}
129
131
  icon={iconCompare}
130
132
  loading={loading}
131
133
  />
132
134
  )}
133
-
134
135
  {displayMessageBar && (
135
136
  <CompareMessageSnackbar
136
137
  displayMessageBar={displayMessageBar}
@@ -12,9 +12,7 @@ export function EmptyCompareList() {
12
12
  </OverlayCloseButton>
13
13
  }
14
14
  >
15
- <Trans>
16
- Discover our collection and add items to your comparelist!
17
- </Trans>
15
+ <Trans>Discover our collection and add items to your comparelist!</Trans>
18
16
  </FullPageMessage>
19
17
  )
20
18
  }
@@ -1,7 +1,7 @@
1
1
  import { useGo, usePageContext } from '@graphcommerce/framer-next-pages'
2
2
  import { useMutation } from '@graphcommerce/graphql'
3
3
  import type { LinkOrButtonProps } from '@graphcommerce/next-ui'
4
- import { LinkOrButton } from '@graphcommerce/next-ui'
4
+ import { LinkOrButton, sxx } from '@graphcommerce/next-ui'
5
5
  import { Trans } from '@lingui/react/macro'
6
6
  import { DeleteCompareListDocument } from '../graphql/DeleteCompareList.gql'
7
7
  import { useCompareList } from '../hooks'
@@ -30,21 +30,11 @@ export function EmptyCompareListButton(props: EmptyCompareListButtonProps) {
30
30
  button={{
31
31
  variant: 'pill',
32
32
  ...button,
33
- sx: [
34
- {
35
- whiteSpace: 'nowrap',
36
- },
37
- ...(Array.isArray(button.sx) ? button.sx : [button.sx]),
38
- ],
33
+ sx: sxx({ whiteSpace: 'nowrap' }, button.sx),
39
34
  }}
40
35
  link={{
41
36
  ...link,
42
- sx: [
43
- {
44
- whiteSpace: 'nowrap',
45
- },
46
- ...(Array.isArray(link.sx) ? link.sx : [link.sx]),
47
- ],
37
+ sx: sxx({ whiteSpace: 'nowrap' }, link.sx),
48
38
  }}
49
39
  onClick={() => {
50
40
  go()
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-compare",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "10.0.0-canary.67",
5
+ "version": "10.0.0-canary.68",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -19,20 +19,20 @@
19
19
  "./plugins/AddCompareTypePolicies": "./plugins/AddCompareTypePolicies.tsx"
20
20
  },
21
21
  "peerDependencies": {
22
- "@graphcommerce/ecommerce-ui": "^10.0.0-canary.67",
23
- "@graphcommerce/eslint-config-pwa": "^10.0.0-canary.67",
24
- "@graphcommerce/framer-next-pages": "^10.0.0-canary.67",
25
- "@graphcommerce/framer-utils": "^10.0.0-canary.67",
26
- "@graphcommerce/graphql": "^10.0.0-canary.67",
27
- "@graphcommerce/magento-cart": "^10.0.0-canary.67",
28
- "@graphcommerce/magento-product": "^10.0.0-canary.67",
29
- "@graphcommerce/next-ui": "^10.0.0-canary.67",
30
- "@graphcommerce/prettier-config-pwa": "^10.0.0-canary.67",
31
- "@graphcommerce/typescript-config-pwa": "^10.0.0-canary.67",
22
+ "@graphcommerce/ecommerce-ui": "^10.0.0-canary.68",
23
+ "@graphcommerce/eslint-config-pwa": "^10.0.0-canary.68",
24
+ "@graphcommerce/framer-next-pages": "^10.0.0-canary.68",
25
+ "@graphcommerce/framer-utils": "^10.0.0-canary.68",
26
+ "@graphcommerce/graphql": "^10.0.0-canary.68",
27
+ "@graphcommerce/magento-cart": "^10.0.0-canary.68",
28
+ "@graphcommerce/magento-product": "^10.0.0-canary.68",
29
+ "@graphcommerce/next-ui": "^10.0.0-canary.68",
30
+ "@graphcommerce/prettier-config-pwa": "^10.0.0-canary.68",
31
+ "@graphcommerce/typescript-config-pwa": "^10.0.0-canary.68",
32
32
  "@lingui/core": "^5",
33
33
  "@lingui/macro": "^5",
34
34
  "@lingui/react": "^5",
35
- "@mui/material": "^5.10.16",
35
+ "@mui/material": "^7.0.0",
36
36
  "framer-motion": "^11.0.0",
37
37
  "graphql": "^16.0.0",
38
38
  "next": "*",