UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

59 lines (58 loc) 1.98 kB
"use client"; import { getDefaultZIndex } from "../../core/utils/get-default-z-index/get-default-z-index.mjs"; import { getSpacing } from "../../core/utils/get-size/get-size.mjs"; import { createVarsResolver } from "../../core/styles-api/create-vars-resolver/create-vars-resolver.mjs"; import { useProps } from "../../core/MantineProvider/use-props/use-props.mjs"; import { useStyles } from "../../core/styles-api/use-styles/use-styles.mjs"; import { factory } from "../../core/factory/factory.mjs"; import { Box } from "../../core/Box/Box.mjs"; import { OptionalPortal } from "../Portal/OptionalPortal.mjs"; import Affix_module_default from "./Affix.module.mjs"; import { jsx } from "react/jsx-runtime"; //#region packages/@mantine/core/src/components/Affix/Affix.tsx const defaultProps = { position: { bottom: 0, right: 0 }, zIndex: getDefaultZIndex("modal"), withinPortal: true }; const varsResolver = createVarsResolver((_, { zIndex, position }) => ({ root: { "--affix-z-index": zIndex?.toString(), "--affix-top": getSpacing(position?.top), "--affix-left": getSpacing(position?.left), "--affix-bottom": getSpacing(position?.bottom), "--affix-right": getSpacing(position?.right) } })); const Affix = factory((_props) => { const props = useProps("Affix", defaultProps, _props); const { classNames, className, style, styles, unstyled, vars, portalProps, zIndex, withinPortal, position, attributes, ...others } = props; const getStyles = useStyles({ name: "Affix", classes: Affix_module_default, props, className, style, classNames, styles, unstyled, attributes, vars, varsResolver }); return /* @__PURE__ */ jsx(OptionalPortal, { ...portalProps, withinPortal, children: /* @__PURE__ */ jsx(Box, { ...getStyles("root"), ...others }) }); }); Affix.classes = Affix_module_default; Affix.varsResolver = varsResolver; Affix.displayName = "@mantine/core/Affix"; //#endregion export { Affix }; //# sourceMappingURL=Affix.mjs.map