@react-aria/overlays
Advanced tools
Comparing version 3.0.0-nightly.992 to 3.0.0-nightly.994
@@ -9,2 +9,4 @@ var { | ||
var _babelRuntimeHelpersObjectWithoutPropertiesLoose = $parcel$interopDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose")); | ||
var { | ||
@@ -899,3 +901,5 @@ useId, | ||
} = useModalProvider(); | ||
return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersExtends({}, props, modalProviderProps)); | ||
return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersExtends({ | ||
"data-overlay-container": true | ||
}, props, modalProviderProps)); | ||
} | ||
@@ -915,2 +919,5 @@ /** | ||
} | ||
exports.OverlayProvider = OverlayProvider; | ||
/** | ||
@@ -923,10 +930,17 @@ * A container for overlays like modals and popovers. Renders the overlay | ||
*/ | ||
function OverlayContainer(props) { | ||
let { | ||
portalContainer = document.body | ||
} = props, | ||
rest = _babelRuntimeHelpersObjectWithoutPropertiesLoose(props, ["portalContainer"]); | ||
_react.useEffect(() => { | ||
if (portalContainer.closest('[data-overlay-container]')) { | ||
throw new Error('An OverlayContainer must not be inside another container. Please change the portalContainer prop.'); | ||
} | ||
}, [portalContainer]); | ||
exports.OverlayProvider = OverlayProvider; | ||
let contents = /*#__PURE__*/_react.createElement(OverlayProvider, rest); | ||
function OverlayContainer(props) { | ||
let contents = /*#__PURE__*/_react.createElement(OverlayProvider, props); | ||
return /*#__PURE__*/_reactDom.createPortal(contents, document.body); | ||
return /*#__PURE__*/_reactDom.createPortal(contents, portalContainer); | ||
} | ||
@@ -933,0 +947,0 @@ |
import { VisuallyHidden } from "@react-aria/visually-hidden"; | ||
import _babelRuntimeHelpersEsmInteropRequireDefault from "@babel/runtime/helpers/esm/interopRequireDefault"; | ||
import _reactDom from "react-dom"; | ||
import _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | ||
import { useId, chain, getScrollParent, isIOS, useLayoutEffect } from "@react-aria/utils"; | ||
@@ -841,3 +842,5 @@ import { useFocusWithin, useInteractOutside } from "@react-aria/interactions"; | ||
} = useModalProvider(); | ||
return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersEsmExtends({}, props, modalProviderProps)); | ||
return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersEsmExtends({ | ||
"data-overlay-container": true | ||
}, props, modalProviderProps)); | ||
} | ||
@@ -857,2 +860,3 @@ /** | ||
} | ||
/** | ||
@@ -865,7 +869,17 @@ * A container for overlays like modals and popovers. Renders the overlay | ||
*/ | ||
export function OverlayContainer(props) { | ||
let contents = /*#__PURE__*/_react.createElement(OverlayProvider, props); | ||
let { | ||
portalContainer = document.body | ||
} = props, | ||
rest = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(props, ["portalContainer"]); | ||
return /*#__PURE__*/_reactDom.createPortal(contents, document.body); | ||
_react.useEffect(() => { | ||
if (portalContainer.closest('[data-overlay-container]')) { | ||
throw new Error('An OverlayContainer must not be inside another container. Please change the portalContainer prop.'); | ||
} | ||
}, [portalContainer]); | ||
let contents = /*#__PURE__*/_react.createElement(OverlayProvider, rest); | ||
return /*#__PURE__*/_reactDom.createPortal(contents, portalContainer); | ||
} | ||
@@ -872,0 +886,0 @@ |
@@ -139,2 +139,5 @@ import React, { HTMLAttributes, RefObject, AriaAttributes, ReactNode } from "react"; | ||
export function OverlayProvider(props: ModalProviderProps): JSX.Element; | ||
interface OverlayContainerProps extends ModalProviderProps { | ||
portalContainer?: HTMLElement; | ||
} | ||
/** | ||
@@ -147,3 +150,3 @@ * A container for overlays like modals and popovers. Renders the overlay | ||
*/ | ||
export function OverlayContainer(props: ModalProviderProps): React.ReactPortal; | ||
export function OverlayContainer(props: OverlayContainerProps): React.ReactPortal; | ||
interface ModalAriaProps extends HTMLAttributes<HTMLElement> { | ||
@@ -150,0 +153,0 @@ /** Data attribute marks the dom node as a modal for the aria-modal-polyfill. */ |
{ | ||
"name": "@react-aria/overlays", | ||
"version": "3.0.0-nightly.992+d1844573", | ||
"version": "3.0.0-nightly.994+faa93480", | ||
"description": "Spectrum UI components in React", | ||
@@ -21,9 +21,9 @@ "license": "Apache-2.0", | ||
"@babel/runtime": "^7.6.2", | ||
"@react-aria/i18n": "3.0.0-nightly.992+d1844573", | ||
"@react-aria/interactions": "3.0.0-nightly.992+d1844573", | ||
"@react-aria/utils": "3.0.0-nightly.992+d1844573", | ||
"@react-aria/visually-hidden": "3.0.0-nightly.992+d1844573", | ||
"@react-stately/overlays": "3.1.2-nightly.2672+d1844573", | ||
"@react-types/button": "3.3.2-nightly.2672+d1844573", | ||
"@react-types/overlays": "3.4.1-nightly.2672+d1844573", | ||
"@react-aria/i18n": "3.0.0-nightly.994+faa93480", | ||
"@react-aria/interactions": "3.0.0-nightly.994+faa93480", | ||
"@react-aria/utils": "3.0.0-nightly.994+faa93480", | ||
"@react-aria/visually-hidden": "3.0.0-nightly.994+faa93480", | ||
"@react-stately/overlays": "3.1.2-nightly.2674+faa93480", | ||
"@react-types/button": "3.3.2-nightly.2674+faa93480", | ||
"@react-types/overlays": "3.4.1-nightly.2674+faa93480", | ||
"dom-helpers": "^3.3.1" | ||
@@ -38,3 +38,3 @@ }, | ||
}, | ||
"gitHead": "d1844573fa992f7a34285ebafdc08cb407829095" | ||
"gitHead": "faa9348097bf62403e37e32daf897cdad5512e09" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
358611
3615