@graphcommerce/next-ui 6.0.0-canary.22 → 6.0.0-canary.24

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
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.0.0-canary.24
4
+
5
+ ## 6.0.0-canary.23
6
+
3
7
  ## 6.0.0-canary.22
4
8
 
5
9
  ## 6.0.0-canary.21
@@ -1,5 +1,7 @@
1
- import { Breakpoint, Theme, useMediaQuery } from '@mui/material'
1
+ import { Breakpoint } from '@mui/material'
2
2
  import dynamic from 'next/dynamic'
3
+ import { startTransition, useEffect, useState } from 'react'
4
+ import { useMatchMedia } from '../hooks'
3
5
  import { OverlayPanelProps } from './OverlayPanel'
4
6
  import { PopperPanelProps } from './PopperPanel'
5
7
 
@@ -15,7 +17,15 @@ export type OverlayOrPopperPanelProps = {
15
17
  export function OverlayOrPopperPanel(panel: OverlayOrPopperPanelProps) {
16
18
  const { breakpoint = 'md', ...panelProps } = panel
17
19
 
18
- const isDesktop = useMediaQuery((theme: Theme) => theme.breakpoints.up(breakpoint || 'md'))
20
+ const matchMedia = useMatchMedia()
21
+ const [isDesktop, setIsDesktop] = useState<boolean | undefined>(undefined)
22
+ useEffect(
23
+ () => startTransition(() => setIsDesktop(matchMedia.up(breakpoint || 'md'))),
24
+ [breakpoint, matchMedia],
25
+ )
26
+
27
+ if (isDesktop === undefined) return null
28
+
19
29
  const isPopper = isDesktop && breakpoint
20
30
  return <>{isPopper ? <PopperPanel {...panelProps} /> : <OverlayPanel {...panelProps} />}</>
21
31
  }
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.22",
5
+ "version": "6.0.0-canary.24",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "sideEffects": false,
@@ -18,18 +18,18 @@
18
18
  "@emotion/react": "^11.10.5",
19
19
  "@emotion/server": "^11.4.0",
20
20
  "@emotion/styled": "^11.10.5",
21
- "@graphcommerce/framer-next-pages": "6.0.0-canary.22",
22
- "@graphcommerce/framer-scroller": "6.0.0-canary.22",
23
- "@graphcommerce/framer-utils": "6.0.0-canary.22",
24
- "@graphcommerce/image": "6.0.0-canary.22",
21
+ "@graphcommerce/framer-next-pages": "6.0.0-canary.24",
22
+ "@graphcommerce/framer-scroller": "6.0.0-canary.24",
23
+ "@graphcommerce/framer-utils": "6.0.0-canary.24",
24
+ "@graphcommerce/image": "6.0.0-canary.24",
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.22",
31
- "@graphcommerce/prettier-config-pwa": "6.0.0-canary.22",
32
- "@graphcommerce/typescript-config-pwa": "6.0.0-canary.22",
30
+ "@graphcommerce/eslint-config-pwa": "6.0.0-canary.24",
31
+ "@graphcommerce/prettier-config-pwa": "6.0.0-canary.24",
32
+ "@graphcommerce/typescript-config-pwa": "6.0.0-canary.24",
33
33
  "@types/cookie": "^0.5.1",
34
34
  "@types/react-is": "^17.0.3",
35
35
  "typescript": "4.9.4"