@react-spectrum/overlays
Version:
Spectrum UI components in React
50 lines (42 loc) • 2.24 kB
JavaScript
import "./overlays.c765f49e.css";
import $j2iDu$underlay_vars_cssmodulejs from "./underlay_vars_css.module.js";
import {classNames as $j2iDu$classNames} from "@react-spectrum/utils";
import {isScrollable as $j2iDu$isScrollable} from "@react-aria/utils";
import $j2iDu$react from "react";
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $76a452f4e3df11be$export$f360afc887607b02({ isOpen: isOpen, isTransparent: isTransparent, ...otherProps }) {
let pageHeight = undefined;
if (typeof document !== 'undefined') {
let scrollingElement = (0, $j2iDu$isScrollable)(document.body) ? document.body : document.scrollingElement || document.documentElement;
// Prevent Firefox from adding scrollbars when the page has a fractional height.
let fractionalHeightDifference = scrollingElement.getBoundingClientRect().height % 1;
pageHeight = scrollingElement.scrollHeight - fractionalHeightDifference;
}
return /*#__PURE__*/ (0, $j2iDu$react).createElement("div", {
"data-testid": "underlay",
...otherProps,
// Cover the entire document so iOS 26 Safari doesn't clip the underlay to the inner viewport.
style: {
height: pageHeight
},
className: (0, $j2iDu$classNames)((0, ($parcel$interopDefault($j2iDu$underlay_vars_cssmodulejs))), 'spectrum-Underlay', {
'is-open': isOpen,
'spectrum-Underlay--transparent': isTransparent
})
});
}
export {$76a452f4e3df11be$export$f360afc887607b02 as Underlay};
//# sourceMappingURL=Underlay.module.js.map