@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/dist/components/Modal/useCustomModalOverlay.d.ts +1 -1
- package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
- package/dist/index.cjs.js +5 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +5 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +7 -7
- package/src/components/Modal/index.tsx +1 -1
- package/src/components/Modal/useCustomModalOverlay.tsx +7 -1
package/dist/index.esm.js
CHANGED
|
@@ -578,8 +578,11 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
578
578
|
underlayProps
|
|
579
579
|
};
|
|
580
580
|
}
|
|
581
|
+
function isWindowDefined() {
|
|
582
|
+
return typeof window !== "undefined";
|
|
583
|
+
}
|
|
581
584
|
function useWindowWidth() {
|
|
582
|
-
const [width, setWidth] = React11.useState(window.innerWidth);
|
|
585
|
+
const [width, setWidth] = React11.useState(isWindowDefined() ? window.innerWidth : null);
|
|
583
586
|
React11.useEffect(() => {
|
|
584
587
|
const handleResize = () => {
|
|
585
588
|
setWidth(window.innerWidth);
|
|
@@ -622,7 +625,7 @@ var Modal = forwardRef15(function ModalInner({
|
|
|
622
625
|
onClose,
|
|
623
626
|
isOpen
|
|
624
627
|
}, ref);
|
|
625
|
-
const isMobile = useWindowWidth() < 744;
|
|
628
|
+
const isMobile = (useWindowWidth() ?? Infinity) < 744;
|
|
626
629
|
const transitionEnabled = isMobile && bottomSheet !== false;
|
|
627
630
|
const showDismiss = !isMobile || bottomSheet !== true;
|
|
628
631
|
const transition = useTransition(isOpen, {
|