@react-aria/overlays 3.22.0 → 3.23.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.
Files changed (90) hide show
  1. package/dist/DismissButton.main.js +2 -2
  2. package/dist/DismissButton.mjs +3 -3
  3. package/dist/DismissButton.module.js +2 -2
  4. package/dist/Overlay.mjs +1 -1
  5. package/dist/PortalProvider.mjs +1 -1
  6. package/dist/ar-AE.mjs +1 -1
  7. package/dist/ariaHideOutside.main.js +7 -7
  8. package/dist/ariaHideOutside.mjs +8 -8
  9. package/dist/ariaHideOutside.module.js +7 -7
  10. package/dist/bg-BG.mjs +1 -1
  11. package/dist/calculatePosition.main.js +40 -40
  12. package/dist/calculatePosition.main.js.map +1 -1
  13. package/dist/calculatePosition.mjs +41 -41
  14. package/dist/calculatePosition.module.js +40 -40
  15. package/dist/calculatePosition.module.js.map +1 -1
  16. package/dist/cs-CZ.mjs +1 -1
  17. package/dist/da-DK.mjs +1 -1
  18. package/dist/de-DE.mjs +1 -1
  19. package/dist/el-GR.mjs +1 -1
  20. package/dist/en-US.mjs +1 -1
  21. package/dist/es-ES.mjs +1 -1
  22. package/dist/et-EE.mjs +1 -1
  23. package/dist/fi-FI.mjs +1 -1
  24. package/dist/fr-FR.mjs +1 -1
  25. package/dist/he-IL.mjs +1 -1
  26. package/dist/hr-HR.mjs +1 -1
  27. package/dist/hu-HU.mjs +1 -1
  28. package/dist/intlStrings.mjs +1 -1
  29. package/dist/it-IT.mjs +1 -1
  30. package/dist/ja-JP.mjs +1 -1
  31. package/dist/ko-KR.mjs +1 -1
  32. package/dist/lt-LT.mjs +1 -1
  33. package/dist/lv-LV.mjs +1 -1
  34. package/dist/nb-NO.mjs +1 -1
  35. package/dist/nl-NL.mjs +1 -1
  36. package/dist/pl-PL.mjs +1 -1
  37. package/dist/pt-BR.mjs +1 -1
  38. package/dist/pt-PT.mjs +1 -1
  39. package/dist/ro-RO.mjs +1 -1
  40. package/dist/ru-RU.mjs +1 -1
  41. package/dist/sk-SK.mjs +1 -1
  42. package/dist/sl-SI.mjs +1 -1
  43. package/dist/sr-SP.mjs +1 -1
  44. package/dist/sv-SE.mjs +1 -1
  45. package/dist/tr-TR.mjs +1 -1
  46. package/dist/types.d.ts +10 -10
  47. package/dist/types.d.ts.map +1 -1
  48. package/dist/uk-UA.mjs +1 -1
  49. package/dist/useCloseOnScroll.main.js +6 -2
  50. package/dist/useCloseOnScroll.main.js.map +1 -1
  51. package/dist/useCloseOnScroll.mjs +7 -3
  52. package/dist/useCloseOnScroll.module.js +6 -2
  53. package/dist/useCloseOnScroll.module.js.map +1 -1
  54. package/dist/useModal.main.js +4 -4
  55. package/dist/useModal.mjs +5 -5
  56. package/dist/useModal.module.js +4 -4
  57. package/dist/useModalOverlay.main.js.map +1 -1
  58. package/dist/useModalOverlay.mjs +1 -1
  59. package/dist/useModalOverlay.module.js.map +1 -1
  60. package/dist/useOverlay.main.js +1 -1
  61. package/dist/useOverlay.main.js.map +1 -1
  62. package/dist/useOverlay.mjs +2 -2
  63. package/dist/useOverlay.module.js +1 -1
  64. package/dist/useOverlay.module.js.map +1 -1
  65. package/dist/useOverlayPosition.main.js +62 -19
  66. package/dist/useOverlayPosition.main.js.map +1 -1
  67. package/dist/useOverlayPosition.mjs +63 -20
  68. package/dist/useOverlayPosition.module.js +62 -19
  69. package/dist/useOverlayPosition.module.js.map +1 -1
  70. package/dist/useOverlayTrigger.main.js +5 -5
  71. package/dist/useOverlayTrigger.main.js.map +1 -1
  72. package/dist/useOverlayTrigger.mjs +6 -6
  73. package/dist/useOverlayTrigger.module.js +5 -5
  74. package/dist/useOverlayTrigger.module.js.map +1 -1
  75. package/dist/usePopover.main.js.map +1 -1
  76. package/dist/usePopover.mjs +1 -1
  77. package/dist/usePopover.module.js.map +1 -1
  78. package/dist/usePreventScroll.main.js +22 -22
  79. package/dist/usePreventScroll.mjs +23 -23
  80. package/dist/usePreventScroll.module.js +22 -22
  81. package/dist/zh-CN.mjs +1 -1
  82. package/dist/zh-TW.mjs +1 -1
  83. package/package.json +14 -14
  84. package/src/calculatePosition.ts +3 -3
  85. package/src/useCloseOnScroll.ts +10 -2
  86. package/src/useModalOverlay.ts +3 -3
  87. package/src/useOverlay.ts +4 -4
  88. package/src/useOverlayPosition.ts +58 -11
  89. package/src/useOverlayTrigger.ts +3 -3
  90. package/src/usePopover.ts +3 -4
package/dist/hr-HR.mjs CHANGED
@@ -5,4 +5,4 @@ $553439c3ffb3e492$exports = {
5
5
 
6
6
 
7
7
  export {$553439c3ffb3e492$exports as default};
8
- //# sourceMappingURL=hr-HR.mjs.map
8
+ //# sourceMappingURL=hr-HR.module.js.map
package/dist/hu-HU.mjs CHANGED
@@ -5,4 +5,4 @@ $74cf411061b983a2$exports = {
5
5
 
6
6
 
7
7
  export {$74cf411061b983a2$exports as default};
8
- //# sourceMappingURL=hu-HU.mjs.map
8
+ //# sourceMappingURL=hu-HU.module.js.map
@@ -107,4 +107,4 @@ $a2f21f5f14f60553$exports = {
107
107
 
108
108
 
109
109
  export {$a2f21f5f14f60553$exports as default};
110
- //# sourceMappingURL=intlStrings.mjs.map
110
+ //# sourceMappingURL=intlStrings.module.js.map
package/dist/it-IT.mjs CHANGED
@@ -5,4 +5,4 @@ $e933f298574dc435$exports = {
5
5
 
6
6
 
7
7
  export {$e933f298574dc435$exports as default};
8
- //# sourceMappingURL=it-IT.mjs.map
8
+ //# sourceMappingURL=it-IT.module.js.map
package/dist/ja-JP.mjs CHANGED
@@ -5,4 +5,4 @@ $ac91fc9fe02f71f6$exports = {
5
5
 
6
6
 
7
7
  export {$ac91fc9fe02f71f6$exports as default};
8
- //# sourceMappingURL=ja-JP.mjs.map
8
+ //# sourceMappingURL=ja-JP.module.js.map
package/dist/ko-KR.mjs CHANGED
@@ -5,4 +5,4 @@ $52b96f86422025af$exports = {
5
5
 
6
6
 
7
7
  export {$52b96f86422025af$exports as default};
8
- //# sourceMappingURL=ko-KR.mjs.map
8
+ //# sourceMappingURL=ko-KR.module.js.map
package/dist/lt-LT.mjs CHANGED
@@ -5,4 +5,4 @@ $c0d724c3e51dafa6$exports = {
5
5
 
6
6
 
7
7
  export {$c0d724c3e51dafa6$exports as default};
8
- //# sourceMappingURL=lt-LT.mjs.map
8
+ //# sourceMappingURL=lt-LT.module.js.map
package/dist/lv-LV.mjs CHANGED
@@ -5,4 +5,4 @@ $c92899672a3fe72e$exports = {
5
5
 
6
6
 
7
7
  export {$c92899672a3fe72e$exports as default};
8
- //# sourceMappingURL=lv-LV.mjs.map
8
+ //# sourceMappingURL=lv-LV.module.js.map
package/dist/nb-NO.mjs CHANGED
@@ -5,4 +5,4 @@ $9f576b39d8e7a9d6$exports = {
5
5
 
6
6
 
7
7
  export {$9f576b39d8e7a9d6$exports as default};
8
- //# sourceMappingURL=nb-NO.mjs.map
8
+ //# sourceMappingURL=nb-NO.module.js.map
package/dist/nl-NL.mjs CHANGED
@@ -5,4 +5,4 @@ $9d025808aeec81a7$exports = {
5
5
 
6
6
 
7
7
  export {$9d025808aeec81a7$exports as default};
8
- //# sourceMappingURL=nl-NL.mjs.map
8
+ //# sourceMappingURL=nl-NL.module.js.map
package/dist/pl-PL.mjs CHANGED
@@ -5,4 +5,4 @@ $fce709921e2c0fa6$exports = {
5
5
 
6
6
 
7
7
  export {$fce709921e2c0fa6$exports as default};
8
- //# sourceMappingURL=pl-PL.mjs.map
8
+ //# sourceMappingURL=pl-PL.module.js.map
package/dist/pt-BR.mjs CHANGED
@@ -5,4 +5,4 @@ $2599cf0c4ab37f59$exports = {
5
5
 
6
6
 
7
7
  export {$2599cf0c4ab37f59$exports as default};
8
- //# sourceMappingURL=pt-BR.mjs.map
8
+ //# sourceMappingURL=pt-BR.module.js.map
package/dist/pt-PT.mjs CHANGED
@@ -5,4 +5,4 @@ $3c220ae7ef8a35fd$exports = {
5
5
 
6
6
 
7
7
  export {$3c220ae7ef8a35fd$exports as default};
8
- //# sourceMappingURL=pt-PT.mjs.map
8
+ //# sourceMappingURL=pt-PT.module.js.map
package/dist/ro-RO.mjs CHANGED
@@ -5,4 +5,4 @@ $93562b5094072f54$exports = {
5
5
 
6
6
 
7
7
  export {$93562b5094072f54$exports as default};
8
- //# sourceMappingURL=ro-RO.mjs.map
8
+ //# sourceMappingURL=ro-RO.module.js.map
package/dist/ru-RU.mjs CHANGED
@@ -5,4 +5,4 @@ $cd9e2abd0d06c7b4$exports = {
5
5
 
6
6
 
7
7
  export {$cd9e2abd0d06c7b4$exports as default};
8
- //# sourceMappingURL=ru-RU.mjs.map
8
+ //# sourceMappingURL=ru-RU.module.js.map
package/dist/sk-SK.mjs CHANGED
@@ -5,4 +5,4 @@ $45375701f409adf1$exports = {
5
5
 
6
6
 
7
7
  export {$45375701f409adf1$exports as default};
8
- //# sourceMappingURL=sk-SK.mjs.map
8
+ //# sourceMappingURL=sk-SK.module.js.map
package/dist/sl-SI.mjs CHANGED
@@ -5,4 +5,4 @@ $27fab53a576de9dd$exports = {
5
5
 
6
6
 
7
7
  export {$27fab53a576de9dd$exports as default};
8
- //# sourceMappingURL=sl-SI.mjs.map
8
+ //# sourceMappingURL=sl-SI.module.js.map
package/dist/sr-SP.mjs CHANGED
@@ -5,4 +5,4 @@ $4438748d9952e7c7$exports = {
5
5
 
6
6
 
7
7
  export {$4438748d9952e7c7$exports as default};
8
- //# sourceMappingURL=sr-SP.mjs.map
8
+ //# sourceMappingURL=sr-SP.module.js.map
package/dist/sv-SE.mjs CHANGED
@@ -5,4 +5,4 @@ $0936d7347ef4da4c$exports = {
5
5
 
6
6
 
7
7
  export {$0936d7347ef4da4c$exports as default};
8
- //# sourceMappingURL=sv-SE.mjs.map
8
+ //# sourceMappingURL=sv-SE.module.js.map
package/dist/tr-TR.mjs CHANGED
@@ -5,4 +5,4 @@ $29700c92185d38f8$exports = {
5
5
 
6
6
 
7
7
  export {$29700c92185d38f8$exports as default};
8
- //# sourceMappingURL=tr-TR.mjs.map
8
+ //# sourceMappingURL=tr-TR.module.js.map
package/dist/types.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { DOMAttributes, DOMProps, AriaLabelingProps } from "@react-types/shared";
1
+ import { DOMAttributes, RefObject, DOMProps, AriaLabelingProps } from "@react-types/shared";
2
2
  import { PlacementAxis, PositionProps } from "@react-types/overlays";
3
- import React, { RefObject, AriaAttributes, ReactNode } from "react";
4
3
  import { AriaButtonProps } from "@react-types/button";
5
4
  import { OverlayTriggerState } from "@react-stately/overlays";
5
+ import React, { AriaAttributes, ReactNode } from "react";
6
6
  export interface AriaPositionProps extends PositionProps {
7
7
  /**
8
8
  * Cross size of the overlay arrow in pixels.
@@ -17,16 +17,16 @@ export interface AriaPositionProps extends PositionProps {
17
17
  /**
18
18
  * The ref for the element which the overlay positions itself with respect to.
19
19
  */
20
- targetRef: RefObject<Element>;
20
+ targetRef: RefObject<Element | null>;
21
21
  /**
22
22
  * The ref for the overlay element.
23
23
  */
24
- overlayRef: RefObject<Element>;
24
+ overlayRef: RefObject<Element | null>;
25
25
  /**
26
26
  * A ref for the scrollable region within the overlay.
27
27
  * @default overlayRef
28
28
  */
29
- scrollRef?: RefObject<Element>;
29
+ scrollRef?: RefObject<Element | null>;
30
30
  /**
31
31
  * Whether the overlay should update its position automatically.
32
32
  * @default true
@@ -96,7 +96,7 @@ export interface OverlayAria {
96
96
  * Hides the overlay when the user interacts outside it, when the Escape key is pressed,
97
97
  * or optionally, on blur. Only the top-most overlay will close at once.
98
98
  */
99
- export function useOverlay(props: AriaOverlayProps, ref: RefObject<Element>): OverlayAria;
99
+ export function useOverlay(props: AriaOverlayProps, ref: RefObject<Element | null>): OverlayAria;
100
100
  export interface OverlayTriggerProps {
101
101
  /** Type of overlay that is opened by the trigger. */
102
102
  type: 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid';
@@ -111,7 +111,7 @@ export interface OverlayTriggerAria {
111
111
  * Handles the behavior and accessibility for an overlay trigger, e.g. a button
112
112
  * that opens a popover, menu, or other overlay that is positioned relative to the trigger.
113
113
  */
114
- export function useOverlayTrigger(props: OverlayTriggerProps, state: OverlayTriggerState, ref?: RefObject<Element>): OverlayTriggerAria;
114
+ export function useOverlayTrigger(props: OverlayTriggerProps, state: OverlayTriggerState, ref?: RefObject<Element | null>): OverlayTriggerAria;
115
115
  interface PreventScrollOptions {
116
116
  /** Whether the scroll lock is disabled. */
117
117
  isDisabled?: boolean;
@@ -210,11 +210,11 @@ export interface AriaPopoverProps extends Omit<AriaPositionProps, 'isOpen' | 'on
210
210
  /**
211
211
  * The ref for the element which the popover positions itself with respect to.
212
212
  */
213
- triggerRef: RefObject<Element>;
213
+ triggerRef: RefObject<Element | null>;
214
214
  /**
215
215
  * The ref for the popover element.
216
216
  */
217
- popoverRef: RefObject<Element>;
217
+ popoverRef: RefObject<Element | null>;
218
218
  /**
219
219
  * Whether the popover is non-modal, i.e. elements outside the popover may be
220
220
  * interacted with by assistive technologies.
@@ -312,7 +312,7 @@ export interface ModalOverlayAria {
312
312
  * Provides the behavior and accessibility implementation for a modal component.
313
313
  * A modal is an overlay element which blocks interaction with elements outside it.
314
314
  */
315
- export function useModalOverlay(props: AriaModalOverlayProps, state: OverlayTriggerState, ref: RefObject<HTMLElement>): ModalOverlayAria;
315
+ export function useModalOverlay(props: AriaModalOverlayProps, state: OverlayTriggerState, ref: RefObject<HTMLElement | null>): ModalOverlayAria;
316
316
  export type { Placement, PlacementAxis, PositionProps } from '@react-types/overlays';
317
317
 
318
318
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"mappings":";;;;;AEoBA,kCAAmC,SAAQ,aAAa;IACtD;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,SAAS,EAAE,UAAU,OAAO,CAAC,CAAC;IAC9B;;OAEG;IACH,UAAU,EAAE,UAAU,OAAO,CAAC,CAAC;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,UAAU,OAAO,CAAC,CAA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ACnG;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC;AAED;IACE,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAC1B,sCAAsC;IACtC,aAAa,EAAE,aAAa,CAAA;CAC7B;AAED;;;GAGG;AACH,gCAAgC,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,mBAAmB,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC,GAAG,gBAAgB,CAuBvI;ACrCD,YAAY,EAAC,SAAS,EAAE,aAAa,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC","sources":["packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/calculatePosition.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useCloseOnScroll.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useOverlayPosition.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useOverlay.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useOverlayTrigger.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/usePreventScroll.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useModal.tsx","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/DismissButton.tsx","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/ariaHideOutside.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/usePopover.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/PortalProvider.tsx","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/Overlay.tsx","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useModalOverlay.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/index.ts","packages/@react-aria/overlays/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useOverlayPosition} from './useOverlayPosition';\nexport {useOverlay} from './useOverlay';\nexport {useOverlayTrigger} from './useOverlayTrigger';\nexport {usePreventScroll} from './usePreventScroll';\nexport {ModalProvider, useModalProvider, OverlayProvider, OverlayContainer, useModal} from './useModal';\nexport {DismissButton} from './DismissButton';\nexport {ariaHideOutside} from './ariaHideOutside';\nexport {usePopover} from './usePopover';\nexport {useModalOverlay} from './useModalOverlay';\nexport {Overlay, useOverlayFocusContain} from './Overlay';\nexport {UNSTABLE_PortalProvider, useUNSTABLE_PortalContext} from './PortalProvider';\n\nexport type {AriaPositionProps, PositionAria} from './useOverlayPosition';\nexport type {AriaOverlayProps, OverlayAria} from './useOverlay';\nexport type {OverlayTriggerAria, OverlayTriggerProps} from './useOverlayTrigger';\nexport type {AriaModalOptions, ModalAria, ModalProviderAria, ModalProviderProps, OverlayContainerProps} from './useModal';\nexport type {DismissButtonProps} from './DismissButton';\nexport type {AriaPopoverProps, PopoverAria} from './usePopover';\nexport type {AriaModalOverlayProps, ModalOverlayAria} from './useModalOverlay';\nexport type {OverlayProps} from './Overlay';\nexport type {Placement, PlacementAxis, PositionProps} from '@react-types/overlays';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;;AEoBA,kCAAmC,SAAQ,aAAa;IACtD;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,SAAS,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,CAAC;IACrC;;OAEG;IACH,UAAU,EAAE,UAAU,OAAO,G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ID;;;GAGG;AACH,wBAAwB,KAAK,EAAE,YAAY,qBAiC1C;AAED,eAAe;AACf,+CAMC;ACpED,sCAAuC,SAAQ,IAAI,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IACnG;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAA;CACpC;AAED;IACE,mCAAmC;IACnC,UAAU,EAAE,aAAa,CAAC;IAC1B,sCAAsC;IACtC,aAAa,EAAE,aAAa,CAAA;CAC7B;AAED;;;GAGG;AACH,gCAAgC,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,mBAAmB,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,GAAG,gBAAgB,CAuB9I;ACrCD,YAAY,EAAC,SAAS,EAAE,aAAa,EAAE,aAAa,EAAC,MAAM,uBAAuB,CAAC","sources":["packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/calculatePosition.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useCloseOnScroll.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useOverlayPosition.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useOverlay.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useOverlayTrigger.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/usePreventScroll.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useModal.tsx","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/DismissButton.tsx","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/ariaHideOutside.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/usePopover.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/PortalProvider.tsx","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/Overlay.tsx","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/useModalOverlay.ts","packages/@react-aria/overlays/src/packages/@react-aria/overlays/src/index.ts","packages/@react-aria/overlays/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useOverlayPosition} from './useOverlayPosition';\nexport {useOverlay} from './useOverlay';\nexport {useOverlayTrigger} from './useOverlayTrigger';\nexport {usePreventScroll} from './usePreventScroll';\nexport {ModalProvider, useModalProvider, OverlayProvider, OverlayContainer, useModal} from './useModal';\nexport {DismissButton} from './DismissButton';\nexport {ariaHideOutside} from './ariaHideOutside';\nexport {usePopover} from './usePopover';\nexport {useModalOverlay} from './useModalOverlay';\nexport {Overlay, useOverlayFocusContain} from './Overlay';\nexport {UNSTABLE_PortalProvider, useUNSTABLE_PortalContext} from './PortalProvider';\n\nexport type {AriaPositionProps, PositionAria} from './useOverlayPosition';\nexport type {AriaOverlayProps, OverlayAria} from './useOverlay';\nexport type {OverlayTriggerAria, OverlayTriggerProps} from './useOverlayTrigger';\nexport type {AriaModalOptions, ModalAria, ModalProviderAria, ModalProviderProps, OverlayContainerProps} from './useModal';\nexport type {DismissButtonProps} from './DismissButton';\nexport type {AriaPopoverProps, PopoverAria} from './usePopover';\nexport type {AriaModalOverlayProps, ModalOverlayAria} from './useModalOverlay';\nexport type {OverlayProps} from './Overlay';\nexport type {Placement, PlacementAxis, PositionProps} from '@react-types/overlays';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/dist/uk-UA.mjs CHANGED
@@ -5,4 +5,4 @@ $662ccaf2be4c25b3$exports = {
5
5
 
6
6
 
7
7
  export {$662ccaf2be4c25b3$exports as default};
8
- //# sourceMappingURL=uk-UA.mjs.map
8
+ //# sourceMappingURL=uk-UA.module.js.map
@@ -28,12 +28,16 @@ function $9a8aa1b0b336ea3a$export$18fc8428861184da(opts) {
28
28
  let target = e.target;
29
29
  // window is not a Node and doesn't have contain, but window contains everything
30
30
  if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current)) return;
31
+ // Ignore scroll events on any input or textarea as the cursor position can cause it to scroll
32
+ // such as in a combobox. Clicking the dropdown button places focus on the input, and if the
33
+ // text inside the input extends beyond the 'end', then it will scroll so the cursor is visible at the end.
34
+ if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
31
35
  let onCloseHandler = onClose || $9a8aa1b0b336ea3a$export$f6211563215e3b37.get(triggerRef.current);
32
36
  if (onCloseHandler) onCloseHandler();
33
37
  };
34
- window.addEventListener("scroll", onScroll, true);
38
+ window.addEventListener('scroll', onScroll, true);
35
39
  return ()=>{
36
- window.removeEventListener("scroll", onScroll, true);
40
+ window.removeEventListener('scroll', onScroll, true);
37
41
  };
38
42
  }, [
39
43
  isOpen,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;AASM,MAAM,4CAA2C,IAAI;AASrD,SAAS,0CAAiB,IAA0B;IACzD,IAAI,cAAC,UAAU,UAAE,MAAM,WAAE,OAAO,EAAC,GAAG;IAEpC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,UAAU,YAAY,MACzB;QAGF,IAAI,WAAW,CAAC;YACd,uEAAuE;YACvE,IAAI,SAAS,EAAE,MAAM;YACrB,gFAAgF;YAChF,IAAI,CAAC,WAAW,OAAO,IAAK,AAAC,kBAAkB,QAAS,CAAC,OAAO,QAAQ,CAAC,WAAW,OAAO,GACzF;YAGF,IAAI,iBAAiB,WAAW,0CAAW,GAAG,CAAC,WAAW,OAAO;YACjE,IAAI,gBACF;QAEJ;QAEA,OAAO,gBAAgB,CAAC,UAAU,UAAU;QAC5C,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;QACjD;IACF,GAAG;QAAC;QAAQ;QAAS;KAAW;AAClC","sources":["packages/@react-aria/overlays/src/useCloseOnScroll.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {RefObject, useEffect} from 'react';\n\n// This behavior moved from useOverlayTrigger to useOverlayPosition.\n// For backward compatibility, where useOverlayTrigger handled hiding the popover on close,\n// it sets a close function here mapped from the trigger element. This way we can avoid\n// forcing users to pass an onClose function to useOverlayPosition which could be considered\n// a breaking change.\nexport const onCloseMap: WeakMap<Element, () => void> = new WeakMap();\n\ninterface CloseOnScrollOptions {\n triggerRef: RefObject<Element>,\n isOpen?: boolean,\n onClose?: () => void\n}\n\n/** @private */\nexport function useCloseOnScroll(opts: CloseOnScrollOptions) {\n let {triggerRef, isOpen, onClose} = opts;\n\n useEffect(() => {\n if (!isOpen || onClose === null) {\n return;\n }\n\n let onScroll = (e: MouseEvent) => {\n // Ignore if scrolling an scrollable region outside the trigger's tree.\n let target = e.target;\n // window is not a Node and doesn't have contain, but window contains everything\n if (!triggerRef.current || ((target instanceof Node) && !target.contains(triggerRef.current))) {\n return;\n }\n\n let onCloseHandler = onClose || onCloseMap.get(triggerRef.current);\n if (onCloseHandler) {\n onCloseHandler();\n }\n };\n\n window.addEventListener('scroll', onScroll, true);\n return () => {\n window.removeEventListener('scroll', onScroll, true);\n };\n }, [isOpen, onClose, triggerRef]);\n}\n"],"names":[],"version":3,"file":"useCloseOnScroll.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;AAUM,MAAM,4CAA2C,IAAI;AASrD,SAAS,0CAAiB,IAA0B;IACzD,IAAI,cAAC,UAAU,UAAE,MAAM,WAAE,OAAO,EAAC,GAAG;IAEpC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,CAAC,UAAU,YAAY,MACzB;QAGF,IAAI,WAAW,CAAC;YACd,uEAAuE;YACvE,IAAI,SAAS,EAAE,MAAM;YACrB,gFAAgF;YAChF,IAAI,CAAC,WAAW,OAAO,IAAK,AAAC,kBAAkB,QAAS,CAAC,OAAO,QAAQ,CAAC,WAAW,OAAO,GACzF;YAGF,8FAA8F;YAC9F,4FAA4F;YAC5F,2GAA2G;YAC3G,IAAI,EAAE,MAAM,YAAY,oBAAoB,EAAE,MAAM,YAAY,qBAC9D;YAGF,IAAI,iBAAiB,WAAW,0CAAW,GAAG,CAAC,WAAW,OAAO;YACjE,IAAI,gBACF;QAEJ;QAEA,OAAO,gBAAgB,CAAC,UAAU,UAAU;QAC5C,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;QACjD;IACF,GAAG;QAAC;QAAQ;QAAS;KAAW;AAClC","sources":["packages/@react-aria/overlays/src/useCloseOnScroll.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {RefObject} from '@react-types/shared';\nimport {useEffect} from 'react';\n\n// This behavior moved from useOverlayTrigger to useOverlayPosition.\n// For backward compatibility, where useOverlayTrigger handled hiding the popover on close,\n// it sets a close function here mapped from the trigger element. This way we can avoid\n// forcing users to pass an onClose function to useOverlayPosition which could be considered\n// a breaking change.\nexport const onCloseMap: WeakMap<Element, () => void> = new WeakMap();\n\ninterface CloseOnScrollOptions {\n triggerRef: RefObject<Element | null>,\n isOpen?: boolean,\n onClose?: () => void\n}\n\n/** @private */\nexport function useCloseOnScroll(opts: CloseOnScrollOptions) {\n let {triggerRef, isOpen, onClose} = opts;\n\n useEffect(() => {\n if (!isOpen || onClose === null) {\n return;\n }\n\n let onScroll = (e: MouseEvent) => {\n // Ignore if scrolling an scrollable region outside the trigger's tree.\n let target = e.target;\n // window is not a Node and doesn't have contain, but window contains everything\n if (!triggerRef.current || ((target instanceof Node) && !target.contains(triggerRef.current))) {\n return;\n }\n\n // Ignore scroll events on any input or textarea as the cursor position can cause it to scroll\n // such as in a combobox. Clicking the dropdown button places focus on the input, and if the\n // text inside the input extends beyond the 'end', then it will scroll so the cursor is visible at the end.\n if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {\n return;\n }\n\n let onCloseHandler = onClose || onCloseMap.get(triggerRef.current);\n if (onCloseHandler) {\n onCloseHandler();\n }\n };\n\n window.addEventListener('scroll', onScroll, true);\n return () => {\n window.removeEventListener('scroll', onScroll, true);\n };\n }, [isOpen, onClose, triggerRef]);\n}\n"],"names":[],"version":3,"file":"useCloseOnScroll.main.js.map"}
@@ -21,12 +21,16 @@ function $dd149f63282afbbf$export$18fc8428861184da(opts) {
21
21
  let target = e.target;
22
22
  // window is not a Node and doesn't have contain, but window contains everything
23
23
  if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current)) return;
24
+ // Ignore scroll events on any input or textarea as the cursor position can cause it to scroll
25
+ // such as in a combobox. Clicking the dropdown button places focus on the input, and if the
26
+ // text inside the input extends beyond the 'end', then it will scroll so the cursor is visible at the end.
27
+ if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
24
28
  let onCloseHandler = onClose || $dd149f63282afbbf$export$f6211563215e3b37.get(triggerRef.current);
25
29
  if (onCloseHandler) onCloseHandler();
26
30
  };
27
- window.addEventListener("scroll", onScroll, true);
31
+ window.addEventListener('scroll', onScroll, true);
28
32
  return ()=>{
29
- window.removeEventListener("scroll", onScroll, true);
33
+ window.removeEventListener('scroll', onScroll, true);
30
34
  };
31
35
  }, [
32
36
  isOpen,
@@ -37,4 +41,4 @@ function $dd149f63282afbbf$export$18fc8428861184da(opts) {
37
41
 
38
42
 
39
43
  export {$dd149f63282afbbf$export$f6211563215e3b37 as onCloseMap, $dd149f63282afbbf$export$18fc8428861184da as useCloseOnScroll};
40
- //# sourceMappingURL=useCloseOnScroll.mjs.map
44
+ //# sourceMappingURL=useCloseOnScroll.module.js.map
@@ -21,12 +21,16 @@ function $dd149f63282afbbf$export$18fc8428861184da(opts) {
21
21
  let target = e.target;
22
22
  // window is not a Node and doesn't have contain, but window contains everything
23
23
  if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current)) return;
24
+ // Ignore scroll events on any input or textarea as the cursor position can cause it to scroll
25
+ // such as in a combobox. Clicking the dropdown button places focus on the input, and if the
26
+ // text inside the input extends beyond the 'end', then it will scroll so the cursor is visible at the end.
27
+ if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
24
28
  let onCloseHandler = onClose || $dd149f63282afbbf$export$f6211563215e3b37.get(triggerRef.current);
25
29
  if (onCloseHandler) onCloseHandler();
26
30
  };
27
- window.addEventListener("scroll", onScroll, true);
31
+ window.addEventListener('scroll', onScroll, true);
28
32
  return ()=>{
29
- window.removeEventListener("scroll", onScroll, true);
33
+ window.removeEventListener('scroll', onScroll, true);
30
34
  };
31
35
  }, [
32
36
  isOpen,
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AASM,MAAM,4CAA2C,IAAI;AASrD,SAAS,0CAAiB,IAA0B;IACzD,IAAI,cAAC,UAAU,UAAE,MAAM,WAAE,OAAO,EAAC,GAAG;IAEpC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,UAAU,YAAY,MACzB;QAGF,IAAI,WAAW,CAAC;YACd,uEAAuE;YACvE,IAAI,SAAS,EAAE,MAAM;YACrB,gFAAgF;YAChF,IAAI,CAAC,WAAW,OAAO,IAAK,AAAC,kBAAkB,QAAS,CAAC,OAAO,QAAQ,CAAC,WAAW,OAAO,GACzF;YAGF,IAAI,iBAAiB,WAAW,0CAAW,GAAG,CAAC,WAAW,OAAO;YACjE,IAAI,gBACF;QAEJ;QAEA,OAAO,gBAAgB,CAAC,UAAU,UAAU;QAC5C,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;QACjD;IACF,GAAG;QAAC;QAAQ;QAAS;KAAW;AAClC","sources":["packages/@react-aria/overlays/src/useCloseOnScroll.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {RefObject, useEffect} from 'react';\n\n// This behavior moved from useOverlayTrigger to useOverlayPosition.\n// For backward compatibility, where useOverlayTrigger handled hiding the popover on close,\n// it sets a close function here mapped from the trigger element. This way we can avoid\n// forcing users to pass an onClose function to useOverlayPosition which could be considered\n// a breaking change.\nexport const onCloseMap: WeakMap<Element, () => void> = new WeakMap();\n\ninterface CloseOnScrollOptions {\n triggerRef: RefObject<Element>,\n isOpen?: boolean,\n onClose?: () => void\n}\n\n/** @private */\nexport function useCloseOnScroll(opts: CloseOnScrollOptions) {\n let {triggerRef, isOpen, onClose} = opts;\n\n useEffect(() => {\n if (!isOpen || onClose === null) {\n return;\n }\n\n let onScroll = (e: MouseEvent) => {\n // Ignore if scrolling an scrollable region outside the trigger's tree.\n let target = e.target;\n // window is not a Node and doesn't have contain, but window contains everything\n if (!triggerRef.current || ((target instanceof Node) && !target.contains(triggerRef.current))) {\n return;\n }\n\n let onCloseHandler = onClose || onCloseMap.get(triggerRef.current);\n if (onCloseHandler) {\n onCloseHandler();\n }\n };\n\n window.addEventListener('scroll', onScroll, true);\n return () => {\n window.removeEventListener('scroll', onScroll, true);\n };\n }, [isOpen, onClose, triggerRef]);\n}\n"],"names":[],"version":3,"file":"useCloseOnScroll.module.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAUM,MAAM,4CAA2C,IAAI;AASrD,SAAS,0CAAiB,IAA0B;IACzD,IAAI,cAAC,UAAU,UAAE,MAAM,WAAE,OAAO,EAAC,GAAG;IAEpC,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,CAAC,UAAU,YAAY,MACzB;QAGF,IAAI,WAAW,CAAC;YACd,uEAAuE;YACvE,IAAI,SAAS,EAAE,MAAM;YACrB,gFAAgF;YAChF,IAAI,CAAC,WAAW,OAAO,IAAK,AAAC,kBAAkB,QAAS,CAAC,OAAO,QAAQ,CAAC,WAAW,OAAO,GACzF;YAGF,8FAA8F;YAC9F,4FAA4F;YAC5F,2GAA2G;YAC3G,IAAI,EAAE,MAAM,YAAY,oBAAoB,EAAE,MAAM,YAAY,qBAC9D;YAGF,IAAI,iBAAiB,WAAW,0CAAW,GAAG,CAAC,WAAW,OAAO;YACjE,IAAI,gBACF;QAEJ;QAEA,OAAO,gBAAgB,CAAC,UAAU,UAAU;QAC5C,OAAO;YACL,OAAO,mBAAmB,CAAC,UAAU,UAAU;QACjD;IACF,GAAG;QAAC;QAAQ;QAAS;KAAW;AAClC","sources":["packages/@react-aria/overlays/src/useCloseOnScroll.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {RefObject} from '@react-types/shared';\nimport {useEffect} from 'react';\n\n// This behavior moved from useOverlayTrigger to useOverlayPosition.\n// For backward compatibility, where useOverlayTrigger handled hiding the popover on close,\n// it sets a close function here mapped from the trigger element. This way we can avoid\n// forcing users to pass an onClose function to useOverlayPosition which could be considered\n// a breaking change.\nexport const onCloseMap: WeakMap<Element, () => void> = new WeakMap();\n\ninterface CloseOnScrollOptions {\n triggerRef: RefObject<Element | null>,\n isOpen?: boolean,\n onClose?: () => void\n}\n\n/** @private */\nexport function useCloseOnScroll(opts: CloseOnScrollOptions) {\n let {triggerRef, isOpen, onClose} = opts;\n\n useEffect(() => {\n if (!isOpen || onClose === null) {\n return;\n }\n\n let onScroll = (e: MouseEvent) => {\n // Ignore if scrolling an scrollable region outside the trigger's tree.\n let target = e.target;\n // window is not a Node and doesn't have contain, but window contains everything\n if (!triggerRef.current || ((target instanceof Node) && !target.contains(triggerRef.current))) {\n return;\n }\n\n // Ignore scroll events on any input or textarea as the cursor position can cause it to scroll\n // such as in a combobox. Clicking the dropdown button places focus on the input, and if the\n // text inside the input extends beyond the 'end', then it will scroll so the cursor is visible at the end.\n if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {\n return;\n }\n\n let onCloseHandler = onClose || onCloseMap.get(triggerRef.current);\n if (onCloseHandler) {\n onCloseHandler();\n }\n };\n\n window.addEventListener('scroll', onScroll, true);\n return () => {\n window.removeEventListener('scroll', onScroll, true);\n };\n }, [isOpen, onClose, triggerRef]);\n}\n"],"names":[],"version":3,"file":"useCloseOnScroll.module.js.map"}
@@ -57,7 +57,7 @@ function $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0() {
57
57
  let context = (0, $btuAB$react.useContext)($0775ea8ea6a0565e$var$Context);
58
58
  return {
59
59
  modalProviderProps: {
60
- "aria-hidden": context && context.modalCount > 0 ? true : null
60
+ 'aria-hidden': context && context.modalCount > 0 ? true : null
61
61
  }
62
62
  };
63
63
  }
@@ -78,7 +78,7 @@ function $0775ea8ea6a0565e$export$b47c3594eab58386(props) {
78
78
  let isSSR = (0, $btuAB$reactariassr.useIsSSR)();
79
79
  let { portalContainer: portalContainer = isSSR ? null : document.body, ...rest } = props;
80
80
  (0, ($parcel$interopDefault($btuAB$react))).useEffect(()=>{
81
- if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest("[data-overlay-container]")) throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
81
+ if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest('[data-overlay-container]')) throw new Error('An OverlayContainer must not be inside another container. Please change the portalContainer prop.');
82
82
  }, [
83
83
  portalContainer
84
84
  ]);
@@ -89,7 +89,7 @@ function $0775ea8ea6a0565e$export$b47c3594eab58386(props) {
89
89
  function $0775ea8ea6a0565e$export$33ffd74ebf07f060(options) {
90
90
  // Add aria-hidden to all parent providers on mount, and restore on unmount.
91
91
  let context = (0, $btuAB$react.useContext)($0775ea8ea6a0565e$var$Context);
92
- if (!context) throw new Error("Modal is not contained within a provider");
92
+ if (!context) throw new Error('Modal is not contained within a provider');
93
93
  (0, $btuAB$react.useEffect)(()=>{
94
94
  if ((options === null || options === void 0 ? void 0 : options.isDisabled) || !context || !context.parent) return;
95
95
  // The immediate context is from the provider containing this modal, so we only
@@ -105,7 +105,7 @@ function $0775ea8ea6a0565e$export$33ffd74ebf07f060(options) {
105
105
  ]);
106
106
  return {
107
107
  modalProps: {
108
- "data-ismodal": !(options === null || options === void 0 ? void 0 : options.isDisabled)
108
+ 'data-ismodal': !(options === null || options === void 0 ? void 0 : options.isDisabled)
109
109
  }
110
110
  };
111
111
  }
package/dist/useModal.mjs CHANGED
@@ -43,7 +43,7 @@ function $f57aed4a881a3485$export$d9aaed4c3ece1bc0() {
43
43
  let context = (0, $4AOtR$useContext)($f57aed4a881a3485$var$Context);
44
44
  return {
45
45
  modalProviderProps: {
46
- "aria-hidden": context && context.modalCount > 0 ? true : null
46
+ 'aria-hidden': context && context.modalCount > 0 ? true : null
47
47
  }
48
48
  };
49
49
  }
@@ -64,7 +64,7 @@ function $f57aed4a881a3485$export$b47c3594eab58386(props) {
64
64
  let isSSR = (0, $4AOtR$useIsSSR)();
65
65
  let { portalContainer: portalContainer = isSSR ? null : document.body, ...rest } = props;
66
66
  (0, $4AOtR$react).useEffect(()=>{
67
- if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest("[data-overlay-container]")) throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
67
+ if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest('[data-overlay-container]')) throw new Error('An OverlayContainer must not be inside another container. Please change the portalContainer prop.');
68
68
  }, [
69
69
  portalContainer
70
70
  ]);
@@ -75,7 +75,7 @@ function $f57aed4a881a3485$export$b47c3594eab58386(props) {
75
75
  function $f57aed4a881a3485$export$33ffd74ebf07f060(options) {
76
76
  // Add aria-hidden to all parent providers on mount, and restore on unmount.
77
77
  let context = (0, $4AOtR$useContext)($f57aed4a881a3485$var$Context);
78
- if (!context) throw new Error("Modal is not contained within a provider");
78
+ if (!context) throw new Error('Modal is not contained within a provider');
79
79
  (0, $4AOtR$useEffect)(()=>{
80
80
  if ((options === null || options === void 0 ? void 0 : options.isDisabled) || !context || !context.parent) return;
81
81
  // The immediate context is from the provider containing this modal, so we only
@@ -91,11 +91,11 @@ function $f57aed4a881a3485$export$33ffd74ebf07f060(options) {
91
91
  ]);
92
92
  return {
93
93
  modalProps: {
94
- "data-ismodal": !(options === null || options === void 0 ? void 0 : options.isDisabled)
94
+ 'data-ismodal': !(options === null || options === void 0 ? void 0 : options.isDisabled)
95
95
  }
96
96
  };
97
97
  }
98
98
 
99
99
 
100
100
  export {$f57aed4a881a3485$export$178405afcd8c5eb as ModalProvider, $f57aed4a881a3485$export$d9aaed4c3ece1bc0 as useModalProvider, $f57aed4a881a3485$export$bf688221f59024e5 as OverlayProvider, $f57aed4a881a3485$export$b47c3594eab58386 as OverlayContainer, $f57aed4a881a3485$export$33ffd74ebf07f060 as useModal};
101
- //# sourceMappingURL=useModal.mjs.map
101
+ //# sourceMappingURL=useModal.module.js.map
@@ -43,7 +43,7 @@ function $f57aed4a881a3485$export$d9aaed4c3ece1bc0() {
43
43
  let context = (0, $4AOtR$useContext)($f57aed4a881a3485$var$Context);
44
44
  return {
45
45
  modalProviderProps: {
46
- "aria-hidden": context && context.modalCount > 0 ? true : null
46
+ 'aria-hidden': context && context.modalCount > 0 ? true : null
47
47
  }
48
48
  };
49
49
  }
@@ -64,7 +64,7 @@ function $f57aed4a881a3485$export$b47c3594eab58386(props) {
64
64
  let isSSR = (0, $4AOtR$useIsSSR)();
65
65
  let { portalContainer: portalContainer = isSSR ? null : document.body, ...rest } = props;
66
66
  (0, $4AOtR$react).useEffect(()=>{
67
- if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest("[data-overlay-container]")) throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
67
+ if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest('[data-overlay-container]')) throw new Error('An OverlayContainer must not be inside another container. Please change the portalContainer prop.');
68
68
  }, [
69
69
  portalContainer
70
70
  ]);
@@ -75,7 +75,7 @@ function $f57aed4a881a3485$export$b47c3594eab58386(props) {
75
75
  function $f57aed4a881a3485$export$33ffd74ebf07f060(options) {
76
76
  // Add aria-hidden to all parent providers on mount, and restore on unmount.
77
77
  let context = (0, $4AOtR$useContext)($f57aed4a881a3485$var$Context);
78
- if (!context) throw new Error("Modal is not contained within a provider");
78
+ if (!context) throw new Error('Modal is not contained within a provider');
79
79
  (0, $4AOtR$useEffect)(()=>{
80
80
  if ((options === null || options === void 0 ? void 0 : options.isDisabled) || !context || !context.parent) return;
81
81
  // The immediate context is from the provider containing this modal, so we only
@@ -91,7 +91,7 @@ function $f57aed4a881a3485$export$33ffd74ebf07f060(options) {
91
91
  ]);
92
92
  return {
93
93
  modalProps: {
94
- "data-ismodal": !(options === null || options === void 0 ? void 0 : options.isDisabled)
94
+ 'data-ismodal': !(options === null || options === void 0 ? void 0 : options.isDisabled)
95
95
  }
96
96
  };
97
97
  }
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAmCM,SAAS,0CAAgB,KAA4B,EAAE,KAA0B,EAAE,GAA2B;IACnH,IAAI,gBAAC,YAAY,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,oCAAS,EAAE;QAC7C,GAAG,KAAK;QACR,QAAQ,MAAM,MAAM;QACpB,SAAS,MAAM,KAAK;IACtB,GAAG;IAEH,CAAA,GAAA,0CAAe,EAAE;QACf,YAAY,CAAC,MAAM,MAAM;IAC3B;IAEA,CAAA,GAAA,gDAAqB;IAErB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,MAAM,MAAM,EACd,OAAO,CAAA,GAAA,yCAAc,EAAE;YAAC,IAAI,OAAO;SAAC;IAExC,GAAG;QAAC,MAAM,MAAM;QAAE;KAAI;IAEtB,OAAO;QACL,YAAY,CAAA,GAAA,gCAAS,EAAE;uBACvB;IACF;AACF","sources":["packages/@react-aria/overlays/src/useModalOverlay.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ariaHideOutside} from './ariaHideOutside';\nimport {AriaOverlayProps, useOverlay} from './useOverlay';\nimport {DOMAttributes} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport {RefObject, useEffect} from 'react';\nimport {useOverlayFocusContain} from './Overlay';\nimport {usePreventScroll} from './usePreventScroll';\n\nexport interface AriaModalOverlayProps extends Pick<AriaOverlayProps, 'shouldCloseOnInteractOutside'> {\n /**\n * Whether to close the modal when the user interacts outside it.\n * @default false\n */\n isDismissable?: boolean,\n /**\n * Whether pressing the escape key to close the modal should be disabled.\n * @default false\n */\n isKeyboardDismissDisabled?: boolean\n}\n\nexport interface ModalOverlayAria {\n /** Props for the modal element. */\n modalProps: DOMAttributes,\n /** Props for the underlay element. */\n underlayProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a modal component.\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport function useModalOverlay(props: AriaModalOverlayProps, state: OverlayTriggerState, ref: RefObject<HTMLElement>): ModalOverlayAria {\n let {overlayProps, underlayProps} = useOverlay({\n ...props,\n isOpen: state.isOpen,\n onClose: state.close\n }, ref);\n\n usePreventScroll({\n isDisabled: !state.isOpen\n });\n\n useOverlayFocusContain();\n\n useEffect(() => {\n if (state.isOpen) {\n return ariaHideOutside([ref.current]);\n }\n }, [state.isOpen, ref]);\n\n return {\n modalProps: mergeProps(overlayProps),\n underlayProps\n };\n}\n"],"names":[],"version":3,"file":"useModalOverlay.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAmCM,SAAS,0CAAgB,KAA4B,EAAE,KAA0B,EAAE,GAAkC;IAC1H,IAAI,gBAAC,YAAY,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,oCAAS,EAAE;QAC7C,GAAG,KAAK;QACR,QAAQ,MAAM,MAAM;QACpB,SAAS,MAAM,KAAK;IACtB,GAAG;IAEH,CAAA,GAAA,0CAAe,EAAE;QACf,YAAY,CAAC,MAAM,MAAM;IAC3B;IAEA,CAAA,GAAA,gDAAqB;IAErB,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,MAAM,MAAM,EACd,OAAO,CAAA,GAAA,yCAAc,EAAE;YAAC,IAAI,OAAO;SAAC;IAExC,GAAG;QAAC,MAAM,MAAM;QAAE;KAAI;IAEtB,OAAO;QACL,YAAY,CAAA,GAAA,gCAAS,EAAE;uBACvB;IACF;AACF","sources":["packages/@react-aria/overlays/src/useModalOverlay.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ariaHideOutside} from './ariaHideOutside';\nimport {AriaOverlayProps, useOverlay} from './useOverlay';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport {useEffect} from 'react';\nimport {useOverlayFocusContain} from './Overlay';\nimport {usePreventScroll} from './usePreventScroll';\n\nexport interface AriaModalOverlayProps extends Pick<AriaOverlayProps, 'shouldCloseOnInteractOutside'> {\n /**\n * Whether to close the modal when the user interacts outside it.\n * @default false\n */\n isDismissable?: boolean,\n /**\n * Whether pressing the escape key to close the modal should be disabled.\n * @default false\n */\n isKeyboardDismissDisabled?: boolean\n}\n\nexport interface ModalOverlayAria {\n /** Props for the modal element. */\n modalProps: DOMAttributes,\n /** Props for the underlay element. */\n underlayProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a modal component.\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport function useModalOverlay(props: AriaModalOverlayProps, state: OverlayTriggerState, ref: RefObject<HTMLElement | null>): ModalOverlayAria {\n let {overlayProps, underlayProps} = useOverlay({\n ...props,\n isOpen: state.isOpen,\n onClose: state.close\n }, ref);\n\n usePreventScroll({\n isDisabled: !state.isOpen\n });\n\n useOverlayFocusContain();\n\n useEffect(() => {\n if (state.isOpen) {\n return ariaHideOutside([ref.current]);\n }\n }, [state.isOpen, ref]);\n\n return {\n modalProps: mergeProps(overlayProps),\n underlayProps\n };\n}\n"],"names":[],"version":3,"file":"useModalOverlay.main.js.map"}
@@ -47,4 +47,4 @@ function $8ac8429251c45e4b$export$dbc0f175b25fb0fb(props, state, ref) {
47
47
 
48
48
 
49
49
  export {$8ac8429251c45e4b$export$dbc0f175b25fb0fb as useModalOverlay};
50
- //# sourceMappingURL=useModalOverlay.mjs.map
50
+ //# sourceMappingURL=useModalOverlay.module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAmCM,SAAS,0CAAgB,KAA4B,EAAE,KAA0B,EAAE,GAA2B;IACnH,IAAI,gBAAC,YAAY,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,yCAAS,EAAE;QAC7C,GAAG,KAAK;QACR,QAAQ,MAAM,MAAM;QACpB,SAAS,MAAM,KAAK;IACtB,GAAG;IAEH,CAAA,GAAA,yCAAe,EAAE;QACf,YAAY,CAAC,MAAM,MAAM;IAC3B;IAEA,CAAA,GAAA,yCAAqB;IAErB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,MAAM,EACd,OAAO,CAAA,GAAA,yCAAc,EAAE;YAAC,IAAI,OAAO;SAAC;IAExC,GAAG;QAAC,MAAM,MAAM;QAAE;KAAI;IAEtB,OAAO;QACL,YAAY,CAAA,GAAA,iBAAS,EAAE;uBACvB;IACF;AACF","sources":["packages/@react-aria/overlays/src/useModalOverlay.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ariaHideOutside} from './ariaHideOutside';\nimport {AriaOverlayProps, useOverlay} from './useOverlay';\nimport {DOMAttributes} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport {RefObject, useEffect} from 'react';\nimport {useOverlayFocusContain} from './Overlay';\nimport {usePreventScroll} from './usePreventScroll';\n\nexport interface AriaModalOverlayProps extends Pick<AriaOverlayProps, 'shouldCloseOnInteractOutside'> {\n /**\n * Whether to close the modal when the user interacts outside it.\n * @default false\n */\n isDismissable?: boolean,\n /**\n * Whether pressing the escape key to close the modal should be disabled.\n * @default false\n */\n isKeyboardDismissDisabled?: boolean\n}\n\nexport interface ModalOverlayAria {\n /** Props for the modal element. */\n modalProps: DOMAttributes,\n /** Props for the underlay element. */\n underlayProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a modal component.\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport function useModalOverlay(props: AriaModalOverlayProps, state: OverlayTriggerState, ref: RefObject<HTMLElement>): ModalOverlayAria {\n let {overlayProps, underlayProps} = useOverlay({\n ...props,\n isOpen: state.isOpen,\n onClose: state.close\n }, ref);\n\n usePreventScroll({\n isDisabled: !state.isOpen\n });\n\n useOverlayFocusContain();\n\n useEffect(() => {\n if (state.isOpen) {\n return ariaHideOutside([ref.current]);\n }\n }, [state.isOpen, ref]);\n\n return {\n modalProps: mergeProps(overlayProps),\n underlayProps\n };\n}\n"],"names":[],"version":3,"file":"useModalOverlay.module.js.map"}
1
+ {"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAmCM,SAAS,0CAAgB,KAA4B,EAAE,KAA0B,EAAE,GAAkC;IAC1H,IAAI,gBAAC,YAAY,iBAAE,aAAa,EAAC,GAAG,CAAA,GAAA,yCAAS,EAAE;QAC7C,GAAG,KAAK;QACR,QAAQ,MAAM,MAAM;QACpB,SAAS,MAAM,KAAK;IACtB,GAAG;IAEH,CAAA,GAAA,yCAAe,EAAE;QACf,YAAY,CAAC,MAAM,MAAM;IAC3B;IAEA,CAAA,GAAA,yCAAqB;IAErB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,MAAM,EACd,OAAO,CAAA,GAAA,yCAAc,EAAE;YAAC,IAAI,OAAO;SAAC;IAExC,GAAG;QAAC,MAAM,MAAM;QAAE;KAAI;IAEtB,OAAO;QACL,YAAY,CAAA,GAAA,iBAAS,EAAE;uBACvB;IACF;AACF","sources":["packages/@react-aria/overlays/src/useModalOverlay.ts"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ariaHideOutside} from './ariaHideOutside';\nimport {AriaOverlayProps, useOverlay} from './useOverlay';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {OverlayTriggerState} from '@react-stately/overlays';\nimport {useEffect} from 'react';\nimport {useOverlayFocusContain} from './Overlay';\nimport {usePreventScroll} from './usePreventScroll';\n\nexport interface AriaModalOverlayProps extends Pick<AriaOverlayProps, 'shouldCloseOnInteractOutside'> {\n /**\n * Whether to close the modal when the user interacts outside it.\n * @default false\n */\n isDismissable?: boolean,\n /**\n * Whether pressing the escape key to close the modal should be disabled.\n * @default false\n */\n isKeyboardDismissDisabled?: boolean\n}\n\nexport interface ModalOverlayAria {\n /** Props for the modal element. */\n modalProps: DOMAttributes,\n /** Props for the underlay element. */\n underlayProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a modal component.\n * A modal is an overlay element which blocks interaction with elements outside it.\n */\nexport function useModalOverlay(props: AriaModalOverlayProps, state: OverlayTriggerState, ref: RefObject<HTMLElement | null>): ModalOverlayAria {\n let {overlayProps, underlayProps} = useOverlay({\n ...props,\n isOpen: state.isOpen,\n onClose: state.close\n }, ref);\n\n usePreventScroll({\n isDisabled: !state.isOpen\n });\n\n useOverlayFocusContain();\n\n useEffect(() => {\n if (state.isOpen) {\n return ariaHideOutside([ref.current]);\n }\n }, [state.isOpen, ref]);\n\n return {\n modalProps: mergeProps(overlayProps),\n underlayProps\n };\n}\n"],"names":[],"version":3,"file":"useModalOverlay.module.js.map"}
@@ -58,7 +58,7 @@ function $82711f9cb668ecdb$export$ea8f71083e90600f(props, ref) {
58
58
  };
59
59
  // Handle the escape key
60
60
  let onKeyDown = (e)=>{
61
- if (e.key === "Escape" && !isKeyboardDismissDisabled && !e.nativeEvent.isComposing) {
61
+ if (e.key === 'Escape' && !isKeyboardDismissDisabled && !e.nativeEvent.isComposing) {
62
62
  e.stopPropagation();
63
63
  e.preventDefault();
64
64
  onHide();
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AA6CD,MAAM,wCAAwC,EAAE;AAOzC,SAAS,0CAAW,KAAuB,EAAE,GAAuB;IACzE,IAAI,WACF,OAAO,qBACP,iBAAiB,UACjB,MAAM,iBACN,gBAAgB,kCAChB,4BAA4B,qCAC5B,4BAA4B,EAC7B,GAAG;IAEJ,wFAAwF;IACxF,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,QACF,sCAAgB,IAAI,CAAC;QAGvB,OAAO;YACL,IAAI,QAAQ,sCAAgB,OAAO,CAAC;YACpC,IAAI,SAAS,GACX,sCAAgB,MAAM,CAAC,OAAO;QAElC;IACF,GAAG;QAAC;Q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IAAI,EAAE,MAAM,KAAK,EAAE,aAAa,EAC9B,EAAE,cAAc;IAEpB;IAEA,OAAO;QACL,cAAc;uBACZ;YACA,GAAG,gBAAgB;QACrB;QACA,eAAe;YACb,eAAe;QACjB;IACF;AACF","sources":["packages/@react-aria/overlays/src/useOverlay.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes} from '@react-types/shared';\nimport {isElementInChildOfActiveScope} from '@react-aria/focus';\nimport {RefObject, useEffect} from 'react';\nimport {useFocusWithin, useInteractOutside} from '@react-aria/interactions';\n\nexport interface AriaOverlayProps {\n /** Whether the overlay is currently open. */\n isOpen?: boolean,\n\n /** Handler that is called when the overlay should close. */\n onClose?: () => void,\n\n /**\n * Whether to close the overlay when the user interacts outside it.\n * @default false\n */\n isDismissable?: boolean,\n\n /** Whether the overlay should close when focus is lost or moves outside it. */\n shouldCloseOnBlur?: boolean,\n\n /**\n * Whether pressing the escape key to close the overlay should be disabled.\n * @default false\n */\n isKeyboardDismissDisabled?: boolean,\n\n /**\n * When user interacts with the argument element outside of the overlay ref,\n * return true if onClose should be called. This gives you a chance to filter\n * out interaction with elements that should not dismiss the overlay.\n * By default, onClose will always be called on interaction outside the overlay ref.\n */\n shouldCloseOnInteractOutside?: (element: Element) => boolean\n}\n\nexport interface OverlayAria {\n /** Props to apply to the overlay container element. */\n overlayProps: DOMAttributes,\n /** Props to apply to the underlay element, if any. */\n underlayProps: DOMAttributes\n}\n\nconst visibleOverlays: RefObject<Element>[] = [];\n\n/**\n * Provides the behavior for overlays such as dialogs, popovers, and menus.\n * Hides the overlay when the user interacts outside it, when the Escape key is pressed,\n * or optionally, on blur. Only the top-most overlay will close at once.\n */\nexport function useOverlay(props: AriaOverlayProps, ref: RefObject<Element>): OverlayAria {\n let {\n onClose,\n shouldCloseOnBlur,\n isOpen,\n isDismissable = false,\n isKeyboardDismissDisabled = false,\n shouldCloseOnInteractOutside\n } = props;\n\n // Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.\n useEffect(() => {\n if (isOpen) {\n visibleOverlays.push(ref);\n }\n\n return () => {\n let index = visibleOverlays.indexOf(ref);\n if (index >= 0) {\n visibleOverlays.splice(index, 1);\n }\n };\n }, [isOpen, ref]);\n\n // Only hide the overlay when it is the topmost visible overlay in the stack\n let onHide = () => {\n if (visibleOverlays[visibleOverlays.length - 1] === ref && onClose) {\n onClose();\n }\n };\n\n let onInteractOutsideStart = (e: PointerEvent) => {\n if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target as Element)) {\n if (visibleOverlays[visibleOverlays.length - 1] === ref) {\n e.stopPropagation();\n e.preventDefault();\n }\n }\n };\n\n let onInteractOutside = (e: PointerEvent) => {\n if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target as Element)) {\n if (visibleOverlays[visibleOverlays.length - 1] === ref) {\n e.stopPropagation();\n e.preventDefault();\n }\n onHide();\n }\n };\n\n // Handle the escape key\n let onKeyDown = (e) => {\n if (e.key === 'Escape' && !isKeyboardDismissDisabled && !e.nativeEvent.isComposing) {\n e.stopPropagation();\n e.preventDefault();\n onHide();\n }\n };\n\n // Handle clicking outside the overlay to close it\n useInteractOutside({ref, onInteractOutside: isDismissable && isOpen ? onInteractOutside : null, onInteractOutsideStart});\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !shouldCloseOnBlur,\n onBlurWithin: (e) => {\n // Do not close if relatedTarget is null, which means focus is lost to the body.\n // That can happen when switching tabs, or due to a VoiceOver/Chrome bug with Control+Option+Arrow navigation.\n // Clicking on the body to close the overlay should already be handled by useInteractOutside.\n // https://github.com/adobe/react-spectrum/issues/4130\n // https://github.com/adobe/react-spectrum/issues/4922\n //\n // If focus is moving into a child focus scope (e.g. menu inside a dialog),\n // do not close the outer overlay. At this point, the active scope should\n // still be the outer overlay, since blur events run before focus.\n if (!e.relatedTarget || isElementInChildOfActiveScope(e.relatedTarget)) {\n return;\n }\n\n if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget as Element)) {\n onClose();\n }\n }\n });\n\n let onPointerDownUnderlay = e => {\n // fixes a firefox issue that starts text selection https://bugzilla.mozilla.org/show_bug.cgi?id=1675846\n if (e.target === e.currentTarget) {\n e.preventDefault();\n }\n };\n\n return {\n overlayProps: {\n onKeyDown,\n ...focusWithinProps\n },\n underlayProps: {\n onPointerDown: onPointerDownUnderlay\n }\n };\n}\n"],"names":[],"version":3,"file":"useOverlay.main.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AA6CD,MAAM,wCAA+C,EAAE;AAOhD,SAAS,0CAAW,KAAuB,EAAE,GAA8B;IAChF,IAAI,WACF,OAAO,qBACP,iBAAiB,UACjB,MAAM,iBACN,gBAAgB,kCAChB,4BAA4B,qCAC5B,4BAA4B,EAC7B,GAAG;IAEJ,wFAAwF;IACxF,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,QACF,sCAAgB,IAAI,CAAC;QAGvB,OAAO;YACL,IAAI,QAAQ,sCAAgB,OAAO,CAAC;YACpC,IAAI,SAAS,GACX,sCAAgB,MAAM,CAAC,OAAO;QAElC;IACF,GAAG;QAAC;QAAQ;KAAI;IAEhB,4EAA4E;IAC5E,IAAI,SAAS;QACX,IAAI,qCAAe,CAAC,sCAAgB,MAAM,GAAG,EAAE,KAAK,OAAO,SACzD;IAEJ;IAEA,IAAI,yBAAyB,CAAC;QAC5B,IAAI,CAAC,gCAAgC,6BAA6B,EAAE,MAAM,GACxE;YAAA,IAAI,qCAAe,CAAC,sCAAgB,MAAM,GAAG,EAAE,KAAK,KAAK;gBACvD,EAAE,eAAe;gBACjB,EAAE,cAAc;YAClB;QAAA;IAEJ;IAEA,IAAI,oBAAoB,CAAC;QACvB,IAAI,CAAC,gCAAgC,6BAA6B,EAAE,MAAM,GAAc;YACtF,IAAI,qCAAe,CAAC,sCAAgB,MAAM,GAAG,EAAE,KAAK,KAAK;gBACvD,EAAE,eAAe;gBACjB,EAAE,cAAc;YAClB;YACA;QACF;IACF;IAEA,wBAAwB;IACxB,IAAI,YAAY,CAAC;QACf,IAAI,EAAE,GAAG,KAAK,YAAY,CAAC,6BAA6B,CAAC,EAAE,WAAW,CAAC,WAAW,EAAE;YAClF,EAAE,eAAe;YACjB,EAAE,cAAc;YAChB;QACF;IACF;IAEA,kDAAkD;IAClD,CAAA,GAAA,+CAAiB,EAAE;aAAC;QAAK,mBAAmB,iBAAiB,SAAS,oBAAoB;gCAAM;IAAsB;IAEtH,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,2CAAa,EAAE;QACtC,YAAY,CAAC;QACb,cAAc,CAAC;YACb,gFAAgF;YAChF,8GAA8G;YAC9G,6FAA6F;YAC7F,sDAAsD;YACtD,sDAAsD;YACtD,EAAE;YACF,2EAA2E;YAC3E,yEAAyE;YACzE,kEAAkE;YAClE,IAAI,CAAC,EAAE,aAAa,IAAI,CAAA,GAAA,mDAA4B,EAAE,EAAE,aAAa,GACnE;YAGF,IAAI,CAAC,gCAAgC,6BAA6B,EAAE,aAAa,GAC/E;QAEJ;IACF;IAEA,IAAI,wBAAwB,CAAA;QAC1B,wGAAwG;QACxG,IAAI,EAAE,MAAM,KAAK,EAAE,aAAa,EAC9B,EAAE,cAAc;IAEpB;IAEA,OAAO;QACL,cAAc;uBACZ;YACA,GAAG,gBAAgB;QACrB;QACA,eAAe;YACb,eAAe;QACjB;IACF;AACF","sources":["packages/@react-aria/overlays/src/useOverlay.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {isElementInChildOfActiveScope} from '@react-aria/focus';\nimport {useEffect} from 'react';\nimport {useFocusWithin, useInteractOutside} from '@react-aria/interactions';\n\nexport interface AriaOverlayProps {\n /** Whether the overlay is currently open. */\n isOpen?: boolean,\n\n /** Handler that is called when the overlay should close. */\n onClose?: () => void,\n\n /**\n * Whether to close the overlay when the user interacts outside it.\n * @default false\n */\n isDismissable?: boolean,\n\n /** Whether the overlay should close when focus is lost or moves outside it. */\n shouldCloseOnBlur?: boolean,\n\n /**\n * Whether pressing the escape key to close the overlay should be disabled.\n * @default false\n */\n isKeyboardDismissDisabled?: boolean,\n\n /**\n * When user interacts with the argument element outside of the overlay ref,\n * return true if onClose should be called. This gives you a chance to filter\n * out interaction with elements that should not dismiss the overlay.\n * By default, onClose will always be called on interaction outside the overlay ref.\n */\n shouldCloseOnInteractOutside?: (element: Element) => boolean\n}\n\nexport interface OverlayAria {\n /** Props to apply to the overlay container element. */\n overlayProps: DOMAttributes,\n /** Props to apply to the underlay element, if any. */\n underlayProps: DOMAttributes\n}\n\nconst visibleOverlays: RefObject<Element | null>[] = [];\n\n/**\n * Provides the behavior for overlays such as dialogs, popovers, and menus.\n * Hides the overlay when the user interacts outside it, when the Escape key is pressed,\n * or optionally, on blur. Only the top-most overlay will close at once.\n */\nexport function useOverlay(props: AriaOverlayProps, ref: RefObject<Element | null>): OverlayAria {\n let {\n onClose,\n shouldCloseOnBlur,\n isOpen,\n isDismissable = false,\n isKeyboardDismissDisabled = false,\n shouldCloseOnInteractOutside\n } = props;\n\n // Add the overlay ref to the stack of visible overlays on mount, and remove on unmount.\n useEffect(() => {\n if (isOpen) {\n visibleOverlays.push(ref);\n }\n\n return () => {\n let index = visibleOverlays.indexOf(ref);\n if (index >= 0) {\n visibleOverlays.splice(index, 1);\n }\n };\n }, [isOpen, ref]);\n\n // Only hide the overlay when it is the topmost visible overlay in the stack\n let onHide = () => {\n if (visibleOverlays[visibleOverlays.length - 1] === ref && onClose) {\n onClose();\n }\n };\n\n let onInteractOutsideStart = (e: PointerEvent) => {\n if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target as Element)) {\n if (visibleOverlays[visibleOverlays.length - 1] === ref) {\n e.stopPropagation();\n e.preventDefault();\n }\n }\n };\n\n let onInteractOutside = (e: PointerEvent) => {\n if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.target as Element)) {\n if (visibleOverlays[visibleOverlays.length - 1] === ref) {\n e.stopPropagation();\n e.preventDefault();\n }\n onHide();\n }\n };\n\n // Handle the escape key\n let onKeyDown = (e) => {\n if (e.key === 'Escape' && !isKeyboardDismissDisabled && !e.nativeEvent.isComposing) {\n e.stopPropagation();\n e.preventDefault();\n onHide();\n }\n };\n\n // Handle clicking outside the overlay to close it\n useInteractOutside({ref, onInteractOutside: isDismissable && isOpen ? onInteractOutside : null, onInteractOutsideStart});\n\n let {focusWithinProps} = useFocusWithin({\n isDisabled: !shouldCloseOnBlur,\n onBlurWithin: (e) => {\n // Do not close if relatedTarget is null, which means focus is lost to the body.\n // That can happen when switching tabs, or due to a VoiceOver/Chrome bug with Control+Option+Arrow navigation.\n // Clicking on the body to close the overlay should already be handled by useInteractOutside.\n // https://github.com/adobe/react-spectrum/issues/4130\n // https://github.com/adobe/react-spectrum/issues/4922\n //\n // If focus is moving into a child focus scope (e.g. menu inside a dialog),\n // do not close the outer overlay. At this point, the active scope should\n // still be the outer overlay, since blur events run before focus.\n if (!e.relatedTarget || isElementInChildOfActiveScope(e.relatedTarget)) {\n return;\n }\n\n if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e.relatedTarget as Element)) {\n onClose();\n }\n }\n });\n\n let onPointerDownUnderlay = e => {\n // fixes a firefox issue that starts text selection https://bugzilla.mozilla.org/show_bug.cgi?id=1675846\n if (e.target === e.currentTarget) {\n e.preventDefault();\n }\n };\n\n return {\n overlayProps: {\n onKeyDown,\n ...focusWithinProps\n },\n underlayProps: {\n onPointerDown: onPointerDownUnderlay\n }\n };\n}\n"],"names":[],"version":3,"file":"useOverlay.main.js.map"}
@@ -52,7 +52,7 @@ function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
52
52
  };
53
53
  // Handle the escape key
54
54
  let onKeyDown = (e)=>{
55
- if (e.key === "Escape" && !isKeyboardDismissDisabled && !e.nativeEvent.isComposing) {
55
+ if (e.key === 'Escape' && !isKeyboardDismissDisabled && !e.nativeEvent.isComposing) {
56
56
  e.stopPropagation();
57
57
  e.preventDefault();
58
58
  onHide();
@@ -97,4 +97,4 @@ function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
97
97
 
98
98
 
99
99
  export {$a11501f3d1d39e6c$export$ea8f71083e90600f as useOverlay};
100
- //# sourceMappingURL=useOverlay.mjs.map
100
+ //# sourceMappingURL=useOverlay.module.js.map
@@ -52,7 +52,7 @@ function $a11501f3d1d39e6c$export$ea8f71083e90600f(props, ref) {
52
52
  };
53
53
  // Handle the escape key
54
54
  let onKeyDown = (e)=>{
55
- if (e.key === "Escape" && !isKeyboardDismissDisabled && !e.nativeEvent.isComposing) {
55
+ if (e.key === 'Escape' && !isKeyboardDismissDisabled && !e.nativeEvent.isComposing) {
56
56
  e.stopPropagation();
57
57
  e.preventDefault();
58
58
  onHide();