// This file is auto-generated by "@aria-ui/cli". Do not edit this file directly. import { registerInlinePopoverPositionerElement, type InlinePopoverPositionerElement, type InlinePopoverPositionerProps as InlinePopoverPositionerElementProps } from '@prosekit/web/inline-popover'; import { createElement, forwardRef, useCallback, useRef, type ForwardedRef, type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes, useLayoutEffect } from 'react'; /** Props for the {@link InlinePopoverPositioner} React component. */ export interface InlinePopoverPositionerProps { /** * The initial placement of the floating element * * @default "top" */ placement?: InlinePopoverPositionerElementProps['placement']; /** * The distance between the reference and floating element. * * @default 12 */ offset?: InlinePopoverPositionerElementProps['offset']; /** * Whether to hide the floating element when the reference element or the * floating element is fully clipped. * * @default true */ hide?: InlinePopoverPositionerElementProps['hide']; /** * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) * to place the floating element on top of other page content. * * @default false */ hoist?: InlinePopoverPositionerElementProps['hoist']; /** * Whether the floating element can overlap the reference element to keep it * in view. * * @default true */ overlap?: InlinePopoverPositionerElementProps['overlap']; /** * Whether to improve positioning for inline reference elements that span over * multiple lines. * * @default true */ inline?: InlinePopoverPositionerElementProps['inline']; /** * Describes the virtual padding around the boundary to check for overflow. * * @default 8 */ overflowPadding?: InlinePopoverPositionerElementProps['overflowPadding']; /** * The strategy to use for positioning * * @default "absolute" */ strategy?: InlinePopoverPositionerElementProps['strategy']; /** * Options to activate auto-update listeners * * @see https://floating-ui.com/docs/autoUpdate * * @default true */ autoUpdate?: InlinePopoverPositionerElementProps['autoUpdate']; /** * Whether to flip the `placement` in order to keep it in view when the * preferred placement(s) will overflow the clipping boundary. You can also * provide an array of placements to try sequentially if the preferred * `placement` does not fit. * * @default true */ flip?: InlinePopoverPositionerElementProps['flip']; /** * Whether the floating element should shift to keep it in view. * * @default true */ shift?: InlinePopoverPositionerElementProps['shift']; /** * Whether to constrain the floating element's width and height to not exceed * the viewport. * * @default false */ fitViewport?: InlinePopoverPositionerElementProps['fitViewport']; /** * Whether to constrain the floating element's width so that it matches the * reference element. * * @default false */ sameWidth?: InlinePopoverPositionerElementProps['sameWidth']; /** * Whether to constrain the floating element's height so that it matches the * reference element. * * @default false */ sameHeight?: InlinePopoverPositionerElementProps['sameHeight']; /** * Describes the clipping element(s) or area that overflow will be checked relative to. * Please see https://floating-ui.com/docs/detectoverflow#boundary for more information. * * @default 'clippingAncestors' */ boundary?: InlinePopoverPositionerElementProps['boundary']; /** * Describes the root boundary that the element will be checked for overflow relative to. * Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information. * * @default 'viewport' */ rootBoundary?: InlinePopoverPositionerElementProps['rootBoundary']; /** * The element that will be used to check for overflow. Please see * https://floating-ui.com/docs/detectoverflow#elementcontext for more * information. * * @default 'floating' */ elementContext?: InlinePopoverPositionerElementProps['elementContext']; /** * Whether to check the alternate elementContext's boundary. Please see * https://floating-ui.com/docs/detectoverflow#altboundary for more * information. * * @default false */ altBoundary?: InlinePopoverPositionerElementProps['altBoundary']; } function InlinePopoverPositionerComponent(props: InlinePopoverPositionerProps, forwardedRef: ForwardedRef) { registerInlinePopoverPositionerElement(); const elementRef = useRef(null); const { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17, ...restProps } = props; useLayoutEffect(() => { const element = elementRef.current as Record | null; if (!element) return; Object.assign(element, { altBoundary: p0, autoUpdate: p1, boundary: p2, elementContext: p3, fitViewport: p4, flip: p5, hide: p6, hoist: p7, inline: p8, offset: p9, overflowPadding: p10, overlap: p11, placement: p12, rootBoundary: p13, sameHeight: p14, sameWidth: p15, shift: p16, strategy: p17 }); }); const mergedRef = useCallback( (element: InlinePopoverPositionerElement | null) => { elementRef.current = element; if (typeof forwardedRef === 'function') { forwardedRef(element); } else if (forwardedRef) { forwardedRef.current = element; } }, [forwardedRef], ); return createElement('prosekit-inline-popover-positioner', { ...restProps, ref: mergedRef, suppressHydrationWarning: true }); } /** A React component that renders an `prosekit-inline-popover-positioner` custom element. */ export const InlinePopoverPositioner: ForwardRefExoticComponent & RefAttributes> = /* @__PURE__ */ forwardRef(InlinePopoverPositionerComponent);