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.

39 lines (38 loc) 1.09 kB
"use strict"; 'use client'; Object.defineProperty(exports, "__esModule", { value: true }); exports.usePositioner = usePositioner; var _popupStateMapping = require("./popupStateMapping"); var _useRenderElement = require("../internals/useRenderElement"); var _getDisabledMountTransitionStyles = require("./getDisabledMountTransitionStyles"); /** * Renders the shared outer Positioner element used by popup components. * Applies the common role, hidden state, transition styles, state attributes, and optional inert styling. */ function usePositioner(componentProps, state, { styles, transitionStatus, props, refs, hidden, inert = false }) { const style = { ...styles }; if (inert) { style.pointerEvents = 'none'; } return (0, _useRenderElement.useRenderElement)('div', componentProps, { state, ref: refs, props: [{ role: 'presentation', hidden, style }, (0, _getDisabledMountTransitionStyles.getDisabledMountTransitionStyles)(transitionStatus), props], stateAttributesMapping: _popupStateMapping.popupStateMapping }); }