@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.
@@ -9,5 +9,5 @@ export declare function useCharcoalModalOverlay(props: AriaModalOverlayProps, st
9
9
  isOpen: boolean;
10
10
  onClose: () => void;
11
11
  }, ref: React.RefObject<HTMLElement>): ModalOverlayAria;
12
- export declare function useWindowWidth(): number;
12
+ export declare function useWindowWidth(): number | null;
13
13
  //# sourceMappingURL=useCustomModalOverlay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useCustomModalOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/useCustomModalOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAIjB,MAAM,sBAAsB,CAAA;AAG7B;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,qBAAqB,EAC5B,KAAK,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,EAC/C,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAChC,gBAAgB,CA4BlB;AAED,wBAAgB,cAAc,WAY7B"}
1
+ {"version":3,"file":"useCustomModalOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/useCustomModalOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAIjB,MAAM,sBAAsB,CAAA;AAG7B;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,qBAAqB,EAC5B,KAAK,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,EAC/C,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAChC,gBAAgB,CA4BlB;AAMD,wBAAgB,cAAc,kBAc7B"}
package/dist/index.cjs.js CHANGED
@@ -635,8 +635,11 @@ function useCharcoalModalOverlay(props, state, ref) {
635
635
  underlayProps
636
636
  };
637
637
  }
638
+ function isWindowDefined() {
639
+ return typeof window !== "undefined";
640
+ }
638
641
  function useWindowWidth() {
639
- const [width, setWidth] = React11.useState(window.innerWidth);
642
+ const [width, setWidth] = React11.useState(isWindowDefined() ? window.innerWidth : null);
640
643
  React11.useEffect(() => {
641
644
  const handleResize = () => {
642
645
  setWidth(window.innerWidth);
@@ -679,7 +682,7 @@ var Modal = (0, import_react17.forwardRef)(function ModalInner({
679
682
  onClose,
680
683
  isOpen
681
684
  }, ref);
682
- const isMobile = useWindowWidth() < 744;
685
+ const isMobile = (useWindowWidth() ?? Infinity) < 744;
683
686
  const transitionEnabled = isMobile && bottomSheet !== false;
684
687
  const showDismiss = !isMobile || bottomSheet !== true;
685
688
  const transition = (0, import_react_spring.useTransition)(isOpen, {