@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
52 lines (51 loc) • 2.17 kB
JavaScript
"use client";
import { rem } from "../../core/utils/units-converters/rem.mjs";
import { getDefaultZIndex } from "../../core/utils/get-default-z-index/get-default-z-index.mjs";
import { getRadius } from "../../core/utils/get-size/get-size.mjs";
import { createVarsResolver } from "../../core/styles-api/create-vars-resolver/create-vars-resolver.mjs";
import { rgba } from "../../core/MantineProvider/color-functions/rgba/rgba.mjs";
import { useProps } from "../../core/MantineProvider/use-props/use-props.mjs";
import { useStyles } from "../../core/styles-api/use-styles/use-styles.mjs";
import { polymorphicFactory } from "../../core/factory/polymorphic-factory.mjs";
import { Box } from "../../core/Box/Box.mjs";
import Overlay_module_default from "./Overlay.module.mjs";
import { jsx } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/Overlay/Overlay.tsx
const defaultProps = { zIndex: getDefaultZIndex("modal") };
const varsResolver = createVarsResolver((_, { gradient, color, backgroundOpacity, blur, radius, zIndex }) => ({ root: {
"--overlay-bg": gradient || (color !== void 0 || backgroundOpacity !== void 0) && rgba(color || "#000", backgroundOpacity ?? .6) || void 0,
"--overlay-filter": blur ? `blur(${rem(blur)})` : void 0,
"--overlay-radius": radius === void 0 ? void 0 : getRadius(radius),
"--overlay-z-index": zIndex?.toString()
} }));
const Overlay = polymorphicFactory((_props) => {
const props = useProps("Overlay", defaultProps, _props);
const { classNames, className, style, styles, unstyled, vars, fixed, center, children, radius, zIndex, gradient, blur, color, backgroundOpacity, mod, attributes, ...others } = props;
return /* @__PURE__ */ jsx(Box, {
...useStyles({
name: "Overlay",
props,
classes: Overlay_module_default,
className,
style,
classNames,
styles,
unstyled,
attributes,
vars,
varsResolver
})("root"),
mod: [{
center,
fixed
}, mod],
...others,
children
});
});
Overlay.classes = Overlay_module_default;
Overlay.varsResolver = varsResolver;
Overlay.displayName = "@mantine/core/Overlay";
//#endregion
export { Overlay };
//# sourceMappingURL=Overlay.mjs.map