@graphcommerce/next-ui 3.5.0 → 3.8.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.
@@ -1,4 +1,4 @@
1
- import { makeStyles } from '@material-ui/styles'
1
+ import { makeStyles } from '@material-ui/core'
2
2
  import React from 'react'
3
3
  import { UseStyles } from '../Styles'
4
4
 
package/Button/index.tsx CHANGED
@@ -1,5 +1,9 @@
1
- import { Button as MuiButton, ButtonClassKey as MuiButtonClassKey, Theme } from '@material-ui/core'
2
- import { makeStyles } from '@material-ui/styles'
1
+ import {
2
+ Button as MuiButton,
3
+ ButtonClassKey as MuiButtonClassKey,
4
+ Theme,
5
+ makeStyles,
6
+ } from '@material-ui/core'
3
7
  import clsx from 'clsx'
4
8
  import React from 'react'
5
9
 
package/CHANGELOG.md CHANGED
@@ -3,6 +3,44 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.8.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.7.1...@graphcommerce/next-ui@3.8.0) (2021-10-21)
7
+
8
+
9
+ ### Features
10
+
11
+ * **graphql-mesh:** remove the api project and use a single project 🎉👩‍👩‍👦‍👦 ([ea4ad03](https://github.com/ho-nl/m2-pwa/commit/ea4ad0397d4ff289ef3b3253593fb0914c8c5246))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.7.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.6.0...@graphcommerce/next-ui@3.7.0) (2021-10-19)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * solve import issue where @material-ui/styles couldn't be found ([efb3771](https://github.com/ho-nl/m2-pwa/commit/efb3771e8c173799779691d4d52857678dab4c15))
23
+
24
+
25
+ ### Features
26
+
27
+ * **framer-scroller:** better defaults so the Scroller doesn't look broken when providing no props ([b177ce9](https://github.com/ho-nl/m2-pwa/commit/b177ce9570abb9ccfd4eb5cc34e43d157bb4e81a))
28
+
29
+
30
+
31
+
32
+
33
+ # [3.6.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.5.0...@graphcommerce/next-ui@3.6.0) (2021-10-18)
34
+
35
+
36
+ ### Features
37
+
38
+ * **message-snackbar:** severity props ([c7be8a5](https://github.com/ho-nl/m2-pwa/commit/c7be8a51faf7a5937b7fab5bb352df2089ae4eea))
39
+
40
+
41
+
42
+
43
+
6
44
  # [3.5.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.4.0...@graphcommerce/next-ui@3.5.0) (2021-10-18)
7
45
 
8
46
 
@@ -1,5 +1,5 @@
1
1
  import { usePageContext, usePageRouter } from '@graphcommerce/framer-next-pages'
2
- import { makeStyles } from '@material-ui/styles'
2
+ import { makeStyles } from '@material-ui/core'
3
3
  import { AnimatePresence } from 'framer-motion'
4
4
  import React, { useRef } from 'react'
5
5
  import RouterSlide from './Slide'
@@ -73,9 +73,7 @@ const useStyles = makeStyles(
73
73
  top: 0,
74
74
  width: '100%',
75
75
  height: '100%',
76
- display: `grid`,
77
- gridAutoFlow: `column`,
78
- gridTemplateColumns: `repeat(100, 100%)`,
76
+ gridAutoColumns: `100%`,
79
77
  gridTemplateRows: `100%`,
80
78
  cursor: 'zoom-in',
81
79
  },
@@ -4,8 +4,7 @@ import {
4
4
  ScrollerPageCounter,
5
5
  ScrollerProvider,
6
6
  } from '@graphcommerce/framer-scroller'
7
- import { Theme } from '@material-ui/core'
8
- import { makeStyles } from '@material-ui/styles'
7
+ import { Theme, makeStyles } from '@material-ui/core'
9
8
  import React, { ReactNode } from 'react'
10
9
  import { UseStyles } from '../../Styles'
11
10
  import responsiveVal from '../../Styles/responsiveVal'
@@ -31,15 +30,11 @@ const useStyles = makeStyles(
31
30
  },
32
31
  scroller: {
33
32
  width: '100%',
34
- display: 'grid',
35
- gridAutoFlow: 'column',
36
33
  gridColumnGap: theme.spacings.md,
37
34
  gridRowGap: theme.spacings.lg,
38
35
  alignContent: 'space-around',
39
36
  paddingRight: theme.page.horizontal,
40
- '& > *': {
41
- minWidth: responsiveVal(200, 400),
42
- },
37
+ gridAutoColumns: responsiveVal(200, 400),
43
38
  },
44
39
  sliderButtons: {
45
40
  [theme.breakpoints.down('sm')]: {
@@ -1,5 +1,4 @@
1
- import { Theme } from '@material-ui/core'
2
- import { makeStyles } from '@material-ui/styles'
1
+ import { Theme, makeStyles } from '@material-ui/core'
3
2
  import React from 'react'
4
3
  import Row from '..'
5
4
  import SectionContainer from '../../SectionContainer'
@@ -8,14 +8,10 @@ const useStyles = makeStyles(
8
8
  root: {},
9
9
  scroller: {
10
10
  marginBottom: `${theme.spacings.lg}`,
11
- display: 'grid',
12
- gridAutoFlow: 'column',
13
11
  justifyContent: 'start',
14
12
  gap: `${theme.spacings.md}`,
15
13
  alignContent: 'center',
16
- '& > *': {
17
- minWidth: 'max-content',
18
- },
14
+ gridAutoColumns: `max-content`,
19
15
  },
20
16
  title: {
21
17
  fontWeight: 600,
@@ -1,5 +1,4 @@
1
- import { ContainerProps, Theme } from '@material-ui/core'
2
- import { makeStyles } from '@material-ui/styles'
1
+ import { ContainerProps, Theme, makeStyles } from '@material-ui/core'
3
2
  import { m, useTransform, useViewportScroll } from 'framer-motion'
4
3
  import React from 'react'
5
4
  import Row from '..'
@@ -1,17 +1,16 @@
1
1
  import {
2
- Button,
3
2
  Fab,
4
3
  makeStyles,
5
- PropTypes,
6
4
  Snackbar,
7
5
  SnackbarContent,
8
6
  SnackbarProps,
9
7
  Theme,
8
+ Portal,
10
9
  } from '@material-ui/core'
11
10
  import clsx from 'clsx'
12
11
  import React, { useEffect, useState } from 'react'
13
- import SvgImage from '../SvgImage'
14
- import { iconClose } from '../icons'
12
+ import SvgImageSimple from '../SvgImage/SvgImageSimple'
13
+ import { iconClose, iconCheckmark, iconSadFace } from '../icons'
15
14
 
16
15
  type Size = 'normal' | 'wide'
17
16
  type Variant = 'contained' | 'pill'
@@ -42,10 +41,8 @@ const useStyles = makeStyles(
42
41
  },
43
42
  },
44
43
  rootPillLarge: {},
45
- rootPillColorPrimary: {
46
- backgroundColor: theme.palette.primary.main,
47
- color: theme.palette.primary.contrastText,
48
- },
44
+ rootPillSeverityInfo: {},
45
+ rootPillSeverityError: {},
49
46
  message: {
50
47
  width: '100%',
51
48
  padding: theme.spacings.xxs,
@@ -61,8 +58,9 @@ const useStyles = makeStyles(
61
58
  },
62
59
  },
63
60
  children: {
61
+ // display: 'flex',
64
62
  gridArea: 'children',
65
- ...theme.typography.h4,
63
+ ...theme.typography.h6,
66
64
  fontWeight: 400,
67
65
 
68
66
  '& .MuiSvgIcon-root': {
@@ -111,21 +109,26 @@ const useStyles = makeStyles(
111
109
  sticky: {
112
110
  position: 'sticky',
113
111
  },
112
+ messageIcon: {
113
+ display: 'inline-block',
114
+ marginRight: 5,
115
+ },
114
116
  }),
115
117
  { name: 'MessageSnackbar' },
116
118
  )
117
119
 
118
120
  export type MessageSnackbarImplProps = Omit<
119
121
  SnackbarProps,
120
- 'autoHideDuration' | 'onClose' | 'anchorOrigin'
122
+ 'autoHideDuration' | 'anchorOrigin' | 'color'
121
123
  > & {
122
124
  autoHide?: boolean
123
125
  sticky?: boolean
124
126
  variant?: Variant
125
127
  size?: Size
126
- color?: PropTypes.Color
128
+ severity?: 'success' | 'info' | 'warning' | 'error'
127
129
  action?: React.ReactNode
128
130
  children?: React.ReactNode
131
+ onClose?: () => void
129
132
  }
130
133
 
131
134
  export default function MessageSnackbarImpl(props: MessageSnackbarImplProps) {
@@ -134,13 +137,14 @@ export default function MessageSnackbarImpl(props: MessageSnackbarImplProps) {
134
137
  const {
135
138
  variant = 'contained',
136
139
  size = 'normal',
137
- color = 'default',
138
140
  autoHide,
139
141
  action,
140
142
  open,
141
143
  message,
142
144
  sticky,
143
145
  children,
146
+ onClose,
147
+ severity = 'info',
144
148
  ...snackbarProps
145
149
  } = props
146
150
 
@@ -150,53 +154,77 @@ export default function MessageSnackbarImpl(props: MessageSnackbarImplProps) {
150
154
  setShowSnackbar(!!open)
151
155
  }, [open])
152
156
 
157
+ const hideSnackbar = () => {
158
+ setShowSnackbar(false)
159
+ onClose?.()
160
+ }
161
+
153
162
  const clsxBonus = (base: string) => {
154
163
  const Size = size[0].toUpperCase() + size.slice(1)
155
- const Color = color[0].toUpperCase() + color.slice(1)
164
+ const Severity = severity[0].toUpperCase() + severity.slice(1)
156
165
  const Variant = variant[0].toUpperCase() + variant.slice(1)
157
166
 
158
167
  return clsx(
159
168
  classes[base],
160
169
  classes[`${base}${Variant}`],
161
170
  classes[`${base}${Variant}Size${Size}`],
162
- classes[`${base}${Variant}Color${Color}`],
171
+ classes[`${base}${Variant}Severity${Severity}`],
163
172
  )
164
173
  }
165
174
 
175
+ let icon = iconCheckmark
176
+ if (severity == 'error') icon = iconSadFace
177
+
166
178
  return (
167
- <Snackbar
168
- {...snackbarProps}
169
- message={message}
170
- anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
171
- open={showSnackbar}
172
- autoHideDuration={autoHide ? 6000 : null}
173
- classes={{
174
- root: classes.snackbarRoot,
175
- anchorOriginBottomCenter: clsx(classes.anchorOriginBottomCenter, sticky && classes.sticky),
176
- }}
177
- >
178
- <SnackbarContent
179
+ <Portal>
180
+ <Snackbar
181
+ {...snackbarProps}
182
+ message={message}
183
+ anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
184
+ open={showSnackbar}
185
+ autoHideDuration={autoHide ? 6000 : null}
179
186
  classes={{
180
- root: clsxBonus('root'),
181
- message: clsxBonus('message'),
182
- action: clsxBonus('action'),
187
+ root: classes.snackbarRoot,
188
+ anchorOriginBottomCenter: clsx(
189
+ classes.anchorOriginBottomCenter,
190
+ sticky && classes.sticky,
191
+ ),
183
192
  }}
184
- message={
185
- <>
186
- <div className={classes.children}>{children}</div>
187
- {action && (
188
- <div className={classes.actionButton} onClick={() => setShowSnackbar(false)}>
189
- {action}
193
+ onClose={hideSnackbar}
194
+ >
195
+ <SnackbarContent
196
+ classes={{
197
+ root: clsxBonus('root'),
198
+ message: clsxBonus('message'),
199
+ action: clsxBonus('action'),
200
+ }}
201
+ message={
202
+ <>
203
+ <div className={classes.children}>
204
+ <div>
205
+ <SvgImageSimple
206
+ src={icon}
207
+ alt='checkmark'
208
+ size='large'
209
+ className={classes.messageIcon}
210
+ />
211
+ {children}
212
+ </div>
213
+ </div>
214
+ {action && (
215
+ <div className={classes.actionButton} onClick={hideSnackbar}>
216
+ {action}
217
+ </div>
218
+ )}
219
+ <div className={classes.closeButton}>
220
+ <Fab aria-label='Close snackbar' size='medium' onClick={hideSnackbar}>
221
+ <SvgImageSimple src={iconClose} size='small' alt='close' />
222
+ </Fab>
190
223
  </div>
191
- )}
192
- <div className={classes.closeButton}>
193
- <Fab aria-label='Close snackbar' size='medium' onClick={() => setShowSnackbar(false)}>
194
- <SvgImage src={iconClose} size='small' alt='close' />
195
- </Fab>
196
- </div>
197
- </>
198
- }
199
- />
200
- </Snackbar>
224
+ </>
225
+ }
226
+ />
227
+ </Snackbar>
228
+ </Portal>
201
229
  )
202
230
  }
@@ -1,5 +1,4 @@
1
- import { Badge } from '@material-ui/core'
2
- import { withStyles } from '@material-ui/styles'
1
+ import { Badge, withStyles } from '@material-ui/core'
3
2
 
4
3
  const StyledBadge = withStyles((theme) => ({
5
4
  colorError: {},
package/index.ts CHANGED
@@ -131,8 +131,6 @@ export * from './SectionHeader'
131
131
  export { default as SectionHeader } from './SectionHeader'
132
132
  export * from './Separator'
133
133
  export { default as Separator } from './Separator'
134
- export * from './Snackbar/ErrorSnackbar'
135
- export { default as ErrorSnackbar } from './Snackbar/ErrorSnackbar'
136
134
  export { default as MessageSnackbar } from './Snackbar/MessageSnackbar'
137
135
  export * from './Snackbar/MessageSnackbarImpl'
138
136
  export { default as MessageSnackbarImpl } from './Snackbar/MessageSnackbarImpl'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphcommerce/next-ui",
3
- "version": "3.5.0",
3
+ "version": "3.8.0",
4
4
  "author": "",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -10,12 +10,12 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@apollo/client": "^3.4.16",
13
- "@graphcommerce/framer-next-pages": "^2.106.9",
14
- "@graphcommerce/framer-scroller": "^0.2.11",
15
- "@graphcommerce/framer-sheet": "^2.105.9",
16
- "@graphcommerce/framer-utils": "^2.103.8",
17
- "@graphcommerce/graphql": "^2.103.7",
18
- "@graphcommerce/image": "^2.104.10",
13
+ "@graphcommerce/framer-next-pages": "^2.106.11",
14
+ "@graphcommerce/framer-scroller": "^0.3.2",
15
+ "@graphcommerce/framer-sheet": "^2.105.11",
16
+ "@graphcommerce/framer-utils": "^2.103.10",
17
+ "@graphcommerce/graphql": "^2.104.0",
18
+ "@graphcommerce/image": "^2.104.12",
19
19
  "@graphql-typed-document-node/core": "^3.1.0",
20
20
  "@material-ui/core": "^4.12.3",
21
21
  "@material-ui/lab": "^4.0.0-alpha.60",
@@ -31,15 +31,14 @@
31
31
  "react-is": "^17.0.2",
32
32
  "react-schemaorg": "^2.0.0",
33
33
  "schema-dts": "^1.0.0",
34
- "type-fest": "^2.5.0"
34
+ "type-fest": "^2.5.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@graphcommerce/browserslist-config-pwa": "^3.0.2",
38
- "@graphcommerce/eslint-config-pwa": "^3.0.7",
38
+ "@graphcommerce/eslint-config-pwa": "^3.1.0",
39
39
  "@graphcommerce/prettier-config-pwa": "^3.0.3",
40
40
  "@graphcommerce/typescript-config-pwa": "^3.1.1",
41
41
  "@playwright/test": "^1.15.2",
42
- "@types/react-dom": "^17.0.9",
43
42
  "@types/react-is": "^17.0.2",
44
43
  "graphql-tag": "2.12.5",
45
44
  "typescript": "^4.4.4"
@@ -55,5 +54,5 @@
55
54
  "project": "./tsconfig.json"
56
55
  }
57
56
  },
58
- "gitHead": "08f4dbe739a38ece2c47aa1e94c10f8397da27fa"
57
+ "gitHead": "5a288cb32af2e48278c330ffb36d72be03700ffd"
59
58
  }
@@ -1,9 +0,0 @@
1
- import React from 'react'
2
- import MessageSnackbar from './MessageSnackbar'
3
- import { MessageSnackbarImplProps } from './MessageSnackbarImpl'
4
-
5
- export type ErrorSnackbarProps = Omit<MessageSnackbarImplProps, 'severity' | 'action'>
6
-
7
- export default function ErrorSnackbarImpl(props: ErrorSnackbarProps) {
8
- return <MessageSnackbar {...props} />
9
- }