@charcoal-ui/react 4.4.0 → 4.5.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.
@@ -1,2 +1,2 @@
1
- export declare function usePreventScroll(element: HTMLElement | null, isOpen: boolean): void;
1
+ export declare function usePreventScroll(element: HTMLElement | null, isOpen: boolean, useClip?: boolean): void;
2
2
  //# sourceMappingURL=usePreventScroll.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePreventScroll.d.ts","sourceRoot":"","sources":["../../../../src/components/DropdownSelector/Popover/usePreventScroll.tsx"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,EAAE,MAAM,EAAE,OAAO,QAe5E"}
1
+ {"version":3,"file":"usePreventScroll.d.ts","sourceRoot":"","sources":["../../../../src/components/DropdownSelector/Popover/usePreventScroll.tsx"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,MAAM,EAAE,OAAO,EACf,OAAO,UAAQ,QAgBhB"}
@@ -1,12 +1,12 @@
1
1
  import * as React from 'react';
2
- import { AriaModalOverlayProps } from '@react-aria/overlays';
3
2
  import type { AriaDialogProps } from '@react-types/dialog';
4
3
  import { ButtonProps } from '../Button';
5
4
  import { IconButtonProps } from '../IconButton';
5
+ import { CharcoalModalOverlayProps } from './useCustomModalOverlay';
6
6
  import './index.css';
7
7
  export type BottomSheet = boolean | 'full';
8
8
  export type Size = 'S' | 'M' | 'L';
9
- export type ModalProps = AriaModalOverlayProps & AriaDialogProps & {
9
+ export type ModalProps = CharcoalModalOverlayProps & AriaDialogProps & {
10
10
  children: React.ReactNode;
11
11
  zIndex?: number;
12
12
  title: string;
@@ -22,7 +22,9 @@ export type ModalProps = AriaModalOverlayProps & AriaDialogProps & {
22
22
  */
23
23
  portalContainer?: HTMLElement;
24
24
  };
25
- declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<AriaModalOverlayProps & AriaDialogProps & {
25
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("@react-aria/overlays").AriaModalOverlayProps & {
26
+ overflowClip?: boolean | undefined;
27
+ } & AriaDialogProps & {
26
28
  children: React.ReactNode;
27
29
  zIndex?: number | undefined;
28
30
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,qBAAqB,EAAW,MAAM,sBAAsB,CAAA;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAE1D,OAAe,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAS3D,OAAO,aAAa,CAAA;AAEpB,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAA;AAC1C,MAAM,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AAElC,MAAM,MAAM,UAAU,GAAG,qBAAqB,GAC5C,eAAe,GAAG;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAE7B;;;OAGG;IACH,eAAe,CAAC,EAAE,WAAW,CAAA;CAC9B,CAAA;;;;;;;;;;;IALC;;;OAGG;;;AA8JP,wBAA0B;AAE1B,eAAO,MAAM,YAAY;IACvB;;OAEG;gBACS,MA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AO,MAAM,YAAY;IACvB;;OAEG;gBACS,MAAM,cAAc,CAAC,WAAW,CAAC;WACtC,MAAM;mBACC,IAAI;iBACL,OAAO;iBACP,WAAW;EAOxB,CAAA;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,2CAUpE;AAED,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,kDAYrE"}
@@ -5,7 +5,10 @@ import { AriaModalOverlayProps, ModalOverlayAria } from '@react-aria/overlays';
5
5
  * but `useModalOverlay` (specifically, `useOverlay` within it) detects pointer events on the scrollbar.
6
6
  * Therefore, to prevent this issue, we need to override `shouldCloseOnInteractOutside` in `useModalOverlay`.
7
7
  */
8
- export declare function useCharcoalModalOverlay(props: AriaModalOverlayProps, state: {
8
+ export type CharcoalModalOverlayProps = AriaModalOverlayProps & {
9
+ overflowClip?: boolean;
10
+ };
11
+ export declare function useCharcoalModalOverlay(props: CharcoalModalOverlayProps, state: {
9
12
  isOpen: boolean;
10
13
  onClose: () => void;
11
14
  }, ref: React.RefObject<HTMLElement | null>): ModalOverlayAria;
@@ -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,GAAG,IAAI,CAAC,GACvC,gBAAgB,CA4BlB;AAMD,wBAAgB,cAAc,kBAc7B"}
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,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,GAAG;IAC9D,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AACD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,yBAAyB,EAChC,KAAK,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,EAC/C,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GACvC,gBAAgB,CA6BlB;AAMD,wBAAgB,cAAc,kBAc7B"}
package/dist/index.cjs.js CHANGED
@@ -870,19 +870,19 @@ var import_overlays2 = require("@react-aria/overlays");
870
870
 
871
871
  // src/components/DropdownSelector/Popover/usePreventScroll.tsx
872
872
  var import_react19 = require("react");
873
- function usePreventScroll(element, isOpen) {
873
+ function usePreventScroll(element, isOpen, useClip = false) {
874
874
  (0, import_react19.useEffect)(() => {
875
875
  if (isOpen && element) {
876
876
  const defaultPaddingRight = element.style.paddingRight;
877
877
  const defaultOverflow = element.style.overflow;
878
878
  element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
879
- element.style.overflow = "hidden";
879
+ element.style.overflow = useClip ? "clip" : "hidden";
880
880
  return () => {
881
881
  element.style.paddingRight = defaultPaddingRight;
882
882
  element.style.overflow = defaultOverflow;
883
883
  };
884
884
  }
885
- }, [element, isOpen]);
885
+ }, [element, isOpen, useClip]);
886
886
  }
887
887
 
888
888
  // src/components/Modal/useCustomModalOverlay.tsx
@@ -896,7 +896,7 @@ function useCharcoalModalOverlay(props, state, ref) {
896
896
  onClose: state.onClose,
897
897
  shouldCloseOnInteractOutside: () => false
898
898
  }, ref);
899
- usePreventScroll(typeof document !== "undefined" ? document.body : null, state.isOpen);
899
+ usePreventScroll(typeof document !== "undefined" ? document.body : null, state.isOpen, props.overflowClip);
900
900
  (0, import_overlays2.useOverlayFocusContain)();
901
901
  React11.useEffect(() => {
902
902
  if (state.isOpen && ref.current) {