UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

60 lines (57 loc) 2.48 kB
'use client'; import React from 'react'; import { getDefaultZIndex } from '../../core/utils/get-default-z-index/get-default-z-index.mjs'; import 'clsx'; import '@mantine/hooks'; import '../../core/MantineProvider/Mantine.context.mjs'; import '../../core/MantineProvider/default-theme.mjs'; import '../../core/MantineProvider/MantineProvider.mjs'; import '../../core/MantineProvider/MantineThemeProvider/MantineThemeProvider.mjs'; import { useProps } from '../../core/MantineProvider/use-props/use-props.mjs'; import '../../core/Box/Box.mjs'; import { factory } from '../../core/factory/factory.mjs'; import '../../core/DirectionProvider/DirectionProvider.mjs'; import { DrawerBody } from './DrawerBody.mjs'; import { DrawerCloseButton } from './DrawerCloseButton.mjs'; import { DrawerContent } from './DrawerContent.mjs'; import { DrawerHeader } from './DrawerHeader.mjs'; import { DrawerOverlay } from './DrawerOverlay.mjs'; import { DrawerRoot } from './DrawerRoot.mjs'; import { DrawerTitle } from './DrawerTitle.mjs'; import classes from './Drawer.module.css.mjs'; const defaultProps = { closeOnClickOutside: true, withinPortal: true, lockScroll: true, trapFocus: true, returnFocus: true, closeOnEscape: true, keepMounted: false, zIndex: getDefaultZIndex("modal"), withOverlay: true, withCloseButton: true }; const Drawer = factory((_props, ref) => { const { title, withOverlay, overlayProps, withCloseButton, closeButtonProps, children, ...others } = useProps("Drawer", defaultProps, _props); const hasHeader = !!title || withCloseButton; return /* @__PURE__ */ React.createElement(DrawerRoot, { ref, ...others }, withOverlay && /* @__PURE__ */ React.createElement(DrawerOverlay, { ...overlayProps }), /* @__PURE__ */ React.createElement(DrawerContent, null, hasHeader && /* @__PURE__ */ React.createElement(DrawerHeader, null, title && /* @__PURE__ */ React.createElement(DrawerTitle, null, title), withCloseButton && /* @__PURE__ */ React.createElement(DrawerCloseButton, { ...closeButtonProps })), /* @__PURE__ */ React.createElement(DrawerBody, null, children))); }); Drawer.classes = classes; Drawer.displayName = "@mantine/core/Drawer"; Drawer.Root = DrawerRoot; Drawer.Overlay = DrawerOverlay; Drawer.Content = DrawerContent; Drawer.Body = DrawerBody; Drawer.Header = DrawerHeader; Drawer.Title = DrawerTitle; Drawer.CloseButton = DrawerCloseButton; export { Drawer }; //# sourceMappingURL=Drawer.mjs.map