@graphcommerce/next-ui 6.0.0-canary.31 → 6.0.0-canary.33

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.
@@ -1,8 +1,7 @@
1
1
  import { alpha, Box, BoxProps, ButtonBase, ButtonProps, SxProps, Theme } from '@mui/material'
2
2
  import React from 'react'
3
- import { extendableComponent } from '../Styles'
3
+ import { extendableComponent, responsiveVal } from '../Styles'
4
4
  import { breakpointVal } from '../Styles/breakpointVal'
5
- import { responsiveVal } from '../Styles/responsiveVal'
6
5
 
7
6
  type Variants = 'outlined' | 'default'
8
7
  type Size = 'large' | 'medium' | 'small'
@@ -110,42 +109,72 @@ export function ActionCard(props: ActionCardProps) {
110
109
  (theme) => ({
111
110
  ...breakpointVal(
112
111
  'borderRadius',
112
+ theme.shape.borderRadius * 1.5,
113
113
  theme.shape.borderRadius * 3,
114
- theme.shape.borderRadius * 4,
115
114
  theme.breakpoints.values,
116
115
  ),
117
116
 
118
117
  '&.sizeSmall': {
119
118
  px: responsiveVal(8, 12),
120
- py: responsiveVal(6, 8),
119
+ py: responsiveVal(4, 6),
121
120
  display: 'flex',
122
121
  typography: 'body2',
123
122
  },
124
123
  '&.sizeMedium': {
125
- px: responsiveVal(10, 16),
126
- py: responsiveVal(8, 14),
124
+ px: responsiveVal(10, 14),
125
+ py: responsiveVal(10, 12),
127
126
  typography: 'body2',
128
127
  display: 'block',
129
128
  },
130
129
  '&.sizeLarge': {
131
- px: theme.spacings.xs,
132
- py: theme.spacings.xxs,
130
+ px: responsiveVal(12, 16),
131
+ py: responsiveVal(12, 14),
133
132
  display: 'block',
134
133
  },
135
134
 
136
135
  '&.variantDefault': {
137
- borderRadius: 0,
138
- px: 0,
139
- borderBottom: `1px solid ${theme.palette.divider}`,
136
+ '&::after': {
137
+ content: '""',
138
+ display: 'block',
139
+ position: 'absolute',
140
+ width: '100%',
141
+ left: 0,
142
+ bottom: '-1px',
143
+ borderBottom: `1px solid ${theme.palette.divider}`,
144
+ },
140
145
  '&.selected': {
141
- borderBottom: `2px solid ${theme.palette[color].main}`,
142
- marginBottom: '-1px',
143
- backgroundColor: `${theme.palette[color].main}10`,
146
+ backgroundColor: `${alpha(
147
+ theme.palette[color].main,
148
+ theme.palette.action.hoverOpacity,
149
+ )}`,
144
150
  },
145
151
  '&.error': {
146
- borderBottom: `2px solid ${theme.palette.error.main}`,
147
- marginBottom: '-1px',
148
- backgroundColor: `${theme.palette.error.main}10`,
152
+ backgroundColor: `${alpha(
153
+ theme.palette.error.main,
154
+ theme.palette.action.hoverOpacity,
155
+ )}`,
156
+ },
157
+
158
+ '&.variantDefault.sizeSmall': {
159
+ mt: { xs: '2px', sm: '3px', md: '5px' },
160
+ mb: { xs: '3px', sm: '4px', md: '6px' },
161
+ '&::after': {
162
+ mb: { xs: '-2px', sm: '-3px', md: '-5px' },
163
+ },
164
+ },
165
+ '&.variantDefault.sizeMedium': {
166
+ mt: { xs: '4px', sm: '5px', md: '6px' },
167
+ mb: { xs: '5px', sm: '6px', md: '7px' },
168
+ '&::after': {
169
+ mb: { xs: '-4px', sm: '-5px', md: '-6px' },
170
+ },
171
+ },
172
+ '&.variantDefault.sizeLarge': {
173
+ mt: { xs: '5px', sm: '7px', md: '8px' },
174
+ mb: { xs: '6px', sm: '8px', md: '9px' },
175
+ '&::after': {
176
+ mb: { xs: '-5px', sm: '-7px', md: '-8px' },
177
+ },
149
178
  },
150
179
  },
151
180
 
@@ -262,7 +291,6 @@ export function ActionCard(props: ActionCardProps) {
262
291
  className={classes.title}
263
292
  sx={{
264
293
  typography: 'subtitle2',
265
- '&.sizeMedium': { typographty: 'subtitle1' },
266
294
  '&.sizeLarge': { typography: 'h6' },
267
295
  }}
268
296
  >
@@ -37,6 +37,7 @@ export const ActionCardLayout = React.forwardRef<HTMLDivElement, ActionCardLayou
37
37
  '&.layoutList': {
38
38
  display: 'grid',
39
39
  height: 'min-content',
40
+ pt: '1px',
40
41
  },
41
42
  '&.layoutGrid': {
42
43
  display: 'grid',
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.0.0-canary.33
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1831](https://github.com/graphcommerce-org/graphcommerce/pull/1831) [`f4008bae3`](https://github.com/graphcommerce-org/graphcommerce/commit/f4008bae3e3ac8288c731b1dd87e6c6aef8e81fc) - Added a linting rule that disallows `import { Theme } from '@emotion/react'` because that causes huge performance issues. Added tsc:trace to the root project to debug typescript performance issues. ([@paales](https://github.com/paales))
8
+
9
+ ## 6.0.0-canary.32
10
+
11
+ ### Minor Changes
12
+
13
+ - [#1814](https://github.com/graphcommerce-org/graphcommerce/pull/1814) [`15aa59049`](https://github.com/graphcommerce-org/graphcommerce/commit/15aa590493bf7639231f3bb3dd623c234ebad7cf) - - Show filter label, instead of value
14
+ - Actioncard default styling
15
+ - Active filter styling ([@ErwinOtten](https://github.com/ErwinOtten))
16
+
3
17
  ## 6.0.0-canary.31
4
18
 
5
19
  ### Patch Changes
@@ -249,7 +249,7 @@ export function OverlayBase(incomingProps: LayoutOverlayBaseProps) {
249
249
  bottom: 0,
250
250
  top: 0,
251
251
  left: 0,
252
- backgroundColor: 'rgba(0, 0, 0, 0.3)',
252
+ backgroundColor: 'rgba(0, 0, 0, 0.2)',
253
253
  WebkitTapHighlightColor: 'transparent',
254
254
  willChange: 'opacity',
255
255
  },
@@ -1,4 +1,14 @@
1
- import { alpha, Chip, ChipProps, Typography, useEventCallback } from '@mui/material'
1
+ import {
2
+ alpha,
3
+ lighten,
4
+ Badge,
5
+ Chip,
6
+ ChipProps,
7
+ SxProps,
8
+ Typography,
9
+ useEventCallback,
10
+ Theme,
11
+ } from '@mui/material'
2
12
  import React, { useState } from 'react'
3
13
  import { IconSvg } from '../IconSvg'
4
14
  import { responsiveVal } from '../Styles'
@@ -8,7 +18,7 @@ import { OverlayOrPopperPanel, OverlayOrPopperPanelProps } from './OverlayOrPopp
8
18
  function isMulti(
9
19
  selectedLabel: React.ReactNode | React.ReactNode[],
10
20
  ): selectedLabel is React.ReactNode[] {
11
- return Array.isArray(selectedLabel) && selectedLabel.length > 1
21
+ return Array.isArray(selectedLabel) && selectedLabel.length >= 1
12
22
  }
13
23
 
14
24
  export type ChipOverlayOrPopperProps = {
@@ -16,27 +26,30 @@ export type ChipOverlayOrPopperProps = {
16
26
  selected: boolean
17
27
  selectedLabel: React.ReactNode | React.ReactNode[]
18
28
  children: OverlayOrPopperPanelProps['children']
19
-
29
+ sx?: SxProps<Theme>
20
30
  chipProps?: Omit<ChipProps<'button'>, 'clickable' | 'label'>
21
31
  } & Omit<OverlayOrPopperPanelProps, 'activeEl' | 'children' | 'title'>
22
32
 
23
33
  export function ChipOverlayOrPopper(props: ChipOverlayOrPopperProps) {
24
- let { label, selected, selectedLabel, children, chipProps, ...panelProps } = props
34
+ let { label, selected, selectedLabel, children, chipProps, sx = [], ...panelProps } = props
25
35
  const { onApply, onClose, onReset } = panelProps
26
36
  const [activeEl, setActiveEl] = useState<HTMLElement | null>(null)
27
37
 
28
38
  const chevronIcon = isMulti(selectedLabel) ? (
29
- <Typography
30
- variant='caption'
31
- color='primary.main'
39
+ <Badge
40
+ color='primary'
41
+ badgeContent={selectedLabel.length}
32
42
  sx={{
33
- display: 'flex',
34
43
  alignItems: 'center',
35
- ml: responsiveVal(3, 8),
44
+ '.MuiBadge-badge': {
45
+ position: 'relative',
46
+ transform: 'none',
47
+ ml: { xs: '2px', md: '6px' },
48
+ typography: 'caption',
49
+ fontWeight: 'bold',
50
+ },
36
51
  }}
37
- >
38
- +{selectedLabel.length - 1}
39
- </Typography>
52
+ />
40
53
  ) : (
41
54
  <IconSvg
42
55
  src={activeEl ? iconChevronUp : iconChevronDown}
@@ -54,12 +67,12 @@ export function ChipOverlayOrPopper(props: ChipOverlayOrPopperProps) {
54
67
  size='responsive'
55
68
  component='button'
56
69
  variant='outlined'
57
- color={selected && !activeEl ? 'primary' : 'default'}
70
+ color='default'
58
71
  {...chipProps}
59
72
  clickable
60
73
  label={
61
74
  <Typography variant='body2' sx={{ display: 'flex', flexDirection: 'row' }}>
62
- {selected ? selectedLabel : label}
75
+ {label}
63
76
  {chevronIcon}
64
77
  </Typography>
65
78
  }
@@ -73,17 +86,23 @@ export function ChipOverlayOrPopper(props: ChipOverlayOrPopperProps) {
73
86
  },
74
87
  ...(selected
75
88
  ? {
76
- border: `1px solid ${theme.palette.primary.main ?? theme.palette.primary.main}`,
77
- boxShadow: `inset 0 0 0 1px ${
78
- theme.palette.primary.main ?? theme.palette.primary.main
79
- },0 0 0 4px ${alpha(
89
+ background: lighten(
80
90
  theme.palette.primary.main,
81
- theme.palette.action.hoverOpacity,
82
- )} !important`,
91
+ 1 - theme.palette.action.hoverOpacity,
92
+ ),
93
+ border: `1px solid transparent`,
94
+ '&.MuiChip-clickable:hover': {
95
+ background: lighten(
96
+ theme.palette.primary.main,
97
+ 1 - theme.palette.action.hoverOpacity * 2,
98
+ ),
99
+ border: `1px solid transparent`,
100
+ },
83
101
  }
84
102
  : {}),
85
103
  }),
86
104
  ...(Array.isArray(chipSx) ? chipSx : [chipSx]),
105
+ ...(Array.isArray(sx) ? sx : [sx]),
87
106
  ]}
88
107
  />
89
108
  <OverlayOrPopperPanel
@@ -33,7 +33,7 @@ export function PopperPanel(props: PopperPanelProps) {
33
33
  bgcolor: 'background.paper',
34
34
  display: 'grid',
35
35
  gridTemplateRows: 'min-content auto min-content',
36
- minWidth: 300,
36
+ minWidth: 350,
37
37
  overflowY: 'auto',
38
38
  maxHeight: '500px',
39
39
  }}
@@ -43,7 +43,16 @@ export function PopperPanelActions(props: PanelActionsProps) {
43
43
  </Fab>
44
44
  }
45
45
  >
46
- <Typography variant='h6' component='span'>
46
+ <Typography
47
+ variant='subtitle1'
48
+ component='span'
49
+ sx={{
50
+ display: 'block',
51
+ textOverflow: 'ellipsis',
52
+ overflow: 'hidden',
53
+ whiteSpace: 'nowrap',
54
+ }}
55
+ >
47
56
  {title}
48
57
  </Typography>
49
58
  </LayoutHeader>
@@ -55,7 +64,7 @@ export function PopperPanelActions(props: PanelActionsProps) {
55
64
  type='button'
56
65
  onClick={onApply}
57
66
  variant='pill'
58
- size='large'
67
+ size='medium'
59
68
  color='primary'
60
69
  fullWidth
61
70
  >
@@ -1,5 +1,4 @@
1
- import { Theme } from '@emotion/react'
2
- import { SxProps } from '@mui/material'
1
+ import { Theme, SxProps } from '@mui/material'
3
2
  import React from 'react'
4
3
 
5
4
  export type PanelActionsProps = {
@@ -6,7 +6,7 @@ export function breakpointVal(
6
6
  ) {
7
7
  const minSize = 320
8
8
  const breakpoints = Object.values(breakpointsObject)
9
- const spread = breakpoints[breakpoints.length - 1]
9
+ const spread = breakpoints[breakpoints.length - 1] - minSize
10
10
 
11
11
  const entries = {}
12
12
 
@@ -1,4 +1,4 @@
1
- import { EmotionJSX } from '@emotion/react/types/jsx-namespace'
1
+ import type { EmotionJSX } from '@emotion/react/types/jsx-namespace'
2
2
  import createEmotionServer from '@emotion/server/create-instance'
3
3
  // eslint-disable-next-line @next/next/no-document-import-in-page
4
4
  import type NextDocument from 'next/document'
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": "6.0.0-canary.31",
5
+ "version": "6.0.0-canary.33",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "sideEffects": false,
@@ -18,18 +18,18 @@
18
18
  "@emotion/react": "^11.10.6",
19
19
  "@emotion/server": "^11.4.0",
20
20
  "@emotion/styled": "^11.10.6",
21
- "@graphcommerce/framer-next-pages": "6.0.0-canary.31",
22
- "@graphcommerce/framer-scroller": "6.0.0-canary.31",
23
- "@graphcommerce/framer-utils": "6.0.0-canary.31",
24
- "@graphcommerce/image": "6.0.0-canary.31",
21
+ "@graphcommerce/framer-next-pages": "6.0.0-canary.33",
22
+ "@graphcommerce/framer-scroller": "6.0.0-canary.33",
23
+ "@graphcommerce/framer-utils": "6.0.0-canary.33",
24
+ "@graphcommerce/image": "6.0.0-canary.33",
25
25
  "cookie": "^0.5.0",
26
26
  "react-is": "^18.2.0",
27
27
  "schema-dts": "^1.1.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@graphcommerce/eslint-config-pwa": "6.0.0-canary.31",
31
- "@graphcommerce/prettier-config-pwa": "6.0.0-canary.31",
32
- "@graphcommerce/typescript-config-pwa": "6.0.0-canary.31",
30
+ "@graphcommerce/eslint-config-pwa": "6.0.0-canary.33",
31
+ "@graphcommerce/prettier-config-pwa": "6.0.0-canary.33",
32
+ "@graphcommerce/typescript-config-pwa": "6.0.0-canary.33",
33
33
  "@types/cookie": "^0.5.1",
34
34
  "@types/react-is": "^17.0.3",
35
35
  "typescript": "4.9.5"