@react-aria/overlays 3.21.0 → 3.22.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.
- package/dist/DismissButton.main.js +51 -0
- package/dist/DismissButton.main.js.map +1 -0
- package/dist/DismissButton.mjs +46 -0
- package/dist/DismissButton.module.js +46 -0
- package/dist/DismissButton.module.js.map +1 -0
- package/dist/Overlay.main.js +73 -0
- package/dist/Overlay.main.js.map +1 -0
- package/dist/Overlay.mjs +63 -0
- package/dist/Overlay.module.js +63 -0
- package/dist/Overlay.module.js.map +1 -0
- package/dist/PortalProvider.main.js +41 -0
- package/dist/PortalProvider.main.js.map +1 -0
- package/dist/PortalProvider.mjs +31 -0
- package/dist/PortalProvider.module.js +31 -0
- package/dist/PortalProvider.module.js.map +1 -0
- package/dist/ar-AE.main.js +6 -0
- package/dist/ar-AE.main.js.map +1 -0
- package/dist/ar-AE.mjs +8 -0
- package/dist/ar-AE.module.js +8 -0
- package/dist/ar-AE.module.js.map +1 -0
- package/dist/ariaHideOutside.main.js +121 -0
- package/dist/ariaHideOutside.main.js.map +1 -0
- package/dist/ariaHideOutside.mjs +116 -0
- package/dist/ariaHideOutside.module.js +116 -0
- package/dist/ariaHideOutside.module.js.map +1 -0
- package/dist/bg-BG.main.js +6 -0
- package/dist/bg-BG.main.js.map +1 -0
- package/dist/bg-BG.mjs +8 -0
- package/dist/bg-BG.module.js +8 -0
- package/dist/bg-BG.module.js.map +1 -0
- package/dist/calculatePosition.main.js +355 -0
- package/dist/calculatePosition.main.js.map +1 -0
- package/dist/calculatePosition.mjs +350 -0
- package/dist/calculatePosition.module.js +350 -0
- package/dist/calculatePosition.module.js.map +1 -0
- package/dist/cs-CZ.main.js +6 -0
- package/dist/cs-CZ.main.js.map +1 -0
- package/dist/cs-CZ.mjs +8 -0
- package/dist/cs-CZ.module.js +8 -0
- package/dist/cs-CZ.module.js.map +1 -0
- package/dist/da-DK.main.js +6 -0
- package/dist/da-DK.main.js.map +1 -0
- package/dist/da-DK.mjs +8 -0
- package/dist/da-DK.module.js +8 -0
- package/dist/da-DK.module.js.map +1 -0
- package/dist/de-DE.main.js +6 -0
- package/dist/de-DE.main.js.map +1 -0
- package/dist/de-DE.mjs +8 -0
- package/dist/de-DE.module.js +8 -0
- package/dist/de-DE.module.js.map +1 -0
- package/dist/el-GR.main.js +6 -0
- package/dist/el-GR.main.js.map +1 -0
- package/dist/el-GR.mjs +8 -0
- package/dist/el-GR.module.js +8 -0
- package/dist/el-GR.module.js.map +1 -0
- package/dist/en-US.main.js +6 -0
- package/dist/en-US.main.js.map +1 -0
- package/dist/en-US.mjs +8 -0
- package/dist/en-US.module.js +8 -0
- package/dist/en-US.module.js.map +1 -0
- package/dist/es-ES.main.js +6 -0
- package/dist/es-ES.main.js.map +1 -0
- package/dist/es-ES.mjs +8 -0
- package/dist/es-ES.module.js +8 -0
- package/dist/es-ES.module.js.map +1 -0
- package/dist/et-EE.main.js +6 -0
- package/dist/et-EE.main.js.map +1 -0
- package/dist/et-EE.mjs +8 -0
- package/dist/et-EE.module.js +8 -0
- package/dist/et-EE.module.js.map +1 -0
- package/dist/fi-FI.main.js +6 -0
- package/dist/fi-FI.main.js.map +1 -0
- package/dist/fi-FI.mjs +8 -0
- package/dist/fi-FI.module.js +8 -0
- package/dist/fi-FI.module.js.map +1 -0
- package/dist/fr-FR.main.js +6 -0
- package/dist/fr-FR.main.js.map +1 -0
- package/dist/fr-FR.mjs +8 -0
- package/dist/fr-FR.module.js +8 -0
- package/dist/fr-FR.module.js.map +1 -0
- package/dist/he-IL.main.js +6 -0
- package/dist/he-IL.main.js.map +1 -0
- package/dist/he-IL.mjs +8 -0
- package/dist/he-IL.module.js +8 -0
- package/dist/he-IL.module.js.map +1 -0
- package/dist/hr-HR.main.js +6 -0
- package/dist/hr-HR.main.js.map +1 -0
- package/dist/hr-HR.mjs +8 -0
- package/dist/hr-HR.module.js +8 -0
- package/dist/hr-HR.module.js.map +1 -0
- package/dist/hu-HU.main.js +6 -0
- package/dist/hu-HU.main.js.map +1 -0
- package/dist/hu-HU.mjs +8 -0
- package/dist/hu-HU.module.js +8 -0
- package/dist/hu-HU.module.js.map +1 -0
- package/dist/import.mjs +12 -1533
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.main.js +6 -0
- package/dist/it-IT.main.js.map +1 -0
- package/dist/it-IT.mjs +8 -0
- package/dist/it-IT.module.js +8 -0
- package/dist/it-IT.module.js.map +1 -0
- package/dist/ja-JP.main.js +6 -0
- package/dist/ja-JP.main.js.map +1 -0
- package/dist/ja-JP.mjs +8 -0
- package/dist/ja-JP.module.js +8 -0
- package/dist/ja-JP.module.js.map +1 -0
- package/dist/ko-KR.main.js +6 -0
- package/dist/ko-KR.main.js.map +1 -0
- package/dist/ko-KR.mjs +8 -0
- package/dist/ko-KR.module.js +8 -0
- package/dist/ko-KR.module.js.map +1 -0
- package/dist/lt-LT.main.js +6 -0
- package/dist/lt-LT.main.js.map +1 -0
- package/dist/lt-LT.mjs +8 -0
- package/dist/lt-LT.module.js +8 -0
- package/dist/lt-LT.module.js.map +1 -0
- package/dist/lv-LV.main.js +6 -0
- package/dist/lv-LV.main.js.map +1 -0
- package/dist/lv-LV.mjs +8 -0
- package/dist/lv-LV.module.js +8 -0
- package/dist/lv-LV.module.js.map +1 -0
- package/dist/main.js +28 -1547
- package/dist/main.js.map +1 -1
- package/dist/module.js +12 -1533
- package/dist/module.js.map +1 -1
- package/dist/nb-NO.main.js +6 -0
- package/dist/nb-NO.main.js.map +1 -0
- package/dist/nb-NO.mjs +8 -0
- package/dist/nb-NO.module.js +8 -0
- package/dist/nb-NO.module.js.map +1 -0
- package/dist/nl-NL.main.js +6 -0
- package/dist/nl-NL.main.js.map +1 -0
- package/dist/nl-NL.mjs +8 -0
- package/dist/nl-NL.module.js +8 -0
- package/dist/nl-NL.module.js.map +1 -0
- package/dist/pl-PL.main.js +6 -0
- package/dist/pl-PL.main.js.map +1 -0
- package/dist/pl-PL.mjs +8 -0
- package/dist/pl-PL.module.js +8 -0
- package/dist/pl-PL.module.js.map +1 -0
- package/dist/pt-BR.main.js +6 -0
- package/dist/pt-BR.main.js.map +1 -0
- package/dist/pt-BR.mjs +8 -0
- package/dist/pt-BR.module.js +8 -0
- package/dist/pt-BR.module.js.map +1 -0
- package/dist/pt-PT.main.js +6 -0
- package/dist/pt-PT.main.js.map +1 -0
- package/dist/pt-PT.mjs +8 -0
- package/dist/pt-PT.module.js +8 -0
- package/dist/pt-PT.module.js.map +1 -0
- package/dist/ro-RO.main.js +6 -0
- package/dist/ro-RO.main.js.map +1 -0
- package/dist/ro-RO.mjs +8 -0
- package/dist/ro-RO.module.js +8 -0
- package/dist/ro-RO.module.js.map +1 -0
- package/dist/ru-RU.main.js +6 -0
- package/dist/ru-RU.main.js.map +1 -0
- package/dist/ru-RU.mjs +8 -0
- package/dist/ru-RU.module.js +8 -0
- package/dist/ru-RU.module.js.map +1 -0
- package/dist/sk-SK.main.js +6 -0
- package/dist/sk-SK.main.js.map +1 -0
- package/dist/sk-SK.mjs +8 -0
- package/dist/sk-SK.module.js +8 -0
- package/dist/sk-SK.module.js.map +1 -0
- package/dist/sl-SI.main.js +6 -0
- package/dist/sl-SI.main.js.map +1 -0
- package/dist/sl-SI.mjs +8 -0
- package/dist/sl-SI.module.js +8 -0
- package/dist/sl-SI.module.js.map +1 -0
- package/dist/sr-SP.main.js +6 -0
- package/dist/sr-SP.main.js.map +1 -0
- package/dist/sr-SP.mjs +8 -0
- package/dist/sr-SP.module.js +8 -0
- package/dist/sr-SP.module.js.map +1 -0
- package/dist/sv-SE.main.js +6 -0
- package/dist/sv-SE.main.js.map +1 -0
- package/dist/sv-SE.mjs +8 -0
- package/dist/sv-SE.module.js +8 -0
- package/dist/sv-SE.module.js.map +1 -0
- package/dist/tr-TR.main.js +6 -0
- package/dist/tr-TR.main.js.map +1 -0
- package/dist/tr-TR.mjs +8 -0
- package/dist/tr-TR.module.js +8 -0
- package/dist/tr-TR.module.js.map +1 -0
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/uk-UA.main.js +6 -0
- package/dist/uk-UA.main.js.map +1 -0
- package/dist/uk-UA.mjs +8 -0
- package/dist/uk-UA.module.js +8 -0
- package/dist/uk-UA.module.js.map +1 -0
- package/dist/useCloseOnScroll.main.js +46 -0
- package/dist/useCloseOnScroll.main.js.map +1 -0
- package/dist/useCloseOnScroll.mjs +40 -0
- package/dist/useCloseOnScroll.module.js +40 -0
- package/dist/useCloseOnScroll.module.js.map +1 -0
- package/dist/useModal.main.js +114 -0
- package/dist/useModal.main.js.map +1 -0
- package/dist/useModal.mjs +101 -0
- package/dist/useModal.module.js +101 -0
- package/dist/useModal.module.js.map +1 -0
- package/dist/useModalOverlay.main.js +55 -0
- package/dist/useModalOverlay.main.js.map +1 -0
- package/dist/useModalOverlay.mjs +50 -0
- package/dist/useModalOverlay.module.js +50 -0
- package/dist/useModalOverlay.module.js.map +1 -0
- package/dist/useOverlay.main.js +105 -0
- package/dist/useOverlay.main.js.map +1 -0
- package/dist/useOverlay.mjs +100 -0
- package/dist/useOverlay.module.js +100 -0
- package/dist/useOverlay.module.js.map +1 -0
- package/dist/useOverlayPosition.main.js +181 -0
- package/dist/useOverlayPosition.main.js.map +1 -0
- package/dist/useOverlayPosition.mjs +176 -0
- package/dist/useOverlayPosition.module.js +176 -0
- package/dist/useOverlayPosition.module.js.map +1 -0
- package/dist/useOverlayTrigger.main.js +54 -0
- package/dist/useOverlayTrigger.main.js.map +1 -0
- package/dist/useOverlayTrigger.mjs +49 -0
- package/dist/useOverlayTrigger.module.js +49 -0
- package/dist/useOverlayTrigger.module.js.map +1 -0
- package/dist/usePopover.main.js +66 -0
- package/dist/usePopover.main.js.map +1 -0
- package/dist/usePopover.mjs +61 -0
- package/dist/usePopover.module.js +61 -0
- package/dist/usePopover.module.js.map +1 -0
- package/dist/usePreventScroll.main.js +226 -0
- package/dist/usePreventScroll.main.js.map +1 -0
- package/dist/usePreventScroll.mjs +221 -0
- package/dist/usePreventScroll.module.js +221 -0
- package/dist/usePreventScroll.module.js.map +1 -0
- package/dist/zh-CN.main.js +6 -0
- package/dist/zh-CN.main.js.map +1 -0
- package/dist/zh-CN.mjs +8 -0
- package/dist/zh-CN.module.js +8 -0
- package/dist/zh-CN.module.js.map +1 -0
- package/dist/zh-TW.main.js +6 -0
- package/dist/zh-TW.main.js.map +1 -0
- package/dist/zh-TW.mjs +8 -0
- package/dist/zh-TW.module.js +8 -0
- package/dist/zh-TW.module.js.map +1 -0
- package/package.json +12 -12
- package/src/Overlay.tsx +6 -0
- package/src/PortalProvider.tsx +34 -0
- package/src/index.ts +1 -0
- package/src/useModalOverlay.ts +2 -2
- package/src/useOverlay.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,MAAM,CAAC;AACvC","sources":["packages/@react-aria/overlays/intl/sl-SI.json"],"sourcesContent":["{\n \"dismiss\": \"Opusti\"\n}\n"],"names":[],"version":3,"file":"sl-SI.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,MAAM,CAAC;AACvC","sources":["packages/@react-aria/overlays/intl/sr-SP.json"],"sourcesContent":["{\n \"dismiss\": \"Odbaci\"\n}\n"],"names":[],"version":3,"file":"sr-SP.main.js.map"}
|
package/dist/sr-SP.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,MAAM,CAAC;AACvC","sources":["packages/@react-aria/overlays/intl/sr-SP.json"],"sourcesContent":["{\n \"dismiss\": \"Odbaci\"\n}\n"],"names":[],"version":3,"file":"sr-SP.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,MAAM,CAAC;AACvC","sources":["packages/@react-aria/overlays/intl/sv-SE.json"],"sourcesContent":["{\n \"dismiss\": \"Avvisa\"\n}\n"],"names":[],"version":3,"file":"sv-SE.main.js.map"}
|
package/dist/sv-SE.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,MAAM,CAAC;AACvC","sources":["packages/@react-aria/overlays/intl/sv-SE.json"],"sourcesContent":["{\n \"dismiss\": \"Avvisa\"\n}\n"],"names":[],"version":3,"file":"sv-SE.module.js.map"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,KAAK,CAAC;AACtC","sources":["packages/@react-aria/overlays/intl/tr-TR.json"],"sourcesContent":["{\n \"dismiss\": \"Kapat\"\n}\n"],"names":[],"version":3,"file":"tr-TR.main.js.map"}
|
package/dist/tr-TR.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,KAAK,CAAC;AACtC","sources":["packages/@react-aria/overlays/intl/tr-TR.json"],"sourcesContent":["{\n \"dismiss\": \"Kapat\"\n}\n"],"names":[],"version":3,"file":"tr-TR.module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -256,6 +256,13 @@ export interface PopoverAria {
|
|
|
256
256
|
* A popover is an overlay element positioned relative to a trigger.
|
|
257
257
|
*/
|
|
258
258
|
export function usePopover(props: AriaPopoverProps, state: OverlayTriggerState): PopoverAria;
|
|
259
|
+
interface PortalProviderProps {
|
|
260
|
+
getContainer?: () => HTMLElement | null;
|
|
261
|
+
}
|
|
262
|
+
export function UNSTABLE_PortalProvider(props: PortalProviderProps & {
|
|
263
|
+
children: ReactNode;
|
|
264
|
+
}): React.JSX.Element;
|
|
265
|
+
export function useUNSTABLE_PortalContext(): PortalProviderProps;
|
|
259
266
|
export interface OverlayProps {
|
|
260
267
|
/**
|
|
261
268
|
* The container element in which the overlay portal will be placed.
|
|
@@ -283,7 +290,7 @@ export interface OverlayProps {
|
|
|
283
290
|
export function Overlay(props: OverlayProps): React.ReactPortal;
|
|
284
291
|
/** @private */
|
|
285
292
|
export function useOverlayFocusContain(): void;
|
|
286
|
-
export interface AriaModalOverlayProps {
|
|
293
|
+
export interface AriaModalOverlayProps extends Pick<AriaOverlayProps, 'shouldCloseOnInteractOutside'> {
|
|
287
294
|
/**
|
|
288
295
|
* Whether to close the modal when the user interacts outside it.
|
|
289
296
|
* @default false
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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,CAAC;IAC/B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED;IACE,+CAA+C;IAC/C,YAAY,EAAE,aAAa,CAAC;IAC5B,8CAA8C;IAC9C,UAAU,EAAE,aAAa,CAAC;IAC1B,oEAAoE;IACpE,SAAS,EAAE,aAAa,CAAC;IACzB,2CAA2C;IAC3C,cAAc,IAAI,IAAI,CAAA;CACvB;AAKD;;;GAGG;AACH,mCAAmC,KAAK,EAAE,iBAAiB,GA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E,gBAAgB,EAAE,KAAK,EAAE,mBAAmB,GAAG,WAAW,CA8C3F;ACzGD;IAEE,YAAY,CAAC,EAAE,MAAM,WAAW,GAAG,IAAI,CAAA;CACxC;AAID,wCAAwC,KAAK,EAAE,mBAAmB,GAAG;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAC,qBAQzF;AAED,iEAEC;ACbD;IACE;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,2CAA2C;IAC3C,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAID;;;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,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,+DAAS,CAAC;AAC1C","sources":["packages/@react-aria/overlays/intl/uk-UA.json"],"sourcesContent":["{\n \"dismiss\": \"Скасувати\"\n}\n"],"names":[],"version":3,"file":"uk-UA.main.js.map"}
|
package/dist/uk-UA.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,+DAAS,CAAC;AAC1C","sources":["packages/@react-aria/overlays/intl/uk-UA.json"],"sourcesContent":["{\n \"dismiss\": \"Скасувати\"\n}\n"],"names":[],"version":3,"file":"uk-UA.module.js.map"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var $f2vao$react = require("react");
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
function $parcel$export(e, n, v, s) {
|
|
5
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
$parcel$export(module.exports, "onCloseMap", () => $9a8aa1b0b336ea3a$export$f6211563215e3b37);
|
|
9
|
+
$parcel$export(module.exports, "useCloseOnScroll", () => $9a8aa1b0b336ea3a$export$18fc8428861184da);
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
const $9a8aa1b0b336ea3a$export$f6211563215e3b37 = new WeakMap();
|
|
22
|
+
function $9a8aa1b0b336ea3a$export$18fc8428861184da(opts) {
|
|
23
|
+
let { triggerRef: triggerRef, isOpen: isOpen, onClose: onClose } = opts;
|
|
24
|
+
(0, $f2vao$react.useEffect)(()=>{
|
|
25
|
+
if (!isOpen || onClose === null) return;
|
|
26
|
+
let onScroll = (e)=>{
|
|
27
|
+
// Ignore if scrolling an scrollable region outside the trigger's tree.
|
|
28
|
+
let target = e.target;
|
|
29
|
+
// window is not a Node and doesn't have contain, but window contains everything
|
|
30
|
+
if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current)) return;
|
|
31
|
+
let onCloseHandler = onClose || $9a8aa1b0b336ea3a$export$f6211563215e3b37.get(triggerRef.current);
|
|
32
|
+
if (onCloseHandler) onCloseHandler();
|
|
33
|
+
};
|
|
34
|
+
window.addEventListener("scroll", onScroll, true);
|
|
35
|
+
return ()=>{
|
|
36
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
37
|
+
};
|
|
38
|
+
}, [
|
|
39
|
+
isOpen,
|
|
40
|
+
onClose,
|
|
41
|
+
triggerRef
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=useCloseOnScroll.main.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {useEffect as $dRVb8$useEffect} from "react";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
const $dd149f63282afbbf$export$f6211563215e3b37 = new WeakMap();
|
|
15
|
+
function $dd149f63282afbbf$export$18fc8428861184da(opts) {
|
|
16
|
+
let { triggerRef: triggerRef, isOpen: isOpen, onClose: onClose } = opts;
|
|
17
|
+
(0, $dRVb8$useEffect)(()=>{
|
|
18
|
+
if (!isOpen || onClose === null) return;
|
|
19
|
+
let onScroll = (e)=>{
|
|
20
|
+
// Ignore if scrolling an scrollable region outside the trigger's tree.
|
|
21
|
+
let target = e.target;
|
|
22
|
+
// window is not a Node and doesn't have contain, but window contains everything
|
|
23
|
+
if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current)) return;
|
|
24
|
+
let onCloseHandler = onClose || $dd149f63282afbbf$export$f6211563215e3b37.get(triggerRef.current);
|
|
25
|
+
if (onCloseHandler) onCloseHandler();
|
|
26
|
+
};
|
|
27
|
+
window.addEventListener("scroll", onScroll, true);
|
|
28
|
+
return ()=>{
|
|
29
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
30
|
+
};
|
|
31
|
+
}, [
|
|
32
|
+
isOpen,
|
|
33
|
+
onClose,
|
|
34
|
+
triggerRef
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export {$dd149f63282afbbf$export$f6211563215e3b37 as onCloseMap, $dd149f63282afbbf$export$18fc8428861184da as useCloseOnScroll};
|
|
40
|
+
//# sourceMappingURL=useCloseOnScroll.mjs.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {useEffect as $dRVb8$useEffect} from "react";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
+
* governing permissions and limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
const $dd149f63282afbbf$export$f6211563215e3b37 = new WeakMap();
|
|
15
|
+
function $dd149f63282afbbf$export$18fc8428861184da(opts) {
|
|
16
|
+
let { triggerRef: triggerRef, isOpen: isOpen, onClose: onClose } = opts;
|
|
17
|
+
(0, $dRVb8$useEffect)(()=>{
|
|
18
|
+
if (!isOpen || onClose === null) return;
|
|
19
|
+
let onScroll = (e)=>{
|
|
20
|
+
// Ignore if scrolling an scrollable region outside the trigger's tree.
|
|
21
|
+
let target = e.target;
|
|
22
|
+
// window is not a Node and doesn't have contain, but window contains everything
|
|
23
|
+
if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current)) return;
|
|
24
|
+
let onCloseHandler = onClose || $dd149f63282afbbf$export$f6211563215e3b37.get(triggerRef.current);
|
|
25
|
+
if (onCloseHandler) onCloseHandler();
|
|
26
|
+
};
|
|
27
|
+
window.addEventListener("scroll", onScroll, true);
|
|
28
|
+
return ()=>{
|
|
29
|
+
window.removeEventListener("scroll", onScroll, true);
|
|
30
|
+
};
|
|
31
|
+
}, [
|
|
32
|
+
isOpen,
|
|
33
|
+
onClose,
|
|
34
|
+
triggerRef
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
export {$dd149f63282afbbf$export$f6211563215e3b37 as onCloseMap, $dd149f63282afbbf$export$18fc8428861184da as useCloseOnScroll};
|
|
40
|
+
//# sourceMappingURL=useCloseOnScroll.module.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
var $btuAB$react = require("react");
|
|
2
|
+
var $btuAB$reactdom = require("react-dom");
|
|
3
|
+
var $btuAB$reactariassr = require("@react-aria/ssr");
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
function $parcel$interopDefault(a) {
|
|
7
|
+
return a && a.__esModule ? a.default : a;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function $parcel$export(e, n, v, s) {
|
|
11
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
$parcel$export(module.exports, "ModalProvider", () => $0775ea8ea6a0565e$export$178405afcd8c5eb);
|
|
15
|
+
$parcel$export(module.exports, "useModalProvider", () => $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0);
|
|
16
|
+
$parcel$export(module.exports, "OverlayProvider", () => $0775ea8ea6a0565e$export$bf688221f59024e5);
|
|
17
|
+
$parcel$export(module.exports, "OverlayContainer", () => $0775ea8ea6a0565e$export$b47c3594eab58386);
|
|
18
|
+
$parcel$export(module.exports, "useModal", () => $0775ea8ea6a0565e$export$33ffd74ebf07f060);
|
|
19
|
+
/*
|
|
20
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
21
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
22
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
23
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
+
*
|
|
25
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
26
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
27
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
28
|
+
* governing permissions and limitations under the License.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const $0775ea8ea6a0565e$var$Context = /*#__PURE__*/ (0, ($parcel$interopDefault($btuAB$react))).createContext(null);
|
|
33
|
+
function $0775ea8ea6a0565e$export$178405afcd8c5eb(props) {
|
|
34
|
+
let { children: children } = props;
|
|
35
|
+
let parent = (0, $btuAB$react.useContext)($0775ea8ea6a0565e$var$Context);
|
|
36
|
+
let [modalCount, setModalCount] = (0, $btuAB$react.useState)(0);
|
|
37
|
+
let context = (0, $btuAB$react.useMemo)(()=>({
|
|
38
|
+
parent: parent,
|
|
39
|
+
modalCount: modalCount,
|
|
40
|
+
addModal () {
|
|
41
|
+
setModalCount((count)=>count + 1);
|
|
42
|
+
if (parent) parent.addModal();
|
|
43
|
+
},
|
|
44
|
+
removeModal () {
|
|
45
|
+
setModalCount((count)=>count - 1);
|
|
46
|
+
if (parent) parent.removeModal();
|
|
47
|
+
}
|
|
48
|
+
}), [
|
|
49
|
+
parent,
|
|
50
|
+
modalCount
|
|
51
|
+
]);
|
|
52
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($btuAB$react))).createElement($0775ea8ea6a0565e$var$Context.Provider, {
|
|
53
|
+
value: context
|
|
54
|
+
}, children);
|
|
55
|
+
}
|
|
56
|
+
function $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0() {
|
|
57
|
+
let context = (0, $btuAB$react.useContext)($0775ea8ea6a0565e$var$Context);
|
|
58
|
+
return {
|
|
59
|
+
modalProviderProps: {
|
|
60
|
+
"aria-hidden": context && context.modalCount > 0 ? true : null
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Creates a root node that will be aria-hidden if there are other modals open.
|
|
66
|
+
*/ function $0775ea8ea6a0565e$var$OverlayContainerDOM(props) {
|
|
67
|
+
let { modalProviderProps: modalProviderProps } = $0775ea8ea6a0565e$export$d9aaed4c3ece1bc0();
|
|
68
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($btuAB$react))).createElement("div", {
|
|
69
|
+
"data-overlay-container": true,
|
|
70
|
+
...props,
|
|
71
|
+
...modalProviderProps
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function $0775ea8ea6a0565e$export$bf688221f59024e5(props) {
|
|
75
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($btuAB$react))).createElement($0775ea8ea6a0565e$export$178405afcd8c5eb, null, /*#__PURE__*/ (0, ($parcel$interopDefault($btuAB$react))).createElement($0775ea8ea6a0565e$var$OverlayContainerDOM, props));
|
|
76
|
+
}
|
|
77
|
+
function $0775ea8ea6a0565e$export$b47c3594eab58386(props) {
|
|
78
|
+
let isSSR = (0, $btuAB$reactariassr.useIsSSR)();
|
|
79
|
+
let { portalContainer: portalContainer = isSSR ? null : document.body, ...rest } = props;
|
|
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.");
|
|
82
|
+
}, [
|
|
83
|
+
portalContainer
|
|
84
|
+
]);
|
|
85
|
+
if (!portalContainer) return null;
|
|
86
|
+
let contents = /*#__PURE__*/ (0, ($parcel$interopDefault($btuAB$react))).createElement($0775ea8ea6a0565e$export$bf688221f59024e5, rest);
|
|
87
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($btuAB$reactdom))).createPortal(contents, portalContainer);
|
|
88
|
+
}
|
|
89
|
+
function $0775ea8ea6a0565e$export$33ffd74ebf07f060(options) {
|
|
90
|
+
// Add aria-hidden to all parent providers on mount, and restore on unmount.
|
|
91
|
+
let context = (0, $btuAB$react.useContext)($0775ea8ea6a0565e$var$Context);
|
|
92
|
+
if (!context) throw new Error("Modal is not contained within a provider");
|
|
93
|
+
(0, $btuAB$react.useEffect)(()=>{
|
|
94
|
+
if ((options === null || options === void 0 ? void 0 : options.isDisabled) || !context || !context.parent) return;
|
|
95
|
+
// The immediate context is from the provider containing this modal, so we only
|
|
96
|
+
// want to trigger aria-hidden on its parents not on the modal provider itself.
|
|
97
|
+
context.parent.addModal();
|
|
98
|
+
return ()=>{
|
|
99
|
+
if (context && context.parent) context.parent.removeModal();
|
|
100
|
+
};
|
|
101
|
+
}, [
|
|
102
|
+
context,
|
|
103
|
+
context.parent,
|
|
104
|
+
options === null || options === void 0 ? void 0 : options.isDisabled
|
|
105
|
+
]);
|
|
106
|
+
return {
|
|
107
|
+
modalProps: {
|
|
108
|
+
"data-ismodal": !(options === null || options === void 0 ? void 0 : options.isDisabled)
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
//# sourceMappingURL=useModal.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAkBD,MAAM,8CAAU,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAsB;AAUlD,SAAS,yCAAc,KAAyB;IACrD,IAAI,YAAC,QAAQ,EAAC,GAAG;IACjB,IAAI,SAAS,CAAA,GAAA,uBAAS,EAAE;IACxB,IAAI,CAAC,YAAY,cAAc,GAAG,CAAA,GAAA,qBAAO,EAAE;IAC3C,IAAI,UAAU,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;oBAC3B;wBACA;YACA;gBACE,cAAc,CAAA,QAAS,QAAQ;gBAC/B,IAAI,QACF,OAAO,QAAQ;YAEnB;YACA;gBACE,cAAc,CAAA,QAAS,QAAQ;gBAC/B,IAAI,QACF,OAAO,WAAW;YAEtB;QACF,CAAA,GAAI;QAAC;QAAQ;KAAW;IAExB,qBACE,0DAAC,8BAAQ,QAAQ;QAAC,OAAO;OACtB;AAGP;AAaO,SAAS;IACd,IAAI,UAAU,CAAA,GAAA,uBAAS,EAAE;IACzB,OAAO;QACL,oBAAoB;YAClB,eAAe,WAAW,QAAQ,UAAU,GAAG,IAAI,OAAO;QAC5D;IACF;AACF;AAEA;;CAEC,GACD,SAAS,0CAAo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right 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 React, {AriaAttributes, ReactNode, useContext, useEffect, useMemo, useState} from 'react';\nimport ReactDOM from 'react-dom';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport interface ModalProviderProps extends DOMAttributes {\n children: ReactNode\n}\n\ninterface ModalContext {\n parent: ModalContext | null,\n modalCount: number,\n addModal: () => void,\n removeModal: () => void\n}\n\nconst Context = React.createContext<ModalContext | null>(null);\n\n/**\n * Each ModalProvider tracks how many modals are open in its subtree. On mount, the modals\n * trigger `addModal` to increment the count, and trigger `removeModal` on unmount to decrement it.\n * This is done recursively so that all parent providers are incremented and decremented.\n * If the modal count is greater than zero, we add `aria-hidden` to this provider to hide its\n * subtree from screen readers. This is done using React context in order to account for things\n * like portals, which can cause the React tree and the DOM tree to differ significantly in structure.\n */\nexport function ModalProvider(props: ModalProviderProps) {\n let {children} = props;\n let parent = useContext(Context);\n let [modalCount, setModalCount] = useState(0);\n let context = useMemo(() => ({\n parent,\n modalCount,\n addModal() {\n setModalCount(count => count + 1);\n if (parent) {\n parent.addModal();\n }\n },\n removeModal() {\n setModalCount(count => count - 1);\n if (parent) {\n parent.removeModal();\n }\n }\n }), [parent, modalCount]);\n\n return (\n <Context.Provider value={context}>\n {children}\n </Context.Provider>\n );\n}\n\nexport interface ModalProviderAria {\n /**\n * Props to be spread on the container element.\n */\n modalProviderProps: AriaAttributes\n}\n\n/**\n * Used to determine if the tree should be aria-hidden based on how many\n * modals are open.\n */\nexport function useModalProvider(): ModalProviderAria {\n let context = useContext(Context);\n return {\n modalProviderProps: {\n 'aria-hidden': context && context.modalCount > 0 ? true : null\n }\n };\n}\n\n/**\n * Creates a root node that will be aria-hidden if there are other modals open.\n */\nfunction OverlayContainerDOM(props: ModalProviderProps) {\n let {modalProviderProps} = useModalProvider();\n return <div data-overlay-container {...props} {...modalProviderProps} />;\n}\n\n/**\n * An OverlayProvider acts as a container for the top-level application.\n * Any application that uses modal dialogs or other overlays should\n * be wrapped in a `<OverlayProvider>`. This is used to ensure that\n * the main content of the application is hidden from screen readers\n * if a modal or other overlay is opened. Only the top-most modal or\n * overlay should be accessible at once.\n */\nexport function OverlayProvider(props: ModalProviderProps) {\n return (\n <ModalProvider>\n <OverlayContainerDOM {...props} />\n </ModalProvider>\n );\n}\n\nexport interface OverlayContainerProps extends ModalProviderProps {\n /**\n * The container element in which the overlay portal will be placed.\n * @default document.body\n */\n portalContainer?: Element\n}\n\n/**\n * A container for overlays like modals and popovers. Renders the overlay\n * into a Portal which is placed at the end of the document body.\n * Also ensures that the overlay is hidden from screen readers if a\n * nested modal is opened. Only the top-most modal or overlay should\n * be accessible at once.\n */\nexport function OverlayContainer(props: OverlayContainerProps): React.ReactPortal {\n let isSSR = useIsSSR();\n let {portalContainer = isSSR ? null : document.body, ...rest} = props;\n\n React.useEffect(() => {\n if (portalContainer?.closest('[data-overlay-container]')) {\n throw new Error('An OverlayContainer must not be inside another container. Please change the portalContainer prop.');\n }\n }, [portalContainer]);\n\n if (!portalContainer) {\n return null;\n }\n\n let contents = <OverlayProvider {...rest} />;\n return ReactDOM.createPortal(contents, portalContainer);\n}\n\ninterface ModalAriaProps extends DOMAttributes {\n /** Data attribute marks the dom node as a modal for the aria-modal-polyfill. */\n 'data-ismodal': boolean\n}\n\nexport interface AriaModalOptions {\n isDisabled?: boolean\n}\n\nexport interface ModalAria {\n /** Props for the modal content element. */\n modalProps: ModalAriaProps\n}\n\n/**\n * Hides content outside the current `<OverlayContainer>` from screen readers\n * on mount and restores it on unmount. Typically used by modal dialogs and\n * other types of overlays to ensure that only the top-most modal is\n * accessible at once.\n */\nexport function useModal(options?: AriaModalOptions): ModalAria {\n // Add aria-hidden to all parent providers on mount, and restore on unmount.\n let context = useContext(Context);\n if (!context) {\n throw new Error('Modal is not contained within a provider');\n }\n\n useEffect(() => {\n if (options?.isDisabled || !context || !context.parent) {\n return;\n }\n\n // The immediate context is from the provider containing this modal, so we only\n // want to trigger aria-hidden on its parents not on the modal provider itself.\n context.parent.addModal();\n return () => {\n if (context && context.parent) {\n context.parent.removeModal();\n }\n };\n }, [context, context.parent, options?.isDisabled]);\n\n return {\n modalProps: {\n 'data-ismodal': !options?.isDisabled\n }\n };\n}\n"],"names":[],"version":3,"file":"useModal.main.js.map"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import $4AOtR$react, {useContext as $4AOtR$useContext, useState as $4AOtR$useState, useMemo as $4AOtR$useMemo, useEffect as $4AOtR$useEffect} from "react";
|
|
2
|
+
import $4AOtR$reactdom from "react-dom";
|
|
3
|
+
import {useIsSSR as $4AOtR$useIsSSR} from "@react-aria/ssr";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const $f57aed4a881a3485$var$Context = /*#__PURE__*/ (0, $4AOtR$react).createContext(null);
|
|
19
|
+
function $f57aed4a881a3485$export$178405afcd8c5eb(props) {
|
|
20
|
+
let { children: children } = props;
|
|
21
|
+
let parent = (0, $4AOtR$useContext)($f57aed4a881a3485$var$Context);
|
|
22
|
+
let [modalCount, setModalCount] = (0, $4AOtR$useState)(0);
|
|
23
|
+
let context = (0, $4AOtR$useMemo)(()=>({
|
|
24
|
+
parent: parent,
|
|
25
|
+
modalCount: modalCount,
|
|
26
|
+
addModal () {
|
|
27
|
+
setModalCount((count)=>count + 1);
|
|
28
|
+
if (parent) parent.addModal();
|
|
29
|
+
},
|
|
30
|
+
removeModal () {
|
|
31
|
+
setModalCount((count)=>count - 1);
|
|
32
|
+
if (parent) parent.removeModal();
|
|
33
|
+
}
|
|
34
|
+
}), [
|
|
35
|
+
parent,
|
|
36
|
+
modalCount
|
|
37
|
+
]);
|
|
38
|
+
return /*#__PURE__*/ (0, $4AOtR$react).createElement($f57aed4a881a3485$var$Context.Provider, {
|
|
39
|
+
value: context
|
|
40
|
+
}, children);
|
|
41
|
+
}
|
|
42
|
+
function $f57aed4a881a3485$export$d9aaed4c3ece1bc0() {
|
|
43
|
+
let context = (0, $4AOtR$useContext)($f57aed4a881a3485$var$Context);
|
|
44
|
+
return {
|
|
45
|
+
modalProviderProps: {
|
|
46
|
+
"aria-hidden": context && context.modalCount > 0 ? true : null
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Creates a root node that will be aria-hidden if there are other modals open.
|
|
52
|
+
*/ function $f57aed4a881a3485$var$OverlayContainerDOM(props) {
|
|
53
|
+
let { modalProviderProps: modalProviderProps } = $f57aed4a881a3485$export$d9aaed4c3ece1bc0();
|
|
54
|
+
return /*#__PURE__*/ (0, $4AOtR$react).createElement("div", {
|
|
55
|
+
"data-overlay-container": true,
|
|
56
|
+
...props,
|
|
57
|
+
...modalProviderProps
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function $f57aed4a881a3485$export$bf688221f59024e5(props) {
|
|
61
|
+
return /*#__PURE__*/ (0, $4AOtR$react).createElement($f57aed4a881a3485$export$178405afcd8c5eb, null, /*#__PURE__*/ (0, $4AOtR$react).createElement($f57aed4a881a3485$var$OverlayContainerDOM, props));
|
|
62
|
+
}
|
|
63
|
+
function $f57aed4a881a3485$export$b47c3594eab58386(props) {
|
|
64
|
+
let isSSR = (0, $4AOtR$useIsSSR)();
|
|
65
|
+
let { portalContainer: portalContainer = isSSR ? null : document.body, ...rest } = props;
|
|
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.");
|
|
68
|
+
}, [
|
|
69
|
+
portalContainer
|
|
70
|
+
]);
|
|
71
|
+
if (!portalContainer) return null;
|
|
72
|
+
let contents = /*#__PURE__*/ (0, $4AOtR$react).createElement($f57aed4a881a3485$export$bf688221f59024e5, rest);
|
|
73
|
+
return /*#__PURE__*/ (0, $4AOtR$reactdom).createPortal(contents, portalContainer);
|
|
74
|
+
}
|
|
75
|
+
function $f57aed4a881a3485$export$33ffd74ebf07f060(options) {
|
|
76
|
+
// Add aria-hidden to all parent providers on mount, and restore on unmount.
|
|
77
|
+
let context = (0, $4AOtR$useContext)($f57aed4a881a3485$var$Context);
|
|
78
|
+
if (!context) throw new Error("Modal is not contained within a provider");
|
|
79
|
+
(0, $4AOtR$useEffect)(()=>{
|
|
80
|
+
if ((options === null || options === void 0 ? void 0 : options.isDisabled) || !context || !context.parent) return;
|
|
81
|
+
// The immediate context is from the provider containing this modal, so we only
|
|
82
|
+
// want to trigger aria-hidden on its parents not on the modal provider itself.
|
|
83
|
+
context.parent.addModal();
|
|
84
|
+
return ()=>{
|
|
85
|
+
if (context && context.parent) context.parent.removeModal();
|
|
86
|
+
};
|
|
87
|
+
}, [
|
|
88
|
+
context,
|
|
89
|
+
context.parent,
|
|
90
|
+
options === null || options === void 0 ? void 0 : options.isDisabled
|
|
91
|
+
]);
|
|
92
|
+
return {
|
|
93
|
+
modalProps: {
|
|
94
|
+
"data-ismodal": !(options === null || options === void 0 ? void 0 : options.isDisabled)
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
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
|