@graphcommerce/next-ui 3.20.0 → 3.20.4

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
@@ -3,6 +3,43 @@
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.20.4](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.20.3...@graphcommerce/next-ui@3.20.4) (2021-12-06)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * use Locale to set storeSwitcher icons ([65ea397](https://github.com/ho-nl/m2-pwa/commit/65ea397ec53aa27f545b43feda8e35227e119ebe))
12
+
13
+
14
+
15
+
16
+
17
+ ## [3.20.2](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.20.1...@graphcommerce/next-ui@3.20.2) (2021-12-03)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * aria-labels missing ([16570d1](https://github.com/ho-nl/m2-pwa/commit/16570d11efcb264eba6c620c5508c9616c2d0a2a))
23
+ * make sure the overlay can be clicked away ([5b43e2f](https://github.com/ho-nl/m2-pwa/commit/5b43e2f0568c2587be63b74271409123fc0a44e2))
24
+
25
+
26
+
27
+
28
+
29
+ ## [3.20.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.20.0...@graphcommerce/next-ui@3.20.1) (2021-12-03)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * overlay didn't initialize ([f3b4ad9](https://github.com/ho-nl/m2-pwa/commit/f3b4ad9d96656b965865008f315ffcbdd24842de))
35
+ * search page ([85cf721](https://github.com/ho-nl/m2-pwa/commit/85cf72130bce4c3d2c392a3745adf05bca8618b1))
36
+ * sidebar gallery hideScrollbar ([da68544](https://github.com/ho-nl/m2-pwa/commit/da68544c7d99b23db8cb0b96c8ae96ede32abc62))
37
+ * use standard shadows in overlay ([5383aa2](https://github.com/ho-nl/m2-pwa/commit/5383aa2ae69363ebcff1ebec7c120137a83653d0))
38
+
39
+
40
+
41
+
42
+
6
43
  # [3.20.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.19.1...@graphcommerce/next-ui@3.20.0) (2021-12-03)
7
44
 
8
45
 
@@ -20,7 +20,7 @@ export default function FlagAvatar(props: FlagAvatarProps) {
20
20
  classes={classes}
21
21
  imgProps={{ loading: 'lazy' }}
22
22
  alt={country}
23
- src={`https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.4.3/flags/4x3/${country}.svg`}
23
+ src={`https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.4.3/flags/1x1/${country}.svg`}
24
24
  >
25
25
  {country.toLocaleUpperCase()}
26
26
  </Avatar>
@@ -76,7 +76,9 @@ export default function SidebarSlider(props: SidebarSliderProps) {
76
76
  </div>
77
77
 
78
78
  <div className={classes.scrollerContainer}>
79
- <Scroller className={classes.scroller}>{children}</Scroller>
79
+ <Scroller className={classes.scroller} hideScrollbar>
80
+ {children}
81
+ </Scroller>
80
82
  <div className={classes.centerLeft}>
81
83
  <ScrollerButton layout direction='left' className={classes.sliderButtons}>
82
84
  <SvgImageSimple src={iconChevronLeft} />
@@ -1,4 +1,3 @@
1
- import { usePageContext } from '@graphcommerce/framer-next-pages'
2
1
  import { makeStyles, Theme } from '@material-ui/core'
3
2
  import React from 'react'
4
3
  import { classesPicker } from '../../Styles/classesPicker'
@@ -8,7 +7,7 @@ import LayoutHeaderContent, { ContentProps } from './LayoutHeaderContent'
8
7
  import { FloatingProps } from './LayoutHeadertypes'
9
8
 
10
9
  export type LayoutHeaderProps = FloatingProps &
11
- Omit<ContentProps, 'leftAction' | 'rightAction'> & {
10
+ Omit<ContentProps, 'left' | 'right'> & {
12
11
  /**
13
12
  * Button to display on the left side of the title
14
13
  *
@@ -98,7 +97,7 @@ const useStyles = makeStyles(
98
97
  )
99
98
 
100
99
  export function LayoutHeader(props: LayoutHeaderProps) {
101
- const { children, additional, divider, primary, secondary, noAlign } = props
100
+ const { children, additional, divider, primary, secondary, noAlign, switchPoint } = props
102
101
  const classes = useStyles(props)
103
102
  const showBack = useShowBack()
104
103
  const showClose = useShowClose()
@@ -142,6 +141,7 @@ export function LayoutHeader(props: LayoutHeaderProps) {
142
141
  divider={divider}
143
142
  floatingMd={floatingMd}
144
143
  floatingSm={floatingSm}
144
+ switchPoint={switchPoint}
145
145
  >
146
146
  {children}
147
147
  {additional}
@@ -1,5 +1,5 @@
1
1
  import { usePageRouter, useUp, usePrevUp, usePageContext } from '@graphcommerce/framer-next-pages'
2
- import { Trans } from '@lingui/macro'
2
+ import { t } from '@lingui/macro'
3
3
  import PageLink from 'next/link'
4
4
  import React from 'react'
5
5
  import Button, { ButtonProps } from '../../Button'
@@ -30,17 +30,25 @@ export default function LayoutHeaderBack(props: BackProps) {
30
30
  const backIcon = <SvgImageSimple src={iconChevronLeft} />
31
31
  const canClickBack = backSteps > 0 && router.asPath !== prevUp?.href
32
32
 
33
- if (canClickBack)
33
+ if (canClickBack) {
34
+ const label = up?.href === router.asPath ? up.title : t`Back`
34
35
  return (
35
- <Button onClick={() => router.back()} variant='pill-link' startIcon={backIcon} {...props}>
36
- {up?.href === router.asPath ? up.title : <Trans>Back</Trans>}
36
+ <Button
37
+ onClick={() => router.back()}
38
+ variant='pill-link'
39
+ startIcon={backIcon}
40
+ aria-label={label}
41
+ {...props}
42
+ >
43
+ {label}
37
44
  </Button>
38
45
  )
46
+ }
39
47
 
40
48
  if (up?.href && up.href !== router.asPath)
41
49
  return (
42
50
  <PageLink href={up.href} passHref>
43
- <Button variant='pill-link' startIcon={backIcon} {...props}>
51
+ <Button variant='pill-link' startIcon={backIcon} aria-label={up.title} {...props}>
44
52
  {up.title}
45
53
  </Button>
46
54
  </PageLink>
@@ -17,6 +17,7 @@ const useStyles = makeStyles(
17
17
  left: 0,
18
18
  width: '100%',
19
19
  backgroundColor: theme.palette.background.default,
20
+ boxShadow: theme.shadows[2],
20
21
  opacity: 0,
21
22
  transition: `opacity ${time}`,
22
23
 
@@ -25,6 +26,9 @@ const useStyles = makeStyles(
25
26
  height: theme.appShell.appBarHeightMd,
26
27
  },
27
28
  },
29
+ bgDivider: {
30
+ boxShadow: 'unset',
31
+ },
28
32
  bgFloatingSm: {
29
33
  [theme.breakpoints.down('sm')]: {
30
34
  display: 'none',
@@ -112,14 +116,6 @@ const useStyles = makeStyles(
112
116
  bottom: 0,
113
117
  left: 0,
114
118
  right: 0,
115
- transition: `opacity ${time}`,
116
- opacity: 0,
117
- },
118
- dividerCustomDivider: {
119
- opacity: 1,
120
- },
121
- dividerScrolled: {
122
- opacity: 1,
123
119
  },
124
120
  dividerFloatingSm: {
125
121
  [theme.breakpoints.down('sm')]: {
@@ -141,22 +137,31 @@ export type ContentProps = FloatingProps &
141
137
  left?: React.ReactNode
142
138
  right?: React.ReactNode
143
139
  divider?: React.ReactNode
140
+ switchPoint?: number
144
141
  }
145
142
 
146
143
  export default function LayoutHeaderContent(props: ContentProps) {
147
144
  const ref = useRef<HTMLDivElement>(null)
148
145
  const scroll = useScrollY()
149
146
 
150
- const { left, children, right, divider, floatingMd = false, floatingSm = false } = props
147
+ const {
148
+ left,
149
+ children,
150
+ right,
151
+ divider,
152
+ floatingMd = false,
153
+ floatingSm = false,
154
+ switchPoint = 50,
155
+ } = props
151
156
  const classes = useStyles(props)
152
157
 
153
- const scrolled = useMotionValueValue(scroll, (y) => y > 50)
158
+ const scrolled = useMotionValueValue(scroll, (y) => y >= switchPoint)
154
159
 
155
160
  const className = classesPicker<Classes>(classes, {
156
161
  floatingSm,
157
162
  floatingMd,
158
163
  scrolled,
159
- customDivider: !!divider,
164
+ divider: !!divider,
160
165
  })
161
166
 
162
167
  return (
@@ -166,7 +171,7 @@ export default function LayoutHeaderContent(props: ContentProps) {
166
171
  <div {...className('left')}>{left}</div>
167
172
  <div {...className('center')}>{children}</div>
168
173
  <div {...className('right')}>{right}</div>
169
- <div {...className('divider')}>{divider ?? <Divider />}</div>
174
+ {divider && <div {...className('divider')}>{divider}</div>}
170
175
  </div>
171
176
  </>
172
177
  )
@@ -1,7 +1,7 @@
1
1
  import { usePageContext, usePageRouter, useScrollOffset } from '@graphcommerce/framer-next-pages'
2
2
  import { Scroller, useScrollerContext, useScrollTo } from '@graphcommerce/framer-scroller'
3
3
  import { useElementScroll, useIsomorphicLayoutEffect } from '@graphcommerce/framer-utils'
4
- import { makeStyles, Theme } from '@material-ui/core'
4
+ import { makeStyles, Theme, ClickAwayListener } from '@material-ui/core'
5
5
  import {
6
6
  m,
7
7
  MotionValue,
@@ -26,6 +26,14 @@ const useStyles = makeStyles(
26
26
  '@supports (-webkit-touch-callout: none)': {
27
27
  height: '-webkit-fill-available',
28
28
  },
29
+ [theme.breakpoints.down('sm')]: {
30
+ width: '100vw',
31
+ borderRadius: theme.shape.borderRadius * 3,
32
+ },
33
+ [theme.breakpoints.up('md')]: {
34
+ width: '100vw',
35
+ borderRadius: theme.shape.borderRadius * 4,
36
+ },
29
37
  },
30
38
  rootVariantSmLeft: {
31
39
  [theme.breakpoints.down('sm')]: {
@@ -152,15 +160,13 @@ const useStyles = makeStyles(
152
160
  overlayPaneVariantSmBottom: {
153
161
  [theme.breakpoints.down('sm')]: {
154
162
  width: '100vw',
155
- borderRadius: 10,
156
- boxShadow: '0px 0px 20px rgba(0, 0, 0, 0.1)',
163
+ borderRadius: theme.shape.borderRadius * 3,
157
164
  },
158
165
  },
159
166
  overlayPaneVariantMdBottom: {
160
167
  [theme.breakpoints.up('md')]: {
161
168
  width: '100vw',
162
- borderRadius: 10,
163
- boxShadow: '0px 0px 20px rgba(0, 0, 0, 0.1)',
169
+ borderRadius: theme.shape.borderRadius * 4,
164
170
  },
165
171
  },
166
172
  overlayPaneVariantSmLeft: {
@@ -341,11 +347,13 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
341
347
  <>
342
348
  <m.div {...className('backdrop')} style={{ opacity: positions.open.visible }} />
343
349
  <Scroller {...className('root')} grid={false} hideScrollbar>
344
- <div {...className('beforeOverlay')} onClick={closeOverlay} />
350
+ <div {...className('beforeOverlay')} />
345
351
  <div {...className('overlay')} ref={overlayRef}>
346
- <div {...className('overlayPane')}>
347
- <LayoutProvider scroll={scrollWithoffset}>{children}</LayoutProvider>
348
- </div>
352
+ <ClickAwayListener onClickAway={closeOverlay}>
353
+ <div {...className('overlayPane')}>
354
+ <LayoutProvider scroll={scrollWithoffset}>{children}</LayoutProvider>
355
+ </div>
356
+ </ClickAwayListener>
349
357
  </div>
350
358
  <div {...className('afterOverlay')} />
351
359
  </Scroller>
@@ -26,9 +26,9 @@ export function useOverlayPosition() {
26
26
 
27
27
  const measure = () => {
28
28
  const positions = getScrollSnapPositions()
29
- state.open.x.set(positions.x[1])
29
+ state.open.x.set(positions.x[1] ?? 0)
30
30
  state.closed.x.set(positions.x[0])
31
- state.open.y.set(positions.y[1])
31
+ state.open.y.set(positions.y[1] ?? 0)
32
32
  state.closed.y.set(positions.y[0])
33
33
  }
34
34
  const ro = new ResizeObserver(measure)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphcommerce/next-ui",
3
- "version": "3.20.0",
3
+ "version": "3.20.4",
4
4
  "author": "",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@apollo/client": "^3.4.16",
13
13
  "@graphcommerce/framer-next-pages": "^2.108.0",
14
- "@graphcommerce/framer-scroller": "^1.1.0",
14
+ "@graphcommerce/framer-scroller": "^1.1.4",
15
15
  "@graphcommerce/framer-utils": "^2.103.16",
16
16
  "@graphcommerce/graphql": "^2.105.6",
17
17
  "@graphcommerce/image": "^2.105.5",
@@ -52,5 +52,5 @@
52
52
  "project": "./tsconfig.json"
53
53
  }
54
54
  },
55
- "gitHead": "8f156415c7f5a963e363f0d6d18fe5d6bbd5dba2"
55
+ "gitHead": "b992ac3fbe719310988edb8ad811366431509bc2"
56
56
  }