@charcoal-ui/react 4.0.0-beta.12 → 4.0.0-beta.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charcoal-ui/react",
3
- "version": "4.0.0-beta.12",
3
+ "version": "4.0.0-beta.13",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -29,7 +29,7 @@
29
29
  "test": "vitest run --passWithNoTests"
30
30
  },
31
31
  "devDependencies": {
32
- "@charcoal-ui/esbuild-plugin-styled-components": "^4.0.0-beta.12",
32
+ "@charcoal-ui/esbuild-plugin-styled-components": "^4.0.0-beta.13",
33
33
  "@react-types/switch": "^3.1.2",
34
34
  "@storybook/addon-actions": "^8.0.5",
35
35
  "@storybook/react": "^8.0.5",
@@ -58,10 +58,10 @@
58
58
  "vitest": "^2.0.1"
59
59
  },
60
60
  "dependencies": {
61
- "@charcoal-ui/foundation": "^4.0.0-beta.12",
62
- "@charcoal-ui/icons": "^4.0.0-beta.12",
63
- "@charcoal-ui/theme": "^4.0.0-beta.12",
64
- "@charcoal-ui/utils": "^4.0.0-beta.12",
61
+ "@charcoal-ui/foundation": "^4.0.0-beta.13",
62
+ "@charcoal-ui/icons": "^4.0.0-beta.13",
63
+ "@charcoal-ui/theme": "^4.0.0-beta.13",
64
+ "@charcoal-ui/utils": "^4.0.0-beta.13",
65
65
  "@react-aria/button": "^3.9.1",
66
66
  "@react-aria/checkbox": "^3.13.0",
67
67
  "@react-aria/dialog": "^3.5.10",
@@ -94,5 +94,5 @@
94
94
  "url": "https://github.com/pixiv/charcoal.git",
95
95
  "directory": "packages/react"
96
96
  },
97
- "gitHead": "a13c826cdfd6a26f29e635cda926b7f3af37affe"
97
+ "gitHead": "0b37817809ef7fc52094865f7fbdd9e8d025e9e5"
98
98
  }
@@ -95,7 +95,7 @@ const Modal = forwardRef<HTMLDivElement, ModalProps>(function ModalInner(
95
95
  ref
96
96
  )
97
97
 
98
- const isMobile = useWindowWidth() < 744
98
+ const isMobile = (useWindowWidth() ?? Infinity) < 744
99
99
  const transitionEnabled = isMobile && bottomSheet !== false
100
100
  const showDismiss = !isMobile || bottomSheet !== true
101
101
 
@@ -47,8 +47,14 @@ export function useCharcoalModalOverlay(
47
47
  }
48
48
  }
49
49
 
50
+ function isWindowDefined() {
51
+ return typeof window !== 'undefined'
52
+ }
53
+
50
54
  export function useWindowWidth() {
51
- const [width, setWidth] = React.useState(window.innerWidth)
55
+ const [width, setWidth] = React.useState(
56
+ isWindowDefined() ? window.innerWidth : null
57
+ )
52
58
  React.useEffect(() => {
53
59
  const handleResize = () => {
54
60
  setWidth(window.innerWidth)