@graphcommerce/next-ui 4.2.5 → 4.3.0

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.
@@ -42,34 +42,46 @@ export const LinkOrButton = React.forwardRef<
42
42
  const buttonRef = useForkRef(ref, useRef(null))
43
43
  const linkRef = useForkRef(ref, useRef(null))
44
44
 
45
+ const buttonSx = button?.sx ?? []
46
+ const linkSx = link?.sx ?? []
45
47
  return (
46
48
  <>
47
49
  <Button
48
- sx={{ display: { xs: 'none', [breakpoint]: 'inline-flex' }, ...button?.sx }}
49
- ref={buttonRef}
50
50
  startIcon={startIcon}
51
51
  endIcon={endIcon}
52
- color={color}
53
- loading={loading}
54
52
  {...sharedProps}
55
53
  {...button}
54
+ ref={buttonRef}
55
+ color={color}
56
+ loading={loading}
57
+ sx={[
58
+ {
59
+ display: {
60
+ xs: 'none',
61
+ [breakpoint]: 'inline-flex',
62
+ },
63
+ },
64
+ ...(Array.isArray(buttonSx) ? buttonSx : [buttonSx]),
65
+ ]}
56
66
  >
57
67
  {children}
58
68
  </Button>
59
69
 
60
70
  <Link
61
- sx={{
62
- display: { xs: 'inline-flex', [breakpoint]: 'none' },
63
- alignItems: 'center',
64
- ...link?.sx,
65
- }}
66
71
  ref={linkRef}
67
- color={loading ? 'text.disabled' : color}
68
72
  underline='none'
69
- aria-disabled={loading}
70
73
  variant='body2'
71
74
  {...sharedProps}
72
75
  {...link}
76
+ color={loading ? 'text.disabled' : color}
77
+ aria-disabled={loading}
78
+ sx={[
79
+ {
80
+ display: { xs: 'inline-flex', [breakpoint]: 'none' },
81
+ alignItems: 'center',
82
+ },
83
+ ...(Array.isArray(linkSx) ? linkSx : [linkSx]),
84
+ ]}
73
85
  >
74
86
  {startIcon}
75
87
  <span>{children}</span>
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1322](https://github.com/graphcommerce-org/graphcommerce/pull/1322) [`0298a0de1`](https://github.com/graphcommerce-org/graphcommerce/commit/0298a0de1d13e543c4124a6a099297b4e27e2b05) Thanks [@paales](https://github.com/paales)! - Added `<Slider size='large' />` and made styling with variants
8
+
9
+ * [#1322](https://github.com/graphcommerce-org/graphcommerce/pull/1322) [`3326742a0`](https://github.com/graphcommerce-org/graphcommerce/commit/3326742a0dceb45f0cac4741ca09dc4d4f09ad90) Thanks [@paales](https://github.com/paales)! - Added ‘scrolled’ state to MenuFab to allow for extra styling: `'&.scrolled': {}`
10
+
11
+ - [#1322](https://github.com/graphcommerce-org/graphcommerce/pull/1322) [`7a3799bfc`](https://github.com/graphcommerce-org/graphcommerce/commit/7a3799bfc107f26aa9991a91db5f228e3476f4aa) Thanks [@paales](https://github.com/paales)! - Make CartFab and MenuFab’s color, size and variant passable by props
12
+
13
+ ### Patch Changes
14
+
15
+ - [#1322](https://github.com/graphcommerce-org/graphcommerce/pull/1322) [`5266388ea`](https://github.com/graphcommerce-org/graphcommerce/commit/5266388eaffda41592623ef7a3ddbbe03c8e0dad) Thanks [@paales](https://github.com/paales)! - make sure there is no background on darkmode above the image in ImageText
16
+
17
+ * [#1322](https://github.com/graphcommerce-org/graphcommerce/pull/1322) [`9b35403d9`](https://github.com/graphcommerce-org/graphcommerce/commit/9b35403d9dbb2606ac7cf3bb641a0f9cc3d8a2ba) Thanks [@paales](https://github.com/paales)! - MenuFab darkmode doesn’t need elevationcolor
18
+
19
+ - [#1322](https://github.com/graphcommerce-org/graphcommerce/pull/1322) [`815132ea4`](https://github.com/graphcommerce-org/graphcommerce/commit/815132ea43937b4b84b59ec9974ac593cb4eb456) Thanks [@paales](https://github.com/paales)! - Make sure canonicals don’t report about double slashes and add warning when incorrect URL is passed
20
+
21
+ * [#1322](https://github.com/graphcommerce-org/graphcommerce/pull/1322) [`9a77f88ed`](https://github.com/graphcommerce-org/graphcommerce/commit/9a77f88ed26cbecdae9a135c3cb234a5b7ecf4df) Thanks [@paales](https://github.com/paales)! - Reduce footer spacing
22
+
23
+ - [#1322](https://github.com/graphcommerce-org/graphcommerce/pull/1322) [`0eeaad304`](https://github.com/graphcommerce-org/graphcommerce/commit/0eeaad30461b1d5b486438f0287fa76d49429044) Thanks [@paales](https://github.com/paales)! - LayoutHeaderBack should be a round button on mobile
24
+
25
+ * [#1322](https://github.com/graphcommerce-org/graphcommerce/pull/1322) [`bc5213547`](https://github.com/graphcommerce-org/graphcommerce/commit/bc52135471479c83d989449dad24798112e898f4) Thanks [@paales](https://github.com/paales)! - make sure LinkOrButton sx props do not break styling
26
+
27
+ - [#1322](https://github.com/graphcommerce-org/graphcommerce/pull/1322) [`3f1912f55`](https://github.com/graphcommerce-org/graphcommerce/commit/3f1912f553318d5888f8af2b841918ef4ae96a84) Thanks [@paales](https://github.com/paales)! - Button in MessageSnackbarImpl wasn't full width
28
+
29
+ * [#1322](https://github.com/graphcommerce-org/graphcommerce/pull/1322) [`b6c68cda8`](https://github.com/graphcommerce-org/graphcommerce/commit/b6c68cda8836a1d0c78ef351899cec9ec1037385) Thanks [@paales](https://github.com/paales)! - LayoutOverlay had a very large spacing below the content
30
+
31
+ * Updated dependencies [[`1e2a07141`](https://github.com/graphcommerce-org/graphcommerce/commit/1e2a071414154600430e6dcf0513d86ab78e0b28), [`d91359871`](https://github.com/graphcommerce-org/graphcommerce/commit/d91359871b023a9f0d305b37353c1ee2d0912248), [`bec88d0d7`](https://github.com/graphcommerce-org/graphcommerce/commit/bec88d0d70b679e15150917df89986ecee5b39a6)]:
32
+ - @graphcommerce/framer-scroller@2.1.0
33
+ - @graphcommerce/framer-utils@3.0.5
34
+
3
35
  ## 4.2.5
4
36
 
5
37
  ### Patch Changes
@@ -2,13 +2,12 @@ import { Chip, ChipProps, Menu, MenuProps, menuClasses, SxProps, Theme } from '@
2
2
  import React, { PropsWithChildren, useState } from 'react'
3
3
  import { IconSvg } from '../IconSvg'
4
4
  import { SectionHeader } from '../SectionHeader/SectionHeader'
5
- import { extendableComponent } from '../Styles'
6
5
  import { responsiveVal } from '../Styles/responsiveVal'
7
6
  import { iconChevronDown, iconChevronUp, iconCancelAlt } from '../icons'
8
7
 
9
- const { classes, selectors } = extendableComponent('FilterEqual', ['chip'] as const)
10
-
11
- export type ChipMenuProps = PropsWithChildren<Omit<ChipProps, 'children'>> & {
8
+ export type ChipMenuProps = PropsWithChildren<
9
+ Omit<ChipProps<'button'>, 'children' | 'component'>
10
+ > & {
12
11
  selectedLabel?: React.ReactNode
13
12
  selected: boolean
14
13
  onClose?: () => void
@@ -41,35 +40,21 @@ export function ChipMenu(props: ChipMenuProps) {
41
40
  return (
42
41
  <>
43
42
  <Chip
44
- color='default'
43
+ component='button'
44
+ size='responsive'
45
+ color={selectedAndMenuHidden ? 'primary' : 'default'}
45
46
  clickable
46
47
  onDelete={
47
- onDelete || ((event: React.MouseEvent) => setOpenEl(event.currentTarget.parentElement))
48
+ onDelete ||
49
+ ((event: React.MouseEvent<HTMLButtonElement>) =>
50
+ setOpenEl(event.currentTarget.parentElement))
48
51
  }
49
- onClick={(event) => {
52
+ onClick={(event: React.MouseEvent<HTMLButtonElement>) => {
50
53
  setOpenEl(event.currentTarget)
51
54
  }}
52
55
  deleteIcon={deleteIcon}
53
56
  {...chipProps}
54
57
  label={selectedLabel ?? label}
55
- className={`${classes.chip} ${chipProps.className ?? ''} ${
56
- selectedAndMenuHidden ? 'MuiChip-selected' : ''
57
- }`}
58
- sx={[
59
- { bgcolor: 'background.default' },
60
- selectedAndMenuHidden &&
61
- ((theme) => ({
62
- borderColor: 'text.primary',
63
- color: 'text.primary',
64
- '&:hover': {
65
- background: `${theme.palette.background.default} !important`,
66
- borderColor: `${theme.palette.divider} !important`,
67
- },
68
- '&:focus': {
69
- background: `${theme.palette.background.paper} !important`,
70
- },
71
- })),
72
- ]}
73
58
  />
74
59
 
75
60
  <Menu
@@ -112,5 +97,3 @@ export function ChipMenu(props: ChipMenuProps) {
112
97
  </>
113
98
  )
114
99
  }
115
-
116
- ChipMenu.selectors = selectors
package/Footer/Footer.tsx CHANGED
@@ -35,23 +35,22 @@ export function Footer(props: FooterProps) {
35
35
  borderTop: `1px solid ${theme.palette.divider}`,
36
36
  display: 'grid',
37
37
  alignItems: 'center',
38
-
39
38
  padding: `${theme.spacings.lg} ${theme.page.horizontal} ${theme.page.vertical}`,
40
39
  justifyItems: 'center',
41
40
  gridTemplateAreas: `
42
- 'switcher switcher'
43
- 'support support'
44
- 'social social'
45
- 'links links'
46
- `,
47
- gap: theme.spacings.md,
41
+ 'switcher switcher'
42
+ 'support support'
43
+ 'social social'
44
+ 'links links'
45
+ `,
46
+ gap: theme.spacings.sm,
48
47
  '& > *': { maxWidth: 'max-content' },
49
48
 
50
49
  [theme.breakpoints.up('sm')]: {
51
50
  gridTemplateAreas: `
52
- 'social switcher'
53
- 'links support'
54
- `,
51
+ 'social switcher'
52
+ 'links support'
53
+ `,
55
54
  justifyItems: 'start',
56
55
  padding: `${theme.page.vertical} ${theme.page.horizontal}`,
57
56
  gridTemplateColumns: 'auto auto',
@@ -1,10 +1,11 @@
1
1
  import { useUp, usePrevUp, usePageContext } from '@graphcommerce/framer-next-pages'
2
2
  import { t } from '@lingui/macro'
3
- import { Box } from '@mui/material'
3
+ import { Box, SxProps, Theme } from '@mui/material'
4
4
  import PageLink from 'next/link'
5
5
  import { useRouter } from 'next/router'
6
6
  import { LinkOrButton, LinkOrButtonProps } from '../../Button/LinkOrButton'
7
7
  import { IconSvg } from '../../IconSvg'
8
+ import { responsiveVal } from '../../Styles'
8
9
  import { iconChevronLeft } from '../../icons'
9
10
 
10
11
  export type BackProps = Omit<LinkOrButtonProps, 'onClick' | 'children'>
@@ -22,6 +23,19 @@ export function useShowBack() {
22
23
  return false
23
24
  }
24
25
 
26
+ const buttonSx: SxProps<Theme> = (theme) => ({
27
+ '&:not(.Mui-disabled)': { boxShadow: 6 },
28
+ [theme.breakpoints.down('md')]: {
29
+ minWidth: 'auto',
30
+ paddingLeft: responsiveVal(8, 11),
31
+ paddingRight: responsiveVal(8, 11),
32
+ '& .MuiButton-startIcon': {
33
+ marginRight: 0,
34
+ marginLeft: 0,
35
+ },
36
+ },
37
+ })
38
+
25
39
  export function LayoutHeaderBack(props: BackProps) {
26
40
  const router = useRouter()
27
41
  const path = router.asPath.split('?')[0]
@@ -40,7 +54,7 @@ export function LayoutHeaderBack(props: BackProps) {
40
54
  return (
41
55
  <LinkOrButton
42
56
  onClick={() => router.back()}
43
- button={{ variant: 'pill' }}
57
+ button={{ variant: 'pill', sx: buttonSx }}
44
58
  color='inherit'
45
59
  startIcon={backIcon}
46
60
  aria-label={label}
@@ -57,7 +71,7 @@ export function LayoutHeaderBack(props: BackProps) {
57
71
  return (
58
72
  <PageLink href={up.href} passHref>
59
73
  <LinkOrButton
60
- button={{ variant: 'pill' }}
74
+ button={{ variant: 'pill', sx: buttonSx }}
61
75
  startIcon={backIcon}
62
76
  aria-label={up.title}
63
77
  color='inherit'
@@ -341,7 +341,7 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
341
341
  * padding we'll run into the issue that the user can't scroll to the bottom. We
342
342
  * can't change this value with JS as that causes much jank
343
343
  */
344
- '&.sizeSmFull, &.sizeSmMinimal': { paddingBottom: 56 },
344
+ '&.sizeSmFull, &.sizeSmMinimal': { paddingBottom: '56px' },
345
345
  '&.variantSmBottom.sizeSmFull': {
346
346
  minHeight: `calc(100vh - ${theme.appShell.headerHeightSm} * 0.5)`,
347
347
  },
@@ -1,6 +1,6 @@
1
1
  import { Badge, BadgeProps } from '@mui/material'
2
2
 
3
- // todo: replace with theming
3
+ /** Note: This should _only_ be used on the Desktop, use a standard Badge for other usecases. */
4
4
  export function DesktopHeaderBadge(props: BadgeProps) {
5
5
  const { sx = false } = props
6
6
  return (
@@ -1,8 +1,21 @@
1
- import { Divider, Fab, ListItem, Menu, styled, Box, SxProps, Theme } from '@mui/material'
1
+ import { useMotionValueValue } from '@graphcommerce/framer-utils'
2
+ import {
3
+ Divider,
4
+ Fab,
5
+ ListItem,
6
+ Menu,
7
+ styled,
8
+ Box,
9
+ SxProps,
10
+ Theme,
11
+ FabProps,
12
+ MenuProps as MenuPropsType,
13
+ } from '@mui/material'
2
14
  import { m } from 'framer-motion'
3
15
  import { useRouter } from 'next/router'
4
16
  import React, { useEffect } from 'react'
5
17
  import { IconSvg } from '../IconSvg'
18
+ import { useScrollY } from '../Layout/hooks/useScrollY'
6
19
  import { extendableComponent } from '../Styles/extendableComponent'
7
20
  import { responsiveVal } from '../Styles/responsiveVal'
8
21
  import { useFabSize } from '../Theme'
@@ -18,21 +31,34 @@ export type MenuFabProps = {
18
31
  menuIcon?: React.ReactNode
19
32
  closeIcon?: React.ReactNode
20
33
  sx?: SxProps<Theme>
34
+ MenuProps?: MenuPropsType
35
+ } & Pick<FabProps, 'color' | 'size' | 'variant'>
36
+
37
+ const name = 'MenuFab'
38
+ const parts = ['wrapper', 'fab', 'shadow', 'menu'] as const
39
+ type OwnerState = {
40
+ scrolled: boolean
21
41
  }
22
42
 
23
- const { classes, selectors } = extendableComponent('MenuFab', [
24
- 'wrapper',
25
- 'fab',
26
- 'shadow',
27
- 'menu',
28
- ] as const)
43
+ const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
29
44
 
30
45
  export function MenuFab(props: MenuFabProps) {
31
- const { children, secondary, search, menuIcon, closeIcon, sx = [] } = props
46
+ const {
47
+ children,
48
+ secondary,
49
+ search,
50
+ menuIcon,
51
+ closeIcon,
52
+ sx = [],
53
+ MenuProps,
54
+ ...fabProps
55
+ } = props
32
56
  const router = useRouter()
33
57
  const [openEl, setOpenEl] = React.useState<null | HTMLElement>(null)
34
58
 
35
59
  const { opacity, scale, shadowOpacity } = useFabAnimation()
60
+ const scrollY = useScrollY()
61
+ const scrolled = useMotionValueValue(scrollY, (y) => y > 10)
36
62
 
37
63
  useEffect(() => {
38
64
  const clear = () => setOpenEl(null)
@@ -41,8 +67,15 @@ export function MenuFab(props: MenuFabProps) {
41
67
  }, [router])
42
68
  const fabIconSize = useFabSize('responsive')
43
69
 
70
+ const classes = withState({ scrolled })
71
+
44
72
  return (
45
- <Box sx={[{ width: fabIconSize, height: fabIconSize }, ...(Array.isArray(sx) ? sx : [sx])]}>
73
+ <Box
74
+ sx={[
75
+ { position: 'relative', width: fabIconSize, height: fabIconSize },
76
+ ...(Array.isArray(sx) ? sx : [sx]),
77
+ ]}
78
+ >
46
79
  <MotionDiv
47
80
  className={classes.wrapper}
48
81
  sx={(theme) => ({
@@ -54,6 +87,8 @@ export function MenuFab(props: MenuFabProps) {
54
87
  style={{ scale, opacity }}
55
88
  >
56
89
  <Fab
90
+ // todo: replace color='inverted' and remove styles here when Fab color is extendable
91
+ // https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Fab/Fab.js#L193-L202
57
92
  color='inherit'
58
93
  aria-label='Open Menu'
59
94
  onClick={(event) => setOpenEl(event.currentTarget)}
@@ -69,6 +104,7 @@ export function MenuFab(props: MenuFabProps) {
69
104
  color: theme.palette.background.paper,
70
105
  })}
71
106
  className={classes.fab}
107
+ {...fabProps}
72
108
  >
73
109
  {closeIcon ?? (
74
110
  <IconSvg src={iconClose} size='large' sx={{ display: openEl ? 'block' : 'none' }} />
@@ -102,6 +138,7 @@ export function MenuFab(props: MenuFabProps) {
102
138
  PaperProps={{
103
139
  sx: (theme) => ({
104
140
  backgroundColor: theme.palette.background.paper,
141
+ backgroundImage: 'unset',
105
142
  color: theme.palette.text.primary,
106
143
  minWidth: responsiveVal(200, 280),
107
144
  marginTop: '12px',
@@ -112,6 +149,7 @@ export function MenuFab(props: MenuFabProps) {
112
149
  }}
113
150
  className={classes.menu}
114
151
  MenuListProps={{ dense: true }}
152
+ {...MenuProps}
115
153
  >
116
154
  {[
117
155
  search ? (
@@ -128,4 +166,3 @@ export function MenuFab(props: MenuFabProps) {
128
166
  </Box>
129
167
  )
130
168
  }
131
- MenuFab.selectors = selectors
@@ -37,7 +37,16 @@ export function useCanonical(incomming?: Canonical) {
37
37
 
38
38
  if (!canonical) return canonical
39
39
 
40
- if (canonical?.startsWith('/')) {
40
+ if (!canonical.startsWith('http') && !canonical.startsWith('/')) {
41
+ if (process.env.NODE_ENV !== 'production') {
42
+ console.warn(
43
+ `canonical is relative (${canonical}), a canonical must start with '/', 'http://' or 'https://'`,
44
+ )
45
+ }
46
+ canonical = `/${canonical}`
47
+ }
48
+
49
+ if (canonical.startsWith('/')) {
41
50
  if (!process.env.NEXT_PUBLIC_SITE_URL) {
42
51
  if (process.env.NODE_ENV !== 'production') {
43
52
  throw Error('NEXT_PUBLIC_SITE_URL is not defined in .env')
@@ -59,7 +68,7 @@ export function useCanonical(incomming?: Canonical) {
59
68
  canonical = `${process.env.NEXT_PUBLIC_SITE_URL}${href}`
60
69
  }
61
70
 
62
- if (canonical && !(canonical ?? 'http').startsWith('http')) {
71
+ if (!canonical.startsWith('http')) {
63
72
  if (process.env.NODE_ENV !== 'production') {
64
73
  throw new Error(
65
74
  `canonical must start with '/', 'http://' or 'https://', '${canonical}' given`,
@@ -29,7 +29,7 @@ export function ImageText(props: ImageTextProps) {
29
29
  : theme.palette.background.paper,
30
30
  justifyItems: 'center',
31
31
  columnGap: theme.spacings.lg,
32
- paddingTop: theme.spacings.lg,
32
+ marginTop: theme.spacings.lg,
33
33
  paddingBottom: theme.spacings.lg,
34
34
  [theme.breakpoints.up('md')]: {
35
35
  paddingTop: 0,
@@ -25,16 +25,16 @@ export function StarRatingField(props: StarRatingFieldProps) {
25
25
  <IconSvg
26
26
  src={iconStar}
27
27
  size='large'
28
- className={classes.startEmpty}
29
- sx={{ fill: '#FFDA1C', stroke: 'none', margin: '0 3px' }}
28
+ className={classes.starFull}
29
+ sx={(theme) => ({ fill: theme.palette.divider, stroke: 'none', margin: '0 3px' })}
30
30
  />
31
31
  }
32
32
  icon={
33
33
  <IconSvg
34
34
  src={iconStar}
35
35
  size='large'
36
- className={classes.starFull}
37
- sx={(theme) => ({ fill: theme.palette.divider, stroke: 'none', margin: '0 3px' })}
36
+ className={classes.startEmpty}
37
+ sx={{ fill: '#FFDA1C', stroke: 'none', margin: '0 3px' }}
38
38
  />
39
39
  }
40
40
  onChange={(event, value) => {
@@ -0,0 +1,86 @@
1
+ import { ComponentsVariants, darken, experimental_sx as sx } from '@mui/material'
2
+ import { responsiveVal } from '../Styles'
3
+
4
+ declare module '@mui/material/Chip/Chip' {
5
+ interface ChipPropsSizeOverrides {
6
+ responsive: true
7
+ }
8
+ interface ChipPropsVariantOverrides {
9
+ ['outlinedHighlighted']: true
10
+ }
11
+ }
12
+
13
+ type ChipVariants = NonNullable<ComponentsVariants['MuiChip']>
14
+
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
+ export const MuiChip: ChipVariants = [
17
+ {
18
+ props: {},
19
+ style: { '& .MuiChip-icon': { fontSize: '1.3em' } },
20
+ },
21
+ {
22
+ props: { size: 'small' },
23
+ style: sx({
24
+ typography: 'caption',
25
+ }),
26
+ },
27
+ {
28
+ props: { size: 'medium' },
29
+ style: sx({
30
+ height: responsiveVal(26, 30),
31
+ paddingLeft: responsiveVal(3, 6),
32
+ paddingRight: responsiveVal(3, 6),
33
+ typography: 'caption',
34
+ }),
35
+ },
36
+ {
37
+ props: { size: 'responsive' },
38
+ style: sx({
39
+ height: responsiveVal(32, 40),
40
+ paddingLeft: responsiveVal(4, 8),
41
+ paddingRight: responsiveVal(4, 8),
42
+ borderRadius: '99em',
43
+ typography: 'body2',
44
+ '& .MuiChip-label': {
45
+ paddingLeft: responsiveVal(6, 10),
46
+ paddingRight: responsiveVal(6, 10),
47
+ },
48
+ }),
49
+ },
50
+ {
51
+ props: { variant: 'outlined' },
52
+ style: ({ theme }) => ({
53
+ borderColor: theme.palette.divider,
54
+ backgroundColor: theme.palette.background.default,
55
+ '&:active': {
56
+ boxShadow: 'none',
57
+ },
58
+ '& .MuiChip-deleteIcon': {
59
+ color: theme.palette.text.primary,
60
+ },
61
+ '&.MuiChip-clickable:hover': {
62
+ backgroundColor: darken(theme.palette.background.default, 0.05),
63
+ },
64
+ '& .MuiChip-deleteIcon:hover': {
65
+ color: theme.palette.text.primary,
66
+ },
67
+ }),
68
+ },
69
+ {
70
+ props: { color: 'primary' },
71
+ style: ({ theme }) => ({
72
+ borderColor: theme.palette.text.primary,
73
+ color: theme.palette.text.primary,
74
+ '&:hover': {
75
+ background: `${theme.palette.background.default} !important`,
76
+ borderColor: `${theme.palette.divider} !important`,
77
+ },
78
+ '&:focus': {
79
+ background: `${theme.palette.background.paper} !important`,
80
+ },
81
+ '& .MuiChip-deleteIcon:hover': {
82
+ color: theme.palette.text.primary,
83
+ },
84
+ }),
85
+ },
86
+ ]
package/Theme/MuiFab.ts CHANGED
@@ -44,6 +44,11 @@ declare module '@mui/material/Fab/Fab' {
44
44
  interface FabPropsSizeOverrides {
45
45
  responsive: true
46
46
  }
47
+ // todo: Wait for the color prop to be exendable and then add inverted
48
+ // https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Fab/Fab.js#L193-L202
49
+ // interface FabPropsColorOverrides {
50
+ // inverted: true
51
+ // }
47
52
  }
48
53
 
49
54
  function fabWidthHeight(size: FabSize, theme: Theme) {
@@ -67,3 +72,19 @@ export const MuiFabSizes: FabVariants = sizes.map((size) => ({
67
72
  props: { size },
68
73
  style: ({ theme }) => fabWidthHeight(size, theme),
69
74
  }))
75
+
76
+ // todo: Wait for the color prop to be exendable and add tho theme.
77
+ // https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Fab/Fab.js#L193-L202
78
+ // export const MuiFabInverted: FabVariants = [
79
+ // {
80
+ // props: { color: 'inverted' },
81
+ // style: ({ theme }) => ({
82
+ // boxShadow: 'none',
83
+ // '&:hover, &:focus': {
84
+ // background: theme.palette.text.primary,
85
+ // },
86
+ // background: theme.palette.text.primary,
87
+ // color: theme.palette.background.paper,
88
+ // }),
89
+ // },
90
+ // ]
@@ -1,29 +1,43 @@
1
- import { Components, Theme } from '@mui/material'
1
+ import { ComponentsVariants } from '@mui/material'
2
2
 
3
- /**
4
- * Not yet possible to define a size="large" for the Slider due to a limitation in Material-UI
5
- * https://github.com/mui-org/material-ui/issues/27130#issuecomment-1006425575
6
- *
7
- * If that has been fixed most of the styles can be removed here:
8
- * packages/magento-product/components/ProductListFilters/FilterRangeType.tsx
9
- */
10
-
11
- // declare module '@mui/material/Slider' {
12
- // interface SliderPropsSizeOverrides {
13
- // large: true
14
- // }
15
- // }
3
+ declare module '@mui/material/Slider/Slider' {
4
+ interface SliderPropsSizeOverrides {
5
+ large: true
6
+ }
7
+ }
8
+ type SliderVariants = NonNullable<ComponentsVariants['MuiSlider']>
16
9
 
17
10
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
18
- export const MuiSlider = (theme: Theme): Components['MuiSlider'] => ({
19
- // variants: [
20
- // {
21
- // props: { size: 'large' },
22
- // style: {
23
- // '& .MuiSlider-rail': { height: 4, borderRadius: '2px' },
24
- // '& .MuiSlider-track': { height: 4 },
25
- // '& .MuiSlider-thumb': { width: 28, height: 28 },
26
- // },
27
- // },
28
- // ],
29
- })
11
+ export const MuiSlider: SliderVariants = [
12
+ {
13
+ props: {},
14
+ style: ({ theme }) => ({
15
+ '& .MuiSlider-rail': {
16
+ color: theme.palette.text.disabled,
17
+ },
18
+ '& .MuiSlider-thumb': {
19
+ background: theme.palette.background.default,
20
+ boxShadow: theme.shadows[6],
21
+ },
22
+ }),
23
+ },
24
+ {
25
+ props: { size: 'large' },
26
+ style: {
27
+ maxWidth: `calc(100% - 28px)`,
28
+ margin: `0 auto`,
29
+ display: 'block',
30
+ '& .MuiSlider-rail': {
31
+ height: 4,
32
+ borderRadius: '2px',
33
+ },
34
+ '& .MuiSlider-track': {
35
+ height: 4,
36
+ },
37
+ '& .MuiSlider-thumb': {
38
+ width: '28px',
39
+ height: '28px',
40
+ },
41
+ },
42
+ },
43
+ ]
package/Theme/index.ts CHANGED
@@ -1,6 +1,7 @@
1
- export * from './MuiSlider'
1
+ export * from './DarkLightModeThemeProvider'
2
2
  export * from './MuiButton'
3
- export * from './MuiSnackbar'
3
+ export * from './MuiChip'
4
4
  export * from './MuiFab'
5
+ export * from './MuiSlider'
6
+ export * from './MuiSnackbar'
5
7
  export * from './themeDefaults'
6
- export * from './DarkLightModeThemeProvider'
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": "4.2.5",
5
+ "version": "4.3.0",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "sideEffects": false,
@@ -20,8 +20,8 @@
20
20
  "@emotion/server": "^11.4.0",
21
21
  "@emotion/styled": "^11.6.0",
22
22
  "@graphcommerce/framer-next-pages": "^3.1.2",
23
- "@graphcommerce/framer-scroller": "^2.0.6",
24
- "@graphcommerce/framer-utils": "^3.0.4",
23
+ "@graphcommerce/framer-scroller": "^2.1.0",
24
+ "@graphcommerce/framer-utils": "^3.0.5",
25
25
  "@graphcommerce/image": "^3.1.1",
26
26
  "react-is": "^17.0.2",
27
27
  "react-schemaorg": "^2.0.0",