UNPKG

@ark-ui/react

Version:

A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.

24 lines (21 loc) 986 B
'use client'; import { jsx } from 'react/jsx-runtime'; import { mergeProps } from '@zag-js/react'; import { forwardRef } from 'react'; import { composeRefs } from '../../utils/compose-refs.js'; import { useRenderStrategyPropsContext } from '../../utils/render-strategy.js'; import { ark } from '../factory.js'; import { usePresence } from '../presence/use-presence.js'; import { useDrawerContext } from './use-drawer-context.js'; const DrawerBackdrop = forwardRef((props, ref) => { const drawer = useDrawerContext(); const renderStrategyProps = useRenderStrategyPropsContext(); const presence = usePresence({ ...renderStrategyProps, present: drawer.open }); const mergedProps = mergeProps(drawer.getBackdropProps(), presence.getPresenceProps(), props); if (presence.unmounted) { return null; } return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref: composeRefs(presence.ref, ref) }); }); DrawerBackdrop.displayName = "DrawerBackdrop"; export { DrawerBackdrop };