UNPKG

@base-ui/react

Version:

Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.

34 lines (33 loc) 910 B
'use client'; import { popupStateMapping } from "./popupStateMapping.js"; import { useRenderElement } from "../internals/useRenderElement.js"; import { getDisabledMountTransitionStyles } from "./getDisabledMountTransitionStyles.js"; /** * Renders the shared outer Positioner element used by popup components. * Applies the common role, hidden state, transition styles, state attributes, and optional inert styling. */ export function usePositioner(componentProps, state, { styles, transitionStatus, props, refs, hidden, inert = false }) { const style = { ...styles }; if (inert) { style.pointerEvents = 'none'; } return useRenderElement('div', componentProps, { state, ref: refs, props: [{ role: 'presentation', hidden, style }, getDisabledMountTransitionStyles(transitionStatus), props], stateAttributesMapping: popupStateMapping }); }