@graphcommerce/next-ui 10.0.0-canary.66 → 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.
Files changed (100) hide show
  1. package/ActionCard/ActionCard.tsx +30 -21
  2. package/ActionCard/ActionCardAccordion.tsx +2 -2
  3. package/ActionCard/ActionCardLayout.tsx +4 -3
  4. package/ActionCard/ActionCardList.tsx +13 -6
  5. package/Blog/BlogAuthor/BlogAuthor.tsx +9 -7
  6. package/Blog/BlogContent/BlogContent.tsx +7 -4
  7. package/Blog/BlogHeader/BlogHeader.tsx +7 -4
  8. package/Blog/BlogList/BlogList.tsx +4 -3
  9. package/Blog/BlogListItem/BlogListItem.tsx +6 -5
  10. package/Blog/BlogTags/BlogTag.tsx +2 -4
  11. package/Blog/BlogTitle/BlogTitle.tsx +2 -6
  12. package/Breadcrumbs/Breadcrumbs.tsx +46 -38
  13. package/Breadcrumbs/BreadcrumbsList.tsx +9 -9
  14. package/Button/Button.tsx +4 -4
  15. package/Button/LinkOrButton.tsx +8 -7
  16. package/CHANGELOG.md +10 -0
  17. package/ChipMenu/ChipMenu.tsx +5 -5
  18. package/Container/Container.tsx +4 -4
  19. package/Fab/Fab.tsx +1 -1
  20. package/Footer/Footer.tsx +5 -5
  21. package/Form/Form.tsx +6 -6
  22. package/Form/FormDivider.tsx +1 -1
  23. package/Form/InputCheckmark.tsx +2 -1
  24. package/FramerScroller/SidebarGallery.tsx +43 -34
  25. package/FullPageMessage/FullPageMessage.tsx +13 -4
  26. package/IconHeader/IconHeader.tsx +22 -8
  27. package/IconSvg/IconSvg.tsx +1 -1
  28. package/Layout/components/LayoutHeader.tsx +7 -6
  29. package/Layout/components/LayoutHeaderBack.tsx +0 -2
  30. package/Layout/components/LayoutHeaderContent.tsx +22 -18
  31. package/Layout/components/LayoutTitle.tsx +4 -3
  32. package/LayoutDefault/components/LayoutDefault.tsx +5 -4
  33. package/LayoutOverlay/components/LayoutOverlayHeader.tsx +4 -3
  34. package/LayoutOverlay/components/LayoutOverlayHeader2.tsx +0 -6
  35. package/LayoutParts/DesktopHeaderBadge.tsx +4 -3
  36. package/LayoutParts/DesktopNavBar.tsx +10 -11
  37. package/LayoutParts/DesktopNavBarItem.tsx +22 -16
  38. package/LayoutParts/GlobalHead.tsx +1 -1
  39. package/LayoutParts/Logo.tsx +2 -1
  40. package/LayoutParts/MenuFab.tsx +36 -14
  41. package/LayoutParts/MenuFabItem.tsx +2 -1
  42. package/LayoutParts/MenuFabSecondaryItem.tsx +6 -3
  43. package/LayoutParts/PlaceholderFab.tsx +2 -1
  44. package/LayoutParts/StickyBelowHeader.tsx +4 -3
  45. package/MediaQuery/MediaQuery.tsx +2 -4
  46. package/Navigation/components/NavigationFab.tsx +31 -11
  47. package/Navigation/components/NavigationItem.tsx +14 -10
  48. package/Navigation/components/NavigationOverlay.tsx +39 -20
  49. package/Overlay/components/OverlayBase.tsx +21 -23
  50. package/Overlay/components/OverlayContainer.tsx +35 -12
  51. package/Overlay/components/OverlayHeader.tsx +2 -1
  52. package/Overlay/components/OverlayStickyBottom.tsx +2 -5
  53. package/OverlayOrPopperChip/OverlayOrPopperChip.tsx +35 -31
  54. package/OverlayOrPopperChip/OverlayPanel.tsx +4 -5
  55. package/OverlayOrPopperChip/OverlayPanelActions.tsx +2 -1
  56. package/OverlayOrPopperChip/PopperPanelActions.tsx +2 -1
  57. package/Pagination/Pagination.tsx +9 -6
  58. package/Pagination/PaginationExtended.tsx +4 -3
  59. package/Row/ButtonLinkList/ButtonLinkList.tsx +14 -15
  60. package/Row/ButtonLinkList/ButtonLinkListItem.tsx +1 -1
  61. package/Row/ColumnThree/ColumnThree.tsx +4 -3
  62. package/Row/ColumnTwo/ColumnTwo.tsx +16 -5
  63. package/Row/ColumnTwoSpread/ColumnTwoSpread.tsx +15 -4
  64. package/Row/ColumnTwoWithTop/ColumnTwoWithTop.tsx +22 -6
  65. package/Row/ContentLinks/ContentLinks.tsx +4 -3
  66. package/Row/HeroBanner/HeroBanner.tsx +3 -7
  67. package/Row/IconBlocks/IconBlock.tsx +4 -3
  68. package/Row/IconBlocks/IconBlocks.tsx +2 -1
  69. package/Row/ImageText/ImageText.tsx +5 -5
  70. package/Row/ImageTextBoxed/ImageTextBoxed.tsx +2 -2
  71. package/Row/ParagraphWithSidebarSlide/ParagraphWithSidebarSlide.tsx +1 -1
  72. package/Row/RowLinks/variant/VariantImageLabelSwiper.tsx +4 -3
  73. package/Row/RowLinks/variant/VariantInline.tsx +2 -4
  74. package/Row/RowLinks/variant/VariantLogoSwiper.tsx +4 -3
  75. package/Row/RowLinks/variant/VariantUsps.tsx +4 -3
  76. package/Row/SpecialBanner/SpecialBanner.tsx +2 -2
  77. package/SectionContainer/SectionContainer.tsx +6 -5
  78. package/SectionHeader/SectionHeader.tsx +4 -3
  79. package/Separator/Separator.tsx +4 -3
  80. package/SkipLink/SkipLink.tsx +2 -2
  81. package/Snackbar/MessageSnackbarImpl.tsx +22 -10
  82. package/StarRatingField/StarRatingField.tsx +1 -1
  83. package/Stepper/Stepper.tsx +6 -5
  84. package/Styles/withTheme.tsx +6 -5
  85. package/Tabs/TabItem.tsx +4 -5
  86. package/TextInputNumber/TextInputNumber.tsx +76 -50
  87. package/Theme/DarkLightModeThemeProvider.tsx +41 -88
  88. package/Theme/MuiButton.ts +23 -22
  89. package/Theme/MuiChip.ts +12 -13
  90. package/Theme/MuiFab.ts +5 -5
  91. package/Theme/MuiSlider.ts +5 -5
  92. package/Theme/createTheme.ts +1 -3
  93. package/Theme/themeDefaults.ts +1 -1
  94. package/ToggleButton/ToggleButton.tsx +10 -11
  95. package/ToggleButtonGroup/ToggleButtonGroup.tsx +4 -3
  96. package/UspList/UspList.tsx +4 -3
  97. package/UspList/UspListItem.tsx +4 -3
  98. package/package.json +10 -10
  99. package/types.ts +1 -0
  100. package/utils/sxx.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  import type { BoxProps, ButtonProps, SxProps, Theme } from '@mui/material'
2
- import { alpha, Box, ButtonBase, lighten } from '@mui/material'
2
+ import { Box, ButtonBase } from '@mui/material'
3
3
  import React from 'react'
4
4
  import { extendableComponent, responsiveVal } from '../Styles'
5
5
  import { breakpointVal } from '../Styles/breakpointVal'
@@ -169,22 +169,31 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
169
169
  '&.variantDefault': {
170
170
  position: 'relative',
171
171
  '&.selected': {
172
- backgroundColor:
173
- theme.palette.mode === 'light'
174
- ? alpha(theme.palette[color].main, theme.palette.action.hoverOpacity)
175
- : lighten(theme.palette.background.default, theme.palette.action.hoverOpacity),
172
+ backgroundColor: theme.alpha(
173
+ theme.vars.palette[color].main,
174
+ theme.vars.palette.action.hoverOpacity,
175
+ ),
176
+ ...theme.applyStyles('dark', {
177
+ backgroundColor: theme.lighten(
178
+ theme.vars.palette.background.default,
179
+ theme.vars.palette.action.hoverOpacity,
180
+ ),
181
+ }),
176
182
  },
177
183
  '&.error': {
178
- backgroundColor: alpha(theme.palette.error.main, theme.palette.action.hoverOpacity),
184
+ backgroundColor: theme.alpha(
185
+ theme.vars.palette.error.main,
186
+ theme.vars.palette.action.hoverOpacity,
187
+ ),
179
188
  },
180
189
  '&:focus': {
181
190
  outline: 'none',
182
- boxShadow: `0 0 0 4px ${alpha(theme.palette[color].main, theme.palette.action.focusOpacity)}`,
191
+ boxShadow: `0 0 0 4px ${theme.alpha(theme.vars.palette[color].main, theme.vars.palette.action.focusOpacity)}`,
183
192
  },
184
193
  },
185
194
  '&.variantOutlined': {
186
- backgroundColor: theme.palette.background.paper,
187
- boxShadow: `inset 0 0 0 1px ${theme.palette.divider}`,
195
+ backgroundColor: theme.vars.palette.background.paper,
196
+ boxShadow: `inset 0 0 0 1px ${theme.vars.palette.divider}`,
188
197
  // '&:not(:last-of-type)': {
189
198
  // marginBottom: '-2px',
190
199
  // },
@@ -221,23 +230,23 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
221
230
  },
222
231
  '&.selected': {
223
232
  borderColor: 'transparent',
224
- boxShadow: `inset 0 0 0 2px ${theme.palette[color].main}`,
233
+ boxShadow: `inset 0 0 0 2px ${theme.vars.palette[color].main}`,
225
234
  },
226
235
  '&.selected:focus, &.error:focus': {
227
236
  borderColor: 'transparent',
228
- boxShadow: `inset 0 0 0 2px ${theme.palette[color].main}, 0 0 0 4px ${alpha(
229
- theme.palette[color].main,
230
- theme.palette.action.hoverOpacity,
237
+ boxShadow: `inset 0 0 0 2px ${theme.vars.palette[color].main}, 0 0 0 4px ${theme.alpha(
238
+ theme.vars.palette[color].main,
239
+ theme.vars.palette.action.hoverOpacity,
231
240
  )}`,
232
241
  },
233
242
  '&:focus': {
234
- boxShadow: `inset 0 0 0 1px ${theme.palette.divider},0 0 0 4px ${alpha(
235
- theme.palette[color].main,
236
- theme.palette.action.hoverOpacity,
243
+ boxShadow: `inset 0 0 0 1px ${theme.vars.palette.divider},0 0 0 4px ${theme.alpha(
244
+ theme.vars.palette[color].main,
245
+ theme.vars.palette.action.hoverOpacity,
237
246
  )}`,
238
247
  },
239
248
  '&.error': {
240
- boxShadow: `inset 0 0 0 2px ${theme.palette.error.main}`,
249
+ boxShadow: `inset 0 0 0 2px ${theme.vars.palette.error.main}`,
241
250
  },
242
251
  },
243
252
  '&.selected': {
@@ -247,9 +256,9 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
247
256
  zIndex: 2,
248
257
  },
249
258
  '&.disabled': {
250
- background: theme.palette.action.disabledBackground,
251
- opacity: theme.palette.action.disabledOpacity,
252
- color: theme.palette.action.disabled,
259
+ background: theme.vars.palette.action.disabledBackground,
260
+ opacity: theme.vars.palette.action.disabledOpacity,
261
+ color: theme.vars.palette.action.disabled,
253
262
  },
254
263
  }),
255
264
  sx,
@@ -353,7 +362,7 @@ export function ActionCard<C extends React.ElementType = typeof Box>(props: Acti
353
362
  <Box
354
363
  className={classes.action}
355
364
  sx={sxx(
356
- (theme) => ({ marginBottom: '5px', color: theme.palette[color].main }),
365
+ (theme) => ({ marginBottom: '5px', color: theme.vars.palette[color].main }),
357
366
  slotProps.action?.sx,
358
367
  )}
359
368
  {...slotProps.action}
@@ -32,8 +32,8 @@ export function ActionCardAccordion(props: ActionCardAccordionProps) {
32
32
  '&.Mui-expanded': { my: 0 },
33
33
  '::before': { display: 'none' },
34
34
  border: 'none',
35
- borderBottom: `1px solid ${theme.palette.divider}`,
36
- '&:not(.Mui-expanded)': { borderBottom: `1px solid ${theme.palette.divider}` },
35
+ borderBottom: `1px solid ${theme.vars.palette.divider}`,
36
+ '&:not(.Mui-expanded)': { borderBottom: `1px solid ${theme.vars.palette.divider}` },
37
37
  }),
38
38
  sx,
39
39
  )}
@@ -1,3 +1,4 @@
1
+ import { sxx } from '@graphcommerce/next-ui'
1
2
  import type { BoxProps } from '@mui/material'
2
3
  import { Box } from '@mui/material'
3
4
  import React from 'react'
@@ -28,7 +29,7 @@ export const ActionCardLayout = React.forwardRef<HTMLDivElement, ActionCardLayou
28
29
  ref={ref}
29
30
  {...boxProps}
30
31
  className={`${classes.root} ${className}`}
31
- sx={[
32
+ sx={sxx(
32
33
  (theme) => ({
33
34
  '&.layoutStack': {
34
35
  display: 'grid',
@@ -51,8 +52,8 @@ export const ActionCardLayout = React.forwardRef<HTMLDivElement, ActionCardLayou
51
52
  gap: theme.spacings.xxs,
52
53
  },
53
54
  }),
54
- ...(Array.isArray(sx) ? sx : [sx]),
55
- ]}
55
+ sx,
56
+ )}
56
57
  />
57
58
  )
58
59
  },
@@ -1,3 +1,4 @@
1
+ import { sxx } from '@graphcommerce/next-ui'
1
2
  import { Trans } from '@lingui/react/macro'
2
3
  import type { SxProps, Theme } from '@mui/material'
3
4
  import { Alert } from '@mui/material'
@@ -160,7 +161,6 @@ export const ActionCardList = React.forwardRef<HTMLDivElement, ActionCardListPro
160
161
  })
161
162
  })}
162
163
  </ActionCardLayout>
163
-
164
164
  {childActionCards.length > showMoreAfter && (
165
165
  <Button
166
166
  sx={{ width: 'fit-content' }}
@@ -170,15 +170,22 @@ export const ActionCardList = React.forwardRef<HTMLDivElement, ActionCardListPro
170
170
  >
171
171
  {!show ? <Trans>More options</Trans> : <Trans>Less options</Trans>}{' '}
172
172
  <IconSvg
173
- sx={{
174
- transform: show ? 'rotate(180deg)' : 'rotate(0deg)',
175
- transition: 'transform 0.3s ease-in-out',
176
- }}
173
+ sx={sxx(
174
+ {
175
+ transition: 'transform 0.3s ease-in-out',
176
+ },
177
+ show
178
+ ? {
179
+ transform: 'rotate(180deg)',
180
+ }
181
+ : {
182
+ transform: 'rotate(0deg)',
183
+ },
184
+ )}
177
185
  src={iconChevronDown}
178
186
  />
179
187
  </Button>
180
188
  )}
181
-
182
189
  {error && errorMessage && (
183
190
  <Alert
184
191
  severity='error'
@@ -1,3 +1,4 @@
1
+ import { sxx } from '@graphcommerce/next-ui'
1
2
  import type { SxProps, Theme } from '@mui/material'
2
3
  import { Avatar, Box, Chip } from '@mui/material'
3
4
  import { DateFormat } from '../../Intl/DateTimeFormat'
@@ -14,16 +15,17 @@ export function BlogAuthor(props: BlogAuthorProps) {
14
15
 
15
16
  return (
16
17
  <Box
17
- maxWidth='md'
18
- sx={[
18
+ sx={sxx(
19
19
  {
20
+ maxWidth: 'md',
21
+ },
22
+ (theme) => ({
20
23
  display: 'flex',
21
24
  justifyContent: 'left',
22
25
  margin: '0 auto',
23
- marginBottom: (theme) => theme.spacings.md,
24
- },
25
- ...(Array.isArray(sx) ? sx : [sx]),
26
- ]}
26
+ marginBottom: theme.spacings.md,
27
+ }),
28
+ )}
27
29
  >
28
30
  <Chip
29
31
  sx={{
@@ -46,7 +48,7 @@ export function BlogAuthor(props: BlogAuthorProps) {
46
48
  <Box slot='Author' sx={{ lineHeight: 1.4 }}>
47
49
  {author}
48
50
  </Box>
49
- <Box sx={(theme) => ({ lineHeight: 1.4, color: theme.palette.text.disabled })}>
51
+ <Box sx={(theme) => ({ lineHeight: 1.4, color: theme.vars.palette.text.disabled })}>
50
52
  <DateFormat dateStyle='long' date={date} />
51
53
  </Box>
52
54
  </section>
@@ -1,3 +1,4 @@
1
+ import { sxx } from '@graphcommerce/next-ui'
1
2
  import type { SxProps, Theme } from '@mui/material'
2
3
  import { Box } from '@mui/material'
3
4
 
@@ -11,14 +12,16 @@ export function BlogContent(props: BlogContentProps) {
11
12
 
12
13
  return (
13
14
  <Box
14
- maxWidth='md'
15
- sx={[
15
+ sx={sxx(
16
+ {
17
+ maxWidth: 'md',
18
+ },
16
19
  (theme) => ({
17
20
  margin: '0 auto',
18
21
  marginBottom: theme.spacings.sm,
19
22
  }),
20
- ...(Array.isArray(sx) ? sx : [sx]),
21
- ]}
23
+ sx,
24
+ )}
22
25
  >
23
26
  {children}
24
27
  </Box>
@@ -1,3 +1,4 @@
1
+ import { sxx } from '@graphcommerce/next-ui'
1
2
  import type { SxProps, Theme } from '@mui/material'
2
3
  import { Box } from '@mui/material'
3
4
  import React from 'react'
@@ -19,8 +20,10 @@ export function BlogHeader(props: BlogHeaderProps) {
19
20
  return (
20
21
  <Box
21
22
  className={classes.header}
22
- maxWidth='md'
23
- sx={[
23
+ sx={sxx(
24
+ {
25
+ maxWidth: 'md',
26
+ },
24
27
  (theme) => ({
25
28
  margin: '0 auto',
26
29
  marginBottom: theme.spacings.md,
@@ -34,8 +37,8 @@ export function BlogHeader(props: BlogHeaderProps) {
34
37
  ),
35
38
  },
36
39
  }),
37
- ...(Array.isArray(sx) ? sx : [sx]),
38
- ]}
40
+ sx,
41
+ )}
39
42
  >
40
43
  {asset}
41
44
  </Box>
@@ -1,3 +1,4 @@
1
+ import { sxx } from '@graphcommerce/next-ui'
1
2
  import type { ContainerProps } from '@mui/material'
2
3
  import { Row } from '../../Row/Row'
3
4
 
@@ -8,14 +9,14 @@ export function BlogItemGrid(props: BlogItemGridProps) {
8
9
 
9
10
  return (
10
11
  <Row
11
- sx={[
12
+ sx={sxx(
12
13
  (theme) => ({
13
14
  display: 'grid',
14
15
  gap: theme.spacings.md,
15
16
  gridTemplateColumns: { xs: 'repeat(2, 1fr)', md: 'repeat(3, 1fr)', lg: 'repeat(4, 1fr)' },
16
17
  }),
17
- ...(Array.isArray(sx) ? sx : [sx]),
18
- ]}
18
+ sx,
19
+ )}
19
20
  {...containerProps}
20
21
  />
21
22
  )
@@ -1,3 +1,4 @@
1
+ import { sxx } from '@graphcommerce/next-ui'
1
2
  import type { SxProps, Theme } from '@mui/material'
2
3
  import { Box, Link, Typography } from '@mui/material'
3
4
  import React from 'react'
@@ -23,17 +24,17 @@ export function BlogListItem(props: BlogListItemProps) {
23
24
  return (
24
25
  <Box
25
26
  className={classes.item}
26
- sx={[
27
+ sx={sxx(
27
28
  (theme) => ({
28
29
  display: 'grid',
29
30
  gridTemplateRows: 'auto auto auto',
30
31
  alignContent: 'start',
31
- color: theme.palette.text.primary,
32
+ color: theme.vars.palette.text.primary,
32
33
  gap: theme.spacings.xxs,
33
34
  marginBottom: theme.spacings.sm,
34
35
  }),
35
- ...(Array.isArray(sx) ? sx : [sx]),
36
- ]}
36
+ sx,
37
+ )}
37
38
  >
38
39
  <Link href={`/${url}`} color='inherit' underline='hover'>
39
40
  <Box
@@ -63,7 +64,7 @@ export function BlogListItem(props: BlogListItemProps) {
63
64
  sx={(theme) => ({
64
65
  display: 'inline-block',
65
66
  textDecoration: 'none',
66
- color: theme.palette.text.secondary,
67
+ color: theme.vars.palette.text.secondary,
67
68
  })}
68
69
  >
69
70
  <DateFormat dateStyle='long' date={date} />
@@ -1,3 +1,4 @@
1
+ import { sxx } from '@graphcommerce/next-ui'
1
2
  import type { SxProps, Theme } from '@mui/material'
2
3
  import { Chip } from '@mui/material'
3
4
  import { NextLink } from '../../Theme'
@@ -22,10 +23,7 @@ export function BlogTag(props: BlogTagsProps) {
22
23
  href={`/${url}`}
23
24
  component={NextLink}
24
25
  label={title}
25
- sx={[
26
- { marginRight: 3, borderRadius: 2, cursor: 'pointer' },
27
- ...(Array.isArray(sx) ? sx : [sx]),
28
- ]}
26
+ sx={sxx({ marginRight: 3, borderRadius: 2, cursor: 'pointer' }, sx)}
29
27
  />
30
28
  )
31
29
  }
@@ -1,3 +1,4 @@
1
+ import { sxx } from '@graphcommerce/next-ui'
1
2
  import { Box } from '@mui/material'
2
3
  import React from 'react'
3
4
  import { LayoutTitle } from '../../Layout'
@@ -8,12 +9,7 @@ export function BlogTitle(props: BlogTitleProps) {
8
9
  const { sx = [], children } = props
9
10
 
10
11
  return (
11
- <Box
12
- sx={[
13
- (theme) => ({ maxWidth: theme.breakpoints.values.md, margin: '0 auto' }),
14
- ...(Array.isArray(sx) ? sx : [sx]),
15
- ]}
16
- >
12
+ <Box sx={sxx((theme) => ({ maxWidth: theme.breakpoints.values.md, margin: '0 auto' }), sx)}>
17
13
  <LayoutTitle variant='h1'>{children}</LayoutTitle>
18
14
  </Box>
19
15
  )
@@ -1,3 +1,4 @@
1
+ import { sxx } from '@graphcommerce/next-ui'
1
2
  import { t } from '@lingui/core/macro'
2
3
  import { Trans } from '@lingui/react/macro'
3
4
  import type {
@@ -36,6 +37,11 @@ export type BreadcrumbsProps = BreadcrumbsType &
36
37
  itemSx?: SxProps<Theme>
37
38
  linkProps?: Omit<LinkProps, 'href'>
38
39
  disableHome?: boolean
40
+ /**
41
+ * Hide the last breadcrumb item (and its separator) on mobile. Useful when the last item
42
+ * duplicates the page title.
43
+ */
44
+ hideLastOnMobile?: boolean
39
45
  }
40
46
 
41
47
  export function Breadcrumbs(props: BreadcrumbsProps) {
@@ -49,13 +55,19 @@ export function Breadcrumbs(props: BreadcrumbsProps) {
49
55
  itemSx = [],
50
56
  linkProps,
51
57
  disableHome = false,
58
+ hideLastOnMobile = false,
52
59
  ...rest
53
60
  } = props
54
61
  const [anchorElement, setAnchorElement] = useState<HTMLButtonElement | null>(null)
55
62
  const theme = useTheme()
56
63
 
64
+ // When hiding the last item on mobile, show one more item to compensate
65
+ const effectiveBreadcrumbsAmountMobile = hideLastOnMobile
66
+ ? breadcrumbsAmountMobile + 1
67
+ : breadcrumbsAmountMobile
68
+
57
69
  const isDefaultMobile = breadcrumbsAmountMobile === 0
58
- const showButtonMobile = breadcrumbs.length > breadcrumbsAmountMobile && !isDefaultMobile
70
+ const showButtonMobile = breadcrumbs.length > effectiveBreadcrumbsAmountMobile && !isDefaultMobile
59
71
  const isDefaultDesktop = breadcrumbsAmountDesktop === 0
60
72
  const showButtonDesktop = breadcrumbs.length > breadcrumbsAmountDesktop && !isDefaultDesktop
61
73
 
@@ -74,8 +86,7 @@ export function Breadcrumbs(props: BreadcrumbsProps) {
74
86
  aria-label={t`Breadcrumbs`}
75
87
  maxItems={maxItems}
76
88
  color='inherit'
77
- sx={[
78
- {},
89
+ sx={sxx(
79
90
  !maxItems && {
80
91
  '& .MuiBreadcrumbs-ol': {
81
92
  flexWrap: 'nowrap',
@@ -95,32 +106,45 @@ export function Breadcrumbs(props: BreadcrumbsProps) {
95
106
  '& .MuiBreadcrumbs-separator': {
96
107
  '&:nth-of-type(2)': {
97
108
  display: {
98
- xs: !showButtonMobile && 'none',
99
- md: !showButtonDesktop && 'none',
109
+ xs: showButtonMobile ? undefined : 'none',
110
+ md: showButtonDesktop ? undefined : 'none',
100
111
  },
101
112
  },
102
113
  },
103
-
104
- [theme.breakpoints.down('md')]: showButtonMobile && {
105
- '& .MuiBreadcrumbs-li, & .MuiBreadcrumbs-separator': {
106
- display: 'none',
107
- [`&:nth-last-of-type(-n+${breadcrumbsAmountMobile * 2})`]: {
108
- display: 'flex',
114
+ },
115
+ !maxItems &&
116
+ showButtonMobile && {
117
+ [theme.breakpoints.down('md')]: {
118
+ '& .MuiBreadcrumbs-li, & .MuiBreadcrumbs-separator': {
119
+ display: 'none',
120
+ [`&:nth-last-of-type(-n+${effectiveBreadcrumbsAmountMobile * 2})`]: {
121
+ display: 'flex',
122
+ },
109
123
  },
110
124
  },
111
125
  },
112
-
113
- [theme.breakpoints.up('md')]: showButtonDesktop && {
114
- '& .MuiBreadcrumbs-li, & .MuiBreadcrumbs-separator': {
115
- display: 'none',
116
- [`&:nth-last-of-type(-n+${breadcrumbsAmountDesktop * 2})`]: {
117
- display: 'flex',
126
+ !maxItems &&
127
+ showButtonDesktop && {
128
+ [theme.breakpoints.up('md')]: {
129
+ '& .MuiBreadcrumbs-li, & .MuiBreadcrumbs-separator': {
130
+ display: 'none',
131
+ [`&:nth-last-of-type(-n+${breadcrumbsAmountDesktop * 2})`]: { display: 'flex' },
118
132
  },
119
133
  },
120
134
  },
135
+ // Hide the last item and its separator on mobile
136
+ hideLastOnMobile && {
137
+ [theme.breakpoints.down('md')]: {
138
+ '& .MuiBreadcrumbs-ol .MuiBreadcrumbs-li:nth-last-of-type(1)': {
139
+ display: 'none',
140
+ },
141
+ '& .MuiBreadcrumbs-ol > :nth-last-child(2)': {
142
+ display: 'none',
143
+ },
144
+ },
121
145
  },
122
- ...(Array.isArray(sx) ? sx : [sx]),
123
- ]}
146
+ sx,
147
+ )}
124
148
  >
125
149
  {!maxItems && (
126
150
  <ClickAwayListener
@@ -158,15 +182,8 @@ export function Breadcrumbs(props: BreadcrumbsProps) {
158
182
  </Box>
159
183
  </ClickAwayListener>
160
184
  )}
161
-
162
185
  {disableHome ? null : (
163
- <Link
164
- href='/'
165
- color='inherit'
166
- underline='hover'
167
- {...linkProps}
168
- sx={[...(Array.isArray(itemSx) ? itemSx : [itemSx])]}
169
- >
186
+ <Link href='/' color='inherit' underline='hover' {...linkProps} sx={sxx(itemSx)}>
170
187
  <Trans>Home</Trans>
171
188
  </Link>
172
189
  )}
@@ -177,22 +194,13 @@ export function Breadcrumbs(props: BreadcrumbsProps) {
177
194
  underline='hover'
178
195
  {...breadcrumb}
179
196
  {...linkProps}
180
- sx={[
181
- ...(Array.isArray(breadcrumb.sx) ? breadcrumb.sx : [breadcrumb.sx]),
182
- ...(Array.isArray(itemSx) ? itemSx : [itemSx]),
183
- ]}
197
+ sx={sxx(breadcrumb.sx, itemSx)}
184
198
  >
185
199
  {breadcrumb.name}
186
200
  </Link>
187
201
  ))}
188
-
189
202
  {last && (
190
- <Typography
191
- component='span'
192
- noWrap
193
- color='inherit'
194
- sx={[{ fontWeight: '600' }, ...(Array.isArray(itemSx) ? itemSx : [itemSx])]}
195
- >
203
+ <Typography component='span' noWrap color='inherit' sx={sxx({ fontWeight: '600' }, itemSx)}>
196
204
  {last.name}
197
205
  </Typography>
198
206
  )}
@@ -1,5 +1,5 @@
1
1
  import { Trans } from '@lingui/react/macro'
2
- import { alpha, Box, Link, useTheme } from '@mui/material'
2
+ import { Box, Link, useTheme } from '@mui/material'
3
3
  import type { KeyboardEvent } from 'react'
4
4
  import { useEffect, useRef } from 'react'
5
5
  import type { BreadcrumbsType } from './types'
@@ -34,7 +34,7 @@ export function BreadcrumbsList(props: PopperBreadcrumbsListProps) {
34
34
  ref={listRef}
35
35
  onKeyDown={handleKeyDown}
36
36
  tabIndex={-1}
37
- sx={{
37
+ sx={(theme) => ({
38
38
  backgroundColor: 'background.paper',
39
39
  borderRadius: 3,
40
40
  boxShadow: 12,
@@ -56,7 +56,7 @@ export function BreadcrumbsList(props: PopperBreadcrumbsListProps) {
56
56
  },
57
57
  },
58
58
  },
59
- }}
59
+ })}
60
60
  >
61
61
  <Link
62
62
  href='/'
@@ -66,13 +66,13 @@ export function BreadcrumbsList(props: PopperBreadcrumbsListProps) {
66
66
  noWrap
67
67
  onClick={onClose}
68
68
  tabIndex={0}
69
- sx={{
69
+ sx={(theme) => ({
70
70
  flex: 1,
71
71
  padding: `calc(${theme.spacings.xxs} / 2) ${theme.spacings.xs}`,
72
72
  '&:hover': {
73
- backgroundColor: alpha(theme.palette.action.hover, 0.025),
73
+ backgroundColor: theme.alpha(theme.vars.palette.action.hover, 0.025),
74
74
  },
75
- }}
75
+ })}
76
76
  >
77
77
  <Trans>Home</Trans>
78
78
  </Link>
@@ -86,13 +86,13 @@ export function BreadcrumbsList(props: PopperBreadcrumbsListProps) {
86
86
  noWrap
87
87
  onClick={onClose}
88
88
  tabIndex={0}
89
- sx={{
89
+ sx={(theme) => ({
90
90
  flex: 1,
91
91
  padding: `calc(${theme.spacings.xxs} / 2) ${theme.spacings.xs}`,
92
92
  '&:hover': {
93
- backgroundColor: alpha(theme.palette.action.hover, 0.025),
93
+ backgroundColor: theme.alpha(theme.vars.palette.action.hover, 0.025),
94
94
  },
95
- }}
95
+ })}
96
96
  >
97
97
  {breadcrumb.name}
98
98
  </Link>
package/Button/Button.tsx CHANGED
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable react/forbid-foreign-prop-types */
2
- import type { LoadingButtonProps, LoadingButtonTypeMap } from '@mui/lab'
3
- import { LoadingButton as Button } from '@mui/lab'
2
+ import type { ButtonTypeMap, ButtonProps as MuiButtonProps } from '@mui/material'
3
+ import { Button } from '@mui/material'
4
4
 
5
5
  export type ButtonProps<
6
- D extends React.ElementType = LoadingButtonTypeMap['defaultComponent'],
6
+ D extends React.ElementType = ButtonTypeMap['defaultComponent'],
7
7
  P = object,
8
- > = LoadingButtonProps<D, P>
8
+ > = MuiButtonProps<D, P>
9
9
 
10
10
  export { Button }
@@ -1,3 +1,4 @@
1
+ import { sxx } from '@graphcommerce/next-ui'
1
2
  import type { Breakpoint, LinkProps } from '@mui/material'
2
3
  import { Link, useForkRef } from '@mui/material'
3
4
  import React, { useRef } from 'react'
@@ -60,15 +61,15 @@ export const LinkOrButton = React.forwardRef<
60
61
  color={color}
61
62
  loading={loading}
62
63
  disabled={disabled}
63
- sx={[
64
+ sx={sxx(
64
65
  {
65
66
  display: {
66
67
  xs: 'none',
67
68
  [breakpoint]: 'inline-flex',
68
69
  },
69
70
  },
70
- ...(Array.isArray(buttonSx) ? buttonSx : [buttonSx]),
71
- ]}
71
+ buttonSx,
72
+ )}
72
73
  >
73
74
  {children}
74
75
  </Button>
@@ -81,18 +82,18 @@ export const LinkOrButton = React.forwardRef<
81
82
  {...link}
82
83
  color={loading || disabled ? 'action.disabled' : color}
83
84
  aria-disabled={loading || disabled}
84
- sx={[
85
+ sx={sxx(
85
86
  {
86
87
  display: { xs: 'inline-flex', [breakpoint]: 'none' },
87
88
  alignItems: 'center',
88
89
  },
89
90
  !!disabled &&
90
91
  ((theme) => ({
91
- opacity: theme.palette.action.disabledOpacity,
92
+ opacity: theme.vars.palette.action.disabledOpacity,
92
93
  pointerEvents: 'none',
93
94
  })),
94
- ...(Array.isArray(linkSx) ? linkSx : [linkSx]),
95
- ]}
95
+ linkSx,
96
+ )}
96
97
  >
97
98
  {startIcon}
98
99
  <span>{children}</span>
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.0.0-canary.68
4
+
5
+ ### Major Changes
6
+
7
+ - [#2557](https://github.com/graphcommerce-org/graphcommerce/pull/2557) [`ceaadd8`](https://github.com/graphcommerce-org/graphcommerce/commit/ceaadd87f0648982a068a3b07b1fa149c9127f49) - ## Material UI v5 → v7 Migration
8
+
9
+ This release upgrades Material UI from v5 to v7 with full CSS variables support. ([@paales](https://github.com/paales))
10
+
11
+ ## 10.0.0-canary.67
12
+
3
13
  ## 10.0.0-canary.66
4
14
 
5
15
  ## 10.0.0-canary.65