@graphcommerce/next-ui 3.0.6 → 3.1.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
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.1.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.0.6...@graphcommerce/next-ui@3.1.0) (2021-10-01)
7
+
8
+
9
+ ### Features
10
+
11
+ * **sidebar-gallery:** close using esc key ([fd46fe1](https://github.com/ho-nl/m2-pwa/commit/fd46fe1029f436c1e0e04cbcc3b66deca4d1b0b6))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.0.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.0.0...@graphcommerce/next-ui@3.0.1) (2021-09-27)
7
18
 
8
19
  **Note:** Version bump only for package @graphcommerce/next-ui
@@ -1,17 +1,17 @@
1
1
  import {
2
+ CenterSlide,
3
+ MotionImageAspect,
4
+ MotionImageAspectProps,
5
+ Scroller,
2
6
  ScrollerButton,
3
7
  ScrollerDots,
4
8
  ScrollerProvider,
5
- Scroller,
6
- MotionImageAspectProps,
7
- CenterSlide,
8
- MotionImageAspect,
9
9
  } from '@graphcommerce/framer-scroller'
10
10
  import { clientSize, useMotionValueValue } from '@graphcommerce/framer-utils'
11
11
  import { Fab, makeStyles, Theme, useTheme } from '@material-ui/core'
12
12
  import clsx from 'clsx'
13
- import { m } from 'framer-motion'
14
- import React, { useState } from 'react'
13
+ import { m, useDomEvent } from 'framer-motion'
14
+ import React, { useRef, useState } from 'react'
15
15
  import { UseStyles } from '../../Styles'
16
16
  import responsiveVal from '../../Styles/responsiveVal'
17
17
  import SvgImage from '../../SvgImage'
@@ -183,6 +183,18 @@ export default function SidebarGallery(props: SidebarGalleryProps) {
183
183
 
184
184
  const theme = useTheme()
185
185
 
186
+ const windowRef = useRef(typeof window !== 'undefined' ? window : null)
187
+
188
+ const handleEscapeKey = (e: KeyboardEvent | Event) => {
189
+ if (zoomed) {
190
+ if ((e as KeyboardEvent)?.key === 'Escape') {
191
+ toggle()
192
+ }
193
+ }
194
+ }
195
+
196
+ useDomEvent(windowRef, 'keyup', handleEscapeKey, { passive: true })
197
+
186
198
  return (
187
199
  <ScrollerProvider scrollSnapAlign='center'>
188
200
  <m.div layout className={clsxZoom('root')}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphcommerce/next-ui",
3
- "version": "3.0.6",
3
+ "version": "3.1.0",
4
4
  "author": "",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -56,5 +56,5 @@
56
56
  "project": "./tsconfig.json"
57
57
  }
58
58
  },
59
- "gitHead": "cf2b61fa96aca043ff841b018334ca8c28e5e6cf"
59
+ "gitHead": "88c9c0b170964ec794f59c97bac253a29a7d58e0"
60
60
  }